[webkit-reviews] review granted: [Bug 236784] Use more StringView during CSP parsing : [Attachment 452372] Patch

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Feb 17 16:20:24 PST 2022


Darin Adler <darin at apple.com> has granted Chris Dumez <cdumez at apple.com>'s
request for review:
Bug 236784: Use more StringView during CSP parsing
https://bugs.webkit.org/show_bug.cgi?id=236784

Attachment 452372: Patch

https://bugs.webkit.org/attachment.cgi?id=452372&action=review




--- Comment #2 from Darin Adler <darin at apple.com> ---
Comment on attachment 452372
  --> https://bugs.webkit.org/attachment.cgi?id=452372
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=452372&action=review

As long as we don’t need these things to outlive the buffer we are parsing,
this is a great thing to do.

> Source/WebCore/page/csp/ContentSecurityPolicySourceList.cpp:386
> -template<typename CharacterType> std::optional<String>
ContentSecurityPolicySourceList::parseScheme(StringParsingBuffer<CharacterType>
buffer)
> +template<typename CharacterType> std::optional<StringView>
ContentSecurityPolicySourceList::parseScheme(StringParsingBuffer<CharacterType>
buffer)

Given that both String and StringView have a null value, I am surprised that we
feel the need to use std::optional.


More information about the webkit-reviews mailing list