Blink‎ > ‎Origin Trials‎ > ‎

Running an Origin Trial

For the full context on origin trials, please see the explainer. This is the feature author guide for Blink contributors.

Here, we describe what is involved in running an origin trials experiment for a new browser feature. Most importantly, origin trials are integrated into the launch process for new web platform features. You should be following that overall process (maybe you ended up here from that page).

Should you run an Origin Trial?

Origin Trials are intended to be used to ensure we design the best possible features by getting feedback from developers before the standard is finalized. They may also be used to prove developer interest in a feature proposal that is otherwise undesired due to an expected lack of interest. In general, you should have a specific hypothesis that you wish to test by collecting data.

If you answer “yes” to any of the following questions, you should consider running an origin trial (see caveat in [1]).
  • Is there disagreement about how well this API satisfies its intended use case?
  • Are you unsure about what API shape will be the most ergonomic in real world scenarios?
  • Is it hard to quantify performance gains without testing on real world sites?
  • Is there a reason that this API needs to be deployed to real users, rather than behind a flag, for data to be meaningful?
[1] Origin trials should be run for a specific reason. These questions are guidance to identifying that reason. However, there is still debate about the right reasons, so the guidance may change. You can join the conversation in this doc.

If you're planning to run an Origin Trial please first schedule a meeting with the Origin Trials core team to quickly talk over your feature and the reason for running the trial. To set up this meeting you can email owencm@chromium.org or chasej@chromium.org. Google employees can alternatively schedule a meeting directly with origin-trials-core@google.com.

How do Origin Trials work in Chrome?

The framework will enable features at runtime, on a per-execution-context basis (practically, this will be per-document or per-worker). Features are disabled by default, and only be enabled if a properly signed token, scoped to the origin that it is being presented on, and scoped to the specific feature name, is present in either:
  • an HTTP Origin-Trial header in the server response, 
  • an HTML <META> tag in the document's head, or 
  • (for Dedicated Workers only) the HTTP response or document head of the parent document. 

The logic for enabling includes a check of your runtime feature flag (even if the origin trials framework isn't being used). This means you can easily test your feature locally, even without any trial tokens.

Origin Trials are being enabled in documents (for both inline and external scripts), and in service, shared, and dedicated workers. (Note that for service workers and shared workers, HTTP headers are the only way to enable trials. Dedicated workers will also inherit any trials enabled by their parent document).

If an experiment gets out of hand (way too popular to be an experiment anymore, for instance), we’ll be able to turn it off remotely, for all origins. Similarly, if there turns out to be major problems with the implementation of the framework itself, we’ll be able to turn it off completely, and disable all trials. (Hopefully we don’t have to do that, but we're still in the early stages of origin trials, and we’re being careful.)

Is your feature ready to be an origin trial?

Before running an origin trial experiment, your feature needs to be ready for both web developers and users. Your feature must satisfy the following:
  • Be approved by the internal Chrome launch review process 
    • Users may be exposed to your feature without opting in, so the appropriate measures must be taken for privacy, security, etc. 
  • Have a way to remotely disable the feature 
    • Origin trials provides infrastructure to disable a feature (or a specific origin), but this only applies to the exposure as an origin trial. That means, any interface(s) controlled by the trial will be disabled, but it will still be possible to enable the feature via its runtime flag. As well, all of the token validation/revocation happens in the renderer. 
    • If the previous point is not sufficient for disabling the feature, you should implement a kill switch that allows your feature to be disabled remotely via Finch 
    • This can use the existing functionality in PermissionContextBase or base::FeatureList, or be a feature-specific implementation. 
  • Have UMA metrics to track feature usage 
    • Typically you will record usage with UseCounter
    • The feature must have a corresponding entry in the enum UseCounter::Feature
    • For any JavaScript-exposed API, usage can be recorded easily via one of the [Measure] or [MeasureAs] IDL attributes. 
    • If not exposed via IDL, the appropriate UseCounter::count*() method can be used directly from your feature implementation. 
    • Your feature may use a different UMA metric to track usage. For example, if it's not feasible to integrate with UseCounter, usage is best tracked outside a renderer, etc. 
  • Have an established community for discussion of the feature 
    • At a minimum, this should be a WICG group, Github repo, etc. Anywhere developers can find discussion or log issues about your feature 
    • The origin trials system will facilitate collecting feedback from web developers. However, the goal is to have web developers participate in the existing community around the feature 
  • Prepared a blog post/article/landing page introducing the feature 
    • There needs to be single link that will provide details about the feature 
    • Should make it clear how developers provide feedback/log issues for your feature 
    • This could be the README.md in your Github repo, or any other page of your choice 
    • Should include details about availability via origin trials

What is the timeline for running a trial and collecting feedback?

Please see our overview of the timeline for running a trial and collecting feedback. Contact experimentation-dev@chromium.org with any questions.

What is the actual process to run an origin trial?

First review the Blink launch process. Please contact experimentation-dev@chromium.org with any questions about these steps, .f you don't have access to any of the links below the mailing list can help find someone to guide you.

Running an origin trial requires the following: Note that these steps are not meant to be sequential. For example, you can certainly start integrating your feature with origin trials prior to getting various launch approvals.

Adding your feature to the sign up form

Before your feature can be added to the sign up form, the landing page must be available to web developers (see above). The origin trials team needs some documentation for web developers that sign up (which has happened within minutes of a feature being added to the form!).

In some cases, this may lead to a chicken-and-egg problem. For example, you may not want to publish a blog post until the feature is added the form. If the blog post has detailed information on joining the origin trial, it doesn't make sense to publish and have web developers unable to see your feature on the sign up form. Conversely, if the feature is added to the form first, web developers can (and have in the past) seen the change and signed up before the docs are ready.

Recommended process:
  • Publish the blog post for the feature when the beta release is available
  • Ensure the correct link to the blog post is recorded in go/origin-trials-feature-pipeline.
  • Notify the origin trials team that the trial is ready for signups
  • Origin trials team will add the feature to the signup form, and the list of available trials
 

How to integrate your feature with the framework?

The integration instructions now live in the Chromium source repo: https://chromium.googlesource.com/chromium/src/+/master/docs/origin_trials_integration.md

Roadmap

All of this may change, as we respond to your feedback about the framework itself. Please let us know how it works, and what's missing!

For our 2017 plans, see bit.ly/origin-trials-in-2017.

To follow the most up-to-date progress and plans, filter in crbug.com for “component:Internals>OriginTrials”.
Comments