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 |
}); |