[preload] Mandatory `as` value and related spec alignments
authoryoav@yoav.ws <yoav@yoav.ws@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 9 Jun 2017 05:25:02 +0000 (05:25 +0000)
committeryoav@yoav.ws <yoav@yoav.ws@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 9 Jun 2017 05:25:02 +0000 (05:25 +0000)
commit0169b3ed22ede1ce0147d162c28835d2f704d053
tree2dfda6c48068a33793b5114f6d09ff6a3e5a9fec
parent9cce38b4f7d075105de5dda3c697f48f361f8c0b
[preload] Mandatory `as` value and related spec alignments
https://bugs.webkit.org/show_bug.cgi?id=173047

Reviewed by Dean Jackson.

Source/WebCore:

Align preload's implementation according to latest spec changes: `as` is mandatory and "fetch" replaces the previous empty `as` value,
onerror no longer fires for invalid `as` values, and the IDL for `as` reflects only valid values, to enable feature detection.

Related standard discussions:
https://github.com/w3c/preload/issues/80
https://github.com/whatwg/fetch/pull/547
https://github.com/whatwg/fetch/pull/549
https://github.com/whatwg/html/pull/2588

No new tests but modified existing ones as well as their expectations.

* html/HTMLLinkElement.cpp: Add "enumerated attribute" reflection methods to `as`.
(WebCore::HTMLLinkElement::setAs):
(WebCore::HTMLLinkElement::as):
* html/HTMLLinkElement.h:
* html/HTMLLinkElement.idl:
* loader/LinkLoader.cpp:
(WebCore::LinkLoader::loadLinksFromHeader): preloadIfNeeded signature change.
(WebCore::LinkLoader::resourceTypeFromAsAttribute): Replace the empty value by "fetch".
(WebCore::LinkLoader::preloadIfNeeded): Change the signature, as a LinkLoaderClient is no longer needed, since we don't fire error
events from inside the function.
(WebCore::LinkLoader::loadLink): preloadIfNeeded signature change.
* loader/LinkLoader.h: preloadIfNeeded signature change.

LayoutTests:

Fix tests and expectations to this patch's changes: `as` is mandatory and "fetch" replaces the previous empty `as` value,
onerror no longer fires for invalid `as` values, and the IDL for `as` reflects only valid values, to enable feature detection.

* http/tests/fetch/redirectmode-and-preload.html:
* http/tests/preload/download_resources-expected.txt:
* http/tests/preload/download_resources.html:
* http/tests/preload/download_resources_from_header_iframe-expected.txt:
* http/tests/preload/onerror_event-expected.txt:
* http/tests/preload/onerror_event.html:
* http/tests/preload/onload_event-expected.txt:
* http/tests/preload/onload_event.html:
* http/tests/preload/preloadscanner_download_resources.html:
* http/tests/preload/resources/download_resources_from_header.php:
* http/tests/preload/resources/nph-invalid_resources_from_header.pl:
* http/tests/preload/single_download_preload.html:
* http/tests/preload/single_download_preload_headers.php:
* imported/w3c/web-platform-tests/html/dom/reflection-metadata-expected.txt: PProgressions related to correct reflection.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@217962 268f45cc-cd09-0410-ab3c-d52691b4dbfc
21 files changed:
LayoutTests/ChangeLog
LayoutTests/http/tests/fetch/redirectmode-and-preload.html
LayoutTests/http/tests/preload/download_resources-expected.txt
LayoutTests/http/tests/preload/download_resources.html
LayoutTests/http/tests/preload/download_resources_from_header_iframe-expected.txt
LayoutTests/http/tests/preload/onerror_event-expected.txt
LayoutTests/http/tests/preload/onerror_event.html
LayoutTests/http/tests/preload/onload_event-expected.txt
LayoutTests/http/tests/preload/onload_event.html
LayoutTests/http/tests/preload/preloadscanner_download_resources.html
LayoutTests/http/tests/preload/resources/download_resources_from_header.php
LayoutTests/http/tests/preload/resources/nph-invalid_resources_from_header.pl
LayoutTests/http/tests/preload/single_download_preload.html
LayoutTests/http/tests/preload/single_download_preload_headers.php
LayoutTests/imported/w3c/web-platform-tests/html/dom/reflection-metadata-expected.txt
Source/WebCore/ChangeLog
Source/WebCore/html/HTMLLinkElement.cpp
Source/WebCore/html/HTMLLinkElement.h
Source/WebCore/html/HTMLLinkElement.idl
Source/WebCore/loader/LinkLoader.cpp
Source/WebCore/loader/LinkLoader.h