aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Blott2016-03-15 07:50:17 +0000
committerStephen Blott2016-03-17 11:17:03 +0000
commite5e55b4bac1d45dda0568d1b6cccb3387918573f (patch)
treecf3f68cba43a04b54b35b1a8a86161264e87168c
parenta871ffd82b0e8b8ce10b6228819a4ff12ae952bb (diff)
downloadvimium-e5e55b4bac1d45dda0568d1b6cccb3387918573f.tar.bz2
Do not unregister the main/top frame.
We never unregister the main/top frame. If the tab is navigating to another page, then there'll be a new top frame (with the same Id) along soon. If the tab is closing, then we'll tidy up in the chrome.tabs.onRemoved listener, below. This approach avoids a dependency on the order in which register and unregister events happens. See comment in #2053.
-rw-r--r--background_scripts/main.coffee11
1 files changed, 6 insertions, 5 deletions
diff --git a/background_scripts/main.coffee b/background_scripts/main.coffee
index 2f6af0b9..87426dc3 100644
--- a/background_scripts/main.coffee
+++ b/background_scripts/main.coffee
@@ -384,11 +384,12 @@ Frames =
port.postMessage name: "registerFrameId", chromeFrameId: frameId
port.onDisconnect.addListener listener = ->
- if tabId of frameIdsForTab
- if frameId == 0 # This is the top frame in the tab.
- delete frameIdsForTab[tabId]
- else
- frameIdsForTab[tabId] = frameIdsForTab[tabId].filter (fId) -> fId != frameId
+ # Unregister the frame. However, we never unregister the main/top frame. If the tab is navigating to
+ # another page, then there'll be a new top frame (with the same Id) along soon. If the tab is closing,
+ # then we'll tidy up in the chrome.tabs.onRemoved listener, below. This approach avoids a dependency on
+ # the order in which register and unregister events happens.
+ if tabId of frameIdsForTab and tabId != 0
+ frameIdsForTab[tabId] = frameIdsForTab[tabId].filter (fId) -> fId != frameId
port.onDisconnect.removeListener listener
handleFrameFocused = (request, sender) ->