i.e. when the experimental algorithm or the whole extension is disabled
This has 3 benefits:
performance
avoids breaking websites
Before this commit, in Chromium if the user has "Site access" for
this extension set to "activate on click", the browser would
prompt the user to reload the page after they do click on it,
even when the experimental algorithm is actually disabled
and the reload is not actually needed
However, this change has side-effects: now, after enabling
the experimental algorithm on websites
that rely on MediaSource cloning,
the page needs to be reloaded, but there is no clear indication
of it now.
The motivation for this is to finally release the version that
includes the new MediaSource cloning algorithm (https://github.com/WofWca/jumpcutter/commit/e9daff122f12263a50fb1c4a10e4b13c7fd190cf)
to Chromium (where the majority of users are)
in a safer way, so that it can be disabled and can't break websites,
e.g. by overriding canConstructInDedicatedWorker
(see src/entry-points/content/cloneMediaSources/lib.ts#L460).
Although, based on my testing, the algorithm appears to be quite
stable, especially with the recent fixes, at least on YouTube.
The "scripting" permission doesn't trigger a warning at all
The docs say that for scripting.registerContentScripts() to work
we need either "host_permissions" or the "activeTab" permission.
"activeTab" is not enough, because this way the script is only
injected on pages on which the user has interacted with the extension,
e.g. opened the popup, which means they would need to do this
before the original MediaSource is created,
or reload the page.
i.e. when the experimental algorithm or the whole extension is disabled
This has 3 benefits:
However, this change has side-effects: now, after enabling the experimental algorithm on websites that rely on MediaSource cloning, the page needs to be reloaded, but there is no clear indication of it now.
The motivation for this is to finally release the version that includes the new MediaSource cloning algorithm (https://github.com/WofWca/jumpcutter/commit/e9daff122f12263a50fb1c4a10e4b13c7fd190cf) to Chromium (where the majority of users are) in a safer way, so that it can be disabled and can't break websites, e.g. by overriding
canConstructInDedicatedWorker
(see src/entry-points/content/cloneMediaSources/lib.ts#L460).Although, based on my testing, the algorithm appears to be quite stable, especially with the recent fixes, at least on YouTube.
About the changes to manifest.json: The new
host_permissions
won't trigger a permission warning upon update, at least on Chromium. I tested this, using this guide: https://developer.chrome.com/docs/extensions/develop/concepts/permission-warnings#view_warnings Did not test on Gecko (Firefox). This, I suspect, is because the "Read and change all your data on all websites." permission is already granted thanks tocontent_scripts.matches
https://developer.chrome.com/docs/extensions/reference/permissions-listThe "scripting" permission doesn't trigger a warning at all
The docs say that for
scripting.registerContentScripts()
to work we need either "host_permissions" or the "activeTab" permission. "activeTab" is not enough, because this way the script is only injected on pages on which the user has interacted with the extension, e.g. opened the popup, which means they would need to do this before the originalMediaSource
is created, or reload the page.Co-authored-by: WofWca Commit message by WofWca