| LEFT | RIGHT |
| 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-2016 Eyeo GmbH | 3 * Copyright (C) 2006-2016 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 23 matching lines...) Expand all Loading... |
| 34 var usingContentBlockerAPI = true; | 34 var usingContentBlockerAPI = true; |
| 35 try | 35 try |
| 36 { | 36 { |
| 37 if (safari.self.tab.canLoad(beforeLoadEvent, | 37 if (safari.self.tab.canLoad(beforeLoadEvent, |
| 38 {category: "request", | 38 {category: "request", |
| 39 payload: {type: "prefs.get", | 39 payload: {type: "prefs.get", |
| 40 key: "safariContentBlocker"}}) != tru
e) | 40 key: "safariContentBlocker"}}) != tru
e) |
| 41 usingContentBlockerAPI = false; | 41 usingContentBlockerAPI = false; |
| 42 } | 42 } |
| 43 catch (e) | 43 catch (e) |
| 44 { } | 44 { |
| 45 } |
| 45 | 46 |
| 46 var isTopLevel; | 47 var isTopLevel; |
| 47 var isPrerendered; | 48 var isPrerendered; |
| 48 var documentId; | 49 var documentId; |
| 49 function notifyFrameLoading() | 50 function notifyFrameLoading() |
| 50 { | 51 { |
| 51 isTopLevel = window == window.top; | 52 isTopLevel = window == window.top; |
| 52 isPrerendered = document.visibilityState == "prerender"; | 53 isPrerendered = document.visibilityState == "prerender"; |
| 53 documentId = Math.random().toString().substr(2); | 54 documentId = Math.random().toString().substr(2); |
| 54 | 55 |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 // been prevented from loading by having their "beforeload" event | 148 // been prevented from loading by having their "beforeload" event |
| 148 // cancelled. That is a "load" event for blocked frames, and an "error" | 149 // cancelled. That is a "load" event for blocked frames, and an "error" |
| 149 // event for other blocked elements. We need to dispatch those events | 150 // event for other blocked elements. We need to dispatch those events |
| 150 // manually here to avoid breaking element collapsing and pages that | 151 // manually here to avoid breaking element collapsing and pages that |
| 151 // rely on those events. | 152 // rely on those events. |
| 152 setTimeout(function() | 153 setTimeout(function() |
| 153 { | 154 { |
| 154 var evt = document.createEvent("Event"); | 155 var evt = document.createEvent("Event"); |
| 155 evt.initEvent(eventName); | 156 evt.initEvent(eventName); |
| 156 event.target.dispatchEvent(evt); | 157 event.target.dispatchEvent(evt); |
| 157 }, 0); | 158 }); |
| 158 } | 159 } |
| 159 }, true); | 160 }, true); |
| 160 } | 161 } |
| 161 | 162 |
| 162 | 163 |
| 163 /* Context menus */ | 164 /* Context menus */ |
| 164 | 165 |
| 165 document.addEventListener("contextmenu", function(event) | 166 document.addEventListener("contextmenu", function(event) |
| 166 { | 167 { |
| 167 var element = event.srcElement; | 168 var element = event.srcElement; |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 }); | 223 }); |
| 223 | 224 |
| 224 | 225 |
| 225 /* Detecting extension reload/disable/uninstall (not supported on Safari) */ | 226 /* Detecting extension reload/disable/uninstall (not supported on Safari) */ |
| 226 | 227 |
| 227 ext.onExtensionUnloaded = { | 228 ext.onExtensionUnloaded = { |
| 228 addListener: function() {}, | 229 addListener: function() {}, |
| 229 removeListener: function() {} | 230 removeListener: function() {} |
| 230 }; | 231 }; |
| 231 })(); | 232 })(); |
| LEFT | RIGHT |