| Index: chrome/content/watcher.js |
| =================================================================== |
| --- a/chrome/content/watcher.js |
| +++ b/chrome/content/watcher.js |
| @@ -11,40 +11,27 @@ const Cu = Components.utils; |
| Cu.import("resource://gre/modules/Services.jsm"); |
| function abprequire(module) |
| { |
| let result = {}; |
| result.wrappedJSObject = result; |
| Services.obs.notifyObservers(result, "adblockplus-require", module); |
| - if ("exports" in result) |
| - return result.exports; |
| - else |
| - return Cu.import("chrome://adblockplus-modules/content/" + module[0].toUpperCase() + module.substr(1) + ".jsm", null); |
| + return result.exports; |
| } |
| let {Policy} = abprequire("contentPolicy"); |
| let {RequestNotifier} = abprequire("requestNotifier"); |
| let {Filter} = abprequire("filterClasses"); |
| let policyGlobal = Cu.getGlobalForObject(Policy); |
| let PolicyPrivate = null; |
| -if (policyGlobal == window) |
| -{ |
| - // Work-around for bug 736316 - getGlobalForObject gave us our own window |
| - let {XPIProvider} = Cu.import("resource://gre/modules/XPIProvider.jsm", null); |
| - let addonID = "{d10d0bf8-f5b5-c8b4-a8b2-2b9879e08c5d}" |
| - if (addonID in XPIProvider.bootstrapScopes) |
| - policyGlobal = XPIProvider.bootstrapScopes[addonID]; |
| -} |
| -if ("PolicyPrivate" in policyGlobal) // ABP 2.0.x |
| - PolicyPrivate = policyGlobal.PolicyPrivate; |
| -else if ("PolicyImplementation" in policyGlobal) // ABP 2.1+ with scope separation |
| +if ("PolicyImplementation" in policyGlobal) // ABP 2.1+ with scope separation |
| PolicyPrivate = policyGlobal.PolicyImplementation; |
| else if ("require" in policyGlobal) // ABP 2.1+ without scope separation |
| PolicyPrivate = policyGlobal.require.scopes.contentPolicy.PolicyImplementation; |
| else |
| window.close(); |
|
Thomas Greiner
2012/09/26 13:55:04
Could also be written as:
let PolicyPrivate = pol
Wladimir Palant
2012/09/27 14:39:29
But the way it is understanding the code is much e
|
| let origShouldLoad = PolicyPrivate.shouldLoad; |
| let origProcessNode = Policy.processNode; |