| 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 | 
|   11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the |   11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
|   12  * GNU General Public License for more details. |   12  * GNU General Public License for more details. | 
|   13  * |   13  * | 
|   14  * You should have received a copy of the GNU General Public License |   14  * You should have received a copy of the GNU General Public License | 
|   15  * along with Adblock Plus.  If not, see <http://www.gnu.org/licenses/>. |   15  * along with Adblock Plus.  If not, see <http://www.gnu.org/licenses/>. | 
|   16  */ |   16  */ | 
|   17  |   17  | 
|   18 "use strict"; |   18 "use strict"; | 
|   19  |   19  | 
|   20 let randomEventName = "abp-request-" + Math.random().toString(36).substr(2); |   20 let randomEventName = "abp-request-" + Math.random().toString(36).substr(2); | 
|   21  |   21  | 
|   22 // Proxy "should we block?" messages from checkRequest inside the injected |   22 // Proxy "should we block?" messages from checkRequest inside the injected | 
|   23 // code to the background page and back again. |   23 // code to the background page and back again. | 
|   24 document.addEventListener(randomEventName, event => |   24 document.addEventListener(randomEventName, event => | 
|   25 { |   25 { | 
|   26   let {url, requestType} = event.detail; |   26   let {url, requestType} = event.detail; | 
|   27  |   27  | 
|   28   chrome.runtime.sendMessage({ |   28   browser.runtime.sendMessage({ | 
|   29     type: "request.blockedByWrapper", |   29     type: "request.blockedByWrapper", | 
|   30     requestType, |   30     requestType, | 
|   31     url |   31     url | 
|   32   }, block => |   32   }, block => | 
|   33   { |   33   { | 
|   34     document.dispatchEvent(new CustomEvent( |   34     document.dispatchEvent(new CustomEvent( | 
|   35       randomEventName + "-" + requestType + "-" + url, {detail: block} |   35       randomEventName + "-" + requestType + "-" + url, {detail: block} | 
|   36     )); |   36     )); | 
|   37   }); |   37   }); | 
|   38 }); |   38 }); | 
| (...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  396   if (typeof sandbox != "string" || /(^|\s)allow-scripts(\s|$)/i.test(sandbox)) |  396   if (typeof sandbox != "string" || /(^|\s)allow-scripts(\s|$)/i.test(sandbox)) | 
|  397   { |  397   { | 
|  398     let script = document.createElement("script"); |  398     let script = document.createElement("script"); | 
|  399     script.type = "application/javascript"; |  399     script.type = "application/javascript"; | 
|  400     script.async = false; |  400     script.async = false; | 
|  401     script.textContent = "(" + injected + ")('" + randomEventName + "');"; |  401     script.textContent = "(" + injected + ")('" + randomEventName + "');"; | 
|  402     document.documentElement.appendChild(script); |  402     document.documentElement.appendChild(script); | 
|  403     document.documentElement.removeChild(script); |  403     document.documentElement.removeChild(script); | 
|  404   } |  404   } | 
|  405 } |  405 } | 
| OLD | NEW |