diff options
Diffstat (limited to 'background_scripts')
| -rw-r--r-- | background_scripts/main.coffee | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/background_scripts/main.coffee b/background_scripts/main.coffee index 6ff3fa60..e2bfeb6d 100644 --- a/background_scripts/main.coffee +++ b/background_scripts/main.coffee @@ -278,7 +278,16 @@ selectTab = (callback, direction) -> chrome.tabs.update(toSelect.id, { selected: true }))) updateOpenTabs = (tab) -> - tabInfoMap[tab.id] = { url: tab.url, positionIndex: tab.index, windowId: tab.windowId } + # Chrome might reuse the tab ID of a recently removed tab. + if tabInfoMap[tab.id]?.deletor + clearTimeout tabInfoMap[tab.id].deletor + tabInfoMap[tab.id] = + url: tab.url + positionIndex: tab.index + windowId: tab.windowId + scrollX: null + scrollY: null + deletor: null # Frames are recreated on refresh delete framesForTab[tab.id] @@ -354,7 +363,8 @@ chrome.tabs.onRemoved.addListener (tabId) -> # keep the reference around for a while to wait for the last messages from the closed tab (e.g. for updating # scroll position) - setTimeout (-> delete tabInfoMap[tabId]), 1000 + tabInfoMap.deletor = -> delete tabInfoMap[tabId] + setTimeout tabInfoMap.deletor, 1000 delete framesForTab[tabId] chrome.tabs.onActiveChanged.addListener (tabId, selectInfo) -> updateActiveState(tabId) |
