Skip to content

Add use case stubs for Cross-Origin Storage (COS) - #1208

Open
tomayac wants to merge 9 commits into
mainfrom
guidance/cross-origin-storage
Open

Add use case stubs for Cross-Origin Storage (COS)#1208
tomayac wants to merge 9 commits into
mainfrom
guidance/cross-origin-storage

Conversation

@tomayac

@tomayac tomayac commented Aug 9, 2026

Copy link
Copy Markdown
Member

Summary

Adds guidance use cases for Cross-Origin Storage (COS) under guides/performance/, covering all three ways to use the API:

  1. avoid-redundant-large-asset-downloads — the imperative navigator.crossOriginStorage.requestFileHandle() API: storing/retrieving large files (AI models, Wasm modules, fully-bundled JS libraries, game engine cores) keyed by content hash.
  2. load-shared-resources-declaratively — the declarative HTML crossoriginstorage attribute (on <link>/<script> elements that already carry integrity) and the crossOriginStorage JS import attribute for static/dynamic module imports.
  3. share-web-fonts-across-origins — the declarative CSS cross-origin-storage() request-url-modifier for @font-face.

Each includes a demo.html alongside guide.md and expectations.md.

web-feature-ids in all three points at cross-origin-storage (web-platform-dx/web-features#4029).

Adds three Stage 1 (use case identification) stubs under guides/performance/
for the WICG Cross-Origin Storage proposal:

- avoid-redundant-large-asset-downloads: the imperative
  navigator.crossOriginStorage.requestFileHandle() API for sharing large
  files (AI models, Wasm modules, bundled JS libraries, game engine cores)
  across origins.
- load-shared-resources-declaratively: the declarative HTML
  (crossoriginstorage attribute) and JS (crossOriginStorage import
  attribute) integrations.
- share-web-fonts-across-origins: the declarative CSS cross-origin-storage()
  request-url-modifier for @font-face.

Re-read the explainer (https://github.com/WICG/cross-origin-storage/) and
spec (https://wicg.github.io/cross-origin-storage/) in full for this pass;
content reflects the current API shape (singular requestFileHandle(),
origins upgrade-only semantics, Public Hash List availability gating,
GREASE'ing, declarative HTML/JS/CSS integrations).

Known blocker: COS has no shipping browser implementation and no entry in
the web-features package yet, so the web-feature-ids: cross-origin-storage
value in each guide.md is a placeholder that will fail this repo's
web-feature-ids CI check. Tracking issue for the upstream feature
definition: web-platform-dx/web-features#4029.
See PR description for details.
@github-actions
github-actions Bot requested review from malchata and tunetheweb August 9, 2026 11:36
tomayac added 3 commits August 9, 2026 11:55
Per feedback: don't call out the web-features dependency in the guide
content itself. web-feature-ids still points at the cross-origin-storage
placeholder (web-platform-dx/web-features#4029).
Sourced from the working patterns documented in
web-ai-community/cross-origin-storage-extension's docs/ folder
(progressive-enhancement-demo.html and its CSS/HTML/JS fixtures),
rewritten against the literal WICG spec syntax rather than that
extension's polyfill-specific shims (e.g. real dynamic import() with a
'with' option instead of the extension's non-standard
__non_standard__import() helper, since the guide represents the spec,
not one particular polyfill's workaround for it).

- avoid-redundant-large-asset-downloads/demo.html: imperative
  requestFileHandle() read path, NotFoundError/NotAllowedError handling,
  create:true write path with origins:'*'.
- load-shared-resources-declaratively/demo.html: declarative HTML
  crossoriginstorage attribute on <link>/<script>, and feature-detected
  dynamic import() with the crossOriginStorage attribute for the JS form.
- share-web-fonts-across-origins/demo.html: CSS cross-origin-storage()
  with a same-list plain url() fallback, COS-enhanced source ordered
  first per the src list's first-match resolution.
@tomayac
tomayac marked this pull request as ready for review August 9, 2026 13:09

@rviscomi rviscomi left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One small comment about making sure these guides are treated as empty stubs.

Also @tomayac you should add yourself as an ATL for cross-origin-storage

Comment thread guides/performance/load-shared-resources-declaratively/guide.md Outdated
@tomayac

tomayac commented Aug 11, 2026

Copy link
Copy Markdown
Member Author

One small comment about making sure these guides are treated as empty stubs.

Ah, excellent. Suggestion accepted.

Also @tomayac you should add yourself as an ATL for cross-origin-storage

Done (also fixed the built-in AI one).

PTAL! Thanks!

@tomayac
tomayac requested a review from rviscomi August 11, 2026 03:02
Comment thread guides/performance/avoid-redundant-large-asset-downloads/guide.md Outdated
Comment thread guides/performance/share-web-fonts-across-origins/guide.md Outdated
tomayac and others added 3 commits August 12, 2026 19:18
@tomayac
tomayac requested a review from rviscomi August 12, 2026 11:19

@rviscomi rviscomi left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, one more change. We just merged #1256 so we can resolve the failing CI checks by using the tmp- feature ID prefix.

Also requires adding an entry to features/pending-web-features.json.

name: share-web-fonts-across-origins
description: Serve large, popular web fonts from a shared cross-origin cache instead of re-downloading them from a font CDN on every site that references them.
web-feature-ids:
- cross-origin-storage

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- cross-origin-storage
- tmp-cross-origin-storage

Comment thread guides/atls.json
"web_features": {
"canvas-html": "ewewraw",
"container-scroll-state-queries": "bramus",
"cross-origin-storage": "tomayac",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"cross-origin-storage": "tomayac",
"tmp-cross-origin-storage": "tomayac",

name: load-shared-resources-declaratively
description: Serve popular, unmodified scripts, stylesheets, and JavaScript modules from a shared cross-origin cache using markup or import syntax alone, without writing custom caching logic.
web-feature-ids:
- cross-origin-storage

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- cross-origin-storage
- tmp-cross-origin-storage

name: avoid-redundant-large-asset-downloads
description: Avoid re-downloading and re-storing large shared assets, such as AI models, Wasm modules, or fully-bundled JavaScript libraries, that a visitor's browser may already hold from an unrelated site.
web-feature-ids:
- cross-origin-storage

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- cross-origin-storage
- tmp-cross-origin-storage

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants