This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/addart/components/addart.js b/addart/components/addart.js | |
index 6e1a596..fe5563d 100755 | |
--- a/addart/components/addart.js | |
+++ b/addart/components/addart.js | |
@@ -106,11 +106,23 @@ org.eyebeam.addArt.component = { | |
init: function() { | |
// Retrieve ABP component | |
var abp = null; | |
- try { | |
- abp = Components.classes["@mozilla.org/adblockplus;1"].createInstance(); | |
- if (abp && !("policy" in abp)) | |
- abp = abp.wrappedJSObject; // Unwrap ABP component | |
- } catch(e) {} | |
+ if ("@adblockplus.org/abp/public;1" in Components.classes) | |
+ { | |
+ // Adblock Plus 1.3 or higher | |
+ var abpURL = Components.classes["@adblockplus.org/abp/public;1"] | |
+ .getService(Components.interfaces.nsIURI); | |
+ Components.utils.import(abpURL.spec); | |
+ } | |
+ else if ("@mozilla.org/adblockplus;1" in Components.classes) | |
+ { | |
+ // Adblock Plus 1.2.x or below | |
+ abp = Components.classes["@mozilla.org/adblockplus;1"] | |
+ .createInstance().wrappedJSObject; | |
+ } | |
+ else | |
+ { | |
+ // Adblock Plus is not installed | |
+ } | |
if (!abp) | |
return; | |
@@ -248,4 +260,4 @@ org.eyebeam.addArt.component = { | |
throw Components.results.NS_ERROR_NO_INTERFACE; | |
} | |
-}; | |
\ No newline at end of file | |
+}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment