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