Fix WebExtension startup and URI matching compatibility

This commit is contained in:
wuggy 2026-09-19 04:08:21 -07:00
commit dbc2b42c7f
2 changed files with 16 additions and 3 deletions

View file

@ -406,7 +406,7 @@ BrowserGlue.prototype = {
os.addObserver(this, "flash-plugin-hang", false); os.addObserver(this, "flash-plugin-hang", false);
os.addObserver(this, "xpi-signature-changed", false); os.addObserver(this, "xpi-signature-changed", false);
os.addObserver(this, "autocomplete-did-enter-text", false); os.addObserver(this, "autocomplete-did-enter-text", false);
Services.prefs.addObserver(PREF_INTERNAL_USERSCRIPTS_ENABLED, this); Services.prefs.addObserver(PREF_INTERNAL_USERSCRIPTS_ENABLED, this, false);
if (AppConstants.NIGHTLY_BUILD) { if (AppConstants.NIGHTLY_BUILD) {
os.addObserver(this, AddonWatcher.TOPIC_SLOW_ADDON_DETECTED, false); os.addObserver(this, AddonWatcher.TOPIC_SLOW_ADDON_DETECTED, false);

View file

@ -89,9 +89,22 @@ SingleMatchPattern.prototype = {
let suffix = host.substr(2); let suffix = host.substr(2);
let dotSuffix = "." + suffix; let dotSuffix = "." + suffix;
return ({host}) => host === suffix || host.endsWith(dotSuffix); return uri => {
try {
let host = uri.host;
return host === suffix || host.endsWith(dotSuffix);
} catch (e) {
return false;
}
};
} }
return uri => uri.host === host; return uri => {
try {
return uri.host === host;
} catch (e) {
return false;
}
};
}, },
matches(uri, ignorePath = false) { matches(uri, ignorePath = false) {