Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integrate support for AMP release channels #4600

Closed
westonruter opened this issue Apr 16, 2020 · 1 comment · May be fixed by #4403
Closed

Integrate support for AMP release channels #4600

westonruter opened this issue Apr 16, 2020 · 1 comment · May be fixed by #4403
Labels
Groomed Integration: PWA P1 Medium priority Punted WS:Core Work stream for Plugin core

Comments

@westonruter
Copy link
Member

westonruter commented Apr 16, 2020

Feature description

Follow-up on #4390.

AMP has a new LTS channel in addition to Beta and Experimental channels. The LTS channel gets a dedicated URL while the Beta and Experimental channels are per user opt-in via cookie. Cookie-based opt-in however conflicts with the needs of serving AMP pages via service worker since it means those scripts must be cached by the service worker as opaque, meaning that they could consume much more of a site's storage budget than than they would if they had been served with crossorigin=anonymous. See ampproject/amphtml#24731 and ampproject/amphtml#27267.

The AMP plugin therefore should transition to adding crossorigin=anonymous to all scripts (and styles) that it adds to the page. This has an additional benefit of providing more guarantees for user privacy. (Ultimately this won't be necessary once self-hosting of AMP scripts is available per #4530).

Update: With the landing of ESM scripts, crossorigin=anonymous is now added to all scripts by the AMP Optimizer.

Once this is done, we then will also need an alternative to using cookies for sites to opt-in to non-stable release channel(s). In addition to LTS, there is now a way to reference the experimental and beta channels via a new optin query param: ampproject/amphtml#27587. These scripts will not be valid AMP, so when a non-stable release channel is chosen then the document must be put into dev mode.

The way to opt-in to a release channel can be accomplished via a filter like amp_release_channel which would take one string argument that can be modified by callbacks to be one of:

  • 'stable' (default)
  • 'lts'
  • 'beta'
  • 'experimental'

A special value of false should also be considered to revert to the current behavior where stable releases are used with no crossorigin=anonymous being added, which will allow for cookies to be used to control the AMP version.

Note that the Optimizer also needs to add support for LTS channel. See #4589 and ampproject/amp-toolbox#691.


Do not alter or remove anything below. The following sections will be managed by moderators only.

Acceptance criteria

Implementation brief

  1. Add new amp_release_channel filter.
  2. Adjust generation of script URLs based on filtered value.
  3. Adjust recognition of scripts to account for different values.
  4. Add crossorigin=anonymous to all scripts.
  5. Add dev mode to scripts when the beta or experimental channels are being used.
  6. Add support for LTS releases in the RuntimeCSS Transformer. See Add support for LTS releases in the RuntimeCSS Transformer #4589.

QA testing instructions

Demo

Changelog entry

@westonruter
Copy link
Member Author

This will also need to account for #4589.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Groomed Integration: PWA P1 Medium priority Punted WS:Core Work stream for Plugin core
Projects
Archived in project
2 participants