diff --git a/platform/mv3/chromium/manifest.json b/platform/mv3/chromium/manifest.json index b3e77ccc2..49f1381b2 100644 --- a/platform/mv3/chromium/manifest.json +++ b/platform/mv3/chromium/manifest.json @@ -25,7 +25,7 @@ "128": "img/icon_128.png" }, "manifest_version": 3, - "minimum_chrome_version": "118.0", + "minimum_chrome_version": "119.0", "name": "__MSG_extName__", "options_page": "dashboard.html", "optional_host_permissions": [ diff --git a/platform/mv3/extension/js/scripting-manager.js b/platform/mv3/extension/js/scripting-manager.js index 6502cbc0a..814343ebe 100644 --- a/platform/mv3/extension/js/scripting-manager.js +++ b/platform/mv3/extension/js/scripting-manager.js @@ -473,6 +473,7 @@ function registerScriptlet(context, scriptletDetails) { // `MAIN` world not yet supported in Firefox if ( isGecko === false ) { directive.world = 'MAIN'; + directive.matchOriginAsFallback = true; } // register diff --git a/platform/mv3/scriptlets/scriptlet.template.js b/platform/mv3/scriptlets/scriptlet.template.js index f5a47483b..9ce165d09 100644 --- a/platform/mv3/scriptlets/scriptlet.template.js +++ b/platform/mv3/scriptlets/scriptlet.template.js @@ -20,11 +20,9 @@ */ -/* jshint esversion:11 */ +/* eslint-disable indent */ /* global cloneInto */ -'use strict'; - // ruleset: $rulesetId$ /******************************************************************************/ @@ -40,7 +38,7 @@ // Start of code to inject const uBOL_$scriptletName$ = function() { -const scriptletGlobals = {}; // jshint ignore: line +const scriptletGlobals = {}; // eslint-disable-line const argsList = self.$argsList$; @@ -57,7 +55,19 @@ function $scriptletName$(){} /******************************************************************************/ const hnParts = []; -try { hnParts.push(...document.location.hostname.split('.')); } +try { + let origin = document.location.origin; + if ( origin === 'null' ) { + const origins = document.location.ancestorOrigins; + for ( let i = 0; i < origins.length; i++ ) { + origin = origins[i]; + if ( origin !== 'null' ) { break; } + } + } + const pos = origin.lastIndexOf('://'); + if ( pos === -1 ) { return; } + hnParts.push(...origin.slice(pos+3).split('.')); +} catch(ex) { } const hnpartslen = hnParts.length; if ( hnpartslen === 0 ) { return; }