( promise: Promise<Result>, timeoutMs: number )
| 681 | title: title === undefined || title === '' ? tab.url : title, |
| 682 | url: tab.url, |
| 683 | }; |
| 684 | }); |
| 685 | }; |
| 686 | |
| 687 | const getTabId = (tab: BrowserTabInfo | undefined): number | undefined => tab?.id; |
| 688 | |
| 689 | export type InspectableTabResolution = |
| 690 | | { |
| 691 | readonly ok: true; |
| 692 | readonly tab: BrowserTabInfo | undefined; |
| 693 | } |
| 694 | | { |
| 695 | readonly error: string; |
| 696 | readonly ok: false; |
| 697 | }; |
| 698 | |
| 699 | /** |
| 700 | * Reads the selected tab and refuses the browser-tool session when the tab is |
| 701 | * gone or is a browser-internal page the debugger cannot attach to. A tabs API |
| 702 | * without `get` (Firefox scripting path) cannot check, so it is treated as |
| 703 | * inspectable and the attach call reports any real failure. |
| 704 | */ |
| 705 | export const getInspectableTab = async ({ |
| 706 | tabId, |
| 707 | tabsApi, |
no test coverage detected