Browse files

Revert "Do not pass a chrome window to GM_xmlhttpRequester."

This reverts commit 668b18d.
Fixes #1472
  • Loading branch information...
1 parent 34d3d05 commit ee93ec8e329d4719657c604c8ecf224a169d8051 @arantius arantius committed Jan 20, 2012
Showing with 6 additions and 5 deletions.
  1. +2 −1 components/greasemonkey.js
  2. +4 −4 content/xmlhttprequester.js
View
3 components/greasemonkey.js
@@ -116,7 +116,8 @@ function createSandbox(
sandbox.GM_listValues = GM_util.hitch(scriptStorage, 'listValues');
sandbox.GM_openInTab = GM_util.hitch(null, openInTab, aContentWin, aChromeWin);
sandbox.GM_xmlhttpRequest = GM_util.hitch(
- new GM_xmlhttpRequester(aContentWin, aUrl), 'contentStartRequest');
+ new GM_xmlhttpRequester(aContentWin, aChromeWin, aUrl),
+ 'contentStartRequest');
return sandbox;
}
View
8 content/xmlhttprequester.js
@@ -1,7 +1,8 @@
Components.utils.import("resource://greasemonkey/util.js");
-function GM_xmlhttpRequester(wrappedContentWin, originUrl) {
+function GM_xmlhttpRequester(wrappedContentWin, chromeWindow, originUrl) {
this.wrappedContentWin = wrappedContentWin;
+ this.chromeWindow = chromeWindow;
this.originUrl = originUrl;
}
@@ -33,9 +34,8 @@ GM_xmlhttpRequester.prototype.contentStartRequest = function(details) {
case "http":
case "https":
case "ftp":
- var req = Components.classes["@mozilla.org/xmlextras/xmlhttprequest;1"]
- .createInstance();
- this.chromeStartRequest(url, details, req);
+ var req = new this.chromeWindow.XMLHttpRequest();
+ GM_util.hitch(this, "chromeStartRequest", url, details, req)();
break;
default:
throw new Error("Disallowed scheme in URL: " + details.url);

0 comments on commit ee93ec8

Please sign in to comment.