Left: | ||
Right: |
LEFT | RIGHT |
---|---|
1 /* | 1 /* |
2 * This file is part of Adblock Plus <http://adblockplus.org/>, | 2 * This file is part of Adblock Plus <http://adblockplus.org/>, |
3 * Copyright (C) 2006-2014 Eyeo GmbH | 3 * Copyright (C) 2006-2014 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 |
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 * GNU General Public License for more details. | 12 * GNU General Public License for more details. |
13 * | 13 * |
14 * You should have received a copy of the GNU General Public License | 14 * You should have received a copy of the GNU General Public License |
15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. | 15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. |
16 */ | 16 */ |
17 | 17 |
18 /** | 18 /** |
19 * @fileOverview Various application-specific functions. | 19 * @fileOverview Various application-specific functions. |
20 */ | 20 */ |
21 | 21 |
22 Cu.import("resource://gre/modules/XPCOMUtils.jsm"); | 22 Cu.import("resource://gre/modules/XPCOMUtils.jsm"); |
23 Cu.import("resource://gre/modules/Services.jsm"); | 23 Cu.import("resource://gre/modules/Services.jsm"); |
24 Cu.import("resource://gre/modules/AddonManager.jsm"); | |
24 | 25 |
25 /** | 26 /** |
26 * Checks whether an application window is known and should get Adblock Plus | 27 * Checks whether an application window is known and should get Adblock Plus |
27 * user interface elements. | 28 * user interface elements. |
28 * @result Boolean | 29 * @result Boolean |
29 */ | 30 */ |
30 exports.isKnownWindow = function isKnownWindow(/**Window*/ window) false; | 31 exports.isKnownWindow = function isKnownWindow(/**Window*/ window) false; |
31 | 32 |
32 /** | 33 /** |
33 * HACK: In some applications the window finishes initialization during load | 34 * HACK: In some applications the window finishes initialization during load |
(...skipping 886 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
920 UI.openFiltersDialog = function() | 921 UI.openFiltersDialog = function() |
921 { | 922 { |
922 let window = UI.currentWindow; | 923 let window = UI.currentWindow; |
923 if (!window) | 924 if (!window) |
924 return | 925 return |
925 | 926 |
926 let browser = exports.addTab(window, "about:addons").browser; | 927 let browser = exports.addTab(window, "about:addons").browser; |
927 browser.addEventListener("load", function openAddonPrefs(event) | 928 browser.addEventListener("load", function openAddonPrefs(event) |
928 { | 929 { |
929 browser.removeEventListener("load", openAddonPrefs, true); | 930 browser.removeEventListener("load", openAddonPrefs, true); |
930 Utils.runAsync(function(state) | 931 Utils.runAsync(function() |
931 { | 932 { |
932 let event = new Event("Event"); | 933 // The page won't be ready until the add-on manager data is loaded so we call this method |
933 event.initEvent("popstate", true, false); | 934 // to know when the data will be ready. |
934 event.state = state; | 935 AddonManager.getAddonsByTypes(["extension", "theme", "locale"], functi on() |
935 browser._contentWindow.dispatchEvent(event); | 936 { |
936 }, this, {id: require("info").addonID}); | 937 let event = new Event("Event"); |
Wladimir Palant
2014/05/02 16:36:47
Passing in this and the state parameter is unneces
saroyanm
2014/05/03 08:02:06
My bad that I didn't left comment on this.
When I
Wladimir Palant
2014/05/03 17:54:18
That's indeed an issue. The list of add-ons is bei
saroyanm
2014/05/04 14:05:08
Thanks for descriptive answer Wladimir,
I also ha
| |
938 event.initEvent("popstate", true, false); | |
939 event.state = {id: require("info").addonID}; | |
940 browser._contentWindow.dispatchEvent(event); | |
941 }); | |
942 }); | |
937 }, true); | 943 }, true); |
938 }; | 944 }; |
939 | 945 |
940 break; | 946 break; |
941 } | 947 } |
942 } | 948 } |
LEFT | RIGHT |