Fixing exception

This commit is contained in:
Alex Yatskov 2016-07-23 23:02:55 -07:00
parent e062ae2063
commit 282ada3b91

View File

@ -40,7 +40,7 @@ class Yomichan {
chrome.runtime.onInstalled.addListener(this.onInstalled.bind(this)); chrome.runtime.onInstalled.addListener(this.onInstalled.bind(this));
chrome.runtime.onMessage.addListener(this.onMessage.bind(this)); chrome.runtime.onMessage.addListener(this.onMessage.bind(this));
chrome.browserAction.onClicked.addListener(this.onBrowserAction.bind(this)); chrome.browserAction.onClicked.addListener(this.onBrowserAction.bind(this));
chrome.tabs.onCreated.addListener(this.onTabReady.bind(this)); chrome.tabs.onCreated.addListener((tab) => this.onTabReady(tab.id));
chrome.tabs.onUpdated.addListener(this.onTabReady.bind(this)); chrome.tabs.onUpdated.addListener(this.onTabReady.bind(this));
loadOptions((opts) => { loadOptions((opts) => {
@ -68,12 +68,12 @@ class Yomichan {
return true; return true;
} }
onTabReady(tab) { onTabReady(tabId) {
this.tabInvoke(tab, 'setOptions', this.options); this.tabInvoke(tabId, 'setOptions', this.options);
this.tabInvoke(tab, 'setEnabled', this.state === 'enabled'); this.tabInvoke(tabId, 'setEnabled', this.state === 'enabled');
} }
onBrowserAction(tab) { onBrowserAction() {
switch (this.state) { switch (this.state) {
case 'disabled': case 'disabled':
this.setState('loading'); this.setState('loading');