mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-29 07:42:04 +00:00
Bug 1266840 - Define XMLHttpRequest in devtools loader. r=jryans
MozReview-Commit-ID: 5F2UlTlzx1R --HG-- extra : transplant_source : %A3%F20%C8%BE%3F%19%C1%F8%A2%A9%FFF3%BBr%8E%95%B0%F5
This commit is contained in:
parent
3938b1fcd9
commit
8493b659d3
@ -17,6 +17,7 @@
|
||||
"require": true,
|
||||
"setInterval": true,
|
||||
"setTimeout": true,
|
||||
"XMLHttpRequest": true,
|
||||
"_Iterator": true,
|
||||
},
|
||||
"rules": {
|
||||
|
@ -160,7 +160,7 @@ exports.appendSyntaxHighlightedCSS = appendSyntaxHighlightedCSS;
|
||||
function getMdnPage(pageUrl) {
|
||||
let deferred = Promise.defer();
|
||||
|
||||
let xhr = Cc["@mozilla.org/xmlextras/xmlhttprequest;1"].createInstance(Ci.nsIXMLHttpRequest);
|
||||
let xhr = new XMLHttpRequest();
|
||||
|
||||
xhr.addEventListener("load", onLoaded, false);
|
||||
xhr.addEventListener("error", onError, false);
|
||||
|
@ -244,6 +244,13 @@ const globals = exports.globals = {
|
||||
lazyRequireGetter: lazyRequireGetter,
|
||||
id: null // Defined by Loader.jsm
|
||||
},
|
||||
|
||||
// Let new XMLHttpRequest do the right thing.
|
||||
XMLHttpRequest: function () {
|
||||
return Cc["@mozilla.org/xmlextras/xmlhttprequest;1"]
|
||||
.createInstance(Ci.nsIXMLHttpRequest);
|
||||
},
|
||||
|
||||
// Make sure `define` function exists. This allows defining some modules
|
||||
// in AMD format while retaining CommonJS compatibility through this hook.
|
||||
// JSON Viewer needs modules in AMD format, as it currently uses RequireJS
|
||||
|
Loading…
Reference in New Issue
Block a user