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

Side by Side Diff: inject.preload.js

Issue 29445594: Noissue - Fix some problems Firefox has with our injected code (Closed)
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:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 340 matching lines...) Expand 10 before | Expand all | Expand 10 after
351 realSetConfiguration(this, configuration); 351 realSetConfiguration(this, configuration);
352 checkConfiguration(this, configuration); 352 checkConfiguration(this, configuration);
353 }; 353 };
354 } 354 }
355 355
356 function WrappedRTCPeerConnection(...args) 356 function WrappedRTCPeerConnection(...args)
357 { 357 {
358 if (!(this instanceof WrappedRTCPeerConnection)) 358 if (!(this instanceof WrappedRTCPeerConnection))
359 return WrappedRTCPeerConnection(); 359 return WrappedRTCPeerConnection();
360 360
361 let configuration = protectConfiguration(args[0]); 361 let configuration = protectConfiguration(args[0]);
Sebastian Noack 2017/05/22 12:16:54 Nit: Perhaps move this definition below where the
kzar 2017/05/22 13:02:04 Mmh I think it's OK here personally.
362
362 // Since the old webkitRTCPeerConnection constructor takes an optional 363 // Since the old webkitRTCPeerConnection constructor takes an optional
363 // second argument we need to take care to pass that through. Necessary 364 // second argument we need to take care to pass that through. Necessary
364 // for older versions of Chrome such as 49. 365 // for older versions of Chrome such as 49.
365 let peerconnection = new RealRTCPeerConnection(configuration, args[1]); 366 let constraints = undefined;
367 if (args.length > 1)
368 constraints = args[1];
369
370 let peerconnection = new RealRTCPeerConnection(configuration, constraints);
366 checkConfiguration(peerconnection, configuration); 371 checkConfiguration(peerconnection, configuration);
367 return peerconnection; 372 return peerconnection;
368 } 373 }
369 374
370 WrappedRTCPeerConnection.prototype = RealRTCPeerConnection.prototype; 375 WrappedRTCPeerConnection.prototype = RealRTCPeerConnection.prototype;
371 376
372 let boundWrappedRTCPeerConnection = WrappedRTCPeerConnection.bind(); 377 let boundWrappedRTCPeerConnection = WrappedRTCPeerConnection.bind();
373 copyProperties(RealRTCPeerConnection, boundWrappedRTCPeerConnection, 378 copyProperties(RealRTCPeerConnection, boundWrappedRTCPeerConnection,
374 ["caller", "generateCertificate", "name", "prototype"]); 379 ["generateCertificate", "name", "prototype"]);
375 RealRTCPeerConnection.prototype.constructor = boundWrappedRTCPeerConnection; 380 RealRTCPeerConnection.prototype.constructor = boundWrappedRTCPeerConnection;
376 381
377 if ("RTCPeerConnection" in window) 382 if ("RTCPeerConnection" in window)
378 window.RTCPeerConnection = boundWrappedRTCPeerConnection; 383 window.RTCPeerConnection = boundWrappedRTCPeerConnection;
379 if ("webkitRTCPeerConnection" in window) 384 if ("webkitRTCPeerConnection" in window)
380 window.webkitRTCPeerConnection = boundWrappedRTCPeerConnection; 385 window.webkitRTCPeerConnection = boundWrappedRTCPeerConnection;
381 } 386 }
382 387
383 if (document instanceof HTMLDocument) 388 if (document instanceof HTMLDocument)
384 { 389 {
385 let script = document.createElement("script"); 390 let script = document.createElement("script");
386 script.type = "application/javascript"; 391 script.type = "application/javascript";
387 script.async = false; 392 script.async = false;
388 script.textContent = "(" + injected + ")('" + randomEventName + "');"; 393 script.textContent = "(" + injected + ")('" + randomEventName + "');";
389 document.documentElement.appendChild(script); 394 document.documentElement.appendChild(script);
390 document.documentElement.removeChild(script); 395 document.documentElement.removeChild(script);
391 } 396 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld