aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Blott2016-05-07 04:36:49 +0100
committerStephen Blott2016-05-07 04:36:49 +0100
commit62a3a7bb3568c3312abe693c267093994d143d4a (patch)
treeeb7544d39d2da37196680d02fcda94375a069025
parent804fdc96f5dc1698d0ed3872de6c1d78feda2e59 (diff)
parentbd0bcadf130db6d34ba99e4d43eb57c05eb52970 (diff)
downloadvimium-62a3a7bb3568c3312abe693c267093994d143d4a.tar.bz2
Merge pull request #2125 from smblott-github/fix-link-hints-not-launching
Fix link-hints failing to launch.
-rw-r--r--background_scripts/main.coffee12
1 files changed, 8 insertions, 4 deletions
diff --git a/background_scripts/main.coffee b/background_scripts/main.coffee
index 9f04d1c0..76fbcd96 100644
--- a/background_scripts/main.coffee
+++ b/background_scripts/main.coffee
@@ -301,10 +301,14 @@ Frames =
(portsForTab[tabId] ?= {})[frameId] = port
unregisterFrame: ({tabId, frameId}) ->
- if tabId of frameIdsForTab
- frameIdsForTab[tabId] = (fId for fId in frameIdsForTab[tabId] when fId != frameId)
- if tabId of portsForTab
- delete portsForTab[tabId][frameId]
+ # FrameId 0 is the top/main frame. We never unregister that frame. If the tab is closing, then we tidy
+ # up elsewhere. If the tab is navigating to a new page, then a new top frame will be along soon.
+ # This mitigates against the unregister and register messages arriving in the "wrong" order.
+ if 0 < frameId
+ if tabId of frameIdsForTab
+ frameIdsForTab[tabId] = (fId for fId in frameIdsForTab[tabId] when fId != frameId)
+ if tabId of portsForTab
+ delete portsForTab[tabId][frameId]
HintCoordinator.unregisterFrame tabId, frameId
isEnabledForUrl: ({request, tabId, port}) ->