Changeset 217962 in webkit


Ignore:
Timestamp:
Jun 8, 2017 10:25:02 PM (7 years ago)
Author:
yoav@yoav.ws
Message:

[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.
Location:
trunk
Files:
21 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r217958 r217962  
     12017-06-08  Yoav Weiss  <yoav@yoav.ws>
     2
     3        [preload] Mandatory `as` value and related spec alignments
     4        https://bugs.webkit.org/show_bug.cgi?id=173047
     5
     6        Reviewed by Dean Jackson.
     7
     8        Fix tests and expectations to this patch's changes: `as` is mandatory and "fetch" replaces the previous empty `as` value,
     9        onerror no longer fires for invalid `as` values, and the IDL for `as` reflects only valid values, to enable feature detection.
     10
     11        * http/tests/fetch/redirectmode-and-preload.html:
     12        * http/tests/preload/download_resources-expected.txt:
     13        * http/tests/preload/download_resources.html:
     14        * http/tests/preload/download_resources_from_header_iframe-expected.txt:
     15        * http/tests/preload/onerror_event-expected.txt:
     16        * http/tests/preload/onerror_event.html:
     17        * http/tests/preload/onload_event-expected.txt:
     18        * http/tests/preload/onload_event.html:
     19        * http/tests/preload/preloadscanner_download_resources.html:
     20        * http/tests/preload/resources/download_resources_from_header.php:
     21        * http/tests/preload/resources/nph-invalid_resources_from_header.pl:
     22        * http/tests/preload/single_download_preload.html:
     23        * http/tests/preload/single_download_preload_headers.php:
     24        * imported/w3c/web-platform-tests/html/dom/reflection-metadata-expected.txt: PProgressions related to correct reflection.
     25
    1262017-06-08  Ryosuke Niwa  <rniwa@webkit.org>
    227
  • trunk/LayoutTests/http/tests/fetch/redirectmode-and-preload.html

    r211341 r217962  
    99    <script src="/js-test-resources/testharness.js"></script>
    1010    <script src="/js-test-resources/testharnessreport.js"></script>
    11     <link rel=preload onload="startTests()" href="./resources/redirect-with-cache.php?enableCaching&url=http://localhost:8000/security/resources/allow-if-origin.php?allowCache&origin=http%3A%2F%2F127.0.0.1%3A8000&name=alert-fail.js&contentType=text/ascii">
     11    <link rel=preload as=fetch onload="startTests()" href="./resources/redirect-with-cache.php?enableCaching&url=http://localhost:8000/security/resources/allow-if-origin.php?allowCache&origin=http%3A%2F%2F127.0.0.1%3A8000&name=alert-fail.js&contentType=text/ascii">
    1212  </head>
    1313  <body>
  • trunk/LayoutTests/http/tests/preload/download_resources-expected.txt

    r214472 r217962  
    11CONSOLE MESSAGE: line 13: <link rel=preload> must have a valid `as` value
     2CONSOLE MESSAGE: line 14: <link rel=preload> must have a valid `as` value
    23This test makes sure that link preload preloads resources
    34
  • trunk/LayoutTests/http/tests/preload/download_resources.html

    r217863 r217962  
    1212<link rel=preload href="../security/resources/captions.vtt" as=track>
    1313<link rel=preload href="../resources/dummy.xml?badvalue" as=foobarxmlthing>
    14 <link rel=preload href="../resources/dummy.xml">
     14<link rel=preload href="../resources/dummy.xml?empty">
     15<link rel=preload href="../resources/dummy.xml" as=fetch>
    1516<script src="http://127.0.0.1:8000/resources/slow-script.pl?delay=400"></script>
    1617<script>
     
    2425
    2526    assert_false(internals.isPreloaded("../resources/dummy.xml?badvalue"));
     27    assert_false(internals.isPreloaded("../resources/dummy.xml?empty"));
    2628    assert_true(internals.isPreloaded("../resources/dummy.xml"));
    2729    document.write('<script src="../resources/dummy.js"></scr' + 'ipt>' +
  • trunk/LayoutTests/http/tests/preload/download_resources_from_header_iframe-expected.txt

    r217863 r217962  
     1CONSOLE MESSAGE: <link rel=preload> must have a valid `as` value
    12CONSOLE MESSAGE: <link rel=preload> must have a valid `as` value
    23
     
    1314PASS internals.isPreloaded('../security/resources/captions.vtt'); is true
    1415PASS internals.isPreloaded('../resources/dummy.xml?badvalue'); is false
     16PASS internals.isPreloaded('../resources/dummy.xml?empty'); is false
    1517PASS internals.isPreloaded('../resources/dummy.xml'); is true
    1618PASS successfullyParsed is true
  • trunk/LayoutTests/http/tests/preload/onerror_event-expected.txt

    r214472 r217962  
    1 CONSOLE MESSAGE: line 25: <link rel=preload> must have a valid `as` value
     1CONSOLE MESSAGE: line 26: <link rel=preload> must have a valid `as` value
     2CONSOLE MESSAGE: line 28: <link rel=preload> must have a valid `as` value
    23This test makes sure that link preload triggers error events for non-existing resources.
    34
  • trunk/LayoutTests/http/tests/preload/onerror_event.html

    r214472 r217962  
    1212    var trackFailed = false;
    1313    var gibrishFailed = false;
     14    var fetchFailed = false;
    1415    var noTypeFailed = false;
    1516    var counter = 0;
     
    2425<link rel=preload href="../non-existent/security/captions.vtt" as=track onerror="count();trackFailed = true;" onload="count();">
    2526<link rel=preload href="../non-existent/dummy.xml" as=foobarxmlthing onerror="count();gibrishFailed = true;" onload="count();">
     27<link rel=preload href="http://127.0.0.1:9999/non-existent/dummy.xml?fetch" as=fetch onerror="count();fetchFailed = true;" onload="count();">
    2628<link rel=preload href="http://127.0.0.1:9999/non-existent/dummy.xml" onerror="count();noTypeFailed = true;" onload="count();">
    2729<script>
     
    4951        assert_true(fontFailed);
    5052        assert_true(trackFailed);
    51         assert_true(gibrishFailed);
    52         assert_true(noTypeFailed);
     53        assert_false(gibrishFailed);
     54        assert_true(fetchFailed);
     55        assert_false(noTypeFailed);
    5356        t.done();
    5457    };
    5558    setInterval(t.step_func(function() {
    56         if (window.counter >= 7)
     59        if (window.counter >= 6)
    5760            test();
    5861    }, 100));
  • trunk/LayoutTests/http/tests/preload/onload_event-expected.txt

    r214472 r217962  
    1 CONSOLE MESSAGE: line 33: <link rel=preload> must have a valid `as` value
    21CONSOLE MESSAGE: line 34: <link rel=preload> must have a valid `as` value
     2CONSOLE MESSAGE: line 35: <link rel=preload> must have a valid `as` value
     3CONSOLE MESSAGE: line 36: <link rel=preload> must have a valid `as` value
     4CONSOLE MESSAGE: line 37: <link rel=preload> must have a valid `as` value
    35PASS successfullyParsed is true
    46
     
    1113PASS trackLoaded is true
    1214PASS gibberishLoaded is false
    13 PASS gibberishErrored is true
     15PASS gibberishErrored is false
    1416PASS xsltLoaded is false
    15 PASS xsltErrored is true
    16 PASS noTypeLoaded is true
    17 PASS emptyTypeLoaded is true
     17PASS xsltErrored is false
     18PASS noTypeLoaded is false
     19PASS emptyTypeLoaded is false
     20PASS fetchLoaded is true
    1821This test makes sure that link preload events are fired
  • trunk/LayoutTests/http/tests/preload/onload_event.html

    r217863 r217962  
    2020    var noTypeLoaded = false;
    2121    var emptyTypeLoaded = false;
     22    var fetchLoaded = false;
    2223    var counter = 0;
    2324    function count() {
     
    3132<link rel=preload href="../resources/test.ogv" as=video onload="count(); mediaLoaded = true;" onerror="count()">
    3233<link rel=preload href="../security/resources/captions.vtt" as=track onload="count(); trackLoaded = true;" onerror="count();">
    33 <link rel=preload href="../resources/dummy.xml" as=foobarxmlthing onload="count(); gibberishLoaded = true;" onerror="count(); gibberishErrored = true;">
     34<link rel=preload href="../resources/dummy.xml?foobarxmlthing" as=foobarxmlthing onload="count(); gibberishLoaded = true;" onerror="count(); gibberishErrored = true;">
    3435<link rel=preload href="../resources/dummy.xslt" as=xslt onload="count(); xsltLoaded = true;" onerror="count(); xsltErrored = true;">
    3536<link rel=preload href="../resources/dummy.xml" onload="count(); noTypeLoaded = true;" onerror="count()">
    3637<link rel=preload href="../resources/dummy.xml?empty" as onload="count(); emptyTypeLoaded = true;" onerror="count()">
     38<link rel=preload href="../resources/dummy.xml?fetch" as=fetch onload="count(); fetchLoaded = true;" onerror="count()">
    3739<script>
    3840    function test() {
     
    4446        shouldBeTrue("trackLoaded");
    4547        shouldBeFalse("gibberishLoaded");
    46         shouldBeTrue("gibberishErrored");
     48        shouldBeFalse("gibberishErrored");
    4749        shouldBeFalse("xsltLoaded");
    48         shouldBeTrue("xsltErrored");
    49         shouldBeTrue("noTypeLoaded");
    50         shouldBeTrue("emptyTypeLoaded");
     50        shouldBeFalse("xsltErrored");
     51        shouldBeFalse("noTypeLoaded");
     52        shouldBeFalse("emptyTypeLoaded");
     53        shouldBeTrue("fetchLoaded");
    5154        if (window.testRunner)
    5255            testRunner.notifyDone();
     
    7174    addEventListener("load", function(){
    7275        setInterval(function() {
    73             if (window.counter >= 10)
     76            if (window.counter >= 7)
    7477                test();
    7578        }, 100);
  • trunk/LayoutTests/http/tests/preload/preloadscanner_download_resources.html

    r217863 r217962  
    2929<link rel=preload href="../security/resources/captions.vtt" as=track>
    3030<link rel=preload href="../resources/dummy.xml?badvalue" as=foobarxmlthing>
    31 <link rel=preload href="../resources/dummy.xml">
     31<link rel=preload href="../resources/dummy.xml" as=fetch>
  • trunk/LayoutTests/http/tests/preload/resources/download_resources_from_header.php

    r217863 r217962  
    88header("link: <../security/resources/captions.vtt>; rel=preload; as=track", false);
    99header("Link: <../resources/dummy.xml?badvalue>; rel=preload; as=foobar", false);
    10 header("Link: <../resources/dummy.xml>; rel=preload", false);
     10header("Link: <../resources/dummy.xml?empty>; rel=preload", false);
     11header("Link: <../resources/dummy.xml>; rel=preload;as=fetch", false);
    1112?>
    1213<!DOCTYPE html>
     
    2122    shouldBeTrue("internals.isPreloaded('../security/resources/captions.vtt');");
    2223    shouldBeFalse("internals.isPreloaded('../resources/dummy.xml?badvalue');");
     24    shouldBeFalse("internals.isPreloaded('../resources/dummy.xml?empty');");
    2325    shouldBeTrue("internals.isPreloaded('../resources/dummy.xml');");
    2426</script>
  • trunk/LayoutTests/http/tests/preload/resources/nph-invalid_resources_from_header.pl

    r217863 r217962  
    1010Link: <../resources/test\f.mp4>; rel=preload; as=video
    1111Link: <../security/resources/cap\ttions.vtt>; rel=preload; as=track
    12 Link: <../resources/dummy   .xml>; rel=preload;
     12Link: <../resources/dummy   .xml>; rel=preload; as=fetch
    1313Link: <../resources/dumm>y.xml>; rel=preload
    1414Content-Security-Policy: img-src 'none'
  • trunk/LayoutTests/http/tests/preload/single_download_preload.html

    r217863 r217962  
    1414<link rel=preload href="http://127.0.0.1:8000/security/resources/captions.vtt" as=track>
    1515<link rel=preload href="http://127.0.0.1:8000/resources/dummy.xml?foobar" as=foobarxmlthing>
    16 <link rel=preload href="http://127.0.0.1:8000/resources/dummy.xml" crossorigin>
     16<link rel=preload href="http://127.0.0.1:8000/resources/dummy.xml" as=fetch crossorigin>
    1717<script src="http://127.0.0.1:8000/resources/slow-script.pl?delay=200"></script>
    1818<style>
  • trunk/LayoutTests/http/tests/preload/single_download_preload_headers.php

    r217863 r217962  
    99header("link: <http://127.0.0.1:8000/security/resources/captions.vtt>; rel=preload; as=track", false);
    1010header("Link: <http://127.0.0.1:8000/resources/dummy.xml?foobar>; rel=preload; as=foobar", false);
    11 header("Link: <http://127.0.0.1:8000/resources/dummy.xml>; crossorigin; rel=preload", false);
     11header("Link: <http://127.0.0.1:8000/resources/dummy.xml>; as=fetch; crossorigin; rel=preload", false);
    1212?>
    1313<!DOCTYPE html>
  • trunk/LayoutTests/imported/w3c/web-platform-tests/html/dom/reflection-metadata-expected.txt

    r217225 r217962  
    11471147PASS link.as: IDL get with DOM attribute unset
    11481148PASS link.as: setAttribute() to ""
    1149 FAIL link.as: setAttribute() to " \0\x01\x02\x03\x04\x05\x06\x07 \b\t\n\v\f\r\x0e\x0f \x10\x11\x12\x13\x14\x15\x16\x17 \x18\x19\x1a\x1b\x1c\x1d\x1e\x1f  foo " assert_equals: IDL get expected "" but got " \0\x01\x02\x03\x04\x05\x06\x07 \b\t\n\v\f\r\x0e\x0f \x10\x11\x12\x13\x14\x15\x16\x17 \x18\x19\x1a\x1b\x1c\x1d\x1e\x1f  foo "
    1150 FAIL link.as: setAttribute() to undefined assert_equals: IDL get expected "" but got "undefined"
    1151 FAIL link.as: setAttribute() to 7 assert_equals: IDL get expected "" but got "7"
    1152 FAIL link.as: setAttribute() to 1.5 assert_equals: IDL get expected "" but got "1.5"
    1153 FAIL link.as: setAttribute() to true assert_equals: IDL get expected "" but got "true"
    1154 FAIL link.as: setAttribute() to false assert_equals: IDL get expected "" but got "false"
    1155 FAIL link.as: setAttribute() to object "[object Object]" assert_equals: IDL get expected "" but got "[object Object]"
    1156 FAIL link.as: setAttribute() to NaN assert_equals: IDL get expected "" but got "NaN"
    1157 FAIL link.as: setAttribute() to Infinity assert_equals: IDL get expected "" but got "Infinity"
    1158 FAIL link.as: setAttribute() to -Infinity assert_equals: IDL get expected "" but got "-Infinity"
    1159 FAIL link.as: setAttribute() to "\0" assert_equals: IDL get expected "" but got "\0"
    1160 FAIL link.as: setAttribute() to null assert_equals: IDL get expected "" but got "null"
    1161 FAIL link.as: setAttribute() to object "test-toString" assert_equals: IDL get expected "" but got "test-toString"
    1162 FAIL link.as: setAttribute() to object "test-valueOf" assert_equals: IDL get expected "" but got "test-valueOf"
     1149PASS link.as: setAttribute() to " \0\x01\x02\x03\x04\x05\x06\x07 \b\t\n\v\f\r\x0e\x0f \x10\x11\x12\x13\x14\x15\x16\x17 \x18\x19\x1a\x1b\x1c\x1d\x1e\x1f  foo "
     1150PASS link.as: setAttribute() to undefined
     1151PASS link.as: setAttribute() to 7
     1152PASS link.as: setAttribute() to 1.5
     1153PASS link.as: setAttribute() to true
     1154PASS link.as: setAttribute() to false
     1155PASS link.as: setAttribute() to object "[object Object]"
     1156PASS link.as: setAttribute() to NaN
     1157PASS link.as: setAttribute() to Infinity
     1158PASS link.as: setAttribute() to -Infinity
     1159PASS link.as: setAttribute() to "\0"
     1160PASS link.as: setAttribute() to null
     1161PASS link.as: setAttribute() to object "test-toString"
     1162PASS link.as: setAttribute() to object "test-valueOf"
    11631163PASS link.as: setAttribute() to "audio"
    1164 FAIL link.as: setAttribute() to "xaudio" assert_equals: IDL get expected "" but got "xaudio"
    1165 FAIL link.as: setAttribute() to "audio\0" assert_equals: IDL get expected "" but got "audio\0"
    1166 FAIL link.as: setAttribute() to "udio" assert_equals: IDL get expected "" but got "udio"
     1164PASS link.as: setAttribute() to "xaudio"
     1165PASS link.as: setAttribute() to "audio\0"
     1166PASS link.as: setAttribute() to "udio"
    11671167FAIL link.as: setAttribute() to "AUDIO" assert_equals: IDL get expected "audio" but got "AUDIO"
    1168 PASS link.as: setAttribute() to "document"
    1169 FAIL link.as: setAttribute() to "xdocument" assert_equals: IDL get expected "" but got "xdocument"
    1170 FAIL link.as: setAttribute() to "document\0" assert_equals: IDL get expected "" but got "document\0"
    1171 FAIL link.as: setAttribute() to "ocument" assert_equals: IDL get expected "" but got "ocument"
    1172 FAIL link.as: setAttribute() to "DOCUMENT" assert_equals: IDL get expected "document" but got "DOCUMENT"
    1173 PASS link.as: setAttribute() to "embed"
    1174 FAIL link.as: setAttribute() to "xembed" assert_equals: IDL get expected "" but got "xembed"
    1175 FAIL link.as: setAttribute() to "embed\0" assert_equals: IDL get expected "" but got "embed\0"
    1176 FAIL link.as: setAttribute() to "mbed" assert_equals: IDL get expected "" but got "mbed"
    1177 FAIL link.as: setAttribute() to "EMBED" assert_equals: IDL get expected "embed" but got "EMBED"
     1168FAIL link.as: setAttribute() to "document" assert_equals: IDL get expected "document" but got ""
     1169PASS link.as: setAttribute() to "xdocument"
     1170PASS link.as: setAttribute() to "document\0"
     1171PASS link.as: setAttribute() to "ocument"
     1172FAIL link.as: setAttribute() to "DOCUMENT" assert_equals: IDL get expected "document" but got ""
     1173FAIL link.as: setAttribute() to "embed" assert_equals: IDL get expected "embed" but got ""
     1174PASS link.as: setAttribute() to "xembed"
     1175PASS link.as: setAttribute() to "embed\0"
     1176PASS link.as: setAttribute() to "mbed"
     1177FAIL link.as: setAttribute() to "EMBED" assert_equals: IDL get expected "embed" but got ""
    11781178PASS link.as: setAttribute() to "font"
    1179 FAIL link.as: setAttribute() to "xfont" assert_equals: IDL get expected "" but got "xfont"
    1180 FAIL link.as: setAttribute() to "font\0" assert_equals: IDL get expected "" but got "font\0"
    1181 FAIL link.as: setAttribute() to "ont" assert_equals: IDL get expected "" but got "ont"
     1179PASS link.as: setAttribute() to "xfont"
     1180PASS link.as: setAttribute() to "font\0"
     1181PASS link.as: setAttribute() to "ont"
    11821182FAIL link.as: setAttribute() to "FONT" assert_equals: IDL get expected "font" but got "FONT"
    11831183PASS link.as: setAttribute() to "image"
    1184 FAIL link.as: setAttribute() to "ximage" assert_equals: IDL get expected "" but got "ximage"
    1185 FAIL link.as: setAttribute() to "image\0" assert_equals: IDL get expected "" but got "image\0"
    1186 FAIL link.as: setAttribute() to "mage" assert_equals: IDL get expected "" but got "mage"
     1184PASS link.as: setAttribute() to "ximage"
     1185PASS link.as: setAttribute() to "image\0"
     1186PASS link.as: setAttribute() to "mage"
    11871187FAIL link.as: setAttribute() to "IMAGE" assert_equals: IDL get expected "image" but got "IMAGE"
    1188 PASS link.as: setAttribute() to "manifest"
    1189 FAIL link.as: setAttribute() to "xmanifest" assert_equals: IDL get expected "" but got "xmanifest"
    1190 FAIL link.as: setAttribute() to "manifest\0" assert_equals: IDL get expected "" but got "manifest\0"
    1191 FAIL link.as: setAttribute() to "anifest" assert_equals: IDL get expected "" but got "anifest"
    1192 FAIL link.as: setAttribute() to "MANIFEST" assert_equals: IDL get expected "manifest" but got "MANIFEST"
    1193 PASS link.as: setAttribute() to "object"
    1194 FAIL link.as: setAttribute() to "xobject" assert_equals: IDL get expected "" but got "xobject"
    1195 FAIL link.as: setAttribute() to "object\0" assert_equals: IDL get expected "" but got "object\0"
    1196 FAIL link.as: setAttribute() to "bject" assert_equals: IDL get expected "" but got "bject"
    1197 FAIL link.as: setAttribute() to "OBJECT" assert_equals: IDL get expected "object" but got "OBJECT"
    1198 PASS link.as: setAttribute() to "report"
    1199 FAIL link.as: setAttribute() to "xreport" assert_equals: IDL get expected "" but got "xreport"
    1200 FAIL link.as: setAttribute() to "report\0" assert_equals: IDL get expected "" but got "report\0"
    1201 FAIL link.as: setAttribute() to "eport" assert_equals: IDL get expected "" but got "eport"
    1202 FAIL link.as: setAttribute() to "REPORT" assert_equals: IDL get expected "report" but got "REPORT"
     1188FAIL link.as: setAttribute() to "manifest" assert_equals: IDL get expected "manifest" but got ""
     1189PASS link.as: setAttribute() to "xmanifest"
     1190PASS link.as: setAttribute() to "manifest\0"
     1191PASS link.as: setAttribute() to "anifest"
     1192FAIL link.as: setAttribute() to "MANIFEST" assert_equals: IDL get expected "manifest" but got ""
     1193FAIL link.as: setAttribute() to "object" assert_equals: IDL get expected "object" but got ""
     1194PASS link.as: setAttribute() to "xobject"
     1195PASS link.as: setAttribute() to "object\0"
     1196PASS link.as: setAttribute() to "bject"
     1197FAIL link.as: setAttribute() to "OBJECT" assert_equals: IDL get expected "object" but got ""
     1198FAIL link.as: setAttribute() to "report" assert_equals: IDL get expected "report" but got ""
     1199PASS link.as: setAttribute() to "xreport"
     1200PASS link.as: setAttribute() to "report\0"
     1201PASS link.as: setAttribute() to "eport"
     1202FAIL link.as: setAttribute() to "REPORT" assert_equals: IDL get expected "report" but got ""
    12031203PASS link.as: setAttribute() to "script"
    1204 FAIL link.as: setAttribute() to "xscript" assert_equals: IDL get expected "" but got "xscript"
    1205 FAIL link.as: setAttribute() to "script\0" assert_equals: IDL get expected "" but got "script\0"
    1206 FAIL link.as: setAttribute() to "cript" assert_equals: IDL get expected "" but got "cript"
     1204PASS link.as: setAttribute() to "xscript"
     1205PASS link.as: setAttribute() to "script\0"
     1206PASS link.as: setAttribute() to "cript"
    12071207FAIL link.as: setAttribute() to "SCRIPT" assert_equals: IDL get expected "script" but got "SCRIPT"
    1208 PASS link.as: setAttribute() to "serviceworker"
    1209 FAIL link.as: setAttribute() to "xserviceworker" assert_equals: IDL get expected "" but got "xserviceworker"
    1210 FAIL link.as: setAttribute() to "serviceworker\0" assert_equals: IDL get expected "" but got "serviceworker\0"
    1211 FAIL link.as: setAttribute() to "erviceworker" assert_equals: IDL get expected "" but got "erviceworker"
    1212 FAIL link.as: setAttribute() to "SERVICEWORKER" assert_equals: IDL get expected "serviceworker" but got "SERVICEWORKER"
    1213 PASS link.as: setAttribute() to "sharedworker"
    1214 FAIL link.as: setAttribute() to "xsharedworker" assert_equals: IDL get expected "" but got "xsharedworker"
    1215 FAIL link.as: setAttribute() to "sharedworker\0" assert_equals: IDL get expected "" but got "sharedworker\0"
    1216 FAIL link.as: setAttribute() to "haredworker" assert_equals: IDL get expected "" but got "haredworker"
    1217 FAIL link.as: setAttribute() to "SHAREDWORKER" assert_equals: IDL get expected "sharedworker" but got "SHAREDWORKER"
     1208FAIL link.as: setAttribute() to "serviceworker" assert_equals: IDL get expected "serviceworker" but got ""
     1209PASS link.as: setAttribute() to "xserviceworker"
     1210PASS link.as: setAttribute() to "serviceworker\0"
     1211PASS link.as: setAttribute() to "erviceworker"
     1212FAIL link.as: setAttribute() to "SERVICEWORKER" assert_equals: IDL get expected "serviceworker" but got ""
     1213FAIL link.as: setAttribute() to "sharedworker" assert_equals: IDL get expected "sharedworker" but got ""
     1214PASS link.as: setAttribute() to "xsharedworker"
     1215PASS link.as: setAttribute() to "sharedworker\0"
     1216PASS link.as: setAttribute() to "haredworker"
     1217FAIL link.as: setAttribute() to "SHAREDWORKER" assert_equals: IDL get expected "sharedworker" but got ""
    12181218PASS link.as: setAttribute() to "style"
    1219 FAIL link.as: setAttribute() to "xstyle" assert_equals: IDL get expected "" but got "xstyle"
    1220 FAIL link.as: setAttribute() to "style\0" assert_equals: IDL get expected "" but got "style\0"
    1221 FAIL link.as: setAttribute() to "tyle" assert_equals: IDL get expected "" but got "tyle"
     1219PASS link.as: setAttribute() to "xstyle"
     1220PASS link.as: setAttribute() to "style\0"
     1221PASS link.as: setAttribute() to "tyle"
    12221222FAIL link.as: setAttribute() to "STYLE" assert_equals: IDL get expected "style" but got "STYLE"
    12231223PASS link.as: setAttribute() to "track"
    1224 FAIL link.as: setAttribute() to "xtrack" assert_equals: IDL get expected "" but got "xtrack"
    1225 FAIL link.as: setAttribute() to "track\0" assert_equals: IDL get expected "" but got "track\0"
    1226 FAIL link.as: setAttribute() to "rack" assert_equals: IDL get expected "" but got "rack"
     1224PASS link.as: setAttribute() to "xtrack"
     1225PASS link.as: setAttribute() to "track\0"
     1226PASS link.as: setAttribute() to "rack"
    12271227FAIL link.as: setAttribute() to "TRACK" assert_equals: IDL get expected "track" but got "TRACK"
    12281228PASS link.as: setAttribute() to "video"
    1229 FAIL link.as: setAttribute() to "xvideo" assert_equals: IDL get expected "" but got "xvideo"
    1230 FAIL link.as: setAttribute() to "video\0" assert_equals: IDL get expected "" but got "video\0"
    1231 FAIL link.as: setAttribute() to "ideo" assert_equals: IDL get expected "" but got "ideo"
     1229PASS link.as: setAttribute() to "xvideo"
     1230PASS link.as: setAttribute() to "video\0"
     1231PASS link.as: setAttribute() to "ideo"
    12321232FAIL link.as: setAttribute() to "VIDEO" assert_equals: IDL get expected "video" but got "VIDEO"
    1233 PASS link.as: setAttribute() to "worker"
    1234 FAIL link.as: setAttribute() to "xworker" assert_equals: IDL get expected "" but got "xworker"
    1235 FAIL link.as: setAttribute() to "worker\0" assert_equals: IDL get expected "" but got "worker\0"
    1236 FAIL link.as: setAttribute() to "orker" assert_equals: IDL get expected "" but got "orker"
    1237 FAIL link.as: setAttribute() to "WORKER" assert_equals: IDL get expected "worker" but got "WORKER"
    1238 PASS link.as: setAttribute() to "xslt"
    1239 FAIL link.as: setAttribute() to "xxslt" assert_equals: IDL get expected "" but got "xxslt"
    1240 FAIL link.as: setAttribute() to "xslt\0" assert_equals: IDL get expected "" but got "xslt\0"
    1241 FAIL link.as: setAttribute() to "slt" assert_equals: IDL get expected "" but got "slt"
    1242 FAIL link.as: setAttribute() to "XSLT" assert_equals: IDL get expected "xslt" but got "XSLT"
     1233FAIL link.as: setAttribute() to "worker" assert_equals: IDL get expected "worker" but got ""
     1234PASS link.as: setAttribute() to "xworker"
     1235PASS link.as: setAttribute() to "worker\0"
     1236PASS link.as: setAttribute() to "orker"
     1237FAIL link.as: setAttribute() to "WORKER" assert_equals: IDL get expected "worker" but got ""
     1238FAIL link.as: setAttribute() to "xslt" assert_equals: IDL get expected "xslt" but got ""
     1239PASS link.as: setAttribute() to "xxslt"
     1240PASS link.as: setAttribute() to "xslt\0"
     1241PASS link.as: setAttribute() to "slt"
     1242FAIL link.as: setAttribute() to "XSLT" assert_equals: IDL get expected "xslt" but got ""
    12431243PASS link.as: IDL set to ""
    1244 FAIL link.as: IDL set to " \0\x01\x02\x03\x04\x05\x06\x07 \b\t\n\v\f\r\x0e\x0f \x10\x11\x12\x13\x14\x15\x16\x17 \x18\x19\x1a\x1b\x1c\x1d\x1e\x1f  foo " assert_equals: IDL get expected "" but got " \0\x01\x02\x03\x04\x05\x06\x07 \b\t\n\v\f\r\x0e\x0f \x10\x11\x12\x13\x14\x15\x16\x17 \x18\x19\x1a\x1b\x1c\x1d\x1e\x1f  foo "
    1245 FAIL link.as: IDL set to undefined assert_equals: IDL get expected "" but got "undefined"
    1246 FAIL link.as: IDL set to 7 assert_equals: IDL get expected "" but got "7"
    1247 FAIL link.as: IDL set to 1.5 assert_equals: IDL get expected "" but got "1.5"
    1248 FAIL link.as: IDL set to true assert_equals: IDL get expected "" but got "true"
    1249 FAIL link.as: IDL set to false assert_equals: IDL get expected "" but got "false"
    1250 FAIL link.as: IDL set to object "[object Object]" assert_equals: IDL get expected "" but got "[object Object]"
    1251 FAIL link.as: IDL set to NaN assert_equals: IDL get expected "" but got "NaN"
    1252 FAIL link.as: IDL set to Infinity assert_equals: IDL get expected "" but got "Infinity"
    1253 FAIL link.as: IDL set to -Infinity assert_equals: IDL get expected "" but got "-Infinity"
    1254 FAIL link.as: IDL set to "\0" assert_equals: IDL get expected "" but got "\0"
    1255 FAIL link.as: IDL set to null assert_equals: IDL get expected "" but got "null"
    1256 FAIL link.as: IDL set to object "test-toString" assert_equals: IDL get expected "" but got "test-toString"
    1257 FAIL link.as: IDL set to object "test-valueOf" assert_equals: IDL get expected "" but got "test-valueOf"
     1244PASS link.as: IDL set to " \0\x01\x02\x03\x04\x05\x06\x07 \b\t\n\v\f\r\x0e\x0f \x10\x11\x12\x13\x14\x15\x16\x17 \x18\x19\x1a\x1b\x1c\x1d\x1e\x1f  foo "
     1245PASS link.as: IDL set to undefined
     1246PASS link.as: IDL set to 7
     1247PASS link.as: IDL set to 1.5
     1248PASS link.as: IDL set to true
     1249PASS link.as: IDL set to false
     1250PASS link.as: IDL set to object "[object Object]"
     1251PASS link.as: IDL set to NaN
     1252PASS link.as: IDL set to Infinity
     1253PASS link.as: IDL set to -Infinity
     1254PASS link.as: IDL set to "\0"
     1255PASS link.as: IDL set to null
     1256PASS link.as: IDL set to object "test-toString"
     1257PASS link.as: IDL set to object "test-valueOf"
    12581258PASS link.as: IDL set to "audio"
    1259 FAIL link.as: IDL set to "xaudio" assert_equals: IDL get expected "" but got "xaudio"
    1260 FAIL link.as: IDL set to "audio\0" assert_equals: IDL get expected "" but got "audio\0"
    1261 FAIL link.as: IDL set to "udio" assert_equals: IDL get expected "" but got "udio"
     1259PASS link.as: IDL set to "xaudio"
     1260PASS link.as: IDL set to "audio\0"
     1261PASS link.as: IDL set to "udio"
    12621262FAIL link.as: IDL set to "AUDIO" assert_equals: IDL get expected "audio" but got "AUDIO"
    1263 PASS link.as: IDL set to "document"
    1264 FAIL link.as: IDL set to "xdocument" assert_equals: IDL get expected "" but got "xdocument"
    1265 FAIL link.as: IDL set to "document\0" assert_equals: IDL get expected "" but got "document\0"
    1266 FAIL link.as: IDL set to "ocument" assert_equals: IDL get expected "" but got "ocument"
    1267 FAIL link.as: IDL set to "DOCUMENT" assert_equals: IDL get expected "document" but got "DOCUMENT"
    1268 PASS link.as: IDL set to "embed"
    1269 FAIL link.as: IDL set to "xembed" assert_equals: IDL get expected "" but got "xembed"
    1270 FAIL link.as: IDL set to "embed\0" assert_equals: IDL get expected "" but got "embed\0"
    1271 FAIL link.as: IDL set to "mbed" assert_equals: IDL get expected "" but got "mbed"
    1272 FAIL link.as: IDL set to "EMBED" assert_equals: IDL get expected "embed" but got "EMBED"
     1263FAIL link.as: IDL set to "document" assert_equals: IDL get expected "document" but got ""
     1264PASS link.as: IDL set to "xdocument"
     1265PASS link.as: IDL set to "document\0"
     1266PASS link.as: IDL set to "ocument"
     1267FAIL link.as: IDL set to "DOCUMENT" assert_equals: IDL get expected "document" but got ""
     1268FAIL link.as: IDL set to "embed" assert_equals: IDL get expected "embed" but got ""
     1269PASS link.as: IDL set to "xembed"
     1270PASS link.as: IDL set to "embed\0"
     1271PASS link.as: IDL set to "mbed"
     1272FAIL link.as: IDL set to "EMBED" assert_equals: IDL get expected "embed" but got ""
    12731273PASS link.as: IDL set to "font"
    1274 FAIL link.as: IDL set to "xfont" assert_equals: IDL get expected "" but got "xfont"
    1275 FAIL link.as: IDL set to "font\0" assert_equals: IDL get expected "" but got "font\0"
    1276 FAIL link.as: IDL set to "ont" assert_equals: IDL get expected "" but got "ont"
     1274PASS link.as: IDL set to "xfont"
     1275PASS link.as: IDL set to "font\0"
     1276PASS link.as: IDL set to "ont"
    12771277FAIL link.as: IDL set to "FONT" assert_equals: IDL get expected "font" but got "FONT"
    12781278PASS link.as: IDL set to "image"
    1279 FAIL link.as: IDL set to "ximage" assert_equals: IDL get expected "" but got "ximage"
    1280 FAIL link.as: IDL set to "image\0" assert_equals: IDL get expected "" but got "image\0"
    1281 FAIL link.as: IDL set to "mage" assert_equals: IDL get expected "" but got "mage"
     1279PASS link.as: IDL set to "ximage"
     1280PASS link.as: IDL set to "image\0"
     1281PASS link.as: IDL set to "mage"
    12821282FAIL link.as: IDL set to "IMAGE" assert_equals: IDL get expected "image" but got "IMAGE"
    1283 PASS link.as: IDL set to "manifest"
    1284 FAIL link.as: IDL set to "xmanifest" assert_equals: IDL get expected "" but got "xmanifest"
    1285 FAIL link.as: IDL set to "manifest\0" assert_equals: IDL get expected "" but got "manifest\0"
    1286 FAIL link.as: IDL set to "anifest" assert_equals: IDL get expected "" but got "anifest"
    1287 FAIL link.as: IDL set to "MANIFEST" assert_equals: IDL get expected "manifest" but got "MANIFEST"
    1288 PASS link.as: IDL set to "object"
    1289 FAIL link.as: IDL set to "xobject" assert_equals: IDL get expected "" but got "xobject"
    1290 FAIL link.as: IDL set to "object\0" assert_equals: IDL get expected "" but got "object\0"
    1291 FAIL link.as: IDL set to "bject" assert_equals: IDL get expected "" but got "bject"
    1292 FAIL link.as: IDL set to "OBJECT" assert_equals: IDL get expected "object" but got "OBJECT"
    1293 PASS link.as: IDL set to "report"
    1294 FAIL link.as: IDL set to "xreport" assert_equals: IDL get expected "" but got "xreport"
    1295 FAIL link.as: IDL set to "report\0" assert_equals: IDL get expected "" but got "report\0"
    1296 FAIL link.as: IDL set to "eport" assert_equals: IDL get expected "" but got "eport"
    1297 FAIL link.as: IDL set to "REPORT" assert_equals: IDL get expected "report" but got "REPORT"
     1283FAIL link.as: IDL set to "manifest" assert_equals: IDL get expected "manifest" but got ""
     1284PASS link.as: IDL set to "xmanifest"
     1285PASS link.as: IDL set to "manifest\0"
     1286PASS link.as: IDL set to "anifest"
     1287FAIL link.as: IDL set to "MANIFEST" assert_equals: IDL get expected "manifest" but got ""
     1288FAIL link.as: IDL set to "object" assert_equals: IDL get expected "object" but got ""
     1289PASS link.as: IDL set to "xobject"
     1290PASS link.as: IDL set to "object\0"
     1291PASS link.as: IDL set to "bject"
     1292FAIL link.as: IDL set to "OBJECT" assert_equals: IDL get expected "object" but got ""
     1293FAIL link.as: IDL set to "report" assert_equals: IDL get expected "report" but got ""
     1294PASS link.as: IDL set to "xreport"
     1295PASS link.as: IDL set to "report\0"
     1296PASS link.as: IDL set to "eport"
     1297FAIL link.as: IDL set to "REPORT" assert_equals: IDL get expected "report" but got ""
    12981298PASS link.as: IDL set to "script"
    1299 FAIL link.as: IDL set to "xscript" assert_equals: IDL get expected "" but got "xscript"
    1300 FAIL link.as: IDL set to "script\0" assert_equals: IDL get expected "" but got "script\0"
    1301 FAIL link.as: IDL set to "cript" assert_equals: IDL get expected "" but got "cript"
     1299PASS link.as: IDL set to "xscript"
     1300PASS link.as: IDL set to "script\0"
     1301PASS link.as: IDL set to "cript"
    13021302FAIL link.as: IDL set to "SCRIPT" assert_equals: IDL get expected "script" but got "SCRIPT"
    1303 PASS link.as: IDL set to "serviceworker"
    1304 FAIL link.as: IDL set to "xserviceworker" assert_equals: IDL get expected "" but got "xserviceworker"
    1305 FAIL link.as: IDL set to "serviceworker\0" assert_equals: IDL get expected "" but got "serviceworker\0"
    1306 FAIL link.as: IDL set to "erviceworker" assert_equals: IDL get expected "" but got "erviceworker"
    1307 FAIL link.as: IDL set to "SERVICEWORKER" assert_equals: IDL get expected "serviceworker" but got "SERVICEWORKER"
    1308 PASS link.as: IDL set to "sharedworker"
    1309 FAIL link.as: IDL set to "xsharedworker" assert_equals: IDL get expected "" but got "xsharedworker"
    1310 FAIL link.as: IDL set to "sharedworker\0" assert_equals: IDL get expected "" but got "sharedworker\0"
    1311 FAIL link.as: IDL set to "haredworker" assert_equals: IDL get expected "" but got "haredworker"
    1312 FAIL link.as: IDL set to "SHAREDWORKER" assert_equals: IDL get expected "sharedworker" but got "SHAREDWORKER"
     1303FAIL link.as: IDL set to "serviceworker" assert_equals: IDL get expected "serviceworker" but got ""
     1304PASS link.as: IDL set to "xserviceworker"
     1305PASS link.as: IDL set to "serviceworker\0"
     1306PASS link.as: IDL set to "erviceworker"
     1307FAIL link.as: IDL set to "SERVICEWORKER" assert_equals: IDL get expected "serviceworker" but got ""
     1308FAIL link.as: IDL set to "sharedworker" assert_equals: IDL get expected "sharedworker" but got ""
     1309PASS link.as: IDL set to "xsharedworker"
     1310PASS link.as: IDL set to "sharedworker\0"
     1311PASS link.as: IDL set to "haredworker"
     1312FAIL link.as: IDL set to "SHAREDWORKER" assert_equals: IDL get expected "sharedworker" but got ""
    13131313PASS link.as: IDL set to "style"
    1314 FAIL link.as: IDL set to "xstyle" assert_equals: IDL get expected "" but got "xstyle"
    1315 FAIL link.as: IDL set to "style\0" assert_equals: IDL get expected "" but got "style\0"
    1316 FAIL link.as: IDL set to "tyle" assert_equals: IDL get expected "" but got "tyle"
     1314PASS link.as: IDL set to "xstyle"
     1315PASS link.as: IDL set to "style\0"
     1316PASS link.as: IDL set to "tyle"
    13171317FAIL link.as: IDL set to "STYLE" assert_equals: IDL get expected "style" but got "STYLE"
    13181318PASS link.as: IDL set to "track"
    1319 FAIL link.as: IDL set to "xtrack" assert_equals: IDL get expected "" but got "xtrack"
    1320 FAIL link.as: IDL set to "track\0" assert_equals: IDL get expected "" but got "track\0"
    1321 FAIL link.as: IDL set to "rack" assert_equals: IDL get expected "" but got "rack"
     1319PASS link.as: IDL set to "xtrack"
     1320PASS link.as: IDL set to "track\0"
     1321PASS link.as: IDL set to "rack"
    13221322FAIL link.as: IDL set to "TRACK" assert_equals: IDL get expected "track" but got "TRACK"
    13231323PASS link.as: IDL set to "video"
    1324 FAIL link.as: IDL set to "xvideo" assert_equals: IDL get expected "" but got "xvideo"
    1325 FAIL link.as: IDL set to "video\0" assert_equals: IDL get expected "" but got "video\0"
    1326 FAIL link.as: IDL set to "ideo" assert_equals: IDL get expected "" but got "ideo"
     1324PASS link.as: IDL set to "xvideo"
     1325PASS link.as: IDL set to "video\0"
     1326PASS link.as: IDL set to "ideo"
    13271327FAIL link.as: IDL set to "VIDEO" assert_equals: IDL get expected "video" but got "VIDEO"
    1328 PASS link.as: IDL set to "worker"
    1329 FAIL link.as: IDL set to "xworker" assert_equals: IDL get expected "" but got "xworker"
    1330 FAIL link.as: IDL set to "worker\0" assert_equals: IDL get expected "" but got "worker\0"
    1331 FAIL link.as: IDL set to "orker" assert_equals: IDL get expected "" but got "orker"
    1332 FAIL link.as: IDL set to "WORKER" assert_equals: IDL get expected "worker" but got "WORKER"
    1333 PASS link.as: IDL set to "xslt"
    1334 FAIL link.as: IDL set to "xxslt" assert_equals: IDL get expected "" but got "xxslt"
    1335 FAIL link.as: IDL set to "xslt\0" assert_equals: IDL get expected "" but got "xslt\0"
    1336 FAIL link.as: IDL set to "slt" assert_equals: IDL get expected "" but got "slt"
    1337 FAIL link.as: IDL set to "XSLT" assert_equals: IDL get expected "xslt" but got "XSLT"
     1328FAIL link.as: IDL set to "worker" assert_equals: IDL get expected "worker" but got ""
     1329PASS link.as: IDL set to "xworker"
     1330PASS link.as: IDL set to "worker\0"
     1331PASS link.as: IDL set to "orker"
     1332FAIL link.as: IDL set to "WORKER" assert_equals: IDL get expected "worker" but got ""
     1333FAIL link.as: IDL set to "xslt" assert_equals: IDL get expected "xslt" but got ""
     1334PASS link.as: IDL set to "xxslt"
     1335PASS link.as: IDL set to "xslt\0"
     1336PASS link.as: IDL set to "slt"
     1337FAIL link.as: IDL set to "XSLT" assert_equals: IDL get expected "xslt" but got ""
    13381338PASS link.media: typeof IDL attribute
    13391339PASS link.media: IDL get with DOM attribute unset
  • trunk/Source/WebCore/ChangeLog

    r217959 r217962  
     12017-06-08  Yoav Weiss  <yoav@yoav.ws>
     2
     3        [preload] Mandatory `as` value and related spec alignments
     4        https://bugs.webkit.org/show_bug.cgi?id=173047
     5
     6        Reviewed by Dean Jackson.
     7
     8        Align preload's implementation according to latest spec changes: `as` is mandatory and "fetch" replaces the previous empty `as` value,
     9        onerror no longer fires for invalid `as` values, and the IDL for `as` reflects only valid values, to enable feature detection.
     10
     11        Related standard discussions:
     12        https://github.com/w3c/preload/issues/80
     13        https://github.com/whatwg/fetch/pull/547
     14        https://github.com/whatwg/fetch/pull/549
     15        https://github.com/whatwg/html/pull/2588
     16
     17        No new tests but modified existing ones as well as their expectations.
     18
     19        * html/HTMLLinkElement.cpp: Add "enumerated attribute" reflection methods to `as`.
     20        (WebCore::HTMLLinkElement::setAs):
     21        (WebCore::HTMLLinkElement::as):
     22        * html/HTMLLinkElement.h:
     23        * html/HTMLLinkElement.idl:
     24        * loader/LinkLoader.cpp:
     25        (WebCore::LinkLoader::loadLinksFromHeader): preloadIfNeeded signature change.
     26        (WebCore::LinkLoader::resourceTypeFromAsAttribute): Replace the empty value by "fetch".
     27        (WebCore::LinkLoader::preloadIfNeeded): Change the signature, as a LinkLoaderClient is no longer needed, since we don't fire error
     28        events from inside the function.
     29        (WebCore::LinkLoader::loadLink): preloadIfNeeded signature change.
     30        * loader/LinkLoader.h: preloadIfNeeded signature change.
     31
    1322017-06-08  Chris Dumez  <cdumez@apple.com>
    233
  • trunk/Source/WebCore/html/HTMLLinkElement.cpp

    r217256 r217962  
    220220}
    221221
     222void HTMLLinkElement::setAs(const AtomicString& value)
     223{
     224    setAttributeWithoutSynchronization(asAttr, value);
     225}
     226
     227String HTMLLinkElement::as() const
     228{
     229    String as = attributeWithoutSynchronization(asAttr);
     230    if (equalLettersIgnoringASCIICase(as, "fetch")
     231        || equalLettersIgnoringASCIICase(as, "image")
     232        || equalLettersIgnoringASCIICase(as, "script")
     233        || equalLettersIgnoringASCIICase(as, "style")
     234        || equalLettersIgnoringASCIICase(as, "video")
     235        || equalLettersIgnoringASCIICase(as, "audio")
     236        || equalLettersIgnoringASCIICase(as, "font")
     237#if ENABLE(VIDEO_TRACK)
     238        || equalLettersIgnoringASCIICase(as, "track"))
     239#endif
     240        return as;
     241    return String();
     242}
     243
    222244void HTMLLinkElement::process()
    223245{
  • trunk/Source/WebCore/html/HTMLLinkElement.h

    r216978 r217962  
    6666    WEBCORE_EXPORT void setCrossOrigin(const AtomicString&);
    6767    WEBCORE_EXPORT String crossOrigin() const;
     68    WEBCORE_EXPORT void setAs(const AtomicString&);
     69    WEBCORE_EXPORT String as() const;
    6870
    6971    void dispatchPendingEvent(LinkEventSender*);
  • trunk/Source/WebCore/html/HTMLLinkElement.idl

    r216347 r217962  
    3434    [Reflect] attribute DOMString target;
    3535    [Reflect] attribute DOMString type;
    36     [Reflect] attribute DOMString as;
     36    attribute DOMString as;
    3737    attribute DOMString? crossOrigin;
    3838
  • trunk/Source/WebCore/loader/LinkLoader.cpp

    r217863 r217962  
    108108        if (equalIgnoringFragmentIdentifier(url, baseURL))
    109109            continue;
    110         preloadIfNeeded(relAttribute, url, document, header.as(), header.media(), header.mimeType(), header.crossOrigin(), nullptr, nullptr);
     110        preloadIfNeeded(relAttribute, url, document, header.as(), header.media(), header.mimeType(), header.crossOrigin(), nullptr);
    111111    }
    112112}
     
    114114std::optional<CachedResource::Type> LinkLoader::resourceTypeFromAsAttribute(const String& as)
    115115{
    116     if (as.isEmpty())
     116    if (equalLettersIgnoringASCIICase(as, "fetch"))
    117117        return CachedResource::RawResource;
    118118    if (equalLettersIgnoringASCIICase(as, "image"))
     
    201201}
    202202
    203 std::unique_ptr<LinkPreloadResourceClient> LinkLoader::preloadIfNeeded(const LinkRelAttribute& relAttribute, const URL& href, Document& document, const String& as, const String& media, const String& mimeType, const String& crossOriginMode, LinkLoader* loader, LinkLoaderClient* client)
     203std::unique_ptr<LinkPreloadResourceClient> LinkLoader::preloadIfNeeded(const LinkRelAttribute& relAttribute, const URL& href, Document& document, const String& as, const String& media, const String& mimeType, const String& crossOriginMode, LinkLoader* loader)
    204204{
    205205    if (!document.loader() || !relAttribute.isLinkPreload)
     
    214214    if (!type) {
    215215        document.addConsoleMessage(MessageSource::Other, MessageLevel::Error, String("<link rel=preload> must have a valid `as` value"));
    216         if (client)
    217             client->linkLoadingErrored();
    218216        return nullptr;
    219217    }
     
    253251
    254252    if (m_client.shouldLoadLink()) {
    255         auto resourceClient = preloadIfNeeded(relAttribute, href, document, as, media, mimeType, crossOrigin, this, &m_client);
     253        auto resourceClient = preloadIfNeeded(relAttribute, href, document, as, media, mimeType, crossOrigin, this);
    256254        if (resourceClient)
    257255            m_preloadResourceClient = WTFMove(resourceClient);
  • trunk/Source/WebCore/loader/LinkLoader.h

    r217247 r217962  
    6565private:
    6666    void notifyFinished(CachedResource&) override;
    67     static std::unique_ptr<LinkPreloadResourceClient> preloadIfNeeded(const LinkRelAttribute&, const URL& href, Document&, const String& as, const String& media, const String& type, const String& crossOriginMode, LinkLoader*, LinkLoaderClient*);
     67    static std::unique_ptr<LinkPreloadResourceClient> preloadIfNeeded(const LinkRelAttribute&, const URL& href, Document&, const String& as, const String& media, const String& type, const String& crossOriginMode, LinkLoader*);
    6868
    6969    LinkLoaderClient& m_client;
Note: See TracChangeset for help on using the changeset viewer.