mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
scripts/ui: add tabs.query promise error handler (#16915)
This commit is contained in:
parent
6a23dcc68a
commit
be6edb4bc8
@ -18,6 +18,7 @@ import {
|
|||||||
PLATFORM_FIREFOX,
|
PLATFORM_FIREFOX,
|
||||||
} from '../../shared/constants/app';
|
} from '../../shared/constants/app';
|
||||||
import { isManifestV3 } from '../../shared/modules/mv3.utils';
|
import { isManifestV3 } from '../../shared/modules/mv3.utils';
|
||||||
|
import { checkForLastErrorAndLog } from '../../shared/modules/browser-runtime.utils';
|
||||||
import { SUPPORT_LINK } from '../../shared/lib/ui-utils';
|
import { SUPPORT_LINK } from '../../shared/lib/ui-utils';
|
||||||
import { getErrorHtml } from '../../shared/lib/error-utils';
|
import { getErrorHtml } from '../../shared/lib/error-utils';
|
||||||
import ExtensionPlatform from './platforms/extension';
|
import ExtensionPlatform from './platforms/extension';
|
||||||
@ -289,7 +290,12 @@ async function queryCurrentActiveTab(windowType) {
|
|||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
const tabs = await browser.tabs.query({ active: true, currentWindow: true });
|
const tabs = await browser.tabs
|
||||||
|
.query({ active: true, currentWindow: true })
|
||||||
|
.catch((e) => {
|
||||||
|
checkForLastErrorAndLog() || log.error(e);
|
||||||
|
});
|
||||||
|
|
||||||
const [activeTab] = tabs;
|
const [activeTab] = tabs;
|
||||||
const { id, title, url } = activeTab;
|
const { id, title, url } = activeTab;
|
||||||
const { origin, protocol } = url ? new URL(url) : {};
|
const { origin, protocol } = url ? new URL(url) : {};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user