@ai-ecoverse/sliccy-browser 0.1.35 → 0.1.36
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/browser.js +9 -6
package/package.json
CHANGED
package/src/browser.js
CHANGED
|
@@ -304,12 +304,15 @@ async function findTabNow(query = {}) {
|
|
|
304
304
|
throw new Error('browser.findTab: query requires `domain` or `urlMatch`');
|
|
305
305
|
}
|
|
306
306
|
const tabs = await listTabs();
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
307
|
+
const wanted = domain?.toLowerCase();
|
|
308
|
+
const re = urlMatch === undefined ? undefined : compilePattern(urlMatch, 'browser.findTab');
|
|
309
|
+
return (
|
|
310
|
+
tabs.find(
|
|
311
|
+
(tab) =>
|
|
312
|
+
(wanted === undefined || hostnameOf(tab.url)?.toLowerCase() === wanted) &&
|
|
313
|
+
(re === undefined || re.test(tab.url))
|
|
314
|
+
) ?? null
|
|
315
|
+
);
|
|
313
316
|
}
|
|
314
317
|
|
|
315
318
|
export async function ensureTab(url, options) {
|