[tor-commits] [snowflake/master] Don't overwrite global location

arlo at torproject.org arlo at torproject.org
Wed Jul 10 15:58:46 UTC 2019


commit 6e95581f53d5b20c699617b7f57fc8b285a3d9c7
Author: Arlo Breault <arlolra at gmail.com>
Date:   Sun Jul 7 10:30:19 2019 +0200

    Don't overwrite global location
---
 proxy/init-badge.js | 2 +-
 proxy/shims.js      | 5 +----
 2 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/proxy/init-badge.js b/proxy/init-badge.js
index 09579e6..180a963 100644
--- a/proxy/init-badge.js
+++ b/proxy/init-badge.js
@@ -13,7 +13,7 @@ var snowflake, query, debug, silenceNotifications, log, dbg, init;
 
   snowflake = null;
 
-  query = Query.parse(location);
+  query = Query.parse(location.search.substr(1));
 
   debug = Params.getBool(query, 'debug', false);
 
diff --git a/proxy/shims.js b/proxy/shims.js
index 4fc0b38..4ddf421 100644
--- a/proxy/shims.js
+++ b/proxy/shims.js
@@ -10,7 +10,7 @@ if (typeof module !== "undefined" && module !== null ? module.exports : void 0)
     }
   };
   chrome = {};
-  location = '';
+  location = { search: '' };
   if ((typeof TESTING === "undefined" || TESTING === null) || !TESTING) {
     webrtc = require('wrtc');
     PeerConnection = webrtc.RTCPeerConnection;
@@ -20,9 +20,6 @@ if (typeof module !== "undefined" && module !== null ? module.exports : void 0)
     ({ XMLHttpRequest } = require('xmlhttprequest'));
   }
 } else {
-  document = window.document;
-  chrome = window.chrome;
-  location = window.location.search.substr(1);
   PeerConnection = window.RTCPeerConnection || window.mozRTCPeerConnection || window.webkitRTCPeerConnection;
   IceCandidate = window.RTCIceCandidate || window.mozRTCIceCandidate;
   SessionDescription = window.RTCSessionDescription || window.mozRTCSessionDescription;





More information about the tor-commits mailing list