| OLD | NEW |
| 1 /* This Source Code Form is subject to the terms of the Mozilla Public | 1 /* This Source Code Form is subject to the terms of the Mozilla Public |
| 2 * License, v. 2.0. If a copy of the MPL was not distributed with this | 2 * License, v. 2.0. If a copy of the MPL was not distributed with this |
| 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
| 4 | 4 |
| 5 const Cc = Components.classes; | 5 const Cc = Components.classes; |
| 6 const Ci = Components.interfaces; | 6 const Ci = Components.interfaces; |
| 7 const Cr = Components.results; | 7 const Cr = Components.results; |
| 8 const Cu = Components.utils; | 8 const Cu = Components.utils; |
| 9 | 9 |
| 10 let {Services, atob, btoa, File, TextDecoder, TextEncoder} = Cu.import("resource
://gre/modules/Services.jsm", null); | 10 let {Services, atob, btoa, File, TextDecoder, TextEncoder} = Cu.import("resource
://gre/modules/Services.jsm", null); |
| 11 | 11 |
| 12 {%- if hasXMLHttpRequest %} | 12 {%- if hasXMLHttpRequest %} |
| 13 let XMLHttpRequest = Components.Constructor("@mozilla.org/xmlextras/xmlhttpreque
st;1", "nsIXMLHttpRequest"); | 13 let XMLHttpRequest = Components.Constructor("@mozilla.org/xmlextras/xmlhttpreque
st;1", "nsIXMLHttpRequest"); |
| 14 {%- endif %} | 14 {%- endif %} |
| 15 | 15 |
| 16 let addonData = null; | 16 let addonData = null; |
| 17 | 17 |
| 18 function startup(params, reason) | 18 function startup(params, reason) |
| 19 { | 19 { |
| 20 addonData = params; | 20 addonData = params; |
| 21 | 21 |
| 22 {%- if hasChromeRequires %} | 22 {%- if hasChromeRequires %} |
| 23 Services.obs.addObserver(RequireObserver, "{{metadata.get('general', 'basename
')}}-require", true); | 23 Services.obs.addObserver(RequireObserver, "{{metadata.get('general', 'basename
')}}-require", true); |
| 24 onShutdown.add(function() Services.obs.removeObserver(RequireObserver, "{{meta
data.get('general', 'basename')}}-require")); | 24 onShutdown.add(function() |
| 25 { |
| 26 Services.obs.removeObserver(RequireObserver, "{{metadata.get('general', 'bas
ename')}}-require"); |
| 27 }); |
| 25 {%- set hasShutdownHandlers = True %} | 28 {%- set hasShutdownHandlers = True %} |
| 26 {%- endif %} | 29 {%- endif %} |
| 27 | 30 |
| 28 require("main"); | 31 require("main"); |
| 29 } | 32 } |
| 30 | 33 |
| 31 function shutdown(params, reason) | 34 function shutdown(params, reason) |
| 32 { | 35 { |
| 33 {%- if chromeWindows %} | 36 {%- if chromeWindows %} |
| 34 let windowNames = {{chromeWindows|json}}; | 37 let windowNames = {{chromeWindows|json}}; |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 { | 183 { |
| 181 if (topic == "{{metadata.get('general', 'basename')}}-require") | 184 if (topic == "{{metadata.get('general', 'basename')}}-require") |
| 182 { | 185 { |
| 183 subject.wrappedJSObject.exports = require(data); | 186 subject.wrappedJSObject.exports = require(data); |
| 184 } | 187 } |
| 185 }, | 188 }, |
| 186 | 189 |
| 187 QueryInterface: XPCOMUtils.generateQI([Ci.nsISupportsWeakReference, Ci.nsIObse
rver]) | 190 QueryInterface: XPCOMUtils.generateQI([Ci.nsISupportsWeakReference, Ci.nsIObse
rver]) |
| 188 }; | 191 }; |
| 189 {%- endif %} | 192 {%- endif %} |
| OLD | NEW |