Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Delta Between Two Patch Sets: inject.preload.js

Issue 29445594: Noissue - Fix some problems Firefox has with our injected code (Closed)
Left Patch Set: Removed extra newline which was added by mistake Created May 22, 2017, 10:36 a.m.
Right Patch Set: Don't copy the caller property Created May 22, 2017, 11:23 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « no previous file | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 /* 1 /*
2 * This file is part of Adblock Plus <https://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-2017 eyeo GmbH 3 * Copyright (C) 2006-2017 eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 dispatchEvent(new RealCustomEvent(eventName, 167 dispatchEvent(new RealCustomEvent(eventName,
168 {detail: {url, requestType}})); 168 {detail: {url, requestType}}));
169 }; 169 };
170 } 170 }
171 171
172 // Only to be called before the page's code, not hardened. 172 // Only to be called before the page's code, not hardened.
173 function copyProperties(src, dest, properties) 173 function copyProperties(src, dest, properties)
174 { 174 {
175 for (let name of properties) 175 for (let name of properties)
176 { 176 {
177 let descriptor = Object.getOwnPropertyDescriptor(src, name); 177 Object.defineProperty(dest, name,
178 if (descriptor) 178 Object.getOwnPropertyDescriptor(src, name));
179 Object.defineProperty(dest, name, descriptor);
180 } 179 }
181 } 180 }
182 181
183 /* 182 /*
184 * WebSocket wrapper 183 * WebSocket wrapper
185 * 184 *
186 * Required before Chrome 58, since the webRequest API didn't allow us to 185 * Required before Chrome 58, since the webRequest API didn't allow us to
187 * intercept WebSockets. 186 * intercept WebSockets.
188 * See https://bugs.chromium.org/p/chromium/issues/detail?id=129353 187 * See https://bugs.chromium.org/p/chromium/issues/detail?id=129353
189 */ 188 */
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
370 369
371 let peerconnection = new RealRTCPeerConnection(configuration, constraints); 370 let peerconnection = new RealRTCPeerConnection(configuration, constraints);
372 checkConfiguration(peerconnection, configuration); 371 checkConfiguration(peerconnection, configuration);
373 return peerconnection; 372 return peerconnection;
374 } 373 }
375 374
376 WrappedRTCPeerConnection.prototype = RealRTCPeerConnection.prototype; 375 WrappedRTCPeerConnection.prototype = RealRTCPeerConnection.prototype;
377 376
378 let boundWrappedRTCPeerConnection = WrappedRTCPeerConnection.bind(); 377 let boundWrappedRTCPeerConnection = WrappedRTCPeerConnection.bind();
379 copyProperties(RealRTCPeerConnection, boundWrappedRTCPeerConnection, 378 copyProperties(RealRTCPeerConnection, boundWrappedRTCPeerConnection,
380 ["caller", "generateCertificate", "name", "prototype"]); 379 ["generateCertificate", "name", "prototype"]);
Wladimir Palant 2017/05/22 10:55:17 So the issue is being caused by trying to copy the
kzar 2017/05/22 11:25:31 Yea, I just checked and "caller" is indeed the pro
381 RealRTCPeerConnection.prototype.constructor = boundWrappedRTCPeerConnection; 380 RealRTCPeerConnection.prototype.constructor = boundWrappedRTCPeerConnection;
382 381
383 if ("RTCPeerConnection" in window) 382 if ("RTCPeerConnection" in window)
384 window.RTCPeerConnection = boundWrappedRTCPeerConnection; 383 window.RTCPeerConnection = boundWrappedRTCPeerConnection;
385 if ("webkitRTCPeerConnection" in window) 384 if ("webkitRTCPeerConnection" in window)
386 window.webkitRTCPeerConnection = boundWrappedRTCPeerConnection; 385 window.webkitRTCPeerConnection = boundWrappedRTCPeerConnection;
387 } 386 }
388 387
389 if (document instanceof HTMLDocument) 388 if (document instanceof HTMLDocument)
390 { 389 {
391 let script = document.createElement("script"); 390 let script = document.createElement("script");
392 script.type = "application/javascript"; 391 script.type = "application/javascript";
393 script.async = false; 392 script.async = false;
394 script.textContent = "(" + injected + ")('" + randomEventName + "');"; 393 script.textContent = "(" + injected + ")('" + randomEventName + "');";
395 document.documentElement.appendChild(script); 394 document.documentElement.appendChild(script);
396 document.documentElement.removeChild(script); 395 document.documentElement.removeChild(script);
397 } 396 }
LEFTRIGHT
« no previous file | no next file » | Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Toggle Comments ('s')

Powered by Google App Engine
This is Rietveld