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); |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 wantXrays: false | 165 wantXrays: false |
166 }); | 166 }); |
167 {%- endif %} | 167 {%- endif %} |
168 Services.scriptloader.loadSubScript(url, scopes[module]); | 168 Services.scriptloader.loadSubScript(url, scopes[module]); |
169 {%- if 'info' in requires %} | 169 {%- if 'info' in requires %} |
170 } | 170 } |
171 {%- endif %} | 171 {%- endif %} |
172 } | 172 } |
173 return scopes[module].exports; | 173 return scopes[module].exports; |
174 } | 174 } |
175 require.scopes = {__proto__: null}; | 175 require.scopes = Object.create(null); |
176 | 176 |
177 {%- if hasChromeRequires %} | 177 {%- if hasChromeRequires %} |
178 Cu.import("resource://gre/modules/XPCOMUtils.jsm"); | 178 Cu.import("resource://gre/modules/XPCOMUtils.jsm"); |
179 | 179 |
180 let RequireObserver = | 180 let RequireObserver = |
181 { | 181 { |
182 observe: function(subject, topic, data) | 182 observe: function(subject, topic, data) |
183 { | 183 { |
184 if (topic == "{{metadata.get('general', 'basename')}}-require") | 184 if (topic == "{{metadata.get('general', 'basename')}}-require") |
185 { | 185 { |
186 subject.wrappedJSObject.exports = require(data); | 186 subject.wrappedJSObject.exports = require(data); |
187 } | 187 } |
188 }, | 188 }, |
189 | 189 |
190 QueryInterface: XPCOMUtils.generateQI([Ci.nsISupportsWeakReference, Ci.nsIObse
rver]) | 190 QueryInterface: XPCOMUtils.generateQI([Ci.nsISupportsWeakReference, Ci.nsIObse
rver]) |
191 }; | 191 }; |
192 {%- endif %} | 192 {%- endif %} |
OLD | NEW |