Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: lib/appSupport.js

Issue 6286955629248512: disable acceptable ads from first run page (Closed)
Patch Set: Description to getAddonsByTypes method and minore changes Created May 8, 2014, 2:37 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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,31 @@
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()
+ {
+ // The page won't be ready until the add-on manager data is loaded so we call this method
+ // to know when the data will be ready.
+ AddonManager.getAddonsByTypes(["extension", "theme", "locale"], function()
+ {
+ let event = new Event("Event");
+ event.initEvent("popstate", true, false);
+ event.state = {id: require("info").addonID};
+ browser._contentWindow.dispatchEvent(event);
+ });
+ });
+ }, true);
+ };
break;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld