Title: [205893] trunk
Revision
205893
Author
achristen...@apple.com
Date
2016-09-13 18:34:27 -0700 (Tue, 13 Sep 2016)

Log Message

Implement URLSearchParams
https://bugs.webkit.org/show_bug.cgi?id=161920

Reviewed by Chris Dumez.

LayoutTests/imported/w3c:

* web-platform-tests/XMLHttpRequest/send-usp-expected.txt:
* web-platform-tests/fetch/api/request/request-init-002-expected.txt:
* web-platform-tests/fetch/api/response/response-init-002-expected.txt:
* web-platform-tests/url/interfaces-expected.txt:
* web-platform-tests/url/url-constructor-expected.txt:
* web-platform-tests/url/urlsearchparams-append-expected.txt:
* web-platform-tests/url/urlsearchparams-constructor-expected.txt:
* web-platform-tests/url/urlsearchparams-delete-expected.txt:
* web-platform-tests/url/urlsearchparams-get-expected.txt:
* web-platform-tests/url/urlsearchparams-getall-expected.txt:
* web-platform-tests/url/urlsearchparams-has-expected.txt:
* web-platform-tests/url/urlsearchparams-set-expected.txt:
* web-platform-tests/url/urlsearchparams-stringifier-expected.txt:

Source/WebCore:

Covered by newly passing web platform tests.

* CMakeLists.txt:
* DerivedSources.make:
* WebCore.xcodeproj/project.pbxproj:
* html/DOMURL.cpp:
(WebCore::DOMURL::setQuery):
(WebCore::DOMURL::searchParams):
* html/DOMURL.h:
* html/URLSearchParams.cpp: Added.
(WebCore::URLSearchParams::URLSearchParams):
(WebCore::URLSearchParams::get):
(WebCore::URLSearchParams::has):
(WebCore::URLSearchParams::set):
(WebCore::URLSearchParams::append):
(WebCore::URLSearchParams::getAll):
(WebCore::URLSearchParams::remove):
(WebCore::URLSearchParams::toString):
(WebCore::URLSearchParams::updateURL):
(WebCore::URLSearchParams::Iterator::Iterator):
* html/URLSearchParams.h: Added.
(WebCore::URLSearchParams::create):
(WebCore::URLSearchParams::createIterator):
* html/URLSearchParams.idl: Added.
* html/URLUtils.idl:
* platform/URLParser.cpp:
(WebCore::percentDecode):
(WebCore::URLParser::parseHost):
(WebCore::formURLDecode):
(WebCore::serializeURLEncodedForm):
(WebCore::URLParser::serialize):
* platform/URLParser.h:

Source/WTF:

* wtf/text/StringView.h:
(WTF::StringView::split): Added.

LayoutTests:

* js/dom/global-constructors-attributes-dedicated-worker-expected.txt:
* platform/mac-wk1/js/dom/global-constructors-attributes-expected.txt:
* platform/mac/imported/w3c/web-platform-tests/XMLHttpRequest/setrequestheader-content-type-expected.txt:

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (205892 => 205893)


--- trunk/LayoutTests/ChangeLog	2016-09-14 00:38:57 UTC (rev 205892)
+++ trunk/LayoutTests/ChangeLog	2016-09-14 01:34:27 UTC (rev 205893)
@@ -1,3 +1,14 @@
+2016-09-13  Alex Christensen  <achristen...@webkit.org>
+
+        Implement URLSearchParams
+        https://bugs.webkit.org/show_bug.cgi?id=161920
+
+        Reviewed by Chris Dumez.
+
+        * js/dom/global-constructors-attributes-dedicated-worker-expected.txt:
+        * platform/mac-wk1/js/dom/global-constructors-attributes-expected.txt:
+        * platform/mac/imported/w3c/web-platform-tests/XMLHttpRequest/setrequestheader-content-type-expected.txt:
+
 2016-09-13  Jer Noble  <jer.no...@apple.com>
 
         [media-source] MediaSource.addSourceBuffer(null) should throw an exception

Added: trunk/LayoutTests/fast/dom/DOMURL/searchparams-expected.txt (0 => 205893)


--- trunk/LayoutTests/fast/dom/DOMURL/searchparams-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/dom/DOMURL/searchparams-expected.txt	2016-09-14 01:34:27 UTC (rev 205893)
@@ -0,0 +1,3 @@
+CONSOLE MESSAGE: line 8: PASS
+CONSOLE MESSAGE: line 11: PASS
+

Added: trunk/LayoutTests/fast/dom/DOMURL/searchparams.html (0 => 205893)


--- trunk/LayoutTests/fast/dom/DOMURL/searchparams.html	                        (rev 0)
+++ trunk/LayoutTests/fast/dom/DOMURL/searchparams.html	2016-09-14 01:34:27 UTC (rev 205893)
@@ -0,0 +1,12 @@
+<script>
+if (window.testRunner)
+    testRunner.dumpAsText();
+var u = new URL("http://example.com?q=foo");
+u.searchParams.foo = 1;
+if (window.GCController)
+	GCController.collect();
+console.log(u.searchParams.foo == 1 ? "PASS" : "FAIL");
+
+var x = new URLSearchParams("a=ß");
+console.log(x == "a=%C3%83%C5%B8" ? "PASS" : "FAIL");
+</script>

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (205892 => 205893)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2016-09-14 00:38:57 UTC (rev 205892)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2016-09-14 01:34:27 UTC (rev 205893)
@@ -1,3 +1,24 @@
+2016-09-13  Alex Christensen  <achristen...@webkit.org>
+
+        Implement URLSearchParams
+        https://bugs.webkit.org/show_bug.cgi?id=161920
+
+        Reviewed by Chris Dumez.
+
+        * web-platform-tests/XMLHttpRequest/send-usp-expected.txt:
+        * web-platform-tests/fetch/api/request/request-init-002-expected.txt:
+        * web-platform-tests/fetch/api/response/response-init-002-expected.txt:
+        * web-platform-tests/url/interfaces-expected.txt:
+        * web-platform-tests/url/url-constructor-expected.txt:
+        * web-platform-tests/url/urlsearchparams-append-expected.txt:
+        * web-platform-tests/url/urlsearchparams-constructor-expected.txt:
+        * web-platform-tests/url/urlsearchparams-delete-expected.txt:
+        * web-platform-tests/url/urlsearchparams-get-expected.txt:
+        * web-platform-tests/url/urlsearchparams-getall-expected.txt:
+        * web-platform-tests/url/urlsearchparams-has-expected.txt:
+        * web-platform-tests/url/urlsearchparams-set-expected.txt:
+        * web-platform-tests/url/urlsearchparams-stringifier-expected.txt:
+
 2016-09-13  Chris Dumez  <cdu...@apple.com>
 
         Drop support for <isindex>

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/send-usp-expected.txt (205892 => 205893)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/send-usp-expected.txt	2016-09-14 00:38:57 UTC (rev 205892)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/send-usp-expected.txt	2016-09-14 01:34:27 UTC (rev 205893)
@@ -1,134 +1,131 @@
-CONSOLE MESSAGE: line 43: ReferenceError: Can't find variable: URLSearchParams
 
-Harness Error (FAIL), message = ReferenceError: Can't find variable: URLSearchParams
+PASS Overall fetch with URLSearchParams 
+PASS XMLHttpRequest.send(URLSearchParams) (0) 
+PASS XMLHttpRequest.send(URLSearchParams) (1) 
+PASS XMLHttpRequest.send(URLSearchParams) (2) 
+PASS XMLHttpRequest.send(URLSearchParams) (3) 
+PASS XMLHttpRequest.send(URLSearchParams) (4) 
+PASS XMLHttpRequest.send(URLSearchParams) (5) 
+PASS XMLHttpRequest.send(URLSearchParams) (6) 
+PASS XMLHttpRequest.send(URLSearchParams) (7) 
+PASS XMLHttpRequest.send(URLSearchParams) (8) 
+PASS XMLHttpRequest.send(URLSearchParams) (9) 
+PASS XMLHttpRequest.send(URLSearchParams) (10) 
+PASS XMLHttpRequest.send(URLSearchParams) (11) 
+PASS XMLHttpRequest.send(URLSearchParams) (12) 
+PASS XMLHttpRequest.send(URLSearchParams) (13) 
+PASS XMLHttpRequest.send(URLSearchParams) (14) 
+PASS XMLHttpRequest.send(URLSearchParams) (15) 
+PASS XMLHttpRequest.send(URLSearchParams) (16) 
+PASS XMLHttpRequest.send(URLSearchParams) (17) 
+PASS XMLHttpRequest.send(URLSearchParams) (18) 
+PASS XMLHttpRequest.send(URLSearchParams) (19) 
+PASS XMLHttpRequest.send(URLSearchParams) (20) 
+PASS XMLHttpRequest.send(URLSearchParams) (21) 
+PASS XMLHttpRequest.send(URLSearchParams) (22) 
+PASS XMLHttpRequest.send(URLSearchParams) (23) 
+PASS XMLHttpRequest.send(URLSearchParams) (24) 
+PASS XMLHttpRequest.send(URLSearchParams) (25) 
+PASS XMLHttpRequest.send(URLSearchParams) (26) 
+PASS XMLHttpRequest.send(URLSearchParams) (27) 
+PASS XMLHttpRequest.send(URLSearchParams) (28) 
+PASS XMLHttpRequest.send(URLSearchParams) (29) 
+PASS XMLHttpRequest.send(URLSearchParams) (30) 
+PASS XMLHttpRequest.send(URLSearchParams) (31) 
+PASS XMLHttpRequest.send(URLSearchParams) (32) 
+PASS XMLHttpRequest.send(URLSearchParams) (33) 
+PASS XMLHttpRequest.send(URLSearchParams) (34) 
+PASS XMLHttpRequest.send(URLSearchParams) (35) 
+PASS XMLHttpRequest.send(URLSearchParams) (36) 
+PASS XMLHttpRequest.send(URLSearchParams) (37) 
+PASS XMLHttpRequest.send(URLSearchParams) (38) 
+PASS XMLHttpRequest.send(URLSearchParams) (39) 
+PASS XMLHttpRequest.send(URLSearchParams) (40) 
+PASS XMLHttpRequest.send(URLSearchParams) (41) 
+PASS XMLHttpRequest.send(URLSearchParams) (42) 
+PASS XMLHttpRequest.send(URLSearchParams) (43) 
+PASS XMLHttpRequest.send(URLSearchParams) (44) 
+PASS XMLHttpRequest.send(URLSearchParams) (45) 
+PASS XMLHttpRequest.send(URLSearchParams) (46) 
+PASS XMLHttpRequest.send(URLSearchParams) (47) 
+PASS XMLHttpRequest.send(URLSearchParams) (48) 
+PASS XMLHttpRequest.send(URLSearchParams) (49) 
+PASS XMLHttpRequest.send(URLSearchParams) (50) 
+PASS XMLHttpRequest.send(URLSearchParams) (51) 
+PASS XMLHttpRequest.send(URLSearchParams) (52) 
+PASS XMLHttpRequest.send(URLSearchParams) (53) 
+PASS XMLHttpRequest.send(URLSearchParams) (54) 
+PASS XMLHttpRequest.send(URLSearchParams) (55) 
+PASS XMLHttpRequest.send(URLSearchParams) (56) 
+PASS XMLHttpRequest.send(URLSearchParams) (57) 
+PASS XMLHttpRequest.send(URLSearchParams) (58) 
+PASS XMLHttpRequest.send(URLSearchParams) (59) 
+PASS XMLHttpRequest.send(URLSearchParams) (60) 
+PASS XMLHttpRequest.send(URLSearchParams) (61) 
+PASS XMLHttpRequest.send(URLSearchParams) (62) 
+PASS XMLHttpRequest.send(URLSearchParams) (63) 
+PASS XMLHttpRequest.send(URLSearchParams) (64) 
+PASS XMLHttpRequest.send(URLSearchParams) (65) 
+PASS XMLHttpRequest.send(URLSearchParams) (66) 
+PASS XMLHttpRequest.send(URLSearchParams) (67) 
+PASS XMLHttpRequest.send(URLSearchParams) (68) 
+PASS XMLHttpRequest.send(URLSearchParams) (69) 
+PASS XMLHttpRequest.send(URLSearchParams) (70) 
+PASS XMLHttpRequest.send(URLSearchParams) (71) 
+PASS XMLHttpRequest.send(URLSearchParams) (72) 
+PASS XMLHttpRequest.send(URLSearchParams) (73) 
+PASS XMLHttpRequest.send(URLSearchParams) (74) 
+PASS XMLHttpRequest.send(URLSearchParams) (75) 
+PASS XMLHttpRequest.send(URLSearchParams) (76) 
+PASS XMLHttpRequest.send(URLSearchParams) (77) 
+PASS XMLHttpRequest.send(URLSearchParams) (78) 
+PASS XMLHttpRequest.send(URLSearchParams) (79) 
+PASS XMLHttpRequest.send(URLSearchParams) (80) 
+PASS XMLHttpRequest.send(URLSearchParams) (81) 
+PASS XMLHttpRequest.send(URLSearchParams) (82) 
+PASS XMLHttpRequest.send(URLSearchParams) (83) 
+PASS XMLHttpRequest.send(URLSearchParams) (84) 
+PASS XMLHttpRequest.send(URLSearchParams) (85) 
+PASS XMLHttpRequest.send(URLSearchParams) (86) 
+PASS XMLHttpRequest.send(URLSearchParams) (87) 
+PASS XMLHttpRequest.send(URLSearchParams) (88) 
+PASS XMLHttpRequest.send(URLSearchParams) (89) 
+PASS XMLHttpRequest.send(URLSearchParams) (90) 
+PASS XMLHttpRequest.send(URLSearchParams) (91) 
+PASS XMLHttpRequest.send(URLSearchParams) (92) 
+PASS XMLHttpRequest.send(URLSearchParams) (93) 
+PASS XMLHttpRequest.send(URLSearchParams) (94) 
+PASS XMLHttpRequest.send(URLSearchParams) (95) 
+PASS XMLHttpRequest.send(URLSearchParams) (96) 
+PASS XMLHttpRequest.send(URLSearchParams) (97) 
+PASS XMLHttpRequest.send(URLSearchParams) (98) 
+PASS XMLHttpRequest.send(URLSearchParams) (99) 
+PASS XMLHttpRequest.send(URLSearchParams) (100) 
+PASS XMLHttpRequest.send(URLSearchParams) (101) 
+PASS XMLHttpRequest.send(URLSearchParams) (102) 
+PASS XMLHttpRequest.send(URLSearchParams) (103) 
+PASS XMLHttpRequest.send(URLSearchParams) (104) 
+PASS XMLHttpRequest.send(URLSearchParams) (105) 
+PASS XMLHttpRequest.send(URLSearchParams) (106) 
+PASS XMLHttpRequest.send(URLSearchParams) (107) 
+PASS XMLHttpRequest.send(URLSearchParams) (108) 
+PASS XMLHttpRequest.send(URLSearchParams) (109) 
+PASS XMLHttpRequest.send(URLSearchParams) (110) 
+PASS XMLHttpRequest.send(URLSearchParams) (111) 
+PASS XMLHttpRequest.send(URLSearchParams) (112) 
+PASS XMLHttpRequest.send(URLSearchParams) (113) 
+PASS XMLHttpRequest.send(URLSearchParams) (114) 
+PASS XMLHttpRequest.send(URLSearchParams) (115) 
+PASS XMLHttpRequest.send(URLSearchParams) (116) 
+PASS XMLHttpRequest.send(URLSearchParams) (117) 
+PASS XMLHttpRequest.send(URLSearchParams) (118) 
+PASS XMLHttpRequest.send(URLSearchParams) (119) 
+PASS XMLHttpRequest.send(URLSearchParams) (120) 
+PASS XMLHttpRequest.send(URLSearchParams) (121) 
+PASS XMLHttpRequest.send(URLSearchParams) (122) 
+PASS XMLHttpRequest.send(URLSearchParams) (123) 
+PASS XMLHttpRequest.send(URLSearchParams) (124) 
+PASS XMLHttpRequest.send(URLSearchParams) (125) 
+PASS XMLHttpRequest.send(URLSearchParams) (126) 
+PASS XMLHttpRequest.send(URLSearchParams) (127) 
 
-NOTRUN Overall fetch with URLSearchParams 
-NOTRUN XMLHttpRequest.send(URLSearchParams) (0) 
-NOTRUN XMLHttpRequest.send(URLSearchParams) (1) 
-NOTRUN XMLHttpRequest.send(URLSearchParams) (2) 
-NOTRUN XMLHttpRequest.send(URLSearchParams) (3) 
-NOTRUN XMLHttpRequest.send(URLSearchParams) (4) 
-NOTRUN XMLHttpRequest.send(URLSearchParams) (5) 
-NOTRUN XMLHttpRequest.send(URLSearchParams) (6) 
-NOTRUN XMLHttpRequest.send(URLSearchParams) (7) 
-NOTRUN XMLHttpRequest.send(URLSearchParams) (8) 
-NOTRUN XMLHttpRequest.send(URLSearchParams) (9) 
-NOTRUN XMLHttpRequest.send(URLSearchParams) (10) 
-NOTRUN XMLHttpRequest.send(URLSearchParams) (11) 
-NOTRUN XMLHttpRequest.send(URLSearchParams) (12) 
-NOTRUN XMLHttpRequest.send(URLSearchParams) (13) 
-NOTRUN XMLHttpRequest.send(URLSearchParams) (14) 
-NOTRUN XMLHttpRequest.send(URLSearchParams) (15) 
-NOTRUN XMLHttpRequest.send(URLSearchParams) (16) 
-NOTRUN XMLHttpRequest.send(URLSearchParams) (17) 
-NOTRUN XMLHttpRequest.send(URLSearchParams) (18) 
-NOTRUN XMLHttpRequest.send(URLSearchParams) (19) 
-NOTRUN XMLHttpRequest.send(URLSearchParams) (20) 
-NOTRUN XMLHttpRequest.send(URLSearchParams) (21) 
-NOTRUN XMLHttpRequest.send(URLSearchParams) (22) 
-NOTRUN XMLHttpRequest.send(URLSearchParams) (23) 
-NOTRUN XMLHttpRequest.send(URLSearchParams) (24) 
-NOTRUN XMLHttpRequest.send(URLSearchParams) (25) 
-NOTRUN XMLHttpRequest.send(URLSearchParams) (26) 
-NOTRUN XMLHttpRequest.send(URLSearchParams) (27) 
-NOTRUN XMLHttpRequest.send(URLSearchParams) (28) 
-NOTRUN XMLHttpRequest.send(URLSearchParams) (29) 
-NOTRUN XMLHttpRequest.send(URLSearchParams) (30) 
-NOTRUN XMLHttpRequest.send(URLSearchParams) (31) 
-NOTRUN XMLHttpRequest.send(URLSearchParams) (32) 
-NOTRUN XMLHttpRequest.send(URLSearchParams) (33) 
-NOTRUN XMLHttpRequest.send(URLSearchParams) (34) 
-NOTRUN XMLHttpRequest.send(URLSearchParams) (35) 
-NOTRUN XMLHttpRequest.send(URLSearchParams) (36) 
-NOTRUN XMLHttpRequest.send(URLSearchParams) (37) 
-NOTRUN XMLHttpRequest.send(URLSearchParams) (38) 
-NOTRUN XMLHttpRequest.send(URLSearchParams) (39) 
-NOTRUN XMLHttpRequest.send(URLSearchParams) (40) 
-NOTRUN XMLHttpRequest.send(URLSearchParams) (41) 
-NOTRUN XMLHttpRequest.send(URLSearchParams) (42) 
-NOTRUN XMLHttpRequest.send(URLSearchParams) (43) 
-NOTRUN XMLHttpRequest.send(URLSearchParams) (44) 
-NOTRUN XMLHttpRequest.send(URLSearchParams) (45) 
-NOTRUN XMLHttpRequest.send(URLSearchParams) (46) 
-NOTRUN XMLHttpRequest.send(URLSearchParams) (47) 
-NOTRUN XMLHttpRequest.send(URLSearchParams) (48) 
-NOTRUN XMLHttpRequest.send(URLSearchParams) (49) 
-NOTRUN XMLHttpRequest.send(URLSearchParams) (50) 
-NOTRUN XMLHttpRequest.send(URLSearchParams) (51) 
-NOTRUN XMLHttpRequest.send(URLSearchParams) (52) 
-NOTRUN XMLHttpRequest.send(URLSearchParams) (53) 
-NOTRUN XMLHttpRequest.send(URLSearchParams) (54) 
-NOTRUN XMLHttpRequest.send(URLSearchParams) (55) 
-NOTRUN XMLHttpRequest.send(URLSearchParams) (56) 
-NOTRUN XMLHttpRequest.send(URLSearchParams) (57) 
-NOTRUN XMLHttpRequest.send(URLSearchParams) (58) 
-NOTRUN XMLHttpRequest.send(URLSearchParams) (59) 
-NOTRUN XMLHttpRequest.send(URLSearchParams) (60) 
-NOTRUN XMLHttpRequest.send(URLSearchParams) (61) 
-NOTRUN XMLHttpRequest.send(URLSearchParams) (62) 
-NOTRUN XMLHttpRequest.send(URLSearchParams) (63) 
-NOTRUN XMLHttpRequest.send(URLSearchParams) (64) 
-NOTRUN XMLHttpRequest.send(URLSearchParams) (65) 
-NOTRUN XMLHttpRequest.send(URLSearchParams) (66) 
-NOTRUN XMLHttpRequest.send(URLSearchParams) (67) 
-NOTRUN XMLHttpRequest.send(URLSearchParams) (68) 
-NOTRUN XMLHttpRequest.send(URLSearchParams) (69) 
-NOTRUN XMLHttpRequest.send(URLSearchParams) (70) 
-NOTRUN XMLHttpRequest.send(URLSearchParams) (71) 
-NOTRUN XMLHttpRequest.send(URLSearchParams) (72) 
-NOTRUN XMLHttpRequest.send(URLSearchParams) (73) 
-NOTRUN XMLHttpRequest.send(URLSearchParams) (74) 
-NOTRUN XMLHttpRequest.send(URLSearchParams) (75) 
-NOTRUN XMLHttpRequest.send(URLSearchParams) (76) 
-NOTRUN XMLHttpRequest.send(URLSearchParams) (77) 
-NOTRUN XMLHttpRequest.send(URLSearchParams) (78) 
-NOTRUN XMLHttpRequest.send(URLSearchParams) (79) 
-NOTRUN XMLHttpRequest.send(URLSearchParams) (80) 
-NOTRUN XMLHttpRequest.send(URLSearchParams) (81) 
-NOTRUN XMLHttpRequest.send(URLSearchParams) (82) 
-NOTRUN XMLHttpRequest.send(URLSearchParams) (83) 
-NOTRUN XMLHttpRequest.send(URLSearchParams) (84) 
-NOTRUN XMLHttpRequest.send(URLSearchParams) (85) 
-NOTRUN XMLHttpRequest.send(URLSearchParams) (86) 
-NOTRUN XMLHttpRequest.send(URLSearchParams) (87) 
-NOTRUN XMLHttpRequest.send(URLSearchParams) (88) 
-NOTRUN XMLHttpRequest.send(URLSearchParams) (89) 
-NOTRUN XMLHttpRequest.send(URLSearchParams) (90) 
-NOTRUN XMLHttpRequest.send(URLSearchParams) (91) 
-NOTRUN XMLHttpRequest.send(URLSearchParams) (92) 
-NOTRUN XMLHttpRequest.send(URLSearchParams) (93) 
-NOTRUN XMLHttpRequest.send(URLSearchParams) (94) 
-NOTRUN XMLHttpRequest.send(URLSearchParams) (95) 
-NOTRUN XMLHttpRequest.send(URLSearchParams) (96) 
-NOTRUN XMLHttpRequest.send(URLSearchParams) (97) 
-NOTRUN XMLHttpRequest.send(URLSearchParams) (98) 
-NOTRUN XMLHttpRequest.send(URLSearchParams) (99) 
-NOTRUN XMLHttpRequest.send(URLSearchParams) (100) 
-NOTRUN XMLHttpRequest.send(URLSearchParams) (101) 
-NOTRUN XMLHttpRequest.send(URLSearchParams) (102) 
-NOTRUN XMLHttpRequest.send(URLSearchParams) (103) 
-NOTRUN XMLHttpRequest.send(URLSearchParams) (104) 
-NOTRUN XMLHttpRequest.send(URLSearchParams) (105) 
-NOTRUN XMLHttpRequest.send(URLSearchParams) (106) 
-NOTRUN XMLHttpRequest.send(URLSearchParams) (107) 
-NOTRUN XMLHttpRequest.send(URLSearchParams) (108) 
-NOTRUN XMLHttpRequest.send(URLSearchParams) (109) 
-NOTRUN XMLHttpRequest.send(URLSearchParams) (110) 
-NOTRUN XMLHttpRequest.send(URLSearchParams) (111) 
-NOTRUN XMLHttpRequest.send(URLSearchParams) (112) 
-NOTRUN XMLHttpRequest.send(URLSearchParams) (113) 
-NOTRUN XMLHttpRequest.send(URLSearchParams) (114) 
-NOTRUN XMLHttpRequest.send(URLSearchParams) (115) 
-NOTRUN XMLHttpRequest.send(URLSearchParams) (116) 
-NOTRUN XMLHttpRequest.send(URLSearchParams) (117) 
-NOTRUN XMLHttpRequest.send(URLSearchParams) (118) 
-NOTRUN XMLHttpRequest.send(URLSearchParams) (119) 
-NOTRUN XMLHttpRequest.send(URLSearchParams) (120) 
-NOTRUN XMLHttpRequest.send(URLSearchParams) (121) 
-NOTRUN XMLHttpRequest.send(URLSearchParams) (122) 
-NOTRUN XMLHttpRequest.send(URLSearchParams) (123) 
-NOTRUN XMLHttpRequest.send(URLSearchParams) (124) 
-NOTRUN XMLHttpRequest.send(URLSearchParams) (125) 
-NOTRUN XMLHttpRequest.send(URLSearchParams) (126) 
-NOTRUN XMLHttpRequest.send(URLSearchParams) (127) 
-

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-init-002-expected.txt (205892 => 205893)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-init-002-expected.txt	2016-09-14 00:38:57 UTC (rev 205892)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-init-002-expected.txt	2016-09-14 01:34:27 UTC (rev 205893)
@@ -5,5 +5,5 @@
 PASS Initialize Request's body with application/octet-binary 
 FAIL Initialize Request's body with multipart/form-data promise_test: Unhandled rejection with value: undefined
 PASS Initialize Request's body with text/plain;charset=UTF-8 
-FAIL Initialize Request's body with application/x-www-form-urlencoded;charset=UTF-8 promise_test: Unhandled rejection with value: "URLSearchParams not supported"
+FAIL Initialize Request's body with application/x-www-form-urlencoded;charset=UTF-8 Type error
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-init-002-expected.txt (205892 => 205893)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-init-002-expected.txt	2016-09-14 00:38:57 UTC (rev 205892)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-init-002-expected.txt	2016-09-14 01:34:27 UTC (rev 205893)
@@ -2,7 +2,7 @@
 PASS Initialize Response with headers values 
 PASS Initialize Response's body with application/octet-binary 
 FAIL Initialize Response's body with multipart/form-data promise_test: Unhandled rejection with value: undefined
-FAIL Initialize Response's body with application/x-www-form-urlencoded;charset=UTF-8 assert_true: Content-Type header should be "application/x-www-form-urlencoded;charset=UTF-8"  expected true got false
+FAIL Initialize Response's body with application/x-www-form-urlencoded;charset=UTF-8 assert_true: Content-Type header should be "application/x-www-form-urlencoded;charset=UTF-8"  expected true got null
 PASS Initialize Response's body with text/plain;charset=UTF-8 
 PASS Read Response's body as readableStream 
 PASS Testing empty Response Content-Type header 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/url/interfaces-expected.txt (205892 => 205893)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/url/interfaces-expected.txt	2016-09-14 00:38:57 UTC (rev 205892)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/url/interfaces-expected.txt	2016-09-14 01:34:27 UTC (rev 205893)
@@ -19,7 +19,7 @@
 PASS URL interface: attribute port 
 PASS URL interface: attribute pathname 
 PASS URL interface: attribute search 
-FAIL URL interface: attribute searchParams assert_true: The prototype object must have a property "searchParams" expected true got false
+PASS URL interface: attribute searchParams 
 PASS URL interface: attribute hash 
 PASS URL must be primary interface of new URL("http://foo") 
 PASS Stringification of new URL("http://foo") 
@@ -37,18 +37,18 @@
 PASS URL interface: new URL("http://foo") must inherit property "port" with the proper type (9) 
 PASS URL interface: new URL("http://foo") must inherit property "pathname" with the proper type (10) 
 PASS URL interface: new URL("http://foo") must inherit property "search" with the proper type (11) 
-FAIL URL interface: new URL("http://foo") must inherit property "searchParams" with the proper type (12) assert_inherits: property "searchParams" not found in prototype chain
+PASS URL interface: new URL("http://foo") must inherit property "searchParams" with the proper type (12) 
 PASS URL interface: new URL("http://foo") must inherit property "hash" with the proper type (13) 
-FAIL URLSearchParams interface: existence and properties of interface object assert_own_property: self does not have own property "URLSearchParams" expected property "URLSearchParams" missing
-FAIL URLSearchParams interface object length assert_own_property: self does not have own property "URLSearchParams" expected property "URLSearchParams" missing
-FAIL URLSearchParams interface object name assert_own_property: self does not have own property "URLSearchParams" expected property "URLSearchParams" missing
-FAIL URLSearchParams interface: existence and properties of interface prototype object assert_own_property: self does not have own property "URLSearchParams" expected property "URLSearchParams" missing
-FAIL URLSearchParams interface: existence and properties of interface prototype object's "constructor" property assert_own_property: self does not have own property "URLSearchParams" expected property "URLSearchParams" missing
-FAIL URLSearchParams interface: operation append(USVString,USVString) assert_own_property: self does not have own property "URLSearchParams" expected property "URLSearchParams" missing
-FAIL URLSearchParams interface: operation delete(USVString) assert_own_property: self does not have own property "URLSearchParams" expected property "URLSearchParams" missing
-FAIL URLSearchParams interface: operation get(USVString) assert_own_property: self does not have own property "URLSearchParams" expected property "URLSearchParams" missing
-FAIL URLSearchParams interface: operation getAll(USVString) assert_own_property: self does not have own property "URLSearchParams" expected property "URLSearchParams" missing
-FAIL URLSearchParams interface: operation has(USVString) assert_own_property: self does not have own property "URLSearchParams" expected property "URLSearchParams" missing
-FAIL URLSearchParams interface: operation set(USVString,USVString) assert_own_property: self does not have own property "URLSearchParams" expected property "URLSearchParams" missing
-FAIL URLSearchParams interface: stringifier assert_own_property: self does not have own property "URLSearchParams" expected property "URLSearchParams" missing
+PASS URLSearchParams interface: existence and properties of interface object 
+PASS URLSearchParams interface object length 
+PASS URLSearchParams interface object name 
+PASS URLSearchParams interface: existence and properties of interface prototype object 
+PASS URLSearchParams interface: existence and properties of interface prototype object's "constructor" property 
+PASS URLSearchParams interface: operation append(USVString,USVString) 
+PASS URLSearchParams interface: operation delete(USVString) 
+PASS URLSearchParams interface: operation get(USVString) 
+PASS URLSearchParams interface: operation getAll(USVString) 
+PASS URLSearchParams interface: operation has(USVString) 
+PASS URLSearchParams interface: operation set(USVString,USVString) 
+PASS URLSearchParams interface: stringifier 
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/url/url-constructor-expected.txt (205892 => 205893)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/url/url-constructor-expected.txt	2016-09-14 00:38:57 UTC (rev 205892)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/url/url-constructor-expected.txt	2016-09-14 01:34:27 UTC (rev 205893)
@@ -1,8 +1,8 @@
 
-FAIL URL.searchParams getter assert_true: expected true got false
-FAIL URL.searchParams updating, clearing assert_true: expected true got false
-FAIL URL.searchParams setter, invalid values assert_throws: function "function () { url.searchParams = new URLSearchParams(urlS..." threw object "ReferenceError: Can't find variable: URLSearchParams" ("ReferenceError") expected object "TypeError" ("TypeError")
-FAIL URL.searchParams and URL.search setters, update propagation assert_true: expected true got false
+PASS URL.searchParams getter 
+FAIL URL.searchParams updating, clearing assert_equals: expected "" but got "a=b"
+PASS URL.searchParams setter, invalid values 
+FAIL URL.searchParams and URL.search setters, update propagation assert_equals: expected "e=f&g=h" but got "a=b&c=d"
 PASS Loading data… 
 PASS Parsing: <http://example	.
 org> against <http://example.org/foo/bar> 
@@ -349,9 +349,9 @@
 ry#f	r
 a
 g> against <about:blank> 
-FAIL Parsing: <?a=b&c=d> against <http://example.org/foo/bar> assert_true: expected true got false
-FAIL Parsing: <??a=b&c=d> against <http://example.org/foo/bar> assert_true: expected true got false
-FAIL Parsing: <http:> against <http://example.org/foo/bar> assert_true: expected true got false
+PASS Parsing: <?a=b&c=d> against <http://example.org/foo/bar> 
+FAIL Parsing: <??a=b&c=d> against <http://example.org/foo/bar> assert_equals: searchParams expected "%3Fa=b&c=d" but got "a=b&c=d"
+PASS Parsing: <http:> against <http://example.org/foo/bar> 
 FAIL Parsing: <http:> against <https://example.org/foo/bar> assert_throws: function "function () {
           bURL(expected.input, expected.bas..." did not throw
 FAIL Parsing: <sc:> against <https://example.org/foo/bar> assert_equals: origin expected "null" but got "sc://"

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/url/urlsearchparams-append-expected.txt (205892 => 205893)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/url/urlsearchparams-append-expected.txt	2016-09-14 00:38:57 UTC (rev 205892)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/url/urlsearchparams-append-expected.txt	2016-09-14 01:34:27 UTC (rev 205893)
@@ -1,6 +1,6 @@
 
-FAIL Append same name Can't find variable: URLSearchParams
-FAIL Append empty strings Can't find variable: URLSearchParams
-FAIL Append null Can't find variable: URLSearchParams
-FAIL Append multiple Can't find variable: URLSearchParams
+PASS Append same name 
+PASS Append empty strings 
+PASS Append null 
+PASS Append multiple 
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/url/urlsearchparams-constructor-expected.txt (205892 => 205893)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/url/urlsearchparams-constructor-expected.txt	2016-09-14 00:38:57 UTC (rev 205892)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/url/urlsearchparams-constructor-expected.txt	2016-09-14 01:34:27 UTC (rev 205893)
@@ -1,15 +1,15 @@
 
-FAIL Basic URLSearchParams construction Can't find variable: URLSearchParams
-FAIL URLSearchParams constructor, empty. assert_throws: Calling 'URLSearchParams' without 'new' should throw. function "function () { URLSearchParams(); }" threw object "ReferenceError: Can't find variable: URLSearchParams" ("ReferenceError") expected object "TypeError" ("TypeError")
-FAIL URLSearchParams constructor, string. Can't find variable: URLSearchParams
-FAIL URLSearchParams constructor, object. Can't find variable: URLSearchParams
-FAIL Parse + Can't find variable: URLSearchParams
-FAIL Parse space Can't find variable: URLSearchParams
-FAIL Parse %20 Can't find variable: URLSearchParams
-FAIL Parse \0 Can't find variable: URLSearchParams
-FAIL Parse %00 Can't find variable: URLSearchParams
-FAIL Parse βŽ„ Can't find variable: URLSearchParams
-FAIL Parse %e2%8e%84 Can't find variable: URLSearchParams
-FAIL Parse πŸ’© Can't find variable: URLSearchParams
-FAIL Parse %f0%9f%92%a9 Can't find variable: URLSearchParams
+PASS Basic URLSearchParams construction 
+PASS URLSearchParams constructor, empty. 
+PASS URLSearchParams constructor, string. 
+PASS URLSearchParams constructor, object. 
+PASS Parse + 
+PASS Parse space 
+PASS Parse %20 
+PASS Parse \0 
+PASS Parse %00 
+PASS Parse βŽ„ 
+PASS Parse %e2%8e%84 
+PASS Parse πŸ’© 
+PASS Parse %f0%9f%92%a9 
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/url/urlsearchparams-delete-expected.txt (205892 => 205893)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/url/urlsearchparams-delete-expected.txt	2016-09-14 00:38:57 UTC (rev 205892)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/url/urlsearchparams-delete-expected.txt	2016-09-14 01:34:27 UTC (rev 205893)
@@ -1,4 +1,4 @@
 
-FAIL Delete basics Can't find variable: URLSearchParams
-FAIL Deleting appended multiple Can't find variable: URLSearchParams
+PASS Delete basics 
+PASS Deleting appended multiple 
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/url/urlsearchparams-get-expected.txt (205892 => 205893)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/url/urlsearchparams-get-expected.txt	2016-09-14 00:38:57 UTC (rev 205892)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/url/urlsearchparams-get-expected.txt	2016-09-14 01:34:27 UTC (rev 205893)
@@ -1,4 +1,4 @@
 
-FAIL Get basics Can't find variable: URLSearchParams
-FAIL More get() basics Can't find variable: URLSearchParams
+PASS Get basics 
+PASS More get() basics 
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/url/urlsearchparams-getall-expected.txt (205892 => 205893)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/url/urlsearchparams-getall-expected.txt	2016-09-14 00:38:57 UTC (rev 205892)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/url/urlsearchparams-getall-expected.txt	2016-09-14 01:34:27 UTC (rev 205893)
@@ -1,4 +1,4 @@
 
-FAIL getAll() basics Can't find variable: URLSearchParams
-FAIL getAll() multiples Can't find variable: URLSearchParams
+PASS getAll() basics 
+PASS getAll() multiples 
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/url/urlsearchparams-has-expected.txt (205892 => 205893)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/url/urlsearchparams-has-expected.txt	2016-09-14 00:38:57 UTC (rev 205892)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/url/urlsearchparams-has-expected.txt	2016-09-14 01:34:27 UTC (rev 205893)
@@ -1,4 +1,4 @@
 
-FAIL Has basics Can't find variable: URLSearchParams
-FAIL has() following delete() Can't find variable: URLSearchParams
+PASS Has basics 
+PASS has() following delete() 
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/url/urlsearchparams-set-expected.txt (205892 => 205893)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/url/urlsearchparams-set-expected.txt	2016-09-14 00:38:57 UTC (rev 205892)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/url/urlsearchparams-set-expected.txt	2016-09-14 01:34:27 UTC (rev 205893)
@@ -1,4 +1,4 @@
 
-FAIL Set basics Can't find variable: URLSearchParams
-FAIL URLSearchParams.set Can't find variable: URLSearchParams
+PASS Set basics 
+PASS URLSearchParams.set 
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/url/urlsearchparams-stringifier-expected.txt (205892 => 205893)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/url/urlsearchparams-stringifier-expected.txt	2016-09-14 00:38:57 UTC (rev 205892)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/url/urlsearchparams-stringifier-expected.txt	2016-09-14 01:34:27 UTC (rev 205893)
@@ -1,14 +1,14 @@
 
-FAIL Serialize space Can't find variable: URLSearchParams
-FAIL Serialize empty value Can't find variable: URLSearchParams
-FAIL Serialize empty name Can't find variable: URLSearchParams
-FAIL Serialize empty name and value Can't find variable: URLSearchParams
-FAIL Serialize + Can't find variable: URLSearchParams
-FAIL Serialize = Can't find variable: URLSearchParams
-FAIL Serialize & Can't find variable: URLSearchParams
-FAIL Serialize *-._ Can't find variable: URLSearchParams
-FAIL Serialize % Can't find variable: URLSearchParams
-FAIL Serialize \0 Can't find variable: URLSearchParams
-FAIL Serialize πŸ’© Can't find variable: URLSearchParams
-FAIL URLSearchParams.toString Can't find variable: URLSearchParams
+PASS Serialize space 
+PASS Serialize empty value 
+PASS Serialize empty name 
+PASS Serialize empty name and value 
+PASS Serialize + 
+PASS Serialize = 
+PASS Serialize & 
+PASS Serialize *-._ 
+PASS Serialize % 
+PASS Serialize \0 
+PASS Serialize πŸ’© 
+PASS URLSearchParams.toString 
 

Modified: trunk/LayoutTests/js/dom/global-constructors-attributes-dedicated-worker-expected.txt (205892 => 205893)


--- trunk/LayoutTests/js/dom/global-constructors-attributes-dedicated-worker-expected.txt	2016-09-14 00:38:57 UTC (rev 205892)
+++ trunk/LayoutTests/js/dom/global-constructors-attributes-dedicated-worker-expected.txt	2016-09-14 01:34:27 UTC (rev 205893)
@@ -244,6 +244,11 @@
 PASS [Worker] Object.getOwnPropertyDescriptor(global, 'URL').hasOwnProperty('set') is false
 PASS [Worker] Object.getOwnPropertyDescriptor(global, 'URL').enumerable is false
 PASS [Worker] Object.getOwnPropertyDescriptor(global, 'URL').configurable is true
+PASS [Worker] Object.getOwnPropertyDescriptor(global, 'URLSearchParams').value is URLSearchParams
+PASS [Worker] Object.getOwnPropertyDescriptor(global, 'URLSearchParams').hasOwnProperty('get') is false
+PASS [Worker] Object.getOwnPropertyDescriptor(global, 'URLSearchParams').hasOwnProperty('set') is false
+PASS [Worker] Object.getOwnPropertyDescriptor(global, 'URLSearchParams').enumerable is false
+PASS [Worker] Object.getOwnPropertyDescriptor(global, 'URLSearchParams').configurable is true
 PASS [Worker] Object.getOwnPropertyDescriptor(global, 'Uint16Array').value is Uint16Array
 PASS [Worker] Object.getOwnPropertyDescriptor(global, 'Uint16Array').hasOwnProperty('get') is false
 PASS [Worker] Object.getOwnPropertyDescriptor(global, 'Uint16Array').hasOwnProperty('set') is false

Modified: trunk/LayoutTests/platform/mac/imported/w3c/web-platform-tests/XMLHttpRequest/setrequestheader-content-type-expected.txt (205892 => 205893)


--- trunk/LayoutTests/platform/mac/imported/w3c/web-platform-tests/XMLHttpRequest/setrequestheader-content-type-expected.txt	2016-09-14 00:38:57 UTC (rev 205892)
+++ trunk/LayoutTests/platform/mac/imported/w3c/web-platform-tests/XMLHttpRequest/setrequestheader-content-type-expected.txt	2016-09-14 01:34:27 UTC (rev 205893)
@@ -28,9 +28,9 @@
 PASS FormData request respects setRequestHeader("") 
 PASS FormData request has correct default Content-Type of "multipart/form-data;boundary=_" 
 PASS FormData request keeps setRequestHeader() Content-Type and charset 
-FAIL URLSearchParams respects setRequestHeader("") assert_unreached: Skipping test as could not create a URLSearchParams;  Reached unreachable code
-FAIL URLSearchParams request has correct default Content-Type of "application/x-www-form-urlencoded;charset=UTF-8" assert_unreached: Skipping test as could not create a URLSearchParams;  Reached unreachable code
-FAIL URLSearchParams request keeps setRequestHeader() Content-Type, with charset adjusted to UTF-8 assert_unreached: Skipping test as could not create a URLSearchParams;  Reached unreachable code
+PASS URLSearchParams respects setRequestHeader("") 
+FAIL URLSearchParams request has correct default Content-Type of "application/x-www-form-urlencoded;charset=UTF-8" assert_equals: expected "content-type: application/x-www-form-urlencoded;charset=utf-8" but got "content-type: text/plain;charset=utf-8"
+PASS URLSearchParams request keeps setRequestHeader() Content-Type, with charset adjusted to UTF-8 
 PASS ReadableStream request respects setRequestHeader("") 
 FAIL ReadableStream request with under type sends no Content-Type without setRequestHeader() call assert_equals: expected "" but got "content-type: text/plain;charset=utf-8"
 FAIL ReadableStream request keeps setRequestHeader() Content-Type and charset assert_equals: expected "content-type: application/xml;charset=ascii" but got "content-type: application/xml;charset=utf-8"

Modified: trunk/LayoutTests/platform/mac/js/dom/global-constructors-attributes-expected.txt (205892 => 205893)


--- trunk/LayoutTests/platform/mac/js/dom/global-constructors-attributes-expected.txt	2016-09-14 00:38:57 UTC (rev 205892)
+++ trunk/LayoutTests/platform/mac/js/dom/global-constructors-attributes-expected.txt	2016-09-14 01:34:27 UTC (rev 205893)
@@ -2123,6 +2123,11 @@
 PASS Object.getOwnPropertyDescriptor(global, 'URL').hasOwnProperty('set') is false
 PASS Object.getOwnPropertyDescriptor(global, 'URL').enumerable is false
 PASS Object.getOwnPropertyDescriptor(global, 'URL').configurable is true
+PASS Object.getOwnPropertyDescriptor(global, 'URLSearchParams').value is URLSearchParams
+PASS Object.getOwnPropertyDescriptor(global, 'URLSearchParams').hasOwnProperty('get') is false
+PASS Object.getOwnPropertyDescriptor(global, 'URLSearchParams').hasOwnProperty('set') is false
+PASS Object.getOwnPropertyDescriptor(global, 'URLSearchParams').enumerable is false
+PASS Object.getOwnPropertyDescriptor(global, 'URLSearchParams').configurable is true
 PASS Object.getOwnPropertyDescriptor(global, 'Uint16Array').value is Uint16Array
 PASS Object.getOwnPropertyDescriptor(global, 'Uint16Array').hasOwnProperty('get') is false
 PASS Object.getOwnPropertyDescriptor(global, 'Uint16Array').hasOwnProperty('set') is false

Modified: trunk/LayoutTests/platform/mac-wk1/js/dom/global-constructors-attributes-expected.txt (205892 => 205893)


--- trunk/LayoutTests/platform/mac-wk1/js/dom/global-constructors-attributes-expected.txt	2016-09-14 00:38:57 UTC (rev 205892)
+++ trunk/LayoutTests/platform/mac-wk1/js/dom/global-constructors-attributes-expected.txt	2016-09-14 01:34:27 UTC (rev 205893)
@@ -2108,6 +2108,11 @@
 PASS Object.getOwnPropertyDescriptor(global, 'URL').hasOwnProperty('set') is false
 PASS Object.getOwnPropertyDescriptor(global, 'URL').enumerable is false
 PASS Object.getOwnPropertyDescriptor(global, 'URL').configurable is true
+PASS Object.getOwnPropertyDescriptor(global, 'URLSearchParams').value is URLSearchParams
+PASS Object.getOwnPropertyDescriptor(global, 'URLSearchParams').hasOwnProperty('get') is false
+PASS Object.getOwnPropertyDescriptor(global, 'URLSearchParams').hasOwnProperty('set') is false
+PASS Object.getOwnPropertyDescriptor(global, 'URLSearchParams').enumerable is false
+PASS Object.getOwnPropertyDescriptor(global, 'URLSearchParams').configurable is true
 PASS Object.getOwnPropertyDescriptor(global, 'Uint16Array').value is Uint16Array
 PASS Object.getOwnPropertyDescriptor(global, 'Uint16Array').hasOwnProperty('get') is false
 PASS Object.getOwnPropertyDescriptor(global, 'Uint16Array').hasOwnProperty('set') is false

Modified: trunk/Source/WTF/ChangeLog (205892 => 205893)


--- trunk/Source/WTF/ChangeLog	2016-09-14 00:38:57 UTC (rev 205892)
+++ trunk/Source/WTF/ChangeLog	2016-09-14 01:34:27 UTC (rev 205893)
@@ -1,3 +1,13 @@
+2016-09-13  Alex Christensen  <achristen...@webkit.org>
+
+        Implement URLSearchParams
+        https://bugs.webkit.org/show_bug.cgi?id=161920
+
+        Reviewed by Chris Dumez.
+
+        * wtf/text/StringView.h:
+        (WTF::StringView::split): Added.
+
 2016-09-12  Filip Pizlo  <fpi...@apple.com>
 
         ParkingLot is going to have a bad time with threads dying

Modified: trunk/Source/WTF/wtf/text/StringView.cpp (205892 => 205893)


--- trunk/Source/WTF/wtf/text/StringView.cpp	2016-09-14 00:38:57 UTC (rev 205892)
+++ trunk/Source/WTF/wtf/text/StringView.cpp	2016-09-14 01:34:27 UTC (rev 205893)
@@ -141,6 +141,21 @@
     unsigned m_indexEnd;
 };
 
+Vector<StringView> StringView::split(UChar separator)
+{
+    Vector<StringView> result;
+    unsigned startPos = 0;
+    size_t endPos;
+    while ((endPos = find(separator, startPos)) != notFound) {
+        if (startPos != endPos)
+            result.append(substring(startPos, endPos - startPos));
+        startPos = endPos + 1;
+    }
+    if (startPos != length())
+        result.append(substring(startPos));
+    return result;
+}
+
 StringView::GraphemeClusters::Iterator::Iterator(const StringView& stringView, unsigned index)
     : m_impl(std::make_unique<Impl>(stringView, stringView.isNull() ? Nullopt : Optional<NonSharedCharacterBreakIterator>(NonSharedCharacterBreakIterator(stringView)), index))
 {

Modified: trunk/Source/WTF/wtf/text/StringView.h (205892 => 205893)


--- trunk/Source/WTF/wtf/text/StringView.h	2016-09-14 00:38:57 UTC (rev 205892)
+++ trunk/Source/WTF/wtf/text/StringView.h	2016-09-14 01:34:27 UTC (rev 205893)
@@ -115,6 +115,7 @@
     void getCharactersWithUpconvert(UChar*) const;
 
     StringView substring(unsigned start, unsigned length = std::numeric_limits<unsigned>::max()) const;
+    WTF_EXPORT_STRING_API Vector<StringView> split(UChar);
 
     size_t find(UChar, unsigned start = 0) const;
     size_t find(CharacterMatchFunction, unsigned start = 0) const;

Modified: trunk/Source/WebCore/CMakeLists.txt (205892 => 205893)


--- trunk/Source/WebCore/CMakeLists.txt	2016-09-14 00:38:57 UTC (rev 205892)
+++ trunk/Source/WebCore/CMakeLists.txt	2016-09-14 01:34:27 UTC (rev 205893)
@@ -538,6 +538,7 @@
     html/RadioNodeList.idl
     html/TextMetrics.idl
     html/TimeRanges.idl
+    html/URLSearchParams.idl
     html/URLUtils.idl
     html/ValidityState.idl
     html/VoidCallback.idl
@@ -1750,6 +1751,7 @@
     html/TimeRanges.cpp
     html/TypeAhead.cpp
     html/URLInputType.cpp
+    html/URLSearchParams.cpp
     html/ValidationMessage.cpp
     html/WeekInputType.cpp
 

Modified: trunk/Source/WebCore/ChangeLog (205892 => 205893)


--- trunk/Source/WebCore/ChangeLog	2016-09-14 00:38:57 UTC (rev 205892)
+++ trunk/Source/WebCore/ChangeLog	2016-09-14 01:34:27 UTC (rev 205893)
@@ -1,3 +1,43 @@
+2016-09-13  Alex Christensen  <achristen...@webkit.org>
+
+        Implement URLSearchParams
+        https://bugs.webkit.org/show_bug.cgi?id=161920
+
+        Reviewed by Chris Dumez.
+
+        Covered by newly passing web platform tests.
+
+        * CMakeLists.txt:
+        * DerivedSources.make:
+        * WebCore.xcodeproj/project.pbxproj:
+        * html/DOMURL.cpp:
+        (WebCore::DOMURL::setQuery):
+        (WebCore::DOMURL::searchParams):
+        * html/DOMURL.h:
+        * html/URLSearchParams.cpp: Added.
+        (WebCore::URLSearchParams::URLSearchParams):
+        (WebCore::URLSearchParams::get):
+        (WebCore::URLSearchParams::has):
+        (WebCore::URLSearchParams::set):
+        (WebCore::URLSearchParams::append):
+        (WebCore::URLSearchParams::getAll):
+        (WebCore::URLSearchParams::remove):
+        (WebCore::URLSearchParams::toString):
+        (WebCore::URLSearchParams::updateURL):
+        (WebCore::URLSearchParams::Iterator::Iterator):
+        * html/URLSearchParams.h: Added.
+        (WebCore::URLSearchParams::create):
+        (WebCore::URLSearchParams::createIterator):
+        * html/URLSearchParams.idl: Added.
+        * html/URLUtils.idl:
+        * platform/URLParser.cpp:
+        (WebCore::percentDecode):
+        (WebCore::URLParser::parseHost):
+        (WebCore::formURLDecode):
+        (WebCore::serializeURLEncodedForm):
+        (WebCore::URLParser::serialize):
+        * platform/URLParser.h:
+
 2016-09-12  Dean Jackson  <d...@apple.com>
 
         Replace RGBA32 with Color in member variables

Modified: trunk/Source/WebCore/DerivedSources.make (205892 => 205893)


--- trunk/Source/WebCore/DerivedSources.make	2016-09-14 00:38:57 UTC (rev 205892)
+++ trunk/Source/WebCore/DerivedSources.make	2016-09-14 01:34:27 UTC (rev 205893)
@@ -447,6 +447,7 @@
     $(WebCore)/html/RadioNodeList.idl \
     $(WebCore)/html/TextMetrics.idl \
     $(WebCore)/html/TimeRanges.idl \
+    $(WebCore)/html/URLSearchParams.idl \
     $(WebCore)/html/URLUtils.idl \
     $(WebCore)/html/ValidityState.idl \
     $(WebCore)/html/VoidCallback.idl \

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (205892 => 205893)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2016-09-14 00:38:57 UTC (rev 205892)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2016-09-14 01:34:27 UTC (rev 205893)
@@ -2345,6 +2345,8 @@
 		5C4304B1191AC908000E2BC0 /* EXTShaderTextureLOD.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C4304AE191AC908000E2BC0 /* EXTShaderTextureLOD.h */; };
 		5C4304B5191AEF46000E2BC0 /* JSEXTShaderTextureLOD.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5C4304B3191AEF46000E2BC0 /* JSEXTShaderTextureLOD.cpp */; };
 		5C4304B6191AEF46000E2BC0 /* JSEXTShaderTextureLOD.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C4304B4191AEF46000E2BC0 /* JSEXTShaderTextureLOD.h */; };
+		5C5381B21D87D4B200E2EBE6 /* URLSearchParams.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5C5381B01D87D45700E2EBE6 /* URLSearchParams.cpp */; };
+		5C5381B51D87E08700E2EBE6 /* JSURLSearchParams.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5C5381B31D87E08100E2EBE6 /* JSURLSearchParams.cpp */; };
 		5C688AA11D380BF8000B54FA /* ThreadableWebSocketChannel.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5C688AA01D380509000B54FA /* ThreadableWebSocketChannel.cpp */; };
 		5C688AA31D3814BF000B54FA /* SocketProvider.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5C688AA21D38126F000B54FA /* SocketProvider.cpp */; };
 		5C6E65421D5CEFB900F7862E /* URLParser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5C6E653F1D5CEDC900F7862E /* URLParser.cpp */; };
@@ -9392,6 +9394,12 @@
 		5C4304AF191AC908000E2BC0 /* EXTShaderTextureLOD.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = EXTShaderTextureLOD.idl; sourceTree = "<group>"; };
 		5C4304B3191AEF46000E2BC0 /* JSEXTShaderTextureLOD.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSEXTShaderTextureLOD.cpp; sourceTree = "<group>"; };
 		5C4304B4191AEF46000E2BC0 /* JSEXTShaderTextureLOD.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSEXTShaderTextureLOD.h; sourceTree = "<group>"; };
+		5C5381AE1D8791CA00E2EBE6 /* URLUtils.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = URLUtils.idl; sourceTree = "<group>"; };
+		5C5381AF1D8793E000E2EBE6 /* URLSearchParams.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = URLSearchParams.idl; sourceTree = "<group>"; };
+		5C5381B01D87D45700E2EBE6 /* URLSearchParams.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = URLSearchParams.cpp; sourceTree = "<group>"; };
+		5C5381B11D87D45700E2EBE6 /* URLSearchParams.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = URLSearchParams.h; sourceTree = "<group>"; };
+		5C5381B31D87E08100E2EBE6 /* JSURLSearchParams.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JSURLSearchParams.cpp; path = JSURLSearchParams.cpp; sourceTree = "<group>"; };
+		5C5381B41D87E08100E2EBE6 /* JSURLSearchParams.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JSURLSearchParams.h; path = JSURLSearchParams.h; sourceTree = "<group>"; };
 		5C688AA01D380509000B54FA /* ThreadableWebSocketChannel.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ThreadableWebSocketChannel.cpp; sourceTree = "<group>"; };
 		5C688AA21D38126F000B54FA /* SocketProvider.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SocketProvider.cpp; sourceTree = "<group>"; };
 		5C6E653F1D5CEDC900F7862E /* URLParser.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = URLParser.cpp; sourceTree = "<group>"; };
@@ -17774,6 +17782,10 @@
 		93EEC1EC09C2877700C515D1 /* html */ = {
 			isa = PBXGroup;
 			children = (
+				5C5381B01D87D45700E2EBE6 /* URLSearchParams.cpp */,
+				5C5381B11D87D45700E2EBE6 /* URLSearchParams.h */,
+				5C5381AF1D8793E000E2EBE6 /* URLSearchParams.idl */,
+				5C5381AE1D8791CA00E2EBE6 /* URLUtils.idl */,
 				49484FAE102CF01E00187DD3 /* canvas */,
 				1A88A90117553CD7000C74F9 /* forms */,
 				97C1F5511228558800EDE616 /* parser */,
@@ -18882,6 +18894,8 @@
 		A83B79080CCAFF2B000B0825 /* HTML */ = {
 			isa = PBXGroup;
 			children = (
+				5C5381B31D87E08100E2EBE6 /* JSURLSearchParams.cpp */,
+				5C5381B41D87E08100E2EBE6 /* JSURLSearchParams.h */,
 				31A795C41888BAD100382F90 /* JSANGLEInstancedArrays.cpp */,
 				31A795C51888BAD100382F90 /* JSANGLEInstancedArrays.h */,
 				BE8EF03E171C8FF9009B48C3 /* JSAudioTrack.cpp */,
@@ -27687,6 +27701,7 @@
 				E164A2ED191AE6350010737D /* BlobDataFileReferenceMac.mm in Sources */,
 				E14A94D716DFDF950068DE82 /* BlobRegistry.cpp in Sources */,
 				2EDEF1F6121B0EFC00726DB2 /* BlobRegistryImpl.cpp in Sources */,
+				5C5381B21D87D4B200E2EBE6 /* URLSearchParams.cpp in Sources */,
 				2EB4BCD2121F03E300EC4885 /* BlobResourceHandle.cpp in Sources */,
 				976D6C7E122B8A3D001FD1F7 /* BlobURL.cpp in Sources */,
 				58AEE2F418D4BCCF0022E7FE /* BorderEdge.cpp in Sources */,
@@ -29119,6 +29134,7 @@
 				B2FA3DBA0AB75A6F000E5AC4 /* JSSVGPathSegArcRel.cpp in Sources */,
 				B2FA3DBC0AB75A6F000E5AC4 /* JSSVGPathSegClosePath.cpp in Sources */,
 				B2FA3DBE0AB75A6F000E5AC4 /* JSSVGPathSegCurvetoCubicAbs.cpp in Sources */,
+				5C5381B51D87E08700E2EBE6 /* JSURLSearchParams.cpp in Sources */,
 				B2FA3DC00AB75A6F000E5AC4 /* JSSVGPathSegCurvetoCubicRel.cpp in Sources */,
 				B2FA3DC20AB75A6F000E5AC4 /* JSSVGPathSegCurvetoCubicSmoothAbs.cpp in Sources */,
 				B2FA3DC40AB75A6F000E5AC4 /* JSSVGPathSegCurvetoCubicSmoothRel.cpp in Sources */,

Modified: trunk/Source/WebCore/html/DOMURL.cpp (205892 => 205893)


--- trunk/Source/WebCore/html/DOMURL.cpp	2016-09-14 00:38:57 UTC (rev 205892)
+++ trunk/Source/WebCore/html/DOMURL.cpp	2016-09-14 01:34:27 UTC (rev 205893)
@@ -34,6 +34,7 @@
 #include "PublicURLManager.h"
 #include "ResourceRequest.h"
 #include "ScriptExecutionContext.h"
+#include "URLSearchParams.h"
 #include <wtf/MainThread.h>
 
 namespace WebCore {
@@ -82,6 +83,11 @@
     m_url = URL(m_baseURL, url);
 }
 
+void DOMURL::setQuery(const String& query)
+{
+    m_url.setQuery(query);
+}
+
 void DOMURL::setHref(const String& url, ExceptionCode& ec)
 {
     setHref(url);
@@ -107,6 +113,11 @@
     return publicURL.string();
 }
 
+Ref<URLSearchParams> DOMURL::searchParams()
+{
+    return URLSearchParams::create(m_url.query(), this);
+}
+    
 void DOMURL::revokeObjectURL(ScriptExecutionContext& scriptExecutionContext, const String& urlString)
 {
     URL url(URL(), urlString);

Modified: trunk/Source/WebCore/html/DOMURL.h (205892 => 205893)


--- trunk/Source/WebCore/html/DOMURL.h	2016-09-14 00:38:57 UTC (rev 205892)
+++ trunk/Source/WebCore/html/DOMURL.h	2016-09-14 01:34:27 UTC (rev 205893)
@@ -24,8 +24,7 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#ifndef DOMURL_h
-#define DOMURL_h
+#pragma once
 
 #include "ExceptionCode.h"
 #include "URL.h"
@@ -39,9 +38,9 @@
 class Blob;
 class ScriptExecutionContext;
 class URLRegistrable;
+class URLSearchParams;
 
 class DOMURL : public RefCounted<DOMURL>, public URLUtils<DOMURL> {
-
 public:
     static Ref<DOMURL> create(const String& url, const String& base, ExceptionCode&);
     static Ref<DOMURL> create(const String& url, const DOMURL& base, ExceptionCode&);
@@ -50,7 +49,10 @@
     URL href() const { return m_url; }
     void setHref(const String& url);
     void setHref(const String&, ExceptionCode&);
+    void setQuery(const String&);
 
+    Ref<URLSearchParams> searchParams();
+
     static String createObjectURL(ScriptExecutionContext&, Blob*);
     static void revokeObjectURL(ScriptExecutionContext&, const String&);
 
@@ -66,5 +68,3 @@
 };
 
 } // namespace WebCore
-
-#endif // DOMURL_h

Added: trunk/Source/WebCore/html/URLSearchParams.cpp (0 => 205893)


--- trunk/Source/WebCore/html/URLSearchParams.cpp	                        (rev 0)
+++ trunk/Source/WebCore/html/URLSearchParams.cpp	2016-09-14 01:34:27 UTC (rev 205893)
@@ -0,0 +1,120 @@
+/*
+ * Copyright (C) 2016 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "URLSearchParams.h"
+
+#include "DOMURL.h"
+#include "URLParser.h"
+
+namespace WebCore {
+
+URLSearchParams::URLSearchParams(const String& init, DOMURL* associatedURL)
+    : m_associatedURL(associatedURL)
+    , m_pairs(init.startsWith('?') ? URLParser::parseURLEncodedForm(StringView(init).substring(1)) : URLParser::parseURLEncodedForm(init))
+{
+}
+
+URLSearchParams::URLSearchParams(const Vector<std::pair<String, String>>& pairs)
+    : m_pairs(pairs)
+{
+}
+
+String URLSearchParams::get(const String& name) const
+{
+    for (const auto& pair : m_pairs) {
+        if (pair.first == name)
+            return pair.second;
+    }
+    return String();
+}
+
+bool URLSearchParams::has(const String& name) const
+{
+    for (const auto& pair : m_pairs) {
+        if (pair.first == name)
+            return true;
+    }
+    return false;
+}
+
+void URLSearchParams::set(const String& name, const String& value)
+{
+    for (auto& pair : m_pairs) {
+        if (pair.first != name)
+            continue;
+        if (pair.second != value)
+            pair.second = value;
+        bool skippedFirstMatch = false;
+        m_pairs.removeAllMatching([&] (const auto& pair) {
+            bool nameMatches = pair.first == name;
+            if (nameMatches) {
+                if (skippedFirstMatch)
+                    return true;
+                skippedFirstMatch = true;
+            }
+            return false;
+        });
+        updateURL();
+        return;
+    }
+    m_pairs.append({name, value});
+    updateURL();
+}
+
+void URLSearchParams::append(const String& name, const String& value)
+{
+    m_pairs.append({name, value});
+    updateURL();
+}
+
+Vector<String> URLSearchParams::getAll(const String& name) const
+{
+    Vector<String> values;
+    values.reserveInitialCapacity(m_pairs.size());
+    for (const auto& pair : m_pairs) {
+        if (pair.first == name)
+            values.uncheckedAppend(pair.second);
+    }
+    return values;
+}
+
+void URLSearchParams::remove(const String& name)
+{
+    if (m_pairs.removeAllMatching([&] (const auto& pair) { return pair.first == name; }))
+        updateURL();
+}
+
+String URLSearchParams::toString()
+{
+    return URLParser::serialize(m_pairs);
+}
+
+void URLSearchParams::updateURL()
+{
+    if (m_associatedURL)
+        m_associatedURL->setQuery(URLParser::serialize(m_pairs));
+}
+
+}

Added: trunk/Source/WebCore/html/URLSearchParams.h (0 => 205893)


--- trunk/Source/WebCore/html/URLSearchParams.h	                        (rev 0)
+++ trunk/Source/WebCore/html/URLSearchParams.h	2016-09-14 01:34:27 UTC (rev 205893)
@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) 2016 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include "DOMURL.h"
+#include <wtf/Vector.h>
+#include <wtf/text/WTFString.h>
+
+namespace WebCore {
+
+class URLSearchParams : public RefCounted<URLSearchParams> {
+public:
+    static Ref<URLSearchParams> create(const String& string, DOMURL* associatedURL = nullptr) { return adoptRef(*new URLSearchParams(string, associatedURL)); }
+    static Ref<URLSearchParams> create(const Vector<std::pair<String, String>>& pairs) { return adoptRef(*new URLSearchParams(pairs)); }
+
+    void append(const String& name, const String& value);
+    void remove(const String& name);
+    String get(const String& name) const;
+    Vector<String> getAll(const String& name) const;
+    bool has(const String& name) const;
+    void set(const String& name, const String& value);
+    String toString();
+    operator const Vector<std::pair<String, String>>&() { return m_pairs; }
+
+private:
+    URLSearchParams(const String&, DOMURL*);
+    explicit URLSearchParams(const Vector<std::pair<String, String>>&);
+    void updateURL();
+
+    RefPtr<DOMURL> m_associatedURL;
+    Vector<std::pair<String, String>> m_pairs;
+};
+
+}

Added: trunk/Source/WebCore/html/URLSearchParams.idl (0 => 205893)


--- trunk/Source/WebCore/html/URLSearchParams.idl	                        (rev 0)
+++ trunk/Source/WebCore/html/URLSearchParams.idl	2016-09-14 01:34:27 UTC (rev 205893)
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2016 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+[
+    // FIXME: This should use unions once they are supported
+    Constructor(optional USVString arg = ""),
+    Constructor(URLSearchParams init),
+    Exposed=(Window,Worker),
+    ImplementationLacksVTable,
+] interface URLSearchParams {
+    void append(USVString name, USVString value);
+    [ImplementedAs=remove] void delete(USVString name);
+    USVString? get(USVString name);
+    sequence<USVString> getAll(USVString name);
+    boolean has(USVString name);
+    void set(USVString name, USVString value);
+    // FIXME: This should be iterable.
+
+    // FIXME: This should just be stringifier once that is supported in the bindings generator
+    DOMString toString();
+};

Modified: trunk/Source/WebCore/html/URLUtils.h (205892 => 205893)


--- trunk/Source/WebCore/html/URLUtils.h	2016-09-14 00:38:57 UTC (rev 205892)
+++ trunk/Source/WebCore/html/URLUtils.h	2016-09-14 01:34:27 UTC (rev 205893)
@@ -23,8 +23,7 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#ifndef URLUtils_h
-#define URLUtils_h
+#pragma once
 
 #include "SecurityOrigin.h"
 
@@ -293,5 +292,3 @@
 }
 
 } // namespace WebCore
-
-#endif // URLUtils_h

Modified: trunk/Source/WebCore/html/URLUtils.idl (205892 => 205893)


--- trunk/Source/WebCore/html/URLUtils.idl	2016-09-14 00:38:57 UTC (rev 205892)
+++ trunk/Source/WebCore/html/URLUtils.idl	2016-09-14 01:34:27 UTC (rev 205893)
@@ -39,4 +39,5 @@
     attribute USVString pathname;
     attribute USVString hash;
     attribute USVString search;
+    [CachedAttribute] readonly attribute URLSearchParams searchParams;
 };

Modified: trunk/Source/WebCore/platform/URLParser.cpp (205892 => 205893)


--- trunk/Source/WebCore/platform/URLParser.cpp	2016-09-14 00:38:57 UTC (rev 205892)
+++ trunk/Source/WebCore/platform/URLParser.cpp	2016-09-14 01:34:27 UTC (rev 205893)
@@ -115,7 +115,7 @@
 static void encodeQuery(const StringBuilder& source, StringBuilder& destination, const TextEncoding& encoding)
 {
     // FIXME: It is unclear in the spec what to do when encoding fails. The behavior should be specified and tested.
-    CString encoded = encoding.encode(StringView(source.toStringPreserveCapacity()), URLEncodedEntitiesForUnencodables);
+    CString encoded = encoding.encode(source.toStringPreserveCapacity(), URLEncodedEntitiesForUnencodables);
     const char* data = ""
     size_t length = encoded.length();
     for (size_t i = 0; i < length; ++i) {
@@ -1411,20 +1411,18 @@
     return address;
 }
 
-static String percentDecode(const String& input)
+// FIXME: This should return a CString.
+static String percentDecode(const LChar* input, size_t length)
 {
     StringBuilder output;
-    RELEASE_ASSERT(input.is8Bit());
-    const LChar* inputBytes = input.characters8();
-    size_t length = input.length();
     
     for (size_t i = 0; i < length; ++i) {
-        uint8_t byte = inputBytes[i];
+        uint8_t byte = input[i];
         if (byte != '%')
             output.append(byte);
         else if (i < length - 2) {
-            if (isASCIIHexDigit(inputBytes[i + 1]) && isASCIIHexDigit(inputBytes[i + 2])) {
-                output.append(toASCIIHexValue(inputBytes[i + 1], inputBytes[i + 2]));
+            if (isASCIIHexDigit(input[i + 1]) && isASCIIHexDigit(input[i + 2])) {
+                output.append(toASCIIHexValue(input[i + 1], input[i + 2]));
                 i += 2;
             } else
                 output.append(byte);
@@ -1553,7 +1551,8 @@
         // FIXME: Check error.
         utf8Encoded.append(buffer, offset);
     }
-    String percentDecoded = percentDecode(utf8Encoded.toStringPreserveCapacity());
+    RELEASE_ASSERT(utf8Encoded.is8Bit());
+    String percentDecoded = percentDecode(utf8Encoded.characters8(), utf8Encoded.length());
     RELEASE_ASSERT(percentDecoded.is8Bit());
     String domain = String::fromUTF8(percentDecoded.characters8(), percentDecoded.length());
     auto asciiDomain = domainToASCII(domain);
@@ -1585,6 +1584,70 @@
     return true;
 }
 
+static Optional<String> formURLDecode(StringView input)
+{
+    auto utf8 = input.utf8(StrictConversion);
+    if (utf8.isNull())
+        return Nullopt;
+    auto percentDecoded = percentDecode(reinterpret_cast<const LChar*>(utf8.data()), utf8.length());
+    RELEASE_ASSERT(percentDecoded.is8Bit());
+    return String::fromUTF8(percentDecoded.characters8(), percentDecoded.length());
+}
+
+auto URLParser::parseURLEncodedForm(StringView input) -> URLEncodedForm
+{
+    Vector<StringView> sequences = input.split('&');
+
+    URLEncodedForm output;
+    for (auto& bytes : sequences) {
+        auto valueStart = bytes.find('=');
+        if (valueStart == notFound) {
+            if (auto name = formURLDecode(bytes))
+                output.append({name.value().replace('+', 0x20), emptyString()});
+        } else {
+            auto name = formURLDecode(bytes.substring(0, valueStart));
+            auto value = formURLDecode(bytes.substring(valueStart + 1));
+            if (name && value)
+                output.append(std::make_pair(name.value().replace('+', 0x20), value.value().replace('+', 0x20)));
+        }
+    }
+    return output;
+}
+
+static void serializeURLEncodedForm(const String& input, StringBuilder& output)
+{
+    auto utf8 = input.utf8(StrictConversion);
+    const char* data = ""
+    for (size_t i = 0; i < utf8.length(); ++i) {
+        const char byte = data[i];
+        if (byte == 0x20)
+            output.append(0x2B);
+        else if (byte == 0x2A
+            || byte == 0x2D
+            || byte == 0x2E
+            || (byte >= 0x30 && byte <= 0x39)
+            || (byte >= 0x41 && byte <= 0x5A)
+            || byte == 0x5F
+            || (byte >= 0x61 && byte <= 0x7A))
+            output.append(byte);
+        else
+            percentEncode(byte, output);
+    }
+}
+    
+String URLParser::serialize(const URLEncodedForm& tuples)
+{
+    StringBuilder output;
+    for (auto& tuple : tuples) {
+        if (!output.isEmpty())
+            output.append('&');
+        serializeURLEncodedForm(tuple.first, output);
+        output.append('=');
+        serializeURLEncodedForm(tuple.second, output);
+    }
+    return output.toString();
+}
+
 bool URLParser::allValuesEqual(const URL& a, const URL& b)
 {
     // FIXME: m_cannotBeABaseURL is not compared because the old URL::parse did not use it,

Modified: trunk/Source/WebCore/platform/URLParser.h (205892 => 205893)


--- trunk/Source/WebCore/platform/URLParser.h	2016-09-14 00:38:57 UTC (rev 205892)
+++ trunk/Source/WebCore/platform/URLParser.h	2016-09-14 01:34:27 UTC (rev 205893)
@@ -39,6 +39,11 @@
 
     WEBCORE_EXPORT static bool enabled();
     WEBCORE_EXPORT static void setEnabled(bool);
+    
+    typedef Vector<std::pair<String, String>> URLEncodedForm;
+    static URLEncodedForm parseURLEncodedForm(StringView);
+    static String serialize(const URLEncodedForm&);
+
 private:
     URL m_url;
     StringBuilder m_buffer;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to