aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorilya2010-04-10 19:36:06 -0700
committerilya2010-04-10 19:36:06 -0700
commit70f2a92dcb9b0799db49305d4a47c0a104968847 (patch)
tree9be188c20c61166ced8e45a2ad1b6a98d9eae088
parent64456005ddda2499df8d7be189978ba97a54b083 (diff)
downloadvimium-70f2a92dcb9b0799db49305d4a47c0a104968847.tar.bz2
Move some code into init() so that it's clear that it executes once and is part of initialization.
-rw-r--r--background_page.html29
1 files changed, 15 insertions, 14 deletions
diff --git a/background_page.html b/background_page.html
index ce016b49..0c8b2d20 100644
--- a/background_page.html
+++ b/background_page.html
@@ -317,20 +317,6 @@
openTabs[tab.id].scrollY = scrollY;
}
- // ensure that openTabs is populated upon the install of the extension
- chrome.windows.getAll({ populate: true }, function(windows) {
- for (var i in windows) {
- for (var j in windows[i].tabs) {
- var tab = windows[i].tabs[j];
- updateOpenTabs(tab);
- getScrollPosition(tab, function(tab, scrollX, scrollY) {
- // not using the tab defined in the for loop because
- // it might have changed by the time this callback is activated.
- updateScrollPosition(tab, scrollX, scrollY);
- });
- }
- }
- });
chrome.tabs.onUpdated.addListener(function(tabId, changeInfo, tab) {
if (changeInfo.status != "loading") { return; } // only do this once per URL change
@@ -600,6 +586,21 @@
populateSingleKeyCommands();
if (shouldShowUpgradeMessage())
sendRequestToAllTabs({ name: "showUpgradeNotification", version: currentVersion });
+
+ // Ensure that openTabs is populated when Vimium is installed.
+ chrome.windows.getAll({ populate: true }, function(windows) {
+ for (var i in windows) {
+ for (var j in windows[i].tabs) {
+ var tab = windows[i].tabs[j];
+ updateOpenTabs(tab);
+ getScrollPosition(tab, function(tab, scrollX, scrollY) {
+ // Not using the tab defined in the for loop because
+ // it might have changed by the time this callback is activated.
+ updateScrollPosition(tab, scrollX, scrollY);
+ });
+ }
+ }
+ });
}
init();
</script>