utils/index.js
async function showExtensionTab(url, match = url) {
	match = extension.getURL(match || url); url = extension.getURL(url);
	for (const view of extension.getViews({ type: 'tab', })) {
		if (view && (typeof match === 'string' ? view.location.href === match : match.test(view.location.href)) && view.tabId != null) {
			const tab = (await new Promise(got => (view.browser || view.chrome).tabs.getCurrent(got)));
			if (tab) { (await Tabs.update(tab.id, { active: true, })); (await Windows.update(tab.windowId, { focused: true, })); return tab; }
		}
	}
	return Tabs.create({ url, });
}
async function showExtensionTab(url, match = url) {
	match = extension.getURL(match || url); url = extension.getURL(url);
	for (const view of extension.getViews({ type: 'tab', })) {
		if (view && (typeof match === 'string' ? view.location.href === match : match.test(view.location.href)) && view.tabId != null) {
			const tab = (await new Promise(got => (view.browser || view.chrome).tabs.getCurrent(got)));
			if (tab) { (await Tabs.update(tab.id, { active: true, })); (await Windows.update(tab.windowId, { focused: true, })); return tab; }
		}
	}
	return Tabs.create({ url, });
}
async function showExtensionTab ( url , match = url ) { match = extension . getURL ( match || url ) ; url = extension . getURL ( url ) ; for ( const view of extension . getViews ( { type : 'tab' , } ) ) { if ( view && ( typeof match === 'string' ? view . location . href === match : match . test ( view . location . href ) ) && view . tabId != null ) { const tab = ( await new Promise ( got => ( view . browser || view . chrome ) . tabs . getCurrent ( got ) ) ) ; if ( tab ) { ( await Tabs . update ( tab . id , { active : true , } ) ) ; ( await Windows . update ( tab . windowId , { focused : true , } ) ) ; return tab ; } } } return Tabs . create ( { url , } ) ; }
Shows or opens a tab containing an extension page.
Shows the fist tab whose .pathname equals 'match' and that has a window.tabId set, or opens a new tab containing 'url' if no such tab is found.
@param  {string}        url    The url to open in the new tab if no existing tab was found.
@param  {string}        match  Optional value of window.location.pathname a existing tab must have to be focused.
@return {Promise<Tab>}         The chrome.tabs.Tab that is now the active tab in the focused window.
Shows or opens a tab containing an extension page . Shows the fist tab whose . pathname equals match and that has a window . tabId set or opens a new tab containing url if no such tab is found .