RESOLVED FIXED 171396
Add WebCore::protocolIsJavaScript(StringView)
https://bugs.webkit.org/show_bug.cgi?id=171396
Summary Add WebCore::protocolIsJavaScript(StringView)
Daniel Bates
Reported 2017-04-27 14:50:13 PDT
As suggested by Sam Weinig in bug 170925, comment 2, we should add an overload of WebCore::protocolIsJavaScript() that takes a StringView to avoid the need to perform a type conversion from StringView to String.
Attachments
Patch (4.79 KB, patch)
2017-04-27 14:58 PDT, Daniel Bates
no flags
Daniel Bates
Comment 1 2017-04-27 14:58:11 PDT
Alex Christensen
Comment 2 2017-04-28 14:28:41 PDT
Comment on attachment 308455 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=308455&action=review r=me I think we should get rid of all instances of protocolIs that take Strings instead of URLs. They're probably a marginal performance benefit, but we should really parse URLs rather than maintain a separate code path that looks enough like the URLParser. > Source/WebCore/platform/URL.h:315 > +bool protocolIsJavaScript(StringView url); Did you want to use this somewhere? This patch only changes URL.h and URL.cpp.
Daniel Bates
Comment 3 2017-04-28 14:45:12 PDT
(In reply to Alex Christensen from comment #2) > [...] > I think we should get rid of all instances of protocolIs that take Strings > instead of URLs. They're probably a marginal performance benefit, but we > should really parse URLs rather than maintain a separate code path that > looks enough like the URLParser. > We should investigate this. We should do this in the separate bug. > > Source/WebCore/platform/URL.h:315 > > +bool protocolIsJavaScript(StringView url); > > Did you want to use this somewhere? This patch only changes URL.h and > URL.cpp. As I mentioned in the ChangeLog entry, I plan to use this function in the patch for bug #170925.
Daniel Bates
Comment 4 2017-04-28 14:45:47 PDT
Comment on attachment 308455 [details] Patch Clearing flags on attachment: 308455 Committed r215949: <http://trac.webkit.org/changeset/215949>
Daniel Bates
Comment 5 2017-04-28 14:45:49 PDT
All reviewed patches have been landed. Closing bug.
Darin Adler
Comment 6 2017-05-01 09:32:46 PDT
(In reply to Alex Christensen from comment #2) > I think we should get rid of all instances of protocolIs that take Strings > instead of URLs. They're probably a marginal performance benefit, but we > should really parse URLs rather than maintain a separate code path that > looks enough like the URLParser. I am not sure I agree. If the performance benefit is tiny, then that’s OK. Parsing an entire URL to do a properly-case-insensitive prefix check seems like massive overkill to me, so we should be sure a performance benefit is not there before dropping. I think there is at *least* an order of magnitude difference in the costs of the two operations.
Note You need to log in before you can comment on or make changes to this bug.