Index: safari/ext/content.js |
=================================================================== |
--- a/safari/ext/content.js |
+++ b/safari/ext/content.js |
@@ -279,6 +279,9 @@ |
/* Web request blocking */ |
+ var errorEvent = document.createEvent("Event"); |
+ errorEvent.initEvent("error"); |
+ |
document.addEventListener("beforeload", function(event) |
{ |
var type; |
@@ -318,7 +321,14 @@ |
isTopLevel: window == window.top |
} |
})) |
+ { |
event.preventDefault(); |
+ |
+ // Safari doesn't dispatch an "error" event when preventing an element |
+ // from loading by cancelling the "beforeload" event. So we have to |
+ // dispatch it manually. Otherwise element collapsing wouldn't work. |
+ event.target.dispatchEvent(errorEvent); |
Wladimir Palant
2014/01/16 09:21:24
a) Does Safari really allow dispatching the same e
Sebastian Noack
2014/01/16 13:20:56
Apparently it does. But if that is non-standard, I
|
+ } |
}, true); |