Left: | ||
Right: |
OLD | NEW |
---|---|
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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
68 }; | 68 }; |
69 | 69 |
70 /* Pages */ | 70 /* Pages */ |
71 | 71 |
72 let Page = ext.Page = function(tab) | 72 let Page = ext.Page = function(tab) |
73 { | 73 { |
74 this.id = tab.id; | 74 this.id = tab.id; |
75 this._url = tab.url && new URL(tab.url); | 75 this._url = tab.url && new URL(tab.url); |
76 | 76 |
77 this.browserAction = new BrowserAction(tab.id); | 77 this.browserAction = new BrowserAction(tab.id); |
78 this.contextMenus = new ContextMenus(this); | 78 |
79 // Firefox for Android does not support context menus. | |
80 // https://bugzilla.mozilla.org/show_bug.cgi?id=1269062 | |
81 if ("contextMenus" in chrome) | |
Wladimir Palant
2017/08/16 13:21:56
I don't think that this change is necessary. It sh
Manish Jethani
2017/08/16 19:39:09
Done.
| |
82 this.contextMenus = new ContextMenus(this); | |
79 }; | 83 }; |
80 Page.prototype = { | 84 Page.prototype = { |
81 get url() | 85 get url() |
82 { | 86 { |
83 // usually our Page objects are created from Chrome's Tab objects, which | 87 // usually our Page objects are created from Chrome's Tab objects, which |
84 // provide the url. So we can return the url given in the constructor. | 88 // provide the url. So we can return the url given in the constructor. |
85 if (this._url) | 89 if (this._url) |
86 return this._url; | 90 return this._url; |
87 | 91 |
88 // but sometimes we only have the tab id when we create a Page object. | 92 // but sometimes we only have the tab id when we create a Page object. |
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
416 }; | 420 }; |
417 | 421 |
418 | 422 |
419 /* Context menus */ | 423 /* Context menus */ |
420 | 424 |
421 let contextMenuItems = new ext.PageMap(); | 425 let contextMenuItems = new ext.PageMap(); |
422 let contextMenuUpdating = false; | 426 let contextMenuUpdating = false; |
423 | 427 |
424 let updateContextMenu = () => | 428 let updateContextMenu = () => |
425 { | 429 { |
426 if (contextMenuUpdating) | 430 // Firefox for Android does not support context menus. |
431 // https://bugzilla.mozilla.org/show_bug.cgi?id=1269062 | |
432 if (!("contextMenus" in chrome) || contextMenuUpdating) | |
427 return; | 433 return; |
428 | 434 |
429 contextMenuUpdating = true; | 435 contextMenuUpdating = true; |
430 | 436 |
431 chrome.tabs.query({active: true, lastFocusedWindow: true}, tabs => | 437 chrome.tabs.query({active: true, lastFocusedWindow: true}, tabs => |
432 { | 438 { |
433 chrome.contextMenus.removeAll(() => | 439 chrome.contextMenus.removeAll(() => |
434 { | 440 { |
435 contextMenuUpdating = false; | 441 contextMenuUpdating = false; |
436 | 442 |
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
739 ext.windows = { | 745 ext.windows = { |
740 create(createData, callback) | 746 create(createData, callback) |
741 { | 747 { |
742 chrome.windows.create(createData, createdWindow => | 748 chrome.windows.create(createData, createdWindow => |
743 { | 749 { |
744 afterTabLoaded(callback)(createdWindow.tabs[0]); | 750 afterTabLoaded(callback)(createdWindow.tabs[0]); |
745 }); | 751 }); |
746 } | 752 } |
747 }; | 753 }; |
748 }()); | 754 }()); |
OLD | NEW |