Skip to content

chore: rebase the custom-scheme code cache patch onto upstream's checks - #53676

Merged
codebytere merged 1 commit into
mainfrom
chore/resync-code-cache-patch
Sep 8, 2026
Merged

codebytere merged 1 commit into
mainfrom
chore/resync-code-cache-patch

Conversation

@codebytere

Copy link
Copy Markdown
Member

Description of Change

feat_allow_code_cache_in_custom_schemes.patch (#40544, from crrev.com/c/5019665) replaced CheckSecurityForAccessingCodeCacheData in code_cache_host_impl.cc and the CheckValidResource / CheckValidContext DCHECK helpers in generated_code_cache.cc wholesale. Upstream has kept editing those functions since, and the rewrite had drifted from them in two ways:

  • The blink::CommonSchemeRegistry::IsExtensionScheme branches Chromium added for extension script and wasm caching were gone from all three functions (only the one in GetOriginLock survived), so a chrome-extension:// resource write reached mojo::ReportBadMessage("Invalid URL scheme for code cache.") instead of being cached.
  • http(s) scripts were only cacheable from processes locked to http(s) or to an embedder code-cache scheme. Upstream allows them from any non-WebUI process, so pages on file:// or on a standard custom scheme registered without codeCache: true lost V8 code caching for scripts they load over https.

This rebuilds the patch as upstream's code plus the embedder additions only: a url::IsCodeCacheScheme() helper next to AddCodeCacheScheme / GetCodeCacheSchemes, one extra disjunct in each DCHECK, one extra branch in CheckSecurityForAccessingCodeCacheData (embedder-scheme scripts are cached only for processes locked to an embedder scheme, as before) and one in GetOriginLock. The content_client.h, url_schemes.cc, header comment and browsertest parts are unchanged. The patch goes from 210 to about 90 changed lines, which should also make the re-upload of the upstream CL easier. feat_allow_enabling_extensions_on_custom_protocols.patch only shifts context in url/url_util.cc.

Verified on Linux: builds, protocol.registerSchemesAsPrivileged codeCache specs pass (disabled by default, enabled with codeCache: true).

Checklist

Release Notes

Notes: Fixed V8 code caching for https scripts loaded by file:// and custom-scheme pages.

feat_allow_code_cache_in_custom_schemes.patch rewrote
CheckSecurityForAccessingCodeCacheData and the two DCHECK helpers in
generated_code_cache.cc wholesale, and in doing so dropped the
CommonSchemeRegistry::IsExtensionScheme branches Chromium added later and
refused http(s) script caching for any process not locked to http(s) or an
embedder scheme (file:// pages, standard custom schemes without codeCache).
Keep upstream's logic verbatim and only add the embedder-scheme cases via a
new url::IsCodeCacheScheme() helper.
@codebytere
codebytere requested a review from a team as a code owner September 7, 2026 13:19
@codebytere codebytere added semver/patch backwards-compatible bug fixes target/43-x-y PR should also be added to the "43-x-y" branch. target/44-x-y PR should also be added to the "44-x-y" branch. target/45-x-y PR should also be added to the "45-x-y" branch. labels Sep 7, 2026
@electron-cation electron-cation Bot added the new-pr 🌱 PR opened recently label Sep 7, 2026
@electron-cation electron-cation Bot removed the new-pr 🌱 PR opened recently label Sep 8, 2026
@codebytere
codebytere merged commit a6836d3 into main Sep 8, 2026
148 of 149 checks passed
@release-clerk

release-clerk Bot commented Sep 8, 2026

Copy link
Copy Markdown

Release Notes Persisted

Fixed V8 code caching for https scripts loaded by file:// and custom-scheme pages.

@codebytere
codebytere deleted the chore/resync-code-cache-patch branch September 8, 2026 18:11
@github-actions github-actions Bot added the 46-x-y label Sep 8, 2026
@trop

trop Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

I was unable to backport this PR to "43-x-y" cleanly;
you will need to perform this backport manually.

@trop

trop Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

I have automatically backported this PR to "44-x-y", please check out #53745

@trop trop Bot added the in-flight/44-x-y label Sep 8, 2026
@trop

trop Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

I have automatically backported this PR to "45-x-y", please check out #53746

@trop trop Bot added in-flight/45-x-y merged/45-x-y PR was merged to the "45-x-y" branch. merged/44-x-y PR was merged to the "44-x-y" branch. and removed target/44-x-y PR should also be added to the "44-x-y" branch. target/45-x-y PR should also be added to the "45-x-y" branch. in-flight/45-x-y in-flight/44-x-y labels Sep 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

46-x-y merged/44-x-y PR was merged to the "44-x-y" branch. merged/45-x-y PR was merged to the "45-x-y" branch. needs-manual-bp/43-x-y semver/patch backwards-compatible bug fixes

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

2 participants