var extURL = chrome.extension.getURL("tabs.html");

function openMyPage() {
	browser.windows.getCurrent({}).then(function(window) {
		return browser.tabs.query({windowId: window.id});
	}).then(function(tabs) {
		//check for a tabist tab first
		for(let tab of tabs) {
			if(tab.title == "Tabist"){
				//open that tab
				chrome.tabs.update(tab.id, {active: true}); 
				return;
			}
		}

		//loop through again to see if there is an active new tab to replace
		for(let tab of tabs) {
			if(tab.title == "New Tab" && tab.active){
				chrome.tabs.update(tab.id, {"url": extURL});
				return;
			}
		}

		//fallback to making a new tabist tab
		chrome.tabs.create({
			"url": extURL
			//,"pinned": true // TODO: add pinned option
		});
		return;
	}).catch(e => {
		console.log(e.message);
	});
}

chrome.browserAction.onClicked.addListener(openMyPage);
 

var extURL = chrome.extension.getURL("tabs.html");

function openMyPage() {
	chrome.windows.getCurrent({}, function(window) {
		chrome.tabs.query({windowId: window.id}, function(tabs) {
			//check for a tabist tab first
			for(let tab of tabs) {
				if(tab.title == "Tabist"){
					//open that tab
					chrome.tabs.update(tab.id, {active: true}); 
					return;
				}
			}

			//loop through again to see if there is an active new tab to replace
			for(let tab of tabs) {
				if(tab.title == "New Tab" && tab.active){
					chrome.tabs.update(tab.id, {"url": extURL});
					return;
				}
			}

			//fallback to making a new tabist tab
			chrome.tabs.create({
				"url": extURL
				//,"pinned": true // TODO: add pinned option
			});
			return;
		})
	});
}

chrome.browserAction.onClicked.addListener(openMyPage);
 

Convert from a promises based callback scheme to a nested callback based scheme to support chrome.
Convert from a promises based callback scheme to a nested callback based scheme to support chrome.
