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

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

Issue 5729801683861504: Added workaround for missing safari object in frames with javascript: URL (Closed)
Patch Set: Created Feb. 24, 2014, 3:31 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-2013 Eyeo GmbH 3 * Copyright (C) 2006-2013 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
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details. 12 * GNU General Public License for more details.
13 * 13 *
14 * You should have received a copy of the GNU General Public License 14 * You should have received a copy of the GNU General Public License
15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. 15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>.
16 */ 16 */
17 17
18 (function() 18 (function()
19 { 19 {
20 // the safari object is missing in frames created from javascript: URLs.
21 // So we have to fallback to the safari object from the parent frame.
22 if (!("safari" in window))
23 window.safari = window.parent.safari;
24
20 if (window == window.top) 25 if (window == window.top)
21 safari.self.tab.dispatchMessage("loading"); 26 safari.self.tab.dispatchMessage("loading");
22 27
23 28
24 /* Events */ 29 /* Events */
25 30
26 var ContentMessageEventTarget = function() 31 var ContentMessageEventTarget = function()
27 { 32 {
28 MessageEventTarget.call(this, safari.self); 33 MessageEventTarget.call(this, safari.self);
29 }; 34 };
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 // so we need to add it to the event's user info. 365 // so we need to add it to the event's user info.
361 document.addEventListener("contextmenu", function(event) 366 document.addEventListener("contextmenu", function(event)
362 { 367 {
363 var element = event.srcElement; 368 var element = event.srcElement;
364 safari.self.tab.setContextMenuEventUserInfo(event, { 369 safari.self.tab.setContextMenuEventUserInfo(event, {
365 srcUrl: ("src" in element) ? element.src : null, 370 srcUrl: ("src" in element) ? element.src : null,
366 tagName: element.localName 371 tagName: element.localName
367 }); 372 });
368 }, false); 373 }, false);
369 })(); 374 })();
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