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

Unified Diff: bootstrap.js.tmpl

Issue 29338608: Issue 3834 - Expose URL constructor to modules (Closed)
Patch Set: Created March 18, 2016, 12:11 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: bootstrap.js.tmpl
===================================================================
--- a/bootstrap.js.tmpl
+++ b/bootstrap.js.tmpl
@@ -2,20 +2,23 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
const Cc = Components.classes;
const Ci = Components.interfaces;
const Cr = Components.results;
const Cu = Components.utils;
-let {Services, atob, btoa, File, TextDecoder, TextEncoder} = Cu.import("resource://gre/modules/Services.jsm", null);
+let {Services} = Cu.import("resource://gre/modules/Services.jsm", {});
+
+Cu.importGlobalProperties(["atob", "btoa", "File", "URL",
+ "TextDecoder", "TextEncoder"]);
{%- if hasXMLHttpRequest %}
-let XMLHttpRequest = Components.Constructor("@mozilla.org/xmlextras/xmlhttprequest;1", "nsIXMLHttpRequest");
+Cu.importGlobalProperties(["XMLHttpRequest"]);
{%- endif %}
let addonData = null;
function startup(params, reason)
{
addonData = params;
@@ -137,29 +140,22 @@ function require(module)
platformVersion: appInfo.platformVersion
};
}
else
{
{%- endif %}
let url = addonData.resourceURI.spec + "lib/" + module + ".js";
scopes[module] = {
- Cc: Cc,
- Ci: Ci,
- Cr: Cr,
- Cu: Cu,
- atob: atob,
- btoa: btoa,
- File: File,
- require: require,
+ Cc, Ci, Cr, Cu, atob, btoa, File, URL, require,
saroyanm 2016/03/18 13:25:44 Why do we need to make this change ?
Wladimir Palant 2016/03/18 13:33:47 I don't but since I am cleaning up already...
{% if hasShutdownHandlers %}
- onShutdown: onShutdown,
+ onShutdown,
{% endif %}
{%- if hasXMLHttpRequest %}
- XMLHttpRequest: XMLHttpRequest,
+ XMLHttpRequest,
{% endif %}
exports: {}};
{%- if multicompartment %}
let principal = Cc["@mozilla.org/systemprincipal;1"].getService(Ci.nsIPrincipal);
scopes[module] = new Cu.Sandbox(principal, {
sandboxName: url,
sandboxPrototype: scopes[module],
wantXrays: false
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld