Skip to content

Commit

Permalink
fix: Gecko: not working on versions < 128
Browse files Browse the repository at this point in the history
Introduced in e9c984b
  • Loading branch information
WofWca committed Jun 30, 2024
1 parent 989112f commit 622fcea
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion src/entry-points/background/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,14 @@ async function updateMediaSourceCloningScriptRegistered(
// https://whattrainisitnow.com/calendar/
// But let's not mark `strict_min_version`, because the extension
// is still usable without `matchOriginAsFallback`.
matchOriginAsFallback: true,
...(
(
BUILD_DEFINITIONS.BROWSER === "gecko" &&
!(await doesGeckoSupportMatchOriginAsFallback())
)
? {}
: { matchOriginAsFallback: true }
),

// TODO improvement: add `world: 'MAIN'` and load the
// `content/cloneMediaSources-for-page-world.js` script directly.
Expand All @@ -221,3 +228,13 @@ async function updateMediaSourceCloningScriptRegistered(
}
}
const cloneMediaSourcesScriptId = 'cloneMediaSources';

async function doesGeckoSupportMatchOriginAsFallback(): Promise<boolean> {
const version = (
await import(
/* webpackExports: ['getGeckoMajorVersion']*/
"@/helpers"
)
).getGeckoMajorVersion();
return version == undefined || version >= 128;
}

0 comments on commit 622fcea

Please sign in to comment.