Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 83216831b242505c45716032784ae7fc5c87280b
      
https://github.com/WebKit/WebKit/commit/83216831b242505c45716032784ae7fc5c87280b
  Author: Charlie Wolfe <[email protected]>
  Date:   2026-10-01 (Thu, 01 Oct 2026)

  Changed paths:
    M LayoutTests/http/tests/cache/stylesheet-sharing-expected.txt
    M LayoutTests/http/tests/cache/stylesheet-sharing.html
    M Source/WebCore/html/HTMLLinkElement.cpp

  Log Message:
  -----------
  Cross-origin no-cors stylesheets are never reused from the parsed stylesheet 
cache
https://bugs.webkit.org/show_bug.cgi?id=325892
rdar://188872969

Reviewed by Anne van Kesteren and Ryosuke Niwa.

For an opaque stylesheet, initializeStyleSheet() marks the contents' parser 
context as
loadedFromOpaqueSource, and the sheet is cached with that context. But 
setCSSStyleSheet() built the
lookup context without the flag. restoreParsedStyleSheet() only returns a 
cached sheet whose context
is identical, so these sheets were re-parsed on every load.

Set loadedFromOpaqueSource on the lookup context up front when the resource is 
not CORS same-origin,
so it matches the context the sheet was cached with.

~1.9% PLT improvement.

* LayoutTests/http/tests/cache/stylesheet-sharing-expected.txt:
* LayoutTests/http/tests/cache/stylesheet-sharing.html:
* Source/WebCore/html/HTMLLinkElement.cpp:
(WebCore::HTMLLinkElement::initializeStyleSheet):
(WebCore::HTMLLinkElement::setCSSStyleSheet):

Canonical link: https://commits.webkit.org/322418@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to