aboutsummaryrefslogtreecommitdiffstats
path: root/background_scripts
diff options
context:
space:
mode:
authorStephen Blott2016-04-02 08:40:36 +0100
committerStephen Blott2016-04-02 08:42:11 +0100
commit3d7b6e1f548da2f76fe0828e902fbe0a02e2c70d (patch)
tree7d1d8fd11bd21687c437a34d967b1226588d1049 /background_scripts
parentdc62bc6f300052a75cadcfc47b0703cdf20bbb2d (diff)
downloadvimium-3d7b6e1f548da2f76fe0828e902fbe0a02e2c70d.tar.bz2
Separate registerFrame from port initialization.
This is a no-op. It separates the process of registering a frame with the background page from the port initialization. The idea is that -- soon -- we will only register some frames; in particular, we should not register the many tiny iframes on pages like GMail. The eventual goal is to speed up the global link-hints initialisation sequence.
Diffstat (limited to 'background_scripts')
-rw-r--r--background_scripts/main.coffee10
1 files changed, 6 insertions, 4 deletions
diff --git a/background_scripts/main.coffee b/background_scripts/main.coffee
index f17befa0..241c809b 100644
--- a/background_scripts/main.coffee
+++ b/background_scripts/main.coffee
@@ -290,10 +290,6 @@ for icon in [ENABLED_ICON, DISABLED_ICON, PARTIAL_ICON]
Frames =
onConnect: (sender, port) ->
[tabId, frameId] = [sender.tab.id, sender.frameId]
- frameIdsForTab[tabId] ?= []
- frameIdsForTab[tabId].push frameId unless frameId in frameIdsForTab[tabId]
- portsForTab[tabId] ?= {}
- portsForTab[tabId][frameId] = port
port.postMessage handler: "registerFrameId", chromeFrameId: frameId
port.onDisconnect.addListener listener = ->
@@ -310,6 +306,12 @@ Frames =
(request, port) =>
this[request.handler] {request, tabId, frameId, port}
+ registerFrame: ({tabId, frameId, port}) ->
+ frameIdsForTab[tabId] ?= []
+ frameIdsForTab[tabId].push frameId unless frameId in frameIdsForTab[tabId]
+ portsForTab[tabId] ?= {}
+ portsForTab[tabId][frameId] = port
+
isEnabledForUrl: ({request, tabId, port}) ->
urlForTab[tabId] = request.url if request.frameIsFocused
enabledState = Exclusions.isEnabledForUrl request.url