Deleting last URLSearchParams key should remove trailing ? in associated URL
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 13 Jul 2017 18:21:48 +0000 (18:21 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 13 Jul 2017 18:21:48 +0000 (18:21 +0000)
commitd2c27f682e00fdd005e2595bd3f5d3e3e0db667f
treed461cde119ac467db12b7006b1d98800b5e6b2ab
parent9a8181e09950a3b511428b2ed2e1a865273802e1
Deleting last URLSearchParams key should remove trailing ? in associated URL
https://bugs.webkit.org/show_bug.cgi?id=174465

Patch by Alex Christensen <achristensen@webkit.org> on 2017-07-13
Reviewed by Chris Dumez.

Source/WebCore:

This makes us match the behavior of Chrome and Firefox, and the spec after https://github.com/whatwg/url/issues/332 is approved.
This will be covered by an upcoming web platform test, and I updated fast/dom/DOMURL/searchparams.html to cover it now.

* platform/URLParser.cpp:
(WebCore::URLParser::serialize):
If there are no tuples, serialize to the null string instead of a non-null empty string.
This makes it so URL::setQuery removes the ?

LayoutTests:

* fast/dom/DOMURL/searchparams-expected.txt:
* fast/dom/DOMURL/searchparams.html:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@219458 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/fast/dom/DOMURL/searchparams-expected.txt
LayoutTests/fast/dom/DOMURL/searchparams.html
Source/WebCore/ChangeLog
Source/WebCore/platform/URLParser.cpp