From a1f3e89cc3bc70ba578c44c6e8f54e2e27cc11cf Mon Sep 17 00:00:00 2001 From: Phil Crosby Date: Fri, 27 Nov 2009 00:56:22 -0800 Subject: Break the content script's initialization into two stages, so we can do tasks much earlier. This is required for restoring the page's zoom level. Otherwise, the zoom level is set after the page is rendered, causing a large nasty flicker.--- background_page.html | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'background_page.html') diff --git a/background_page.html b/background_page.html index eadb94cc..c1562ac2 100644 --- a/background_page.html +++ b/background_page.html @@ -22,8 +22,9 @@ chrome.extension.onConnect.addListener(function(port, name) { var senderTabId = port.sender.tab ? port.sender.tab.id : null; // If this is a tab we've been waiting to open, execute any "tab loaded" handlers, e.g. to restore - // the tab's scroll position. - if (senderTabId && tabLoadedHandlers[senderTabId]) { + // the tab's scroll position. Wait until domReady before doing this; otherwise operations like restoring + // the scroll position will not be possible. + if (port.name == "domReady" && senderTabId && tabLoadedHandlers[senderTabId]) { var toCall = tabLoadedHandlers[senderTabId]; // Delete first to be sure there's no circular events. delete tabLoadedHandlers[senderTabId]; -- cgit v1.2.3