Index: ext/background.js |
diff --git a/ext/background.js b/ext/background.js |
index c8c68278ca7929ded4e985c2557d194c216364df..341fc1d2f4f729cc7b58744507d2369ef41cd8aa 100644 |
--- a/ext/background.js |
+++ b/ext/background.js |
@@ -75,7 +75,6 @@ |
this._url = tab.url && new URL(tab.url); |
this.browserAction = new BrowserAction(tab.id); |
- this.contextMenus = new ContextMenus(this); |
}; |
Page.prototype = { |
get url() |
@@ -423,90 +422,6 @@ |
}; |
- /* Context menus */ |
- |
- let contextMenuItems = new ext.PageMap(); |
- let contextMenuUpdating = false; |
- |
- let updateContextMenu = () => |
- { |
- // Firefox for Android does not support context menus. |
- // https://bugzilla.mozilla.org/show_bug.cgi?id=1269062 |
- if (!("contextMenus" in browser) || contextMenuUpdating) |
- return; |
- |
- contextMenuUpdating = true; |
- |
- browser.tabs.query({active: true, lastFocusedWindow: true}, tabs => |
- { |
- browser.contextMenus.removeAll(() => |
- { |
- contextMenuUpdating = false; |
- |
- if (tabs.length == 0) |
- return; |
- |
- let items = contextMenuItems.get({id: tabs[0].id}); |
- |
- if (!items) |
- return; |
- |
- items.forEach(item => |
- { |
- browser.contextMenus.create({ |
- title: item.title, |
- contexts: item.contexts, |
- onclick(info, tab) |
- { |
- item.onclick(new Page(tab)); |
- } |
- }); |
- }); |
- }); |
- }); |
- }; |
- |
- let ContextMenus = function(page) |
- { |
- this._page = page; |
- }; |
- ContextMenus.prototype = { |
- create(item) |
- { |
- let items = contextMenuItems.get(this._page); |
- if (!items) |
- contextMenuItems.set(this._page, items = []); |
- |
- items.push(item); |
- updateContextMenu(); |
- }, |
- remove(item) |
- { |
- let items = contextMenuItems.get(this._page); |
- if (items) |
- { |
- let index = items.indexOf(item); |
- if (index != -1) |
- { |
- items.splice(index, 1); |
- updateContextMenu(); |
- } |
- } |
- } |
- }; |
- |
- browser.tabs.onActivated.addListener(updateContextMenu); |
- |
- if ("windows" in browser) |
- { |
- browser.windows.onFocusChanged.addListener(windowId => |
- { |
- if (windowId != browser.windows.WINDOW_ID_NONE) |
- updateContextMenu(); |
- }); |
- } |
- |
- |
/* Web requests */ |
let framesOfTabs = new Map(); |