aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorunknown2010-04-02 17:03:43 +0800
committerilya2010-04-10 19:21:35 -0700
commit7f87e2031be72d8e1cc04056d26590181e18778b (patch)
tree233934bebda3b9c32ce3c3af7f20d4d1c9546ab0
parent15ca22e6e2d4796ea0677e237d5d4e9ff02bd4d1 (diff)
downloadvimium-7f87e2031be72d8e1cc04056d26590181e18778b.tar.bz2
Ensure Restore Tab works immediately upon extension install
-rw-r--r--background_page.html13
1 files changed, 12 insertions, 1 deletions
diff --git a/background_page.html b/background_page.html
index 0e56409f..da803e99 100644
--- a/background_page.html
+++ b/background_page.html
@@ -307,10 +307,21 @@
selectionChangedHandlers.push(callback);
});
}
+
+ function updateOpenTabs(tab) {
+ openTabs[tab.id] = { url: tab.url, positionIndex: tab.index, windowId: tab.windowId };
+ }
+
+ // this ensures that Restore Tab works immediately upon extension install
+ chrome.windows.getAll({ populate: true }, function(windows) {
+ for (var i in windows) for (var j in windows[i].tabs) {
+ updateOpenTabs(windows[i].tabs[j]);
+ }
+ });
chrome.tabs.onUpdated.addListener(function(tabId, changeInfo, tab) {
if (changeInfo.status != "loading") { return; } // only do this once per URL change
- openTabs[tabId] = { url: tab.url, positionIndex: tab.index, windowId: tab.windowId };
+ updateOpenTabs(tab);
});
chrome.tabs.onAttached.addListener(function(tabId, attachedInfo) {