RESOLVED FIXED 162247
Make URLSearchParams spec-compliant
https://bugs.webkit.org/show_bug.cgi?id=162247
Summary Make URLSearchParams spec-compliant
Alex Christensen
Reported 2016-09-19 17:49:26 PDT
Make URLSearchParams spec-compliant
Attachments
Patch (7.10 KB, patch)
2016-09-19 17:55 PDT, Alex Christensen
no flags
Archive of layout-test-results from ews107 for mac-yosemite-wk2 (1.33 MB, application/zip)
2016-09-19 18:59 PDT, Build Bot
no flags
Archive of layout-test-results from ews125 for ios-simulator-elcapitan-wk2 (7.55 MB, application/zip)
2016-09-19 19:06 PDT, Build Bot
no flags
Archive of layout-test-results from ews117 for mac-yosemite (1.21 MB, application/zip)
2016-09-19 19:39 PDT, Build Bot
no flags
Patch (7.36 KB, patch)
2016-09-19 21:27 PDT, Alex Christensen
no flags
Patch (7.19 KB, patch)
2016-09-19 22:05 PDT, Alex Christensen
no flags
Archive of layout-test-results from ews104 for mac-yosemite-wk2 (1.21 MB, application/zip)
2016-09-19 22:46 PDT, Build Bot
no flags
Patch (7.19 KB, patch)
2016-09-19 23:02 PDT, Alex Christensen
sam: review+
Alex Christensen
Comment 1 2016-09-19 17:55:39 PDT
Chris Dumez
Comment 2 2016-09-19 18:38:02 PDT
Comment on attachment 289296 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=289296&action=review > Source/WebCore/html/DOMURL.cpp:94 > void DOMURL::setQuery(const String& query) Who is calling this method? I quickly grep'd and did not find any obvious call site. > Source/WebCore/html/DOMURL.cpp:98 > + m_searchParams->setContents(URLSearchParams::create(query).get()); Shouldn't this get use search() so that we get the *parsed* query from m_url? > Source/WebCore/html/DOMURL.cpp:129 > + m_searchParams = URLSearchParams::create("?" + m_url.query(), this); Can we just use search() instead of "?" + m_url.query(). Seems simpler. > Source/WebCore/html/URLSearchParams.h:47 > + void setContents(const Vector<std::pair<String, String>>& pairs) { m_pairs = pairs; } Instead of doing can we have an updateFromAssocatedURL() method that does the right thing? I don't like that we have to construct a URLSearchParam every time the URL gets updated.
Build Bot
Comment 3 2016-09-19 18:59:50 PDT
Comment on attachment 289296 [details] Patch Attachment 289296 [details] did not pass mac-wk2-ews (mac-wk2): Output: http://webkit-queues.webkit.org/results/2109124 New failing tests: imported/w3c/web-platform-tests/url/urlsearchparams-constructor.html
Build Bot
Comment 4 2016-09-19 18:59:55 PDT
Created attachment 289299 [details] Archive of layout-test-results from ews107 for mac-yosemite-wk2 The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews. Bot: ews107 Port: mac-yosemite-wk2 Platform: Mac OS X 10.10.5
Build Bot
Comment 5 2016-09-19 19:06:05 PDT
Comment on attachment 289296 [details] Patch Attachment 289296 [details] did not pass ios-sim-ews (ios-simulator-wk2): Output: http://webkit-queues.webkit.org/results/2109105 New failing tests: imported/w3c/web-platform-tests/url/urlsearchparams-constructor.html
Build Bot
Comment 6 2016-09-19 19:06:09 PDT
Created attachment 289300 [details] Archive of layout-test-results from ews125 for ios-simulator-elcapitan-wk2 The attached test failures were seen while running run-webkit-tests on the ios-sim-ews. Bot: ews125 Port: ios-simulator-elcapitan-wk2 Platform: Mac OS X 10.11.6
Build Bot
Comment 7 2016-09-19 19:39:48 PDT
Comment on attachment 289296 [details] Patch Attachment 289296 [details] did not pass mac-debug-ews (mac): Output: http://webkit-queues.webkit.org/results/2109268 New failing tests: imported/w3c/web-platform-tests/url/urlsearchparams-constructor.html
Build Bot
Comment 8 2016-09-19 19:39:52 PDT
Created attachment 289302 [details] Archive of layout-test-results from ews117 for mac-yosemite The attached test failures were seen while running run-webkit-tests on the mac-debug-ews. Bot: ews117 Port: mac-yosemite Platform: Mac OS X 10.10.5
Alex Christensen
Comment 9 2016-09-19 20:45:09 PDT
(In reply to comment #2) > Comment on attachment 289296 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=289296&action=review > > > Source/WebCore/html/DOMURL.cpp:94 > > void DOMURL::setQuery(const String& query) > > Who is calling this method? I quickly grep'd and did not find any obvious > call site. URLSearchParams::updateURL
Chris Dumez
Comment 10 2016-09-19 21:05:17 PDT
Comment on attachment 289296 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=289296&action=review >>> Source/WebCore/html/DOMURL.cpp:94 >>> void DOMURL::setQuery(const String& query) >> >> Who is calling this method? I quickly grep'd and did not find any obvious call site. > > URLSearchParams::updateURL Well then isn't it super weird for URLSearchParams to call DOMURL::setQuery() and for DOMURL to update its URLSearchParams object back again? :)
Alex Christensen
Comment 11 2016-09-19 21:06:06 PDT
And ideally without crashing...
Alex Christensen
Comment 12 2016-09-19 21:27:52 PDT
Chris Dumez
Comment 13 2016-09-19 21:40:19 PDT
Comment on attachment 289309 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=289309&action=review > Source/WebCore/html/DOMURL.cpp:97 > + if (m_searchParams) Why is this still updating search params if it is only called by search params > Source/WebCore/html/URLSearchParams.cpp:120 > +void URLSearchParams::updateFromAssociatedURL(const DOMURL& url) I don't think this should take a parameter?
Alex Christensen
Comment 14 2016-09-19 21:41:30 PDT
(In reply to comment #13) > > Source/WebCore/html/URLSearchParams.cpp:120 > > +void URLSearchParams::updateFromAssociatedURL(const DOMURL& url) > > I don't think this should take a parameter? It's nice to not have a null check and to have an assertion.
Chris Dumez
Comment 15 2016-09-19 21:49:20 PDT
(In reply to comment #14) > (In reply to comment #13) > > > Source/WebCore/html/URLSearchParams.cpp:120 > > > +void URLSearchParams::updateFromAssociatedURL(const DOMURL& url) > > > > I don't think this should take a parameter? > It's nice to not have a null check and to have an assertion. You do not need a null check, just an assertion.
Alex Christensen
Comment 16 2016-09-19 22:05:09 PDT
Chris Dumez
Comment 17 2016-09-19 22:14:17 PDT
Comment on attachment 289316 [details] Patch R=me
Build Bot
Comment 18 2016-09-19 22:45:58 PDT
Comment on attachment 289316 [details] Patch Attachment 289316 [details] did not pass mac-wk2-ews (mac-wk2): Output: http://webkit-queues.webkit.org/results/2110154 New failing tests: imported/w3c/web-platform-tests/url/urlsearchparams-constructor.html
Build Bot
Comment 19 2016-09-19 22:46:02 PDT
Created attachment 289325 [details] Archive of layout-test-results from ews104 for mac-yosemite-wk2 The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews. Bot: ews104 Port: mac-yosemite-wk2 Platform: Mac OS X 10.10.5
Alex Christensen
Comment 20 2016-09-19 23:02:01 PDT
Sam Weinig
Comment 21 2016-09-20 03:39:30 PDT
Comment on attachment 289326 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=289326&action=review > Source/WebCore/html/DOMURL.h:61 > + ~DOMURL(); We usually put the destructor up toward the top, below the creates(). > Source/WebCore/html/URLSearchParams.h:38 > + void URLDestroyed() { m_associatedURL = nullptr; } initial capital letter makes me sad. associatedURLDestroyed()? WeakPtr<>?
Alex Christensen
Comment 22 2016-09-20 13:16:12 PDT
Alex Christensen
Comment 23 2016-09-20 15:21:41 PDT
Note You need to log in before you can comment on or make changes to this bug.