OLD | NEW |
1 /* | 1 /* |
2 * This Source Code is subject to the terms of the Mozilla Public License | 2 * This Source Code is subject to the terms of the Mozilla Public License |
3 * version 2.0 (the "License"). You can obtain a copy of the License at | 3 * version 2.0 (the "License"). You can obtain a copy of the License at |
4 * http://mozilla.org/MPL/2.0/. | 4 * http://mozilla.org/MPL/2.0/. |
5 */ | 5 */ |
6 | 6 |
7 const Cc = Components.classes; | 7 const Cc = Components.classes; |
8 const Ci = Components.interfaces; | 8 const Ci = Components.interfaces; |
9 const Cr = Components.results; | 9 const Cr = Components.results; |
10 const Cu = Components.utils; | 10 const Cu = Components.utils; |
11 | 11 |
12 let {Services, atob, btoa} = Cu.import("resource://gre/modules/Services.jsm", nu
ll); | 12 let {Services, atob, btoa, File} = Cu.import("resource://gre/modules/Services.js
m", null); |
13 | 13 |
14 let addonData = null; | 14 let addonData = null; |
15 | 15 |
16 function startup(params, reason) | 16 function startup(params, reason) |
17 { | 17 { |
18 addonData = params; | 18 addonData = params; |
19 | 19 |
20 {%- if hasChrome %} | 20 {%- if hasChrome %} |
21 if (Services.vc.compare(Services.appinfo.platformVersion, "10.0") < 0) | 21 if (Services.vc.compare(Services.appinfo.platformVersion, "10.0") < 0) |
22 { | 22 { |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 { | 142 { |
143 {%- endif %} | 143 {%- endif %} |
144 let url = addonData.resourceURI.spec + "lib/" + module + ".js"; | 144 let url = addonData.resourceURI.spec + "lib/" + module + ".js"; |
145 scopes[module] = { | 145 scopes[module] = { |
146 Cc: Cc, | 146 Cc: Cc, |
147 Ci: Ci, | 147 Ci: Ci, |
148 Cr: Cr, | 148 Cr: Cr, |
149 Cu: Cu, | 149 Cu: Cu, |
150 atob: atob, | 150 atob: atob, |
151 btoa: btoa, | 151 btoa: btoa, |
| 152 File: File, |
152 require: require, | 153 require: require, |
153 {% if hasShutdownHandlers %} | 154 {% if hasShutdownHandlers %} |
154 onShutdown: onShutdown, | 155 onShutdown: onShutdown, |
155 {% endif %} | 156 {% endif %} |
156 exports: {}}; | 157 exports: {}}; |
157 {%- if multicompartment %} | 158 {%- if multicompartment %} |
158 let principal = Cc["@mozilla.org/systemprincipal;1"].getService(Ci.nsIPrin
cipal); | 159 let principal = Cc["@mozilla.org/systemprincipal;1"].getService(Ci.nsIPrin
cipal); |
159 scopes[module] = new Cu.Sandbox(principal, { | 160 scopes[module] = new Cu.Sandbox(principal, { |
160 sandboxName: url, | 161 sandboxName: url, |
161 sandboxPrototype: scopes[module], | 162 sandboxPrototype: scopes[module], |
(...skipping 18 matching lines...) Expand all Loading... |
180 { | 181 { |
181 if (topic == "{{metadata.get('general', 'basename')}}-require") | 182 if (topic == "{{metadata.get('general', 'basename')}}-require") |
182 { | 183 { |
183 subject.wrappedJSObject.exports = require(data); | 184 subject.wrappedJSObject.exports = require(data); |
184 } | 185 } |
185 }, | 186 }, |
186 | 187 |
187 QueryInterface: XPCOMUtils.generateQI([Ci.nsISupportsWeakReference, Ci.nsIObse
rver]) | 188 QueryInterface: XPCOMUtils.generateQI([Ci.nsISupportsWeakReference, Ci.nsIObse
rver]) |
188 }; | 189 }; |
189 {%- endif %} | 190 {%- endif %} |
OLD | NEW |