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: Use messaging instead of requiring the info module Created Oct. 19, 2017, 10:52 a.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 | « composer.postload.js ('k') | lib/filterComposer.js » ('j') | 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 <https://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-present eyeo GmbH 3 * Copyright (C) 2006-present 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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 // In that case we get the url from top frame of the tab, recorded by 88 // In that case we get the url from top frame of the tab, recorded by
89 // the onBeforeRequest handler. 89 // the onBeforeRequest handler.
90 let frames = framesOfTabs.get(this.id); 90 let frames = framesOfTabs.get(this.id);
91 if (frames) 91 if (frames)
92 { 92 {
93 let frame = frames.get(0); 93 let frame = frames.get(0);
94 if (frame) 94 if (frame)
95 return frame.url; 95 return frame.url;
96 } 96 }
97 }, 97 },
98 sendMessage(message, responseCallback) 98 sendMessage(message, responseCallback, frameId)
99 { 99 {
100 browser.tabs.sendMessage(this.id, message, responseCallback); 100 let options = {};
101 if (typeof frameId != "undefined")
102 options.frameId = frameId;
103 browser.tabs.sendMessage(this.id, message, options, responseCallback);
101 } 104 }
102 }; 105 };
103 106
104 ext.getPage = id => new Page({id: parseInt(id, 10)}); 107 ext.getPage = id => new Page({id: parseInt(id, 10)});
105 108
106 function afterTabLoaded(callback) 109 function afterTabLoaded(callback)
107 { 110 {
108 return openedTab => 111 return openedTab =>
109 { 112 {
110 let onUpdated = (tabId, changeInfo, tab) => 113 let onUpdated = (tabId, changeInfo, tab) =>
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after
446 if (!items) 449 if (!items)
447 return; 450 return;
448 451
449 items.forEach(item => 452 items.forEach(item =>
450 { 453 {
451 browser.contextMenus.create({ 454 browser.contextMenus.create({
452 title: item.title, 455 title: item.title,
453 contexts: item.contexts, 456 contexts: item.contexts,
454 onclick(info, tab) 457 onclick(info, tab)
455 { 458 {
456 item.onclick(new Page(tab)); 459 item.onclick(new Page(tab), info);
457 } 460 }
458 }); 461 });
459 }); 462 });
460 }); 463 });
461 }); 464 });
462 }; 465 };
463 466
464 let ContextMenus = function(page) 467 let ContextMenus = function(page)
465 { 468 {
466 this._page = page; 469 this._page = page;
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
674 ext.windows = { 677 ext.windows = {
675 create(createData, callback) 678 create(createData, callback)
676 { 679 {
677 browser.windows.create(createData, createdWindow => 680 browser.windows.create(createData, createdWindow =>
678 { 681 {
679 afterTabLoaded(callback)(createdWindow.tabs[0]); 682 afterTabLoaded(callback)(createdWindow.tabs[0]);
680 }); 683 });
681 } 684 }
682 }; 685 };
683 } 686 }
OLDNEW
« no previous file with comments | « composer.postload.js ('k') | lib/filterComposer.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld