Left: | ||
Right: |
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 17 matching lines...) Expand all Loading... | |
28 var beforeLoadEvent = document.createEvent("Event"); | 28 var beforeLoadEvent = document.createEvent("Event"); |
29 beforeLoadEvent.initEvent("beforeload"); | 29 beforeLoadEvent.initEvent("beforeload"); |
30 | 30 |
31 var isTopLevel = window == window.top; | 31 var isTopLevel = window == window.top; |
32 var isPrerendered = document.visibilityState == "prerender"; | 32 var isPrerendered = document.visibilityState == "prerender"; |
33 | 33 |
34 // Notify the background page that this frame is loading, generating ourselves | 34 // Notify the background page that this frame is loading, generating ourselves |
35 // a random documentId while we're at it. That way the background page can | 35 // a random documentId while we're at it. That way the background page can |
36 // communicate with us reliably, despite limitations in Safari's extension | 36 // communicate with us reliably, despite limitations in Safari's extension |
37 // API. | 37 // API. |
38 var documentId = Math.random().toString(); | 38 var documentId = Math.random().toString().substr(2); |
Sebastian Noack
2016/03/18 19:32:51
Nit: It's not important for the logic, but more an
kzar
2016/03/18 19:53:38
Done.
| |
39 safari.self.tab.dispatchMessage("loading", { | 39 safari.self.tab.dispatchMessage("loading", { |
40 url: window.location.href, | 40 url: window.location.href, |
41 referrer: document.referrer, | 41 referrer: document.referrer, |
42 isTopLevel: isTopLevel, | 42 isTopLevel: isTopLevel, |
43 isPrerendered: isPrerendered, | 43 isPrerendered: isPrerendered, |
44 documentId: documentId | 44 documentId: documentId |
45 }); | 45 }); |
46 | 46 |
47 if (isTopLevel && isPrerendered) | 47 if (isTopLevel && isPrerendered) |
48 { | 48 { |
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
433 }); | 433 }); |
434 | 434 |
435 | 435 |
436 /* Detecting extension reload/disable/uninstall (not supported on Safari) */ | 436 /* Detecting extension reload/disable/uninstall (not supported on Safari) */ |
437 | 437 |
438 ext.onExtensionUnloaded = { | 438 ext.onExtensionUnloaded = { |
439 addListener: function() {}, | 439 addListener: function() {}, |
440 removeListener: function() {} | 440 removeListener: function() {} |
441 }; | 441 }; |
442 })(); | 442 })(); |
LEFT | RIGHT |