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 888 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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() | 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 = {id: require("info").addonID}; | 935 AddonManager.getAddonsByTypes(["extension", "theme", "locale"], functi
on() |
935 browser._contentWindow.dispatchEvent(event); | 936 { |
| 937 let event = new Event("Event"); |
| 938 event.initEvent("popstate", true, false); |
| 939 event.state = {id: require("info").addonID}; |
| 940 browser._contentWindow.dispatchEvent(event); |
| 941 }); |
936 }); | 942 }); |
937 }, true); | 943 }, true); |
938 }; | 944 }; |
939 | 945 |
940 break; | 946 break; |
941 } | 947 } |
942 } | 948 } |
LEFT | RIGHT |