diff options
| author | mrmr1993 | 2014-09-25 11:35:48 +0100 | 
|---|---|---|
| committer | mrmr1993 | 2014-10-25 23:31:19 +0100 | 
| commit | f18f3ead03640585fbd78bd9fd1acdbaaec087b1 (patch) | |
| tree | 8992a36dc3e037f48248f51680dd81e7f3b3fd2e /background_scripts | |
| parent | bc042d344d69c9378251ab98561dc29ee552279b (diff) | |
| download | vimium-f18f3ead03640585fbd78bd9fd1acdbaaec087b1.tar.bz2 | |
Fence off unnecessary tabQueue code when chrome.sessions is defined
Diffstat (limited to 'background_scripts')
| -rw-r--r-- | background_scripts/main.coffee | 24 | 
1 files changed, 13 insertions, 11 deletions
| diff --git a/background_scripts/main.coffee b/background_scripts/main.coffee index 562be033..f926e750 100644 --- a/background_scripts/main.coffee +++ b/background_scripts/main.coffee @@ -411,16 +411,17 @@ chrome.tabs.onRemoved.addListener (tabId) ->    # If we restore pages that content scripts can't run on, they'll ignore Vimium keystrokes when they    # reappear. Pretend they never existed and adjust tab indices accordingly. Could possibly expand this into    # a blacklist in the future. -  if (/^(chrome|view-source:)[^:]*:\/\/.*/.test(openTabInfo.url)) -    for i of tabQueue[openTabInfo.windowId] -      if (tabQueue[openTabInfo.windowId][i].positionIndex > openTabInfo.positionIndex) -        tabQueue[openTabInfo.windowId][i].positionIndex-- -    return - -  if (tabQueue[openTabInfo.windowId]) -    tabQueue[openTabInfo.windowId].push(openTabInfo) -  else -    tabQueue[openTabInfo.windowId] = [openTabInfo] +  unless chrome.sessions +    if (/^(chrome|view-source:)[^:]*:\/\/.*/.test(openTabInfo.url)) +      for i of tabQueue[openTabInfo.windowId] +        if (tabQueue[openTabInfo.windowId][i].positionIndex > openTabInfo.positionIndex) +          tabQueue[openTabInfo.windowId][i].positionIndex-- +      return + +    if (tabQueue[openTabInfo.windowId]) +      tabQueue[openTabInfo.windowId].push(openTabInfo) +    else +      tabQueue[openTabInfo.windowId] = [openTabInfo]    # keep the reference around for a while to wait for the last messages from the closed tab (e.g. for updating    # scroll position) @@ -430,7 +431,8 @@ chrome.tabs.onRemoved.addListener (tabId) ->  chrome.tabs.onActiveChanged.addListener (tabId, selectInfo) -> updateActiveState(tabId) -chrome.windows.onRemoved.addListener (windowId) -> delete tabQueue[windowId] +unless chrome.sessions +  chrome.windows.onRemoved.addListener (windowId) -> delete tabQueue[windowId]  # End action functions | 
