Origin Trials & Content Scripts

125 views
Skip to first unread message

ka...@couponfollow.com

unread,
May 13, 2024, 1:49:25 AMMay 13
to Chromium Extensions
Hey, this section about origin trials in extensions 
"Exposing a feature to one world could be confusing and unintuitive. Instead of using the manifest's trial_token, add the token to the page either by inserting a header using declaritiveNetRequest or programmatically directly in your content script."

Does it mean, that features I enable using a token will impact the website as well, so potentially it can break some functionality?
Are trials designed so that they can't break the existing behavior, just add something new/enhance?

Best

Patrick Kettner

unread,
May 13, 2024, 10:36:40 AMMay 13
to ka...@couponfollow.com, Chromium Extensions
Hi Kamil!

Does it mean, that features I enable using a token will impact the website as well, so potentially it can break some functionality?

It means that the trial token will be applied to the javascript context that you are using it in. If you add it in a content script, then it will be exposed in the website's environment as well. You can't enable a feature for just your content script, but not the MAIN world.

> Are trials designed so that they can't break the existing behavior, just add something new/enhance?

Not specifically, no. Trial Tokens are kind of like giving you the ability to turn on a flag in the user's chrome://flags (they don't literally map to individual flags, but conceptually it is similar). It is just a gate to some kind of change in Chrome. It could be a new feature, a change in functionality, or removing a feature. There are even things called Deprecation Trials that actually re-enable a feature that was recently removed.
All that to say, there is no guarantee that it can't break behavior - in fact some may be explicitly breaking something. Trial tokens are intended to trial behavior, and as such code that is using it should be written defensively, because there is no guarantee their effects will be there long term.

patrick

--
You received this message because you are subscribed to the Google Groups "Chromium Extensions" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-extens...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/chromium-extensions/e2a8fc86-7310-4081-9755-39c17d9f35a9n%40chromium.org.
Reply all
Reply to author
Forward
0 new messages