| Left: | ||
| Right: |
| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * This file is part of Adblock Plus <https://adblockplus.org/>, | 2 * This file is part of Adblock Plus <https://adblockplus.org/>, |
| 3 * Copyright (C) 2006-present eyeo GmbH | 3 * Copyright (C) 2006-present eyeo GmbH |
| 4 * | 4 * |
| 5 * Adblock Plus is free software: you can redistribute it and/or modify | 5 * Adblock Plus is free software: you can redistribute it and/or modify |
| 6 * it under the terms of the GNU General Public License version 3 as | 6 * it under the terms of the GNU General Public License version 3 as |
| 7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
| 8 * | 8 * |
| 9 * Adblock Plus is distributed in the hope that it will be useful, | 9 * Adblock Plus is distributed in the hope that it will be useful, |
| 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| (...skipping 719 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 730 } | 730 } |
| 731 } | 731 } |
| 732 else | 732 else |
| 733 { | 733 { |
| 734 // Edge does not yet support runtime.openOptionsPage (tested version 38) | 734 // Edge does not yet support runtime.openOptionsPage (tested version 38) |
| 735 // nor does Firefox for Android, | 735 // nor does Firefox for Android, |
| 736 // and so this workaround needs to stay for now. | 736 // and so this workaround needs to stay for now. |
| 737 // We are not using extension.getURL to get the absolute path here | 737 // We are not using extension.getURL to get the absolute path here |
| 738 // because of the Edge issue: | 738 // because of the Edge issue: |
| 739 // https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/10 276332/ | 739 // https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/10 276332/ |
| 740 let open = win => | 740 let open = win => |
|
Sebastian Noack
2017/08/29 02:08:21
It seems the `win` argument is ignored now. Mind r
| |
| 741 { | 741 { |
| 742 let optionsUrl = "options.html"; | 742 let optionsUrl = "options.html"; |
| 743 let queryInfo = {url: optionsUrl}; | 743 let fullOptionsUrl = ext.getURL("options.html"); |
| 744 | 744 |
| 745 if (win) | 745 // We find a tab ourselves because Edge has a bug when quering tabs |
| 746 queryInfo.windowId = win.id; | 746 // with extension URL protocol: |
| 747 | 747 // https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/ 8094141/ |
| 748 chrome.tabs.query(queryInfo, tabs => | 748 // https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/ 8604703/ |
| 749 function isOptionsTab(element) | |
| 749 { | 750 { |
| 750 if (tabs && tabs.length > 0) | 751 return element.url == fullOptionsUrl; |
| 752 } | |
| 753 chrome.tabs.query({}, tabs => | |
|
Oleksandr
2017/08/28 01:38:36
Passing {} is the only way to get all tabs, it see
| |
| 754 { | |
| 755 if (tabs && (tabs.findIndex(isOptionsTab) >= 0)) | |
|
Sebastian Noack
2017/08/29 02:08:21
Calling findIndex()/find() twice is redundant. Jus
| |
| 751 { | 756 { |
| 752 let tab = tabs[0]; | 757 let tab = tabs.find(isOptionsTab); |
| 753 | |
| 754 if ("windows" in chrome) | 758 if ("windows" in chrome) |
| 755 chrome.windows.update(tab.windowId, {focused: true}); | 759 chrome.windows.update(tab.windowId, {focused: true}); |
| 756 | 760 |
| 757 chrome.tabs.update(tab.id, {active: true}); | 761 chrome.tabs.update(tab.id, {active: true}); |
| 758 | 762 |
| 759 if (callback) | 763 if (callback) |
| 760 callback(new Page(tab)); | 764 callback(new Page(tab)); |
| 761 } | 765 } |
| 762 else | 766 else |
| 763 { | 767 { |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 784 ext.windows = { | 788 ext.windows = { |
| 785 create(createData, callback) | 789 create(createData, callback) |
| 786 { | 790 { |
| 787 chrome.windows.create(createData, createdWindow => | 791 chrome.windows.create(createData, createdWindow => |
| 788 { | 792 { |
| 789 afterTabLoaded(callback)(createdWindow.tabs[0]); | 793 afterTabLoaded(callback)(createdWindow.tabs[0]); |
| 790 }); | 794 }); |
| 791 } | 795 } |
| 792 }; | 796 }; |
| 793 }()); | 797 }()); |
| OLD | NEW |