RESOLVED DUPLICATE of bug 185986 173192
URL::host should return a StringView
https://bugs.webkit.org/show_bug.cgi?id=173192
Summary URL::host should return a StringView
Alex Christensen
Reported 2017-06-09 16:19:40 PDT
URL::host should return a StringView
Attachments
Patch (47.67 KB, patch)
2017-06-09 16:21 PDT, Alex Christensen
no flags
Patch (49.76 KB, patch)
2017-06-09 16:49 PDT, Alex Christensen
no flags
Patch (49.75 KB, patch)
2017-06-09 17:05 PDT, Alex Christensen
achristensen: review-
Alex Christensen
Comment 1 2017-06-09 16:21:34 PDT
Alex Christensen
Comment 2 2017-06-09 16:49:52 PDT
Chris Dumez
Comment 3 2017-06-09 16:53:15 PDT
Comment on attachment 312511 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=312511&action=review > Source/WebCore/ChangeLog:3 > + URL::host should return a StringView This adds quite a bit of toString() at call sites, which is unfortunate. Couldn't we add a new method which returns a StringView for call sites that actually need a view rather than a string?
Alex Christensen
Comment 4 2017-06-09 16:54:50 PDT
We should work towards removing those .toString() calls by doing things like making functions in HashSet<String> that take StringViews as arguments, etc. This is a step in the right direction.
Chris Dumez
Comment 5 2017-06-09 16:57:01 PDT
(In reply to Alex Christensen from comment #4) > We should work towards removing those .toString() calls by doing things like > making functions in HashSet<String> that take StringViews as arguments, etc. > This is a step in the right direction. I also worry about the safety of this. People should be very careful when using StringViews. e.g. auto host = url.host(); // modify url // host is now potentially bad.
Alex Christensen
Comment 6 2017-06-09 17:00:40 PDT
That's true for all StringViews. That shouldn't prevent this patch. If anything we should get rid of StringView.toStringWithoutCopying, but that's completely unrelated to this patch.
Alex Christensen
Comment 7 2017-06-09 17:05:49 PDT
Build Bot
Comment 8 2017-06-09 17:08:59 PDT
Attachment 312513 [details] did not pass style-queue: ERROR: Source/WebCore/page/SecurityOrigin.cpp:148: Code inside a namespace should not be indented. [whitespace/indent] [4] Total errors found: 1 in 48 files If any of these errors are false positives, please file a bug against check-webkit-style.
Alex Christensen
Comment 9 2018-08-01 13:14:11 PDT
*** This bug has been marked as a duplicate of bug 185986 ***
Note You need to log in before you can comment on or make changes to this bug.