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 724 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 => |
741 { | 741 { |
742 let optionsUrl = "options.html"; | 742 let optionsUrl = "options.html"; |
743 let queryInfo = {url: optionsUrl}; | 743 let queryInfo = {url: optionsUrl}; |
744 | 744 |
745 // extension pages can't be accessed in incognito windows. In order to | 745 if (win) |
746 // correctly mimic the way in which Chrome opens extension options, | |
747 // we have to focus the options page in any other window. | |
748 if (win && !win.incognito) | |
749 queryInfo.windowId = win.id; | 746 queryInfo.windowId = win.id; |
750 | 747 |
751 chrome.tabs.query(queryInfo, tabs => | 748 chrome.tabs.query(queryInfo, tabs => |
752 { | 749 { |
753 if (tabs && tabs.length > 0) | 750 if (tabs && tabs.length > 0) |
754 { | 751 { |
755 let tab = tabs[0]; | 752 let tab = tabs[0]; |
756 | 753 |
757 if ("windows" in chrome) | 754 if ("windows" in chrome) |
758 chrome.windows.update(tab.windowId, {focused: true}); | 755 chrome.windows.update(tab.windowId, {focused: true}); |
(...skipping 28 matching lines...) Expand all Loading... |
787 ext.windows = { | 784 ext.windows = { |
788 create(createData, callback) | 785 create(createData, callback) |
789 { | 786 { |
790 chrome.windows.create(createData, createdWindow => | 787 chrome.windows.create(createData, createdWindow => |
791 { | 788 { |
792 afterTabLoaded(callback)(createdWindow.tabs[0]); | 789 afterTabLoaded(callback)(createdWindow.tabs[0]); |
793 }); | 790 }); |
794 } | 791 } |
795 }; | 792 }; |
796 }()); | 793 }()); |
OLD | NEW |