aboutsummaryrefslogtreecommitdiffstats
path: root/background_page.html
diff options
context:
space:
mode:
authorPhil Crosby2009-11-27 00:56:22 -0800
committerPhil Crosby2009-11-27 00:56:22 -0800
commita1f3e89cc3bc70ba578c44c6e8f54e2e27cc11cf (patch)
treebddd609562d22c79ee67810179d26903d62290b0 /background_page.html
parentabfd4dc1b59c31b8df4a0eafd51c840cf8296d15 (diff)
downloadvimium-a1f3e89cc3bc70ba578c44c6e8f54e2e27cc11cf.tar.bz2
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.
Diffstat (limited to 'background_page.html')
-rw-r--r--background_page.html5
1 files changed, 3 insertions, 2 deletions
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];