[Fetch API] Request and Response url getter should use URL serialization
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 14 Jul 2016 10:14:53 +0000 (10:14 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 14 Jul 2016 10:14:53 +0000 (10:14 +0000)
commit676bd2c4199c7adf7d5189a2aee3226719ffeac5
tree7d5ca4ec64e657d859b03475d61e1a7714cab81f
parent9f38a5bee467acf1a6c61fab319676b84fcd81a5
[Fetch API] Request and Response url getter should use URL serialization
https://bugs.webkit.org/show_bug.cgi?id=159705

Patch by Youenn Fablet <youenn@apple.com> on 2016-07-14
Reviewed by Alex Christensen.

LayoutTests/imported/w3c:

* web-platform-tests/fetch/api/basic/response-url-expected.txt: Added.
* web-platform-tests/fetch/api/basic/response-url-worker-expected.txt: Added.
* web-platform-tests/fetch/api/basic/response-url-worker.html: Added.
* web-platform-tests/fetch/api/basic/response-url.html: Added.
* web-platform-tests/fetch/api/basic/response-url.js: Added.
(checkResponseURL):
* web-platform-tests/fetch/api/request/request-init-003.sub-expected.txt:
* web-platform-tests/fetch/api/request/request-init-003.sub.html:

Source/WebCore:

Tests: fetch/fetch-url-serialization.html
       imported/w3c/web-platform-tests/fetch/api/basic/response-url-worker.html
       imported/w3c/web-platform-tests/fetch/api/basic/response-url.html

Implementing https://url.spec.whatwg.org/#concept-url-serializer and applying it to Request and Response getter.
Adding a temporary routine to compute url cannot-be-a-base-url flag. The parsing routine should store that
information in the URL itself.

Added tests to cover serialization routine. Failing tests are mostly due to limitations of the URL parser.
Tests do not check for URLs with username and password as Request constructor throws with such URLs.

* Modules/fetch/FetchRequest.cpp:
(WebCore::FetchRequest::url): Adding request url serialization, fragment included.
* Modules/fetch/FetchRequest.h:
* Modules/fetch/FetchResponse.cpp:
(WebCore::FetchResponse::url): Adding response url serialization, fragment excluded.
* Modules/fetch/FetchResponse.h:
* platform/URL.cpp:
(WebCore::cannotBeABaseURL): Temporary helper function to have a coarse evaluation of url cannot-be-a-base-url flag.
(WebCore::URL::serialize): Implementation of https://url.spec.whatwg.org/#concept-url-serializer.
* platform/URL.h:
(WebCore::URL::hasUser): Helper getter.
(WebCore::URL::hasPassword): Ditto.
(WebCore::URL::hasQuery): Ditto.
(WebCore::URL::hasFragment): Ditto.

LayoutTests:

* fetch/fetch-url-serialization-expected.txt: Added.
* fetch/fetch-url-serialization.html: Added.
* fetch/fetch-urls.json: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@203221 268f45cc-cd09-0410-ab3c-d52691b4dbfc
14 files changed:
LayoutTests/ChangeLog
LayoutTests/fetch/fetch-url-serialization-expected.txt [new file with mode: 0644]
LayoutTests/fetch/fetch-url-serialization.html [new file with mode: 0644]
LayoutTests/fetch/fetch-urls.json [new file with mode: 0644]
LayoutTests/imported/w3c/ChangeLog
LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/response-url-expected.txt
LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/response-url-worker-expected.txt
Source/WebCore/ChangeLog
Source/WebCore/Modules/fetch/FetchRequest.cpp
Source/WebCore/Modules/fetch/FetchRequest.h
Source/WebCore/Modules/fetch/FetchResponse.cpp
Source/WebCore/Modules/fetch/FetchResponse.h
Source/WebCore/platform/URL.cpp
Source/WebCore/platform/URL.h