Skip to content

Commit

Permalink
Revert "Do not pass a chrome window to GM_xmlhttpRequester."
Browse files Browse the repository at this point in the history
This reverts commit 668b18d.
Fixes #1472
  • Loading branch information
Anthony Lieuallen committed Jan 20, 2012
1 parent 34d3d05 commit ee93ec8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
3 changes: 2 additions & 1 deletion components/greasemonkey.js
Expand Up @@ -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;
}
Expand Down
8 changes: 4 additions & 4 deletions 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;
}

Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit ee93ec8

Please sign in to comment.