codebytere

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

Merged
Created: Sep 7, 2026, 8:19:24 AM
Merged: Sep 8, 2026, 1:11:07 PM
4 comments
Target: main

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.

Backports

43-x-y
Pending
Waiting for a manual backport
44-x-y
In-flight
PR Number
#53745
Waiting to be merged
45-x-y
Merged
PR Number
#53746
Merged At
Sep 8, 2026, 3:50:16 PM
Released In
Not yet
Release Date
Not yet

Semver Impact

Major
Breaking changes
Minor
New features
Patch
Bug fixes
None
Docs, tests, etc.

Semantic Versioning helps users understand the impact of updates:

  • Major (X.y.z): Breaking changes that may require code modifications
  • Minor (x.Y.z): New features that maintain backward compatibility
  • Patch (x.y.Z): Bug fixes that don't change the API
  • None: Changes that don't affect using facing parts of Electron