[webkit-changes] [WebKit/WebKit] 160b58: Trusted Types does excess work when not set in CSP

Luke Warlow noreply at github.com
Tue Feb 18 14:38:22 PST 2025


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 160b58921311c5f62fe63c7b32d2b7a9e184f1ca
      https://github.com/WebKit/WebKit/commit/160b58921311c5f62fe63c7b32d2b7a9e184f1ca
  Author: Luke Warlow <lwarlow at igalia.com>
  Date:   2025-02-18 (Tue, 18 Feb 2025)

  Changed paths:
    M Source/WebCore/dom/Document.cpp
    M Source/WebCore/dom/Document.h
    M Source/WebCore/dom/Element.cpp
    M Source/WebCore/dom/TrustedType.cpp

  Log Message:
  -----------
  Trusted Types does excess work when not set in CSP
https://bugs.webkit.org/show_bug.cgi?id=287107

Reviewed by Ryosuke Niwa.

This patch improves the CSP check within trustedTypeCompliantString,
it now uses a flag on the document rather than looping through all policies.

Attribute functions are also updated to skip work not needed when
trusted types isn't required by CSP.

* Source/WebCore/dom/Document.cpp:
(WebCore::Document::setRequiresTrustedTypes):
* Source/WebCore/dom/Document.h:
(WebCore::Document::requiresTrustedTypes const):
* Source/WebCore/dom/Element.cpp:
(WebCore::trustedTypesCompliantAttributeValue):
(WebCore::Element::setAttribute):
(WebCore::Element::setAttributeNode):
(WebCore::Element::setAttributeNodeNS):
(WebCore::Element::setAttributeNS):
* Source/WebCore/dom/TrustedType.cpp:
(WebCore::trustedTypeCompliantString):

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



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


More information about the webkit-changes mailing list