RESOLVED FIXED 236784
Use more StringView during CSP parsing
https://bugs.webkit.org/show_bug.cgi?id=236784
Summary Use more StringView during CSP parsing
Chris Dumez
Reported 2022-02-17 08:16:46 PST
Use more StringView during CSP parsing.
Attachments
Patch (7.04 KB, patch)
2022-02-17 08:18 PST, Chris Dumez
no flags
Patch (9.00 KB, patch)
2022-02-17 19:51 PST, Chris Dumez
no flags
Chris Dumez
Comment 1 2022-02-17 08:18:30 PST
Darin Adler
Comment 2 2022-02-17 16:20:24 PST
Comment on attachment 452372 [details] 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.
Chris Dumez
Comment 3 2022-02-17 16:22:08 PST
(In reply to Darin Adler from comment #2) > Comment on attachment 452372 [details] > 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. That is true. I'll see if I can fix this up too.
Chris Dumez
Comment 4 2022-02-17 19:51:28 PST
EWS
Comment 5 2022-02-18 09:26:52 PST
Committed r290131 (247475@main): <https://commits.webkit.org/247475@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 452473 [details].
Radar WebKit Bug Importer
Comment 6 2022-02-18 09:27:22 PST
Note You need to log in before you can comment on or make changes to this bug.