aboutsummaryrefslogtreecommitdiffstats
path: root/background_scripts
diff options
context:
space:
mode:
authorStephen Blott2016-04-02 10:32:53 +0100
committerStephen Blott2016-04-02 10:35:43 +0100
commit175f4b275c49ba332000ab773061777af820a87f (patch)
treefa9701436f1c6a366bbdd3283dad13d4ee7926f8 /background_scripts
parent03e010f0aeb835778664438549f168ccae297d7c (diff)
downloadvimium-175f4b275c49ba332000ab773061777af820a87f.tar.bz2
Do not register tiny frames.
This affects focusFrame and link hints. We do not register tiny frames. The reason for doing this is that link hints messages all (registered) frames to collect their hint descriptors. On some sites (e.g. Google Inbox and other Google properties), there are many tiny iframes (on the order of 12 or 15 or so). Those frames cannot provide useful hints, so -- by not registering them -- we don't ask them for hints. The intention is to speed up the link-hints activation sequence.
Diffstat (limited to 'background_scripts')
-rw-r--r--background_scripts/main.coffee8
1 files changed, 4 insertions, 4 deletions
diff --git a/background_scripts/main.coffee b/background_scripts/main.coffee
index 241c809b..dea436ef 100644
--- a/background_scripts/main.coffee
+++ b/background_scripts/main.coffee
@@ -291,6 +291,8 @@ Frames =
onConnect: (sender, port) ->
[tabId, frameId] = [sender.tab.id, sender.frameId]
port.postMessage handler: "registerFrameId", chromeFrameId: frameId
+ # We only register the top frame automatically; other frames request registration via "registerFrame".
+ @registerFrame {tabId, frameId, port} if frameId == 0
port.onDisconnect.addListener listener = ->
# Unregister the frame. However, we never unregister the main/top frame. If the tab is navigating to
@@ -307,10 +309,8 @@ Frames =
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
+ frameIdsForTab[tabId].push frameId unless frameId in frameIdsForTab[tabId] ?= []
+ (portsForTab[tabId] ?= {})[frameId] = port
isEnabledForUrl: ({request, tabId, port}) ->
urlForTab[tabId] = request.url if request.frameIsFocused