Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: bootstrap.js.tmpl

Issue 5462707926990848: Issue 1434 - Removed remaining non-standard JavaScript code from buildtools (Closed)
Patch Set: Replaced some more function expressions Created April 1, 2015, 2:26 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | lib/hooks.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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(() => Services.obs.removeObserver(RequireObserver, "{{metadata. get('general', 'basename')}}-require"));
25 {%- set hasShutdownHandlers = True %} 25 {%- set hasShutdownHandlers = True %}
26 {%- endif %} 26 {%- endif %}
27 27
28 require("main"); 28 require("main");
29 } 29 }
30 30
31 function shutdown(params, reason) 31 function shutdown(params, reason)
32 { 32 {
33 {%- if chromeWindows %} 33 {%- if chromeWindows %}
34 let windowNames = {{chromeWindows|json}}; 34 let windowNames = {{chromeWindows|json}};
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 %}
OLDNEW
« no previous file with comments | « no previous file | lib/hooks.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld