[Pkg-mozext-commits] [greasemonkey] 09/45: Remove the need for a chrome window reference in GM_xhr.

David Prévot taffit at moszumanska.debian.org
Mon Nov 3 20:59:19 UTC 2014


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository greasemonkey.

commit 13839767416e28b5664b0e425cba83156514f0ef
Author: Ventero <ventero at ventero.de>
Date:   Sat Sep 20 23:20:14 2014 +0200

    Remove the need for a chrome window reference in GM_xhr.
---
 components/greasemonkey.js  | 6 +++---
 modules/xmlhttprequester.js | 8 +++-----
 2 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/components/greasemonkey.js b/components/greasemonkey.js
index 7a9ceae..57f994d 100644
--- a/components/greasemonkey.js
+++ b/components/greasemonkey.js
@@ -57,7 +57,7 @@ function contentLoad(aEvent) {
   GM_util.getService().runScripts('document-end', safeWin);
 }
 
-function createSandbox(aScript, aContentWin, aChromeWin, aUrl) {
+function createSandbox(aScript, aContentWin, aUrl) {
   if (GM_util.inArray(aScript.grants, 'none')) {
     // If there is an explicit none grant, use a plain unwrapped sandbox
     // with no other content.
@@ -147,7 +147,7 @@ function createSandbox(aScript, aContentWin, aChromeWin, aUrl) {
   }
   if (GM_util.inArray(aScript.grants, 'GM_xmlhttpRequest')) {
     sandbox.GM_xmlhttpRequest = GM_util.hitch(
-        new GM_xmlhttpRequester(aContentWin, aChromeWin, aUrl, sandbox),
+        new GM_xmlhttpRequester(aContentWin, aUrl, sandbox),
         'contentStartRequest');
   }
 
@@ -442,7 +442,7 @@ service.prototype.injectScripts = function(
   var chromeWin = getChromeWinForContentWin(wrappedContentWin);
 
   for (var i = 0, script = null; script = scripts[i]; i++) {
-    var sandbox = createSandbox(script, wrappedContentWin, chromeWin, url);
+    var sandbox = createSandbox(script, wrappedContentWin, url);
     runScriptInSandbox(script, sandbox);
   }
 };
diff --git a/modules/xmlhttprequester.js b/modules/xmlhttprequester.js
index 69d266a..76c3558 100644
--- a/modules/xmlhttprequester.js
+++ b/modules/xmlhttprequester.js
@@ -2,11 +2,8 @@ var EXPORTED_SYMBOLS = ['GM_xmlhttpRequester'];
 
 Components.utils.import("resource://greasemonkey/util.js");
 
-function GM_xmlhttpRequester(
-    wrappedContentWin, chromeWindow, originUrl, sandbox
-) {
+function GM_xmlhttpRequester(wrappedContentWin, originUrl, sandbox) {
   this.wrappedContentWin = wrappedContentWin;
-  this.chromeWindow = chromeWindow;
   this.originUrl = originUrl;
   this.sandboxPrincipal = Components.utils.getObjectPrincipal(sandbox);
 }
@@ -38,7 +35,8 @@ GM_xmlhttpRequester.prototype.contentStartRequest = function(details) {
     case "http":
     case "https":
     case "ftp":
-        var req = new this.chromeWindow.XMLHttpRequest();
+        var req = Components.classes["@mozilla.org/xmlextras/xmlhttprequest;1"]
+            .createInstance(Components.interfaces.nsIXMLHttpRequest);
         GM_util.hitch(this, "chromeStartRequest", url, details, req)();
       break;
     default:

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/greasemonkey.git



More information about the Pkg-mozext-commits mailing list