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

Unified Diff: bootstrap.js.tmpl

Issue 11237002: Provide an XMLHttpRequest constructor if used in JS modules (Closed)
Patch Set: Created July 25, 2013, 3:43 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 | packagerGecko.py » ('j') | 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
@@ -17,16 +17,20 @@
const Cc = Components.classes;
const Ci = Components.interfaces;
const Cr = Components.results;
const Cu = Components.utils;
let {Services, atob, btoa, File} = Cu.import("resource://gre/modules/Services.jsm", null);
+{%- if hasXMLHttpRequest %}
+let XMLHttpRequest = Components.Constructor("@mozilla.org/xmlextras/xmlhttprequest;1", "nsIXMLHttpRequest");
+{%- endif %}
+
let addonData = null;
function startup(params, reason)
{
addonData = params;
{%- if hasChromeRequires %}
Services.obs.addObserver(RequireObserver, "{{metadata.get('general', 'basename')}}-require", true);
@@ -154,16 +158,19 @@ function require(module)
Cu: Cu,
atob: atob,
btoa: btoa,
File: File,
require: require,
{% if hasShutdownHandlers %}
onShutdown: onShutdown,
{% endif %}
+ {%- if hasXMLHttpRequest %}
+ 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 | packagerGecko.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld