Make URLSearchParams spec-compliant
authorachristensen@apple.com <achristensen@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 20 Sep 2016 20:11:54 +0000 (20:11 +0000)
committerachristensen@apple.com <achristensen@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 20 Sep 2016 20:11:54 +0000 (20:11 +0000)
commit035c0ac1f56856ae8dd63915fb4cd8de8b1171dc
treedb229cfa49d1246b813c84fd2417b993cd058f39
parent9806a38db250a151f1a6ded65d853e89986ac58f
Make URLSearchParams spec-compliant
https://bugs.webkit.org/show_bug.cgi?id=162247

Reviewed by Chris Dumez and Sam Weinig.

LayoutTests/imported/w3c:

* web-platform-tests/url/url-constructor-expected.txt:

Source/WebCore:

Covered by newly-passing web platform tests.

* html/DOMURL.cpp:
(WebCore::DOMURL::~DOMURL):
(WebCore::DOMURL::setHref):
(WebCore::DOMURL::setQuery):
Update any associated URLSearchParams object when the query could change.
(WebCore::DOMURL::searchParams):
The lifetime of the URLSearchParams was wrong.  We were creating a new URLSearchParams each time
URL.searchParams was called, and we should have been creating one the first time and returning the
same instance for subsequent calls.  This means the DOMURL must own the URLSearchParams if it is associated,
but if it is not associated, then a URLSearchParams can live on its own.
* html/DOMURL.h:
* html/URLSearchParams.h:
(WebCore::URLSearchParams::URLDestroyed):
(WebCore::URLSearchParams::setContents):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206168 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/imported/w3c/ChangeLog
LayoutTests/imported/w3c/web-platform-tests/url/url-constructor-expected.txt
Source/WebCore/ChangeLog
Source/WebCore/html/DOMURL.cpp
Source/WebCore/html/DOMURL.h
Source/WebCore/html/URLSearchParams.cpp
Source/WebCore/html/URLSearchParams.h