Index: lib/appSupport.js |
=================================================================== |
--- a/lib/appSupport.js |
+++ b/lib/appSupport.js |
@@ -21,6 +21,7 @@ |
Cu.import("resource://gre/modules/XPCOMUtils.jsm"); |
Cu.import("resource://gre/modules/Services.jsm"); |
+Cu.import("resource://gre/modules/AddonManager.jsm"); |
/** |
* Checks whether an application window is known and should get Adblock Plus |
@@ -916,6 +917,34 @@ |
if (Utils.confirm(window, dialogMessage, dialogTitle)) |
this.setSubscription(url, title); |
}; |
+ |
+ UI.openFiltersDialog = function() |
+ { |
+ let window = UI.currentWindow; |
+ if (!window) |
+ return |
+ |
+ let browser = exports.addTab(window, "about:addons").browser; |
+ browser.addEventListener("load", function openAddonPrefs(event) |
+ { |
+ browser.removeEventListener("load", openAddonPrefs, true); |
+ Utils.runAsync(function() |
+ { |
+ AddonManager.getAddonsByTypes(["extension", "theme", "locale"], function() |
Wladimir Palant
2014/05/08 13:38:00
Please add a comment on why we are doing this. E.g
saroyanm
2014/05/08 14:42:11
Done.
|
+ { |
+ let {addonID} = require("info"); |
+ let addonItem = browser._contentWindow.document.querySelector("#addons-list div[addonID='" + addonID + "']"); |
+ if (addonItem) |
+ { |
+ let event = new Event("Event"); |
+ event.initEvent("popstate", true, false); |
+ event.state = {id: addonID}; |
+ browser._contentWindow.dispatchEvent(event); |
+ } |
+ }); |
+ }); |
+ }, true); |
+ }; |
break; |
} |