LEFT | RIGHT |
(no file at all) | |
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 Loading... |
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 Object.defineProperty(dest, name, | 177 if (src.hasOwnProperty(name)) |
178 Object.getOwnPropertyDescriptor(src, name)); | 178 { |
| 179 Object.defineProperty(dest, name, |
| 180 Object.getOwnPropertyDescriptor(src, name)); |
| 181 } |
179 } | 182 } |
180 } | 183 } |
181 | 184 |
182 /* | 185 /* |
183 * WebSocket wrapper | 186 * WebSocket wrapper |
184 * | 187 * |
185 * Required before Chrome 58, since the webRequest API didn't allow us to | 188 * Required before Chrome 58, since the webRequest API didn't allow us to |
186 * intercept WebSockets. | 189 * intercept WebSockets. |
187 * See https://bugs.chromium.org/p/chromium/issues/detail?id=129353 | 190 * See https://bugs.chromium.org/p/chromium/issues/detail?id=129353 |
188 */ | 191 */ |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
393 if (typeof sandbox != "string" || /(^|\s)allow-scripts(\s|$)/i.test(sandbox)) | 396 if (typeof sandbox != "string" || /(^|\s)allow-scripts(\s|$)/i.test(sandbox)) |
394 { | 397 { |
395 let script = document.createElement("script"); | 398 let script = document.createElement("script"); |
396 script.type = "application/javascript"; | 399 script.type = "application/javascript"; |
397 script.async = false; | 400 script.async = false; |
398 script.textContent = "(" + injected + ")('" + randomEventName + "');"; | 401 script.textContent = "(" + injected + ")('" + randomEventName + "');"; |
399 document.documentElement.appendChild(script); | 402 document.documentElement.appendChild(script); |
400 document.documentElement.removeChild(script); | 403 document.documentElement.removeChild(script); |
401 } | 404 } |
402 } | 405 } |
LEFT | RIGHT |