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

Delta Between Two Patch Sets: safari/ext/content.js

Issue 6549206625943552: Issue 1592 - Fixed frame collapsing on Safari (Closed)
Left Patch Set: Improved comment Created Nov. 25, 2014, 11:43 a.m.
Right Patch Set: Apparently this behaviour isn't limited to Safari 8 Created Nov. 25, 2014, 1:18 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « no previous file | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 category: "webRequest", 97 category: "webRequest",
98 url: url, 98 url: url,
99 type: type, 99 type: type,
100 pageId: documentInfo.pageId, 100 pageId: documentInfo.pageId,
101 frameId: documentInfo.frameId 101 frameId: documentInfo.frameId
102 } 102 }
103 )) 103 ))
104 { 104 {
105 event.preventDefault(); 105 event.preventDefault();
106 106
107 // Safari doesn't dispatch all the expected events for elements that 107 // Safari doesn't dispatch the expected events for elements that have been
108 // have been prevented from loading by having their "beforeload" event 108 // prevented from loading by having their "beforeload" event cancelled.
109 // cancelled. "error" events are never dispatched, and since Safari 8 109 // That is a "load" event for blocked frames, and an "error" event for
110 // "load" events are also not dispatched, when blocking frames. 110 // other blocked elements. We need to dispatch those events manually here
111 // We need to dispatch those events manually here to avoid breaking 111 // to avoid breaking element collapsing and pages that rely on those event s.
112 // element collapsing and pages that rely on those events. 112 setTimeout(function()
113 if (type != "sub_frame" || parseInt(navigator.userAgent.match(/\bVersion\/ (\d+)/)[1], 10) >= 8) 113 {
114 { 114 var evt = document.createEvent("Event");
115 setTimeout(function() 115 evt.initEvent(eventName);
116 { 116 event.target.dispatchEvent(evt);
117 var evt = document.createEvent("Event"); 117 }, 0);
118 evt.initEvent(eventName);
119 event.target.dispatchEvent(evt);
120 }, 0);
121 }
122 } 118 }
123 }, true); 119 }, true);
124 120
125 121
126 /* Context menus */ 122 /* Context menus */
127 123
128 document.addEventListener("contextmenu", function(event) 124 document.addEventListener("contextmenu", function(event)
129 { 125 {
130 var element = event.srcElement; 126 var element = event.srcElement;
131 safari.self.tab.setContextMenuEventUserInfo(event, { 127 safari.self.tab.setContextMenuEventUserInfo(event, {
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
426 messageProxy.handleResponse(event.message); 422 messageProxy.handleResponse(event.message);
427 break; 423 break;
428 case "proxyCallback": 424 case "proxyCallback":
429 backgroundPageProxy.handleCallback(event.message); 425 backgroundPageProxy.handleCallback(event.message);
430 break; 426 break;
431 } 427 }
432 } 428 }
433 } 429 }
434 }); 430 });
435 })(); 431 })();
LEFTRIGHT
« no previous file | no next file » | Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Toggle Comments ('s')

Powered by Google App Engine
This is Rietveld