Handle error when getting a tab that no longer exists. Fix #382.

This commit is contained in:
FelisCatus 2015-04-04 17:05:07 +08:00
parent 974ef69912
commit 53aba6b0ea

View File

@ -14,6 +14,7 @@ class ChromeTabs
chrome.tabs.onUpdated.addListener @onUpdated.bind(this) chrome.tabs.onUpdated.addListener @onUpdated.bind(this)
chrome.tabs.onActivated.addListener (info) => chrome.tabs.onActivated.addListener (info) =>
chrome.tabs.get info.tabId, (tab) => chrome.tabs.get info.tabId, (tab) =>
return if chrome.runtime.lastError
if @_dirtyTabs.hasOwnProperty(info.tabId) if @_dirtyTabs.hasOwnProperty(info.tabId)
@onUpdated tab.id, {}, tab @onUpdated tab.id, {}, tab