diff options
| author | Stephen Blott | 2016-03-04 08:51:39 +0000 |
|---|---|---|
| committer | Stephen Blott | 2016-03-05 05:40:35 +0000 |
| commit | fb67cfdd2ca8c09453cc896fd02d08ed5a74a8a4 (patch) | |
| tree | 816d696b785f8a58b06ddd01560fee05ca0299e7 | |
| parent | 632c97eb3485f05c7f813deea788512156116fbb (diff) | |
| download | vimium-fb67cfdd2ca8c09453cc896fd02d08ed5a74a8a4.tar.bz2 | |
Key bindings; disable on disconnect.
This reinstates the feature whereby we disable the content script when
we lose contact with the background page, e.g., on upgrade.
From my investigations, this doesn't appear to be absolutely necessary.
Nevertheless, it's cleaner like this.
| -rw-r--r-- | content_scripts/vimium_frontend.coffee | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/content_scripts/vimium_frontend.coffee b/content_scripts/vimium_frontend.coffee index 72be5510..0ae3d229 100644 --- a/content_scripts/vimium_frontend.coffee +++ b/content_scripts/vimium_frontend.coffee @@ -214,7 +214,11 @@ window.addEventListener "hashchange", onFocus # initializeOnDomReady = -> # Tell the background page we're in the dom ready state. - chrome.runtime.connect({ name: "domReady" }) + chrome.runtime.connect(name: "domReady").onDisconnect.addListener -> + # We disable content scripts when we lose contact with the background page. + isEnabledForUrl = false + chrome.runtime.sendMessage = -> + window.removeEventListener "focus", onFocus # We only initialize the vomnibar in the tab's main frame, because it's only ever opened there. Vomnibar.init() if DomUtils.isTopFrame() HUD.init() |
