Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: b7794d481cec9bcf56e76492f68d4d44e0686cfd
      
https://github.com/WebKit/WebKit/commit/b7794d481cec9bcf56e76492f68d4d44e0686cfd
  Author: Kiet Ho <[email protected]>
  Date:   2026-09-03 (Thu, 03 Sep 2026)

  Changed paths:
    M Source/WebCore/css/StyleSheetContents.cpp
    M Source/WebCore/dom/ProcessingInstruction.cpp
    M Source/WebCore/inspector/InspectorResourceUtilities.cpp
    M Source/WebCore/loader/cache/CachedCSSStyleSheet.cpp
    M Source/WebCore/loader/cache/CachedCSSStyleSheet.h

  Log Message:
  -----------
  Refactor CachedCSSStyleSheet::sheetText to return std::expected
rdar://186388202
https://bugs.webkit.org/show_bug.cgi?id=323125

Reviewed by Alex Christensen.

CachedCSSStyleSheet::sheetText signals error by setting the passed in
boolean pointers, if they're set. This is inelegant, and particularly
there's a bug where the booleans only get set when an error occur.

Take this opportunity to refactor CachedCSSStyleSheet::sheetText to
return std::expected. If an error occurs, then it returns an Error
enum, otherwise it returns the CSS text.

Refactoring, tested by existing test suite.

* Source/WebCore/css/StyleSheetContents.cpp:
(WebCore::StyleSheetContents::parseAuthorStyleSheet):
* Source/WebCore/dom/ProcessingInstruction.cpp:
(WebCore::ProcessingInstruction::setCSSStyleSheet):
* Source/WebCore/inspector/InspectorResourceUtilities.cpp:
(Inspector::ResourceUtilities::cachedResourceContent):
* Source/WebCore/loader/cache/CachedCSSStyleSheet.cpp:
(WebCore::CachedCSSStyleSheet::sheetText const):
(WebCore::CachedCSSStyleSheet::canUseSheet const):
* Source/WebCore/loader/cache/CachedCSSStyleSheet.h:

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



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

Reply via email to