On 08/07/2023 11:37, wOxxOm wrote:
> An extension can rather easily change this behavior because the
> resultant URL actually works when opened in a new tab manually, which
> means you can write an extension that overrides the `click` event on
> this UI element
Is it intentional that listeners added by extensions have lower priority
than listeners added by pages when content scripts are injected by
scripting.executeScript? The consequence is that events are not
available for extensions when pages do
window.addEventListener(evName, e => {
e.stopImmediatePropagation();
e.preventDefault();
// do something else
}, { capture: true });
An extension may declare "content_scripts" "run_at" as "document_start",
but when a script is executed in response to user action,
injectImmediately is not a rescue since it requires page reloading.
Formally it is correct since extensions add their listeners after the
page, but it makes extensions less powerful.