       chrome.tabs.remove(tab.id)
       selectionChangedHandlers.push(callback))
   restoreTab: (callback) ->
-    # TODO: remove if-else -block when adopted into stable
-    if chrome.sessions
-      chrome.sessions.restore(null, (restoredSession) ->
-          callback() unless chrome.runtime.lastError)
-    else
-      # TODO(ilya): Should this be getLastFocused instead?
-      chrome.windows.getCurrent((window) ->
-        return unless (tabQueue[window.id] && tabQueue[window.id].length > 0)
-        tabQueueEntry = tabQueue[window.id].pop()
-        # Clean out the tabQueue so we don't have unused windows laying about.
-        delete tabQueue[window.id] if (tabQueue[window.id].length == 0)
-
-        # We have to chain a few callbacks to set the appropriate scroll position. We can't just wait until the
-        # tab is created because the content script is not available during the "loading" state. We need to
-        # wait until that's over before we can call setScrollPosition.
-        chrome.tabs.create({ url: tabQueueEntry.url, index: tabQueueEntry.positionIndex }, (tab) ->
-          tabLoadedHandlers[tab.id] = ->
-            chrome.tabs.sendRequest(tab.id,
-              name: "setScrollPosition",
-              scrollX: tabQueueEntry.scrollX,
-              scrollY: tabQueueEntry.scrollY)
-          callback()))
+    chrome.sessions.restore null, ->
+        callback() unless chrome.runtime.lastError
   openCopiedUrlInCurrentTab: (request) -> TabOperations.openUrlInCurrentTab({ url: Clipboard.paste() })
   openCopiedUrlInNewTab: (request) -> TabOperations.openUrlInNewTab({ url: Clipboard.paste() })
   togglePinTab: (request) ->

          func tab.id, { file: file, allFrames: contentScripts.all_frames }, checkLastRuntimeError

currentVersion = Utils.getCurrentVersion()
tabQueue = {} # windowId -> Array
tabInfoMap = {} # tabId -> object with various tab properties
keyQueue = "" # Queue of keys typed
validFirstKeys = {}

  openTabInfo = tabInfoMap[tabId]
  updatePositionsAndWindowsForAllTabsInWindow(openTabInfo.windowId)

  # keep the reference around for a while to wait for the last messages from the closed tab (e.g. for updating
  # scroll position)
  tabInfoMap.deletor = -> delete tabInfoMap[tabId]
  setTimeout tabInfoMap.deletor, 1000
  delete frameIdsForTab[tabId]
  delete urlForTab[tabId]

# End action functions

