Skip to content

Commit

Permalink
Fix Firefox version detection for Firefox forks
Browse files Browse the repository at this point in the history
  • Loading branch information
ajayyy committed Aug 17, 2023
1 parent 3066367 commit 8f7edd3
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions src/background.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,10 +161,6 @@ function onInstall() {

waitFor(() => Config.isReady()).then(() => {
Config.config!.lastVersion = chrome.runtime.getManifest().version;

if (Config.config!.userID && !Config.config!.firefoxOldContentScriptRegistration) {
registerNeededContentScripts(undefined, true).catch(logError);
}
}).catch(logError);
}

Expand Down Expand Up @@ -304,7 +300,7 @@ async function registerNeededContentScripts(activated?: boolean, forceUpdate?: b
function isPersistentContentScriptSupported() {
if (!isFirefoxOrSafari() || isSafari()) return true;

const userAgentVersion = parseInt(navigator.userAgent.split("Firefox/")[1]);
const userAgentVersion = parseInt(navigator.userAgent.match(/Firefox\/(\S+)/)?.[1] ?? "");
return !isNaN(userAgentVersion) && userAgentVersion > 105;
}

Expand Down

0 comments on commit 8f7edd3

Please sign in to comment.