| OLD | NEW | 
|---|
| 1 /* | 1 /* | 
| 2  * This file is part of the Adblock Plus build tools, | 2  * This file is part of the Adblock Plus build tools, | 
| 3  * Copyright (C) 2006-2013 Eyeo GmbH | 3  * Copyright (C) 2006-2013 Eyeo GmbH | 
| 4  * | 4  * | 
| 5  * Adblock Plus is free software: you can redistribute it and/or modify | 5  * Adblock Plus is free software: you can redistribute it and/or modify | 
| 6  * it under the terms of the GNU General Public License version 3 as | 6  * it under the terms of the GNU General Public License version 3 as | 
| 7  * published by the Free Software Foundation. | 7  * published by the Free Software Foundation. | 
| 8  * | 8  * | 
| 9  * Adblock Plus is distributed in the hope that it will be useful, | 9  * Adblock Plus is distributed in the hope that it will be useful, | 
| 10  * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10  * but WITHOUT ANY WARRANTY; without even the implied warranty of | 
| 11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
| 12  * GNU General Public License for more details. | 12  * GNU General Public License for more details. | 
| 13  * | 13  * | 
| 14  * You should have received a copy of the GNU General Public License | 14  * You should have received a copy of the GNU General Public License | 
| 15  * along with Adblock Plus.  If not, see <http://www.gnu.org/licenses/>. | 15  * along with Adblock Plus.  If not, see <http://www.gnu.org/licenses/>. | 
| 16  */ | 16  */ | 
| 17 | 17 | 
| 18 const Cc = Components.classes; | 18 const Cc = Components.classes; | 
| 19 const Ci = Components.interfaces; | 19 const Ci = Components.interfaces; | 
| 20 const Cr = Components.results; | 20 const Cr = Components.results; | 
| 21 const Cu = Components.utils; | 21 const Cu = Components.utils; | 
| 22 | 22 | 
| 23 let {Services, atob, btoa, File} = Cu.import("resource://gre/modules/Services.js
     m", null); | 23 let {Services, atob, btoa, File} = Cu.import("resource://gre/modules/Services.js
     m", null); | 
| 24 | 24 | 
|  | 25 {%- if hasXMLHttpRequest %} | 
|  | 26 let XMLHttpRequest = Components.Constructor("@mozilla.org/xmlextras/xmlhttpreque
     st;1", "nsIXMLHttpRequest"); | 
|  | 27 {%- endif %} | 
|  | 28 | 
| 25 let addonData = null; | 29 let addonData = null; | 
| 26 | 30 | 
| 27 function startup(params, reason) | 31 function startup(params, reason) | 
| 28 { | 32 { | 
| 29   addonData = params; | 33   addonData = params; | 
| 30 | 34 | 
| 31   {%- if hasChromeRequires %} | 35   {%- if hasChromeRequires %} | 
| 32   Services.obs.addObserver(RequireObserver, "{{metadata.get('general', 'basename
     ')}}-require", true); | 36   Services.obs.addObserver(RequireObserver, "{{metadata.get('general', 'basename
     ')}}-require", true); | 
| 33   onShutdown.add(function() Services.obs.removeObserver(RequireObserver, "{{meta
     data.get('general', 'basename')}}-require")); | 37   onShutdown.add(function() Services.obs.removeObserver(RequireObserver, "{{meta
     data.get('general', 'basename')}}-require")); | 
| 34   {%- set hasShutdownHandlers = True %} | 38   {%- set hasShutdownHandlers = True %} | 
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 152         Ci: Ci, | 156         Ci: Ci, | 
| 153         Cr: Cr, | 157         Cr: Cr, | 
| 154         Cu: Cu, | 158         Cu: Cu, | 
| 155         atob: atob, | 159         atob: atob, | 
| 156         btoa: btoa, | 160         btoa: btoa, | 
| 157         File: File, | 161         File: File, | 
| 158         require: require, | 162         require: require, | 
| 159         {% if hasShutdownHandlers %} | 163         {% if hasShutdownHandlers %} | 
| 160         onShutdown: onShutdown, | 164         onShutdown: onShutdown, | 
| 161         {% endif %} | 165         {% endif %} | 
|  | 166         {%- if hasXMLHttpRequest %} | 
|  | 167         XMLHttpRequest: XMLHttpRequest, | 
|  | 168         {% endif %} | 
| 162         exports: {}}; | 169         exports: {}}; | 
| 163       {%- if multicompartment %} | 170       {%- if multicompartment %} | 
| 164       let principal = Cc["@mozilla.org/systemprincipal;1"].getService(Ci.nsIPrin
     cipal); | 171       let principal = Cc["@mozilla.org/systemprincipal;1"].getService(Ci.nsIPrin
     cipal); | 
| 165       scopes[module] = new Cu.Sandbox(principal, { | 172       scopes[module] = new Cu.Sandbox(principal, { | 
| 166         sandboxName: url, | 173         sandboxName: url, | 
| 167         sandboxPrototype: scopes[module], | 174         sandboxPrototype: scopes[module], | 
| 168         wantXrays: false | 175         wantXrays: false | 
| 169       }); | 176       }); | 
| 170       {%- endif %} | 177       {%- endif %} | 
| 171       Services.scriptloader.loadSubScript(url, scopes[module]); | 178       Services.scriptloader.loadSubScript(url, scopes[module]); | 
| (...skipping 14 matching lines...) Expand all  Loading... | 
| 186   { | 193   { | 
| 187     if (topic == "{{metadata.get('general', 'basename')}}-require") | 194     if (topic == "{{metadata.get('general', 'basename')}}-require") | 
| 188     { | 195     { | 
| 189       subject.wrappedJSObject.exports = require(data); | 196       subject.wrappedJSObject.exports = require(data); | 
| 190     } | 197     } | 
| 191   }, | 198   }, | 
| 192 | 199 | 
| 193   QueryInterface: XPCOMUtils.generateQI([Ci.nsISupportsWeakReference, Ci.nsIObse
     rver]) | 200   QueryInterface: XPCOMUtils.generateQI([Ci.nsISupportsWeakReference, Ci.nsIObse
     rver]) | 
| 194 }; | 201 }; | 
| 195 {%- endif %} | 202 {%- endif %} | 
| OLD | NEW | 
|---|