Use more reliable way to check browser environment

This commit is contained in:
Raymond Hill 2023-04-07 13:00:01 -04:00
parent cbfd2ad942
commit b408b9314c
No known key found for this signature in database
GPG key ID: 25E1490B761470C2

View file

@ -34,6 +34,8 @@ import * as ut from './utils.js';
/******************************************************************************/
const isGecko = browser.runtime.getURL('').startsWith('moz-extension://');
const resourceDetailPromises = new Map();
function getSpecificDetails() {
@ -355,7 +357,7 @@ function registerDeclarative(context, declarativeDetails) {
function registerScriptlet(context, scriptletDetails) {
// https://bugzilla.mozilla.org/show_bug.cgi?id=1736575
// `MAIN` world not yet supported in Firefox
if ( navigator && navigator.product === 'Gecko' ) { return; }
if ( isGecko ) { return; }
const { before, filteringModeDetails, rulesetsDetails } = context;
@ -433,7 +435,7 @@ function registerScriptlet(context, scriptletDetails) {
function registerScriptletEntity(context) {
// https://bugzilla.mozilla.org/show_bug.cgi?id=1736575
// `MAIN` world not yet supported in Firefox
if ( navigator && navigator.product === 'Gecko' ) { return; }
if ( isGecko ) { return; }
const { before, filteringModeDetails, rulesetsDetails } = context;