Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: ext/background.js

Issue 29527877: Issue 5582 - Workaround Edge bug in tabs.query (Closed)
Patch Set: Manually look for the options tab Created Aug. 28, 2017, 1:34 a.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ext/background.js
===================================================================
--- a/ext/background.js
+++ b/ext/background.js
@@ -740,17 +740,21 @@
let open = win =>
Sebastian Noack 2017/08/29 02:08:21 It seems the `win` argument is ignored now. Mind r
{
let optionsUrl = "options.html";
- let queryInfo = {url: optionsUrl};
-
- if (win)
- queryInfo.windowId = win.id;
+ let fullOptionsUrl = ext.getURL("options.html");
- chrome.tabs.query(queryInfo, tabs =>
+ // We find a tab ourselves because Edge has a bug when quering tabs
+ // with extension URL protocol:
+ // https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/8094141/
+ // https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/8604703/
+ function isOptionsTab(element)
{
- if (tabs && tabs.length > 0)
+ return element.url == fullOptionsUrl;
+ }
+ chrome.tabs.query({}, tabs =>
Oleksandr 2017/08/28 01:38:36 Passing {} is the only way to get all tabs, it see
+ {
+ if (tabs && (tabs.findIndex(isOptionsTab) >= 0))
Sebastian Noack 2017/08/29 02:08:21 Calling findIndex()/find() twice is redundant. Jus
{
- let tab = tabs[0];
-
+ let tab = tabs.find(isOptionsTab);
if ("windows" in chrome)
chrome.windows.update(tab.windowId, {focused: true});
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld