feat: add cross-browser browser.*/chrome.* shim; exclude test/ from builds

This commit is contained in:
2026-08-19 02:48:15 +08:00
parent b571953f10
commit 9edaa687a5
4 changed files with 18 additions and 2 deletions
+6
View File
@@ -1,4 +1,10 @@
'use strict';
// Cross-browser API namespace. Firefox provides Promise-based `browser.*`;
// Chrome MV3 exposes `browser.*` too, but some builds only populate the
// `chrome.*` global. Alias to whichever is present.
if (typeof browser === 'undefined' || browser == null) {
var browser = (typeof chrome !== 'undefined' ? chrome : {});
}
function errMsg(err) {
return String((err && err.message) || err);