From 9548dffe01c04ccb8296e4202497067586af2fa5 Mon Sep 17 00:00:00 2001 From: Jeremy Maitin-Shepard Date: Mon, 11 May 2015 17:42:25 -0700 Subject: [PATCH] Fix adblockplus glue code to work with recent version of the extension. adblockplus-settings doesn't work anymore, but the settings can be accessed from the extension manager. --- modules/extensions/adblockplus.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/modules/extensions/adblockplus.js b/modules/extensions/adblockplus.js index dfac0da5..9b9a9d33 100644 --- a/modules/extensions/adblockplus.js +++ b/modules/extensions/adblockplus.js @@ -8,7 +8,7 @@ interactive("adblockplus-settings", "Show the Adblock Plus settings dialog.", function (I) { - if (! ("@adblockplus.org/abp/startup;1" in Cc)) + if (! ("@adblockplus.org/abp/public;1" in Cc)) throw interactive_error("Adblock Plus not found"); make_chrome_window("chrome://adblockplus/content/ui/settings.xul"); }); @@ -16,7 +16,7 @@ interactive("adblockplus-settings", interactive("adblockplus-filters", "Show the Adblock Plus filter settings dialog.", function (I) { - if (! ("@adblockplus.org/abp/startup;1" in Cc)) + if (! ("@adblockplus.org/abp/public;1" in Cc)) throw interactive_error("Adblock Plus not found"); make_chrome_window("chrome://adblockplus/content/ui/filters.xul"); }); @@ -24,9 +24,15 @@ interactive("adblockplus-filters", interactive("adblockplus-add", "Add a pattern to Adblock Plus.", function (I) { - if (! ("@adblockplus.org/abp/startup;1" in Cc)) + if (! ("@adblockplus.org/abp/public;1" in Cc)) throw interactive_error("Adblock Plus not found"); - Components.utils.import("chrome://adblockplus-modules/content/Public.jsm"); + + // Access the API per the instructions here: + // https://adblockplus.org/en/IAdblockPlus + var abpURL = Components.classes["@adblockplus.org/abp/public;1"] + .getService(Components.interfaces.nsIURI); + var AdblockPlus = Components.utils.import(abpURL.spec, null).AdblockPlus; + var element = yield read_browser_object(I); var spec = load_spec(element); var pattern = yield I.minibuffer.read_url(