From 3d7b6e1f548da2f76fe0828e902fbe0a02e2c70d Mon Sep 17 00:00:00 2001 From: Stephen Blott Date: Sat, 2 Apr 2016 08:40:36 +0100 Subject: 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. --- content_scripts/vimium_frontend.coffee | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'content_scripts') diff --git a/content_scripts/vimium_frontend.coffee b/content_scripts/vimium_frontend.coffee index 693c0c46..b1e82a75 100644 --- a/content_scripts/vimium_frontend.coffee +++ b/content_scripts/vimium_frontend.coffee @@ -138,12 +138,15 @@ installModes = -> initializeOnEnabledStateKnown = Utils.makeIdempotent -> installModes() +registerFrame = -> + Frame.postMessage "registerFrame" + # # Complete initialization work that sould be done prior to DOMReady. # initializePreDomReady = -> installListeners() - Frame.init() + Frame.init registerFrame checkIfEnabledForUrl() requestHandlers = @@ -214,7 +217,7 @@ Frame = registerFrameId: ({chromeFrameId}) -> frameId = window.frameId = chromeFrameId linkHintsMessage: (request) -> HintCoordinator[request.messageType] request - init: (callback) -> + init: (callback = null) -> @port = chrome.runtime.connect name: "frames" @port.onMessage.addListener (request) => @@ -225,6 +228,8 @@ Frame = isEnabledForUrl = false window.removeEventListener "focus", onFocus + callback?() + setScrollPosition = ({ scrollX, scrollY }) -> if DomUtils.isTopFrame() DomUtils.documentReady -> -- cgit v1.2.3