diff options
| author | unknown | 2010-04-02 17:03:43 +0800 |
|---|---|---|
| committer | ilya | 2010-04-10 19:21:35 -0700 |
| commit | 7f87e2031be72d8e1cc04056d26590181e18778b (patch) | |
| tree | 233934bebda3b9c32ce3c3af7f20d4d1c9546ab0 | |
| parent | 15ca22e6e2d4796ea0677e237d5d4e9ff02bd4d1 (diff) | |
| download | vimium-7f87e2031be72d8e1cc04056d26590181e18778b.tar.bz2 | |
Ensure Restore Tab works immediately upon extension install
| -rw-r--r-- | background_page.html | 13 |
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) { |
