[Pkg-mozext-commits] [greasemonkey] 25/55: Remove referer-setting-observer.

David Prévot taffit at moszumanska.debian.org
Thu Oct 29 15:38:04 UTC 2015


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

taffit pushed a commit to branch master
in repository greasemonkey.

commit c274845d95b6d88d70c8b99f4132cf5e3daa0f1f
Author: Anthony Lieuallen <arantius at gmail.com>
Date:   Wed Sep 23 17:05:39 2015 -0400

    Remove referer-setting-observer.
    
    It doesn't work under e10s, and tests show it's also now (?!) unnecessary.
    
    Refs #2255
---
 modules/xmlhttprequester.js | 32 --------------------------------
 1 file changed, 32 deletions(-)

diff --git a/modules/xmlhttprequester.js b/modules/xmlhttprequester.js
index 28e443a..0c32907 100644
--- a/modules/xmlhttprequester.js
+++ b/modules/xmlhttprequester.js
@@ -99,8 +99,6 @@ GM_xmlhttpRequester.prototype.contentStartRequest = function(details) {
 // that it can access other domains without security warning
 GM_xmlhttpRequester.prototype.chromeStartRequest =
 function(safeUrl, details, req) {
-  this.setupReferer(details, req);
-
   var setupRequestEvent = GM_util.hitch(
       this, 'setupRequestEvent', this.wrappedContentWin, this.sandbox);
 
@@ -185,36 +183,6 @@ function(safeUrl, details, req) {
   }
 };
 
-// sets the "Referer" HTTP header for this GM_XHR request.
-// Firefox does not let chrome JS set the "Referer" HTTP header via XHR
-// directly. However, we can still set it indirectly via an
-// http-on-modify-request observer.
-GM_xmlhttpRequester.prototype.setupReferer =
-function(details, req) {
-  if (!details.headers || !details.headers.Referer) return;
-
-  var observerService = Components.classes["@mozilla.org/observer-service;1"]
-      .getService(Components.interfaces.nsIObserverService);
-  var requestObserver = {};
-  requestObserver.observe = function(subject, topic, data) {
-      observerService.removeObserver(requestObserver, "http-on-modify-request");
-
-      var channel = subject.QueryInterface(Components.interfaces.nsIChannel);
-      if (channel == req.channel) {
-        dump('setting referer ' + details.headers.Referer + '\n');
-        var httpChannel = subject.QueryInterface(
-            Components.interfaces.nsIHttpChannel);
-        httpChannel.setRequestHeader("Referer", details.headers.Referer, false);
-      }
-    };
-
-  // This fails under e10s.  Ignore for now (Mar 13, 2015).
-  // TODO: Make it work!
-  try {
-    observerService.addObserver(requestObserver, "http-on-modify-request", false);
-  } catch (e) { }
-};
-
 // arranges for the specified 'event' on xmlhttprequest 'req' to call the
 // method by the same name which is a property of 'details' in the content
 // window's security context.

-- 
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