| Summary: | Use more StringView during CSP parsing | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | WebKit | Reporter: | Chris Dumez <cdumez> | ||||||
| Component: | WebCore Misc. | Assignee: | Chris Dumez <cdumez> | ||||||
| Status: | RESOLVED FIXED | ||||||||
| Severity: | Normal | CC: | achristensen, darin, ews-watchlist, ggaren, mkwst, sam, webkit-bug-importer, youennf | ||||||
| Priority: | P2 | Keywords: | InRadar | ||||||
| Version: | WebKit Nightly Build | ||||||||
| Hardware: | Unspecified | ||||||||
| OS: | Unspecified | ||||||||
| Attachments: |
|
||||||||
|
Description
Chris Dumez
2022-02-17 08:16:46 PST
Created attachment 452372 [details]
Patch
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. (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. Created attachment 452473 [details]
Patch
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]. |