OLD | NEW |
1 /* | 1 /* |
2 * This file is part of Adblock Plus <http://adblockplus.org/>, | 2 * This file is part of Adblock Plus <http://adblockplus.org/>, |
3 * Copyright (C) 2006-2014 Eyeo GmbH | 3 * Copyright (C) 2006-2014 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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 } | 104 } |
105 )) | 105 )) |
106 { | 106 { |
107 event.preventDefault(); | 107 event.preventDefault(); |
108 | 108 |
109 // Safari doesn't dispatch an "error" event when preventing an element | 109 // Safari doesn't dispatch an "error" event when preventing an element |
110 // from loading by cancelling the "beforeload" event. So we have to | 110 // from loading by cancelling the "beforeload" event. So we have to |
111 // dispatch it manually. Otherwise element collapsing wouldn't work. | 111 // dispatch it manually. Otherwise element collapsing wouldn't work. |
112 if (type != "sub_frame") | 112 if (type != "sub_frame") |
113 { | 113 { |
114 var evt = document.createEvent("Event"); | 114 setTimeout(function() |
115 evt.initEvent("error"); | 115 { |
116 event.target.dispatchEvent(evt); | 116 var evt = document.createEvent("Event"); |
| 117 evt.initEvent("error"); |
| 118 event.target.dispatchEvent(evt); |
| 119 }, 0); |
117 } | 120 } |
118 } | 121 } |
119 }, true); | 122 }, true); |
120 | 123 |
121 | 124 |
122 /* Context menus */ | 125 /* Context menus */ |
123 | 126 |
124 document.addEventListener("contextmenu", function(event) | 127 document.addEventListener("contextmenu", function(event) |
125 { | 128 { |
126 var element = event.srcElement; | 129 var element = event.srcElement; |
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
410 messageProxy.handleResponse(event.message); | 413 messageProxy.handleResponse(event.message); |
411 break; | 414 break; |
412 case "proxyCallback": | 415 case "proxyCallback": |
413 backgroundPageProxy.handleCallback(event.message); | 416 backgroundPageProxy.handleCallback(event.message); |
414 break; | 417 break; |
415 } | 418 } |
416 } | 419 } |
417 } | 420 } |
418 }); | 421 }); |
419 })(); | 422 })(); |
OLD | NEW |