Left: | ||
Right: |
OLD | NEW |
---|---|
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-present eyeo GmbH | 3 * Copyright (C) 2006-present 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 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
218 | 218 |
219 /* | 219 /* |
220 * RTCPeerConnection wrapper | 220 * RTCPeerConnection wrapper |
221 * | 221 * |
222 * The webRequest API in Chrome does not yet allow the blocking of | 222 * The webRequest API in Chrome does not yet allow the blocking of |
223 * WebRTC connections. | 223 * WebRTC connections. |
224 * See https://bugs.chromium.org/p/chromium/issues/detail?id=707683 | 224 * See https://bugs.chromium.org/p/chromium/issues/detail?id=707683 |
225 */ | 225 */ |
226 let RealRTCPeerConnection = window.RTCPeerConnection || | 226 let RealRTCPeerConnection = window.RTCPeerConnection || |
227 window.webkitRTCPeerConnection; | 227 window.webkitRTCPeerConnection; |
228 | |
229 // Firefox has the option (media.peerconnection.enabled) to disable WebRTC | |
Manish Jethani
2017/11/14 10:57:56
Wouldn't it be better to wrap the entire code for
Wladimir Palant
2017/11/14 11:12:49
I agree. While I'm normally not a big fan of incre
kzar
2017/11/14 11:36:35
Done.
| |
230 // in which case RealRTCPeerConnection is undefined. Note: This logic assumes | |
231 // that the WebRTC wrapping code comes last in the injected function! | |
232 if (typeof RealRTCPeerConnection == "undefined") | |
233 return; | |
234 | |
228 let closeRTCPeerConnection = Function.prototype.call.bind( | 235 let closeRTCPeerConnection = Function.prototype.call.bind( |
229 RealRTCPeerConnection.prototype.close | 236 RealRTCPeerConnection.prototype.close |
230 ); | 237 ); |
231 let RealArray = Array; | 238 let RealArray = Array; |
232 let RealString = String; | 239 let RealString = String; |
233 let {create: createObject, defineProperty} = Object; | 240 let {create: createObject, defineProperty} = Object; |
234 | 241 |
235 function normalizeUrl(url) | 242 function normalizeUrl(url) |
236 { | 243 { |
237 if (typeof url != "undefined") | 244 if (typeof url != "undefined") |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
396 if (typeof sandbox != "string" || /(^|\s)allow-scripts(\s|$)/i.test(sandbox)) | 403 if (typeof sandbox != "string" || /(^|\s)allow-scripts(\s|$)/i.test(sandbox)) |
397 { | 404 { |
398 let script = document.createElement("script"); | 405 let script = document.createElement("script"); |
399 script.type = "application/javascript"; | 406 script.type = "application/javascript"; |
400 script.async = false; | 407 script.async = false; |
401 script.textContent = "(" + injected + ")('" + randomEventName + "');"; | 408 script.textContent = "(" + injected + ")('" + randomEventName + "');"; |
402 document.documentElement.appendChild(script); | 409 document.documentElement.appendChild(script); |
403 document.documentElement.removeChild(script); | 410 document.documentElement.removeChild(script); |
404 } | 411 } |
405 } | 412 } |
OLD | NEW |