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

Side by Side Diff: ext/background.js

Issue 29370947: Issue 3138 - Improve how context menu "block element" handles iframes (Closed)
Patch Set: Rebased Created Aug. 9, 2017, 3:27 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
OLDNEW
1 /* 1 /*
2 * This file is part of Adblock Plus <https://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-2017 eyeo GmbH 3 * Copyright (C) 2006-2017 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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 // In that case we get the url from top frame of the tab, recorded by 89 // In that case we get the url from top frame of the tab, recorded by
90 // the onBeforeRequest handler. 90 // the onBeforeRequest handler.
91 let frames = framesOfTabs.get(this.id); 91 let frames = framesOfTabs.get(this.id);
92 if (frames) 92 if (frames)
93 { 93 {
94 let frame = frames.get(0); 94 let frame = frames.get(0);
95 if (frame) 95 if (frame)
96 return frame.url; 96 return frame.url;
97 } 97 }
98 }, 98 },
99 sendMessage(message, responseCallback) 99 sendMessage(message, responseCallback, frameId)
100 { 100 {
101 chrome.tabs.sendMessage(this.id, message, responseCallback); 101 let options = {};
102 if (typeof frameId != "undefined")
103 options.frameId = frameId;
104 chrome.tabs.sendMessage(this.id, message, options, responseCallback);
102 } 105 }
103 }; 106 };
104 107
105 ext.getPage = id => new Page({id: parseInt(id, 10)}); 108 ext.getPage = id => new Page({id: parseInt(id, 10)});
106 109
107 function afterTabLoaded(callback) 110 function afterTabLoaded(callback)
108 { 111 {
109 return openedTab => 112 return openedTab =>
110 { 113 {
111 let onUpdated = (tabId, changeInfo, tab) => 114 let onUpdated = (tabId, changeInfo, tab) =>
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after
442 if (!items) 445 if (!items)
443 return; 446 return;
444 447
445 items.forEach(item => 448 items.forEach(item =>
446 { 449 {
447 chrome.contextMenus.create({ 450 chrome.contextMenus.create({
448 title: item.title, 451 title: item.title,
449 contexts: item.contexts, 452 contexts: item.contexts,
450 onclick(info, tab) 453 onclick(info, tab)
451 { 454 {
452 item.onclick(new Page(tab)); 455 item.onclick(new Page(tab), info);
453 } 456 }
454 }); 457 });
455 }); 458 });
456 }); 459 });
457 }); 460 });
458 }; 461 };
459 462
460 let ContextMenus = function(page) 463 let ContextMenus = function(page)
461 { 464 {
462 this._page = page; 465 this._page = page;
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
739 ext.windows = { 742 ext.windows = {
740 create(createData, callback) 743 create(createData, callback)
741 { 744 {
742 chrome.windows.create(createData, createdWindow => 745 chrome.windows.create(createData, createdWindow =>
743 { 746 {
744 afterTabLoaded(callback)(createdWindow.tabs[0]); 747 afterTabLoaded(callback)(createdWindow.tabs[0]);
745 }); 748 });
746 } 749 }
747 }; 750 };
748 }()); 751 }());
OLDNEW
« composer.postload.js ('K') | « composer.postload.js ('k') | lib/filterComposer.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld