RESOLVED FIXED 173495
Cleanup: WebContentMenuClient::searchWithGoogle() should parse URL using URL { URL { }, ... } instead of URL { ParsedURLString, ... }
https://bugs.webkit.org/show_bug.cgi?id=173495
Summary Cleanup: WebContentMenuClient::searchWithGoogle() should parse URL using URL ...
Daniel Bates
Reported 2017-06-16 14:03:44 PDT
When parsing an arbitrary string s that looks like a URL we should use URL { URL { }, s }. The constructor URL { ParsedURLString, s' } should only be used when s' is the result from URL::string(). WebContentMenuClient::searchWithGoogle() should use URL { URL { }, ... } to construct the URL object for the string it built.
Attachments
Patch (5.24 KB, patch)
2017-06-16 14:04 PDT, Daniel Bates
no flags
Patch (5.33 KB, patch)
2017-06-16 14:10 PDT, Daniel Bates
no flags
Patch (5.35 KB, patch)
2017-06-16 14:11 PDT, Daniel Bates
achristensen: review+
Daniel Bates
Comment 1 2017-06-16 14:04:59 PDT
Daniel Bates
Comment 2 2017-06-16 14:10:21 PDT
Daniel Bates
Comment 3 2017-06-16 14:11:46 PDT
Alex Christensen
Comment 4 2017-06-16 14:12:22 PDT
Comment on attachment 313131 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=313131&action=review > Source/WebKit/win/WebCoreSupport/WebContextMenuClient.cpp:66 > + String url = "http://www.google.com/search?q=" + encoded + "&ie=UTF-8&oe=UTF-8"; I think makeString is even more efficient than calling operator+ twice.
Daniel Bates
Comment 5 2017-06-16 14:24:08 PDT
(In reply to Alex Christensen from comment #4) > Comment on attachment 313131 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=313131&action=review > > > Source/WebKit/win/WebCoreSupport/WebContextMenuClient.cpp:66 > > + String url = "http://www.google.com/search?q=" + encoded + "&ie=UTF-8&oe=UTF-8"; > > I think makeString is even more efficient than calling operator+ twice. The StringOperators usage in this line is almost as efficient as makeString(), which is efficient enough for our use here. StringOperators ensures that we allocate for the finalized size once and then copy the parts just like makeString(). The difference between StringOperators and makeString() is the StringOperators can create temporaries and ultimately we need to convert from StringAppend to String. These differences likely go away with a good optimizing compiler.
Radar WebKit Bug Importer
Comment 6 2017-06-16 17:50:11 PDT
Daniel Bates
Comment 7 2017-06-16 17:56:06 PDT
Note You need to log in before you can comment on or make changes to this bug.