| 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}); |