Hi blink-dev,

A quick heads-up on a small spec-alignment fix landing shortly.
What is changing

Setting URL.protocol or Location.protocol to a special scheme (ftp,
file, http, https, ws, wss) on a URL whose current scheme is non-special
will become a silent no-op, matching
https://url.spec.whatwg.org/#scheme-state step 2.1.2.

Example (before this change in Chromium):

const u = new URL("foo://example.com/");
u.protocol = "http";
u.href;  // "http://example.com/";  <-- Chrome today
         // "foo://example.com/"   <-- spec, Firefox, Safari, Chrome
after this change

HTMLAnchorElement / HTMLAreaElement .protocol setters go through the
same path and are affected identically.
Why

This closes the remaining half of a two-direction spec-alignment effort.
Chromium already ships the mirror restriction (special -> non-special)
since 2023 (crbug 1416018, crrev 61d4ebd@). Firefox shipped both
directions in v117 (Aug 2023). WebKit ships it (bugs.webkit.org 229427).
whatwg/url#674 asked to relax the rule and was closed WONTFIX in
June 2026. Blink is currently the only engine that still permits this
transition.

Spec origin: whatwg/url@5533c8d (Anne van Kesteren, 2015).
Compat / interop impact

Expected to be negligible. The mirror direction (which was the more
common of the two in the wild) measured 0.000139% on Beta / 0.0000346%
on Dev when Hayato Ito ran a UseCounter in 2023 (crrev 54fc40d@),
low enough that Intent to Ship was skipped. The direction being
restricted now is rarer. Anyone who did depend on this pattern is
already broken in Firefox and Safari, so live traffic is unlikely.
Scope

Only the two JS-exposed setters are affected (URL.protocol,
Location.protocol, including anchor/area element wrappers). Internal
Blink callers of KURL::SetProtocol, favicon URL construction,
URLPattern port canonicalization, mixed-content upgrade, WebSocket URL
construction, form submission, resource loader, opt out via the new
SpecialSchemeTransition enum and keep the legacy behavior.
Flag / kill switch

DisallowSpecialSchemeOnNonSpecialUrl (default-on,
RuntimeEnabledFeatures). just in case something goes south.
Links

   - CL: https://crrev.com/c/8734102
   - Bug: https://crbug.com/40256682
   - Spec: https://url.spec.whatwg.org/#scheme-state
   - whatwg/url#674 (WONTFIX): https://github.com/whatwg/url/issues/674
   - Mirror-direction rollout (2023): crbug 1416018

Cheers,
Helmut

-- 
You received this message because you are subscribed to the Google Groups 
"blink-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/a/chromium.org/d/msgid/blink-dev/CAFmjHKScgEqLJ8NN%3DKtef0FyDJAJxogsFX5SXUiRH64YKXnLGw%40mail.gmail.com.

Reply via email to