aboutsummaryrefslogtreecommitdiffstats
path: root/background_scripts/main.coffee
diff options
context:
space:
mode:
authormrmr19932017-12-02 13:32:10 +0000
committermrmr19932017-12-02 14:57:20 +0000
commit43c7390f987fea063e7a97cd8b37c7b61d45f615 (patch)
treeed1601c7e279efc77681b96ffe0f1a0729335e77 /background_scripts/main.coffee
parente9fba3a6c1aa2979a4045f61c3d03ad9cefd9a4b (diff)
downloadvimium-43c7390f987fea063e7a97cd8b37c7b61d45f615.tar.bz2
Register ports for all frames that open them
Diffstat (limited to 'background_scripts/main.coffee')
-rw-r--r--background_scripts/main.coffee4
1 files changed, 2 insertions, 2 deletions
diff --git a/background_scripts/main.coffee b/background_scripts/main.coffee
index 8220545d..53f13b60 100644
--- a/background_scripts/main.coffee
+++ b/background_scripts/main.coffee
@@ -303,6 +303,7 @@ Frames =
[tabId, frameId] = [sender.tab.id, sender.frameId]
port.onDisconnect.addListener -> Frames.unregisterFrame {tabId, frameId}
port.postMessage handler: "registerFrameId", chromeFrameId: frameId
+ (portsForTab[tabId] ?= {})[frameId] = port
# Return our onMessage handler for this port.
(request, port) =>
@@ -310,7 +311,6 @@ Frames =
registerFrame: ({tabId, frameId, port}) ->
frameIdsForTab[tabId].push frameId unless frameId in frameIdsForTab[tabId] ?= []
- (portsForTab[tabId] ?= {})[frameId] = port
unregisterFrame: ({tabId, frameId}) ->
# FrameId 0 is the top/main frame. We never unregister that frame. If the tab is closing, then we tidy
@@ -389,7 +389,7 @@ HintCoordinator =
prepareToActivateMode: (tabId, originatingFrameId, {modeIndex, isVimiumHelpDialog}) ->
@tabState[tabId] = {frameIds: frameIdsForTab[tabId][..], hintDescriptors: {}, originatingFrameId, modeIndex}
- @tabState[tabId].ports = extend {}, portsForTab[tabId]
+ @tabState[tabId].ports = [tabId].map (frameId) -> portsForTab[tabId][frameId]
@sendMessage "getHintDescriptors", tabId, {modeIndex, isVimiumHelpDialog}
# Receive hint descriptors from all frames and activate link-hints mode when we have them all.