From 175f4b275c49ba332000ab773061777af820a87f Mon Sep 17 00:00:00 2001 From: Stephen Blott Date: Sat, 2 Apr 2016 10:32:53 +0100 Subject: 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. --- background_scripts/main.coffee | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'background_scripts') 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 -- cgit v1.2.3