Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: safari/ext/content.js

Issue 5761318371983360: Issue 649 - Dispatch "error" event asynchronusly on Safari (Closed)
Patch Set: Created June 6, 2014, 1:59 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 })();
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld