<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[199650] trunk</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/199650">199650</a></dd>
<dt>Author</dt> <dd>yoav@yoav.ws</dd>
<dt>Date</dt> <dd>2016-04-17 23:06:42 -0700 (Sun, 17 Apr 2016)</dd>
</dl>
<h3>Log Message</h3>
<pre>Initial Link preload support
https://bugs.webkit.org/show_bug.cgi?id=156334
Source/WebCore:
Added basic `<link rel=preload>` functionality that enables preloading
of resources according to their type.
Reviewed by Darin Adler.
Tests: http/tests/preload/download_resources.html
http/tests/preload/dynamic_adding_preload.html
http/tests/preload/dynamic_remove_preload_href.html
http/tests/preload/dynamic_removing_preload.html
* bindings/generic/RuntimeEnabledFeatures.cpp: Added a runtime flag for the feature.
(WebCore::RuntimeEnabledFeatures::RuntimeEnabledFeatures):
* bindings/generic/RuntimeEnabledFeatures.h: Added a runtime flag for the feature.
(WebCore::RuntimeEnabledFeatures::setLinkPreloadEnabled):
(WebCore::RuntimeEnabledFeatures::linkPreloadEnabled):
* html/HTMLAttributeNames.in: Added an `as` attribute.
* html/HTMLLinkElement.cpp:
(WebCore::HTMLLinkElement::process): Added `as` and `crossorigin` attribute values to the loadLink() call.
(WebCore::HTMLLinkElement::setCrossOrigin): Setter for crossOrigin.
(WebCore::HTMLLinkElement::crossOrigin): Getter for crossOrigin.
* html/HTMLLinkElement.idl: Added `as` and `crossorigin` to HTMLLinkElement.
* html/HTMLLinkElement.h: Added getter and setter for crossorigin.
* html/LinkRelAttribute.cpp:
(WebCore::LinkRelAttribute::LinkRelAttribute): Added "preload" as a potential value.
* html/LinkRelAttribute.h: Added isLinkPreload.
* loader/LinkLoader.cpp:
(WebCore::LinkLoader::resourceTypeFromAsAttribute): Translates an `as` value into a resource type.
(WebCore::preloadIfNeeded): Triggers a resource preload when link element is a preload one.
(WebCore::LinkLoader::loadLink): Added a call to preloadIfNeeded.
* loader/LinkLoader.h: Added signatures.
* loader/ResourceLoadInfo.cpp:
(WebCore::toResourceType): Added LinkPreload as a possible CachedResource::type.
* loader/SubresourceLoader.cpp:
(WebCore::logResourceLoaded): Added LinkPreload as a possible CachedResource::type.
* loader/cache/CachedResource.cpp: Turned defaultPriorityForResourceType into a static member, as it's now also called from LinkLoader.
(WebCore::CachedResource::defaultPriorityForResourceType): Added LinkPreload as a possible CachedResource::type, giving it low priority.
(WebCore::defaultPriorityForResourceType): Deleted.
* loader/cache/CachedResource.h: Added LinkPreload as a possible CachedResource::type. Added defaultPriorityForResourceType as static.
* loader/cache/CachedResourceLoader.cpp:
(WebCore::contentTypeFromResourceType): Added LinkPreload as a possible CachedResource::type.
(WebCore::createResource): Added creation of a LinkPreload resource if needed.
(WebCore::CachedResourceLoader::checkInsecureContent): Added LinkPreload as a possible CachedResource::type.
(WebCore::CachedResourceLoader::canRequest): Added LinkPreload as a possible CachedResource::type.
* testing/Internals.cpp: Added function to turn on the link preload feature.
(WebCore::setLinkPreloadSupport):
* testing/Internals.idl: Added function to turn on the link preload feature.
* testing/Internals.h: Added function signature to turn on the link preload feature.
Source/WebKit2:
Reviewed by Darin Adler.
* WebProcess/Network/WebLoaderStrategy.cpp:
(WebKit::maximumBufferingTime): Added LinkPreload as a possible CachedResource::type.
LayoutTests:
Added tests that make sure that `<link rel=preload>` performs its basic
tasks and preloads resources.
Reviewed by Darin Adler.
* http/tests/preload/download_resources-expected.txt: Added.
* http/tests/preload/download_resources.html: Added.
* http/tests/preload/dynamic_adding_preload-expected.txt: Added.
* http/tests/preload/dynamic_adding_preload.html: Added.
* http/tests/preload/dynamic_remove_preload_href-expected.txt: Added.
* http/tests/preload/dynamic_remove_preload_href.html: Added.
* http/tests/preload/dynamic_removing_preload-expected.txt: Added.
* http/tests/preload/dynamic_removing_preload.html: Added.
* imported/w3c/web-platform-tests/html/dom/interfaces-expected.txt: Adjusted expected results to progressions.
* imported/w3c/web-platform-tests/html/dom/reflection-metadata-expected.txt: Adjusted expected results to progressions.
* platform/ios-simulator/imported/w3c/web-platform-tests/html/dom/interfaces-expected.txt: Adjusted expected results to progressions.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestshtmldominterfacesexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/html/dom/interfaces-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestshtmldomreflectionmetadataexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/html/dom/reflection-metadata-expected.txt</a></li>
<li><a href="#trunkLayoutTestsplatformiossimulatorimportedw3cwebplatformtestshtmldominterfacesexpectedtxt">trunk/LayoutTests/platform/ios-simulator/imported/w3c/web-platform-tests/html/dom/interfaces-expected.txt</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorebindingsgenericRuntimeEnabledFeaturescpp">trunk/Source/WebCore/bindings/generic/RuntimeEnabledFeatures.cpp</a></li>
<li><a href="#trunkSourceWebCorebindingsgenericRuntimeEnabledFeaturesh">trunk/Source/WebCore/bindings/generic/RuntimeEnabledFeatures.h</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLAttributeNamesin">trunk/Source/WebCore/html/HTMLAttributeNames.in</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLLinkElementcpp">trunk/Source/WebCore/html/HTMLLinkElement.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLLinkElementh">trunk/Source/WebCore/html/HTMLLinkElement.h</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLLinkElementidl">trunk/Source/WebCore/html/HTMLLinkElement.idl</a></li>
<li><a href="#trunkSourceWebCorehtmlLinkRelAttributecpp">trunk/Source/WebCore/html/LinkRelAttribute.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlLinkRelAttributeh">trunk/Source/WebCore/html/LinkRelAttribute.h</a></li>
<li><a href="#trunkSourceWebCoreloaderLinkLoadercpp">trunk/Source/WebCore/loader/LinkLoader.cpp</a></li>
<li><a href="#trunkSourceWebCoreloaderLinkLoaderh">trunk/Source/WebCore/loader/LinkLoader.h</a></li>
<li><a href="#trunkSourceWebCoreloaderResourceLoadInfocpp">trunk/Source/WebCore/loader/ResourceLoadInfo.cpp</a></li>
<li><a href="#trunkSourceWebCoreloaderSubresourceLoadercpp">trunk/Source/WebCore/loader/SubresourceLoader.cpp</a></li>
<li><a href="#trunkSourceWebCoreloadercacheCachedResourcecpp">trunk/Source/WebCore/loader/cache/CachedResource.cpp</a></li>
<li><a href="#trunkSourceWebCoreloadercacheCachedResourceh">trunk/Source/WebCore/loader/cache/CachedResource.h</a></li>
<li><a href="#trunkSourceWebCoreloadercacheCachedResourceLoadercpp">trunk/Source/WebCore/loader/cache/CachedResourceLoader.cpp</a></li>
<li><a href="#trunkSourceWebCoretestingInternalscpp">trunk/Source/WebCore/testing/Internals.cpp</a></li>
<li><a href="#trunkSourceWebCoretestingInternalsh">trunk/Source/WebCore/testing/Internals.h</a></li>
<li><a href="#trunkSourceWebCoretestingInternalsidl">trunk/Source/WebCore/testing/Internals.idl</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2WebProcessNetworkWebLoaderStrategycpp">trunk/Source/WebKit2/WebProcess/Network/WebLoaderStrategy.cpp</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li>trunk/LayoutTests/http/tests/preload/</li>
<li><a href="#trunkLayoutTestshttptestspreloaddownload_resourcesexpectedtxt">trunk/LayoutTests/http/tests/preload/download_resources-expected.txt</a></li>
<li><a href="#trunkLayoutTestshttptestspreloaddownload_resourceshtml">trunk/LayoutTests/http/tests/preload/download_resources.html</a></li>
<li><a href="#trunkLayoutTestshttptestspreloaddynamic_adding_preloadexpectedtxt">trunk/LayoutTests/http/tests/preload/dynamic_adding_preload-expected.txt</a></li>
<li><a href="#trunkLayoutTestshttptestspreloaddynamic_adding_preloadhtml">trunk/LayoutTests/http/tests/preload/dynamic_adding_preload.html</a></li>
<li><a href="#trunkLayoutTestshttptestspreloaddynamic_remove_preload_hrefexpectedtxt">trunk/LayoutTests/http/tests/preload/dynamic_remove_preload_href-expected.txt</a></li>
<li><a href="#trunkLayoutTestshttptestspreloaddynamic_remove_preload_hrefhtml">trunk/LayoutTests/http/tests/preload/dynamic_remove_preload_href.html</a></li>
<li><a href="#trunkLayoutTestshttptestspreloaddynamic_removing_preloadexpectedtxt">trunk/LayoutTests/http/tests/preload/dynamic_removing_preload-expected.txt</a></li>
<li><a href="#trunkLayoutTestshttptestspreloaddynamic_removing_preloadhtml">trunk/LayoutTests/http/tests/preload/dynamic_removing_preload.html</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (199649 => 199650)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2016-04-18 05:36:31 UTC (rev 199649)
+++ trunk/LayoutTests/ChangeLog        2016-04-18 06:06:42 UTC (rev 199650)
</span><span class="lines">@@ -1,3 +1,25 @@
</span><ins>+2016-04-17 Yoav Weiss <yoav@yoav.ws>
+
+ Initial Link preload support
+ https://bugs.webkit.org/show_bug.cgi?id=156334
+
+ Added tests that make sure that `<link rel=preload>` performs its basic
+ tasks and preloads resources.
+
+ Reviewed by Darin Adler.
+
+ * http/tests/preload/download_resources-expected.txt: Added.
+ * http/tests/preload/download_resources.html: Added.
+ * http/tests/preload/dynamic_adding_preload-expected.txt: Added.
+ * http/tests/preload/dynamic_adding_preload.html: Added.
+ * http/tests/preload/dynamic_remove_preload_href-expected.txt: Added.
+ * http/tests/preload/dynamic_remove_preload_href.html: Added.
+ * http/tests/preload/dynamic_removing_preload-expected.txt: Added.
+ * http/tests/preload/dynamic_removing_preload.html: Added.
+ * imported/w3c/web-platform-tests/html/dom/interfaces-expected.txt: Adjusted expected results to progressions.
+ * imported/w3c/web-platform-tests/html/dom/reflection-metadata-expected.txt: Adjusted expected results to progressions.
+ * platform/ios-simulator/imported/w3c/web-platform-tests/html/dom/interfaces-expected.txt: Adjusted expected results to progressions.
+
</ins><span class="cx"> 2016-04-17 Youenn Fablet <youenn.fablet@crf.canon.fr>
</span><span class="cx">
</span><span class="cx"> [Streams] Consume HTTP data as a ReadableStream
</span></span></pre></div>
<a id="trunkLayoutTestshttptestspreloaddownload_resourcesexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/preload/download_resources-expected.txt (0 => 199650)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/preload/download_resources-expected.txt         (rev 0)
+++ trunk/LayoutTests/http/tests/preload/download_resources-expected.txt        2016-04-18 06:06:42 UTC (rev 199650)
</span><span class="lines">@@ -0,0 +1,13 @@
</span><ins>+CONSOLE MESSAGE: line 15: <link rel=preload> must have a valid `as` value
+PASS internals.isPreloaded('../resources/dummy.js'); is true
+PASS internals.isPreloaded('../resources/dummy.css'); is true
+PASS internals.isPreloaded('../resources/square.png'); is true
+PASS internals.isPreloaded('../resources/Ahem.ttf'); is true
+PASS internals.isPreloaded('../resources/test.mp4'); is true
+PASS internals.isPreloaded('../security/resources/captions.vtt'); is true
+PASS internals.isPreloaded('../resources/dummy.xml?badvalue'); is false
+PASS internals.isPreloaded('../resources/dummy.xml'); is true
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestspreloaddownload_resourceshtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/preload/download_resources.html (0 => 199650)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/preload/download_resources.html         (rev 0)
+++ trunk/LayoutTests/http/tests/preload/download_resources.html        2016-04-18 06:06:42 UTC (rev 199650)
</span><span class="lines">@@ -0,0 +1,35 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<head>
+<script>
+ if (window.internals)
+ window.internals.setLinkPreloadSupport(true);
+</script>
+<script src="/js-test-resources/js-test.js"></script>
+<link rel=preload href="../resources/dummy.js" as=script>
+<link rel=preload href="../resources/dummy.css" as=style>
+<link rel=preload href="../resources/square.png" as=image>
+<link rel=preload href="../resources/Ahem.ttf" as=font crossorigin>
+<link rel=preload href="../resources/test.mp4" as=media>
+<link rel=preload href="../security/resources/captions.vtt" as=track>
+<link rel=preload href="../resources/dummy.xml?badvalue" as=foobarxmlthing>
+<link rel=preload href="../resources/dummy.xml">
+<script src="http://127.0.0.1:8000/resources/slow-script.pl?delay=100"></script>
+</head>
+<body>
+<script>
+ if (window.testRunner)
+ testRunner.dumpAsText();
+ shouldBeTrue("internals.isPreloaded('../resources/dummy.js');");
+ shouldBeTrue("internals.isPreloaded('../resources/dummy.css');");
+ shouldBeTrue("internals.isPreloaded('../resources/square.png');");
+ shouldBeTrue("internals.isPreloaded('../resources/Ahem.ttf');");
+ shouldBeTrue("internals.isPreloaded('../resources/test.mp4');");
+ shouldBeTrue("internals.isPreloaded('../security/resources/captions.vtt');");
+ shouldBeFalse("internals.isPreloaded('../resources/dummy.xml?badvalue');");
+ shouldBeTrue("internals.isPreloaded('../resources/dummy.xml');");
+</script>
+<script>
+ if (window.internals)
+ window.internals.setLinkPreloadSupport(false);
+</script>
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestspreloaddynamic_adding_preloadexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/preload/dynamic_adding_preload-expected.txt (0 => 199650)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/preload/dynamic_adding_preload-expected.txt         (rev 0)
+++ trunk/LayoutTests/http/tests/preload/dynamic_adding_preload-expected.txt        2016-04-18 06:06:42 UTC (rev 199650)
</span><span class="lines">@@ -0,0 +1,5 @@
</span><ins>+PASS internals.isPreloaded('../resources/dummy.js'); is true
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestspreloaddynamic_adding_preloadhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/preload/dynamic_adding_preload.html (0 => 199650)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/preload/dynamic_adding_preload.html         (rev 0)
+++ trunk/LayoutTests/http/tests/preload/dynamic_adding_preload.html        2016-04-18 06:06:42 UTC (rev 199650)
</span><span class="lines">@@ -0,0 +1,24 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<head>
+<script>
+ if (window.internals)
+ window.internals.setLinkPreloadSupport(true);
+</script>
+<script src="/js-test-resources/js-test.js"></script>
+<body>
+<script>
+ var link = document.createElement("link");
+ link.as = "script";
+ link.rel = "preload";
+ link.href = "../resources/dummy.js";
+ document.body.appendChild(link);
+</script>
+<script src="http://127.0.0.1:8000/resources/slow-script.pl?delay=100"></script>
+<script>
+ shouldBeTrue("internals.isPreloaded('../resources/dummy.js');");
+
+ if (window.internals)
+ window.internals.setLinkPreloadSupport(false);
+</script>
+</body>
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestspreloaddynamic_remove_preload_hrefexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/preload/dynamic_remove_preload_href-expected.txt (0 => 199650)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/preload/dynamic_remove_preload_href-expected.txt         (rev 0)
+++ trunk/LayoutTests/http/tests/preload/dynamic_remove_preload_href-expected.txt        2016-04-18 06:06:42 UTC (rev 199650)
</span><span class="lines">@@ -0,0 +1,6 @@
</span><ins>+CONSOLE MESSAGE: line 16: <link rel=preload> has an invalid `href` value
+PASS internals.isPreloaded('../resources/dummy.js'); is false
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestspreloaddynamic_remove_preload_hrefhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/preload/dynamic_remove_preload_href.html (0 => 199650)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/preload/dynamic_remove_preload_href.html         (rev 0)
+++ trunk/LayoutTests/http/tests/preload/dynamic_remove_preload_href.html        2016-04-18 06:06:42 UTC (rev 199650)
</span><span class="lines">@@ -0,0 +1,26 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<head>
+<script>
+ if (window.internals)
+ window.internals.setLinkPreloadSupport(true);
+</script>
+<script src="/js-test-resources/js-test.js"></script>
+<body>
+<script>
+ var link = document.createElement("link");
+ link.as = "script";
+ link.rel = "preload";
+ link.href = "../resources/dummy.js";
+ document.body.appendChild(link);
+ link.href = "";
+ window.addEventListener("load", function() {
+ shouldBeFalse("internals.isPreloaded('../resources/dummy.js');");
+ });
+</script>
+<script src="../resources/slow-script.pl?delay=200"></script>
+<script>
+ if (window.internals)
+ window.internals.setLinkPreloadSupport(false);
+</script>
+</body>
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestspreloaddynamic_removing_preloadexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/preload/dynamic_removing_preload-expected.txt (0 => 199650)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/preload/dynamic_removing_preload-expected.txt         (rev 0)
+++ trunk/LayoutTests/http/tests/preload/dynamic_removing_preload-expected.txt        2016-04-18 06:06:42 UTC (rev 199650)
</span><span class="lines">@@ -0,0 +1,5 @@
</span><ins>+PASS internals.isPreloaded('../resources/dummy.js'); is false
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestspreloaddynamic_removing_preloadhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/preload/dynamic_removing_preload.html (0 => 199650)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/preload/dynamic_removing_preload.html         (rev 0)
+++ trunk/LayoutTests/http/tests/preload/dynamic_removing_preload.html        2016-04-18 06:06:42 UTC (rev 199650)
</span><span class="lines">@@ -0,0 +1,18 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<head>
+<script src="/js-test-resources/js-test.js"></script>
+<body>
+<script>
+ var link = document.createElement("link");
+ link.as = "script";
+ link.rel = "preload";
+ link.href = "../resources/dummy.js";
+ document.body.appendChild(link);
+ document.body.removeChild(link);
+ window.addEventListener("load", function() {
+ shouldBeFalse("internals.isPreloaded('../resources/dummy.js');");
+ });
+</script>
+<script src="../resources/slow-script.pl?delay=200"></script>
+</body>
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestshtmldominterfacesexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/dom/interfaces-expected.txt (199649 => 199650)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/dom/interfaces-expected.txt        2016-04-18 05:36:31 UTC (rev 199649)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/dom/interfaces-expected.txt        2016-04-18 06:06:42 UTC (rev 199650)
</span><span class="lines">@@ -1366,7 +1366,7 @@
</span><span class="cx"> PASS HTMLLinkElement interface: existence and properties of interface prototype object
</span><span class="cx"> PASS HTMLLinkElement interface: existence and properties of interface prototype object's "constructor" property
</span><span class="cx"> PASS HTMLLinkElement interface: attribute href
</span><del>-FAIL HTMLLinkElement interface: attribute crossOrigin assert_true: The prototype object must have a property "crossOrigin" expected true got false
</del><ins>+PASS HTMLLinkElement interface: attribute crossOrigin
</ins><span class="cx"> PASS HTMLLinkElement interface: attribute rel
</span><span class="cx"> PASS HTMLLinkElement interface: attribute relList
</span><span class="cx"> PASS HTMLLinkElement interface: attribute media
</span><span class="lines">@@ -1379,7 +1379,7 @@
</span><span class="cx"> PASS HTMLLinkElement must be primary interface of document.createElement("link")
</span><span class="cx"> PASS Stringification of document.createElement("link")
</span><span class="cx"> PASS HTMLLinkElement interface: document.createElement("link") must inherit property "href" with the proper type (0)
</span><del>-FAIL HTMLLinkElement interface: document.createElement("link") must inherit property "crossOrigin" with the proper type (1) assert_inherits: property "crossOrigin" not found in prototype chain
</del><ins>+PASS HTMLLinkElement interface: document.createElement("link") must inherit property "crossOrigin" with the proper type (1)
</ins><span class="cx"> PASS HTMLLinkElement interface: document.createElement("link") must inherit property "rel" with the proper type (2)
</span><span class="cx"> PASS HTMLLinkElement interface: document.createElement("link") must inherit property "relList" with the proper type (3)
</span><span class="cx"> PASS HTMLLinkElement interface: document.createElement("link") must inherit property "media" with the proper type (4)
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestshtmldomreflectionmetadataexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/dom/reflection-metadata-expected.txt (199649 => 199650)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/dom/reflection-metadata-expected.txt        2016-04-18 05:36:31 UTC (rev 199649)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/dom/reflection-metadata-expected.txt        2016-04-18 06:06:42 UTC (rev 199650)
</span><span class="lines">@@ -3051,132 +3051,132 @@
</span><span class="cx"> PASS link.href: IDL set to object "test-valueOf" should not throw
</span><span class="cx"> PASS link.href: IDL set to object "test-valueOf" followed by getAttribute()
</span><span class="cx"> PASS link.href: IDL set to object "test-valueOf" followed by IDL get
</span><del>-FAIL link.crossOrigin: typeof IDL attribute assert_equals: expected "string" but got "undefined"
-FAIL link.crossOrigin: IDL get with DOM attribute unset assert_equals: expected (string) "" but got (undefined) undefined
</del><ins>+FAIL link.crossOrigin: typeof IDL attribute assert_equals: expected "string" but got "object"
+FAIL link.crossOrigin: IDL get with DOM attribute unset assert_equals: expected (string) "" but got (object) null
</ins><span class="cx"> PASS link.crossOrigin: setAttribute() to "" followed by getAttribute()
</span><del>-FAIL link.crossOrigin: setAttribute() to "" followed by IDL get assert_equals: expected (string) "anonymous" but got (undefined) undefined
</del><ins>+PASS link.crossOrigin: setAttribute() to "" followed by IDL get
</ins><span class="cx"> PASS link.crossOrigin: 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 " followed by getAttribute()
</span><del>-FAIL link.crossOrigin: 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 " followed by IDL get assert_equals: expected (string) "anonymous" but got (undefined) undefined
</del><ins>+PASS link.crossOrigin: 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 " followed by IDL get
</ins><span class="cx"> PASS link.crossOrigin: setAttribute() to undefined followed by getAttribute()
</span><del>-FAIL link.crossOrigin: setAttribute() to undefined followed by IDL get assert_equals: expected (string) "anonymous" but got (undefined) undefined
</del><ins>+PASS link.crossOrigin: setAttribute() to undefined followed by IDL get
</ins><span class="cx"> PASS link.crossOrigin: setAttribute() to 7 followed by getAttribute()
</span><del>-FAIL link.crossOrigin: setAttribute() to 7 followed by IDL get assert_equals: expected (string) "anonymous" but got (undefined) undefined
</del><ins>+PASS link.crossOrigin: setAttribute() to 7 followed by IDL get
</ins><span class="cx"> PASS link.crossOrigin: setAttribute() to 1.5 followed by getAttribute()
</span><del>-FAIL link.crossOrigin: setAttribute() to 1.5 followed by IDL get assert_equals: expected (string) "anonymous" but got (undefined) undefined
</del><ins>+PASS link.crossOrigin: setAttribute() to 1.5 followed by IDL get
</ins><span class="cx"> PASS link.crossOrigin: setAttribute() to true followed by getAttribute()
</span><del>-FAIL link.crossOrigin: setAttribute() to true followed by IDL get assert_equals: expected (string) "anonymous" but got (undefined) undefined
</del><ins>+PASS link.crossOrigin: setAttribute() to true followed by IDL get
</ins><span class="cx"> PASS link.crossOrigin: setAttribute() to false followed by getAttribute()
</span><del>-FAIL link.crossOrigin: setAttribute() to false followed by IDL get assert_equals: expected (string) "anonymous" but got (undefined) undefined
</del><ins>+PASS link.crossOrigin: setAttribute() to false followed by IDL get
</ins><span class="cx"> PASS link.crossOrigin: setAttribute() to object "[object Object]" followed by getAttribute()
</span><del>-FAIL link.crossOrigin: setAttribute() to object "[object Object]" followed by IDL get assert_equals: expected (string) "anonymous" but got (undefined) undefined
</del><ins>+PASS link.crossOrigin: setAttribute() to object "[object Object]" followed by IDL get
</ins><span class="cx"> PASS link.crossOrigin: setAttribute() to NaN followed by getAttribute()
</span><del>-FAIL link.crossOrigin: setAttribute() to NaN followed by IDL get assert_equals: expected (string) "anonymous" but got (undefined) undefined
</del><ins>+PASS link.crossOrigin: setAttribute() to NaN followed by IDL get
</ins><span class="cx"> PASS link.crossOrigin: setAttribute() to Infinity followed by getAttribute()
</span><del>-FAIL link.crossOrigin: setAttribute() to Infinity followed by IDL get assert_equals: expected (string) "anonymous" but got (undefined) undefined
</del><ins>+PASS link.crossOrigin: setAttribute() to Infinity followed by IDL get
</ins><span class="cx"> PASS link.crossOrigin: setAttribute() to -Infinity followed by getAttribute()
</span><del>-FAIL link.crossOrigin: setAttribute() to -Infinity followed by IDL get assert_equals: expected (string) "anonymous" but got (undefined) undefined
</del><ins>+PASS link.crossOrigin: setAttribute() to -Infinity followed by IDL get
</ins><span class="cx"> PASS link.crossOrigin: setAttribute() to "\0" followed by getAttribute()
</span><del>-FAIL link.crossOrigin: setAttribute() to "\0" followed by IDL get assert_equals: expected (string) "anonymous" but got (undefined) undefined
</del><ins>+PASS link.crossOrigin: setAttribute() to "\0" followed by IDL get
</ins><span class="cx"> PASS link.crossOrigin: setAttribute() to null followed by getAttribute()
</span><del>-FAIL link.crossOrigin: setAttribute() to null followed by IDL get assert_equals: expected (string) "anonymous" but got (undefined) undefined
</del><ins>+PASS link.crossOrigin: setAttribute() to null followed by IDL get
</ins><span class="cx"> PASS link.crossOrigin: setAttribute() to object "test-toString" followed by getAttribute()
</span><del>-FAIL link.crossOrigin: setAttribute() to object "test-toString" followed by IDL get assert_equals: expected (string) "anonymous" but got (undefined) undefined
</del><ins>+PASS link.crossOrigin: setAttribute() to object "test-toString" followed by IDL get
</ins><span class="cx"> PASS link.crossOrigin: setAttribute() to object "test-valueOf" followed by getAttribute()
</span><del>-FAIL link.crossOrigin: setAttribute() to object "test-valueOf" followed by IDL get assert_equals: expected (string) "anonymous" but got (undefined) undefined
</del><ins>+PASS link.crossOrigin: setAttribute() to object "test-valueOf" followed by IDL get
</ins><span class="cx"> PASS link.crossOrigin: setAttribute() to "anonymous" followed by getAttribute()
</span><del>-FAIL link.crossOrigin: setAttribute() to "anonymous" followed by IDL get assert_equals: expected (string) "anonymous" but got (undefined) undefined
</del><ins>+PASS link.crossOrigin: setAttribute() to "anonymous" followed by IDL get
</ins><span class="cx"> PASS link.crossOrigin: setAttribute() to "xanonymous" followed by getAttribute()
</span><del>-FAIL link.crossOrigin: setAttribute() to "xanonymous" followed by IDL get assert_equals: expected (string) "anonymous" but got (undefined) undefined
</del><ins>+PASS link.crossOrigin: setAttribute() to "xanonymous" followed by IDL get
</ins><span class="cx"> PASS link.crossOrigin: setAttribute() to "anonymous\0" followed by getAttribute()
</span><del>-FAIL link.crossOrigin: setAttribute() to "anonymous\0" followed by IDL get assert_equals: expected (string) "anonymous" but got (undefined) undefined
</del><ins>+PASS link.crossOrigin: setAttribute() to "anonymous\0" followed by IDL get
</ins><span class="cx"> PASS link.crossOrigin: setAttribute() to "nonymous" followed by getAttribute()
</span><del>-FAIL link.crossOrigin: setAttribute() to "nonymous" followed by IDL get assert_equals: expected (string) "anonymous" but got (undefined) undefined
</del><ins>+PASS link.crossOrigin: setAttribute() to "nonymous" followed by IDL get
</ins><span class="cx"> PASS link.crossOrigin: setAttribute() to "ANONYMOUS" followed by getAttribute()
</span><del>-FAIL link.crossOrigin: setAttribute() to "ANONYMOUS" followed by IDL get assert_equals: expected (string) "anonymous" but got (undefined) undefined
</del><ins>+PASS link.crossOrigin: setAttribute() to "ANONYMOUS" followed by IDL get
</ins><span class="cx"> PASS link.crossOrigin: setAttribute() to "use-credentials" followed by getAttribute()
</span><del>-FAIL link.crossOrigin: setAttribute() to "use-credentials" followed by IDL get assert_equals: expected (string) "use-credentials" but got (undefined) undefined
</del><ins>+PASS link.crossOrigin: setAttribute() to "use-credentials" followed by IDL get
</ins><span class="cx"> PASS link.crossOrigin: setAttribute() to "xuse-credentials" followed by getAttribute()
</span><del>-FAIL link.crossOrigin: setAttribute() to "xuse-credentials" followed by IDL get assert_equals: expected (string) "anonymous" but got (undefined) undefined
</del><ins>+PASS link.crossOrigin: setAttribute() to "xuse-credentials" followed by IDL get
</ins><span class="cx"> PASS link.crossOrigin: setAttribute() to "use-credentials\0" followed by getAttribute()
</span><del>-FAIL link.crossOrigin: setAttribute() to "use-credentials\0" followed by IDL get assert_equals: expected (string) "anonymous" but got (undefined) undefined
</del><ins>+PASS link.crossOrigin: setAttribute() to "use-credentials\0" followed by IDL get
</ins><span class="cx"> PASS link.crossOrigin: setAttribute() to "se-credentials" followed by getAttribute()
</span><del>-FAIL link.crossOrigin: setAttribute() to "se-credentials" followed by IDL get assert_equals: expected (string) "anonymous" but got (undefined) undefined
</del><ins>+PASS link.crossOrigin: setAttribute() to "se-credentials" followed by IDL get
</ins><span class="cx"> PASS link.crossOrigin: setAttribute() to "USE-CREDENTIALS" followed by getAttribute()
</span><del>-FAIL link.crossOrigin: setAttribute() to "USE-CREDENTIALS" followed by IDL get assert_equals: expected (string) "use-credentials" but got (undefined) undefined
</del><ins>+PASS link.crossOrigin: setAttribute() to "USE-CREDENTIALS" followed by IDL get
</ins><span class="cx"> PASS link.crossOrigin: IDL set to "" should not throw
</span><del>-FAIL link.crossOrigin: IDL set to "" followed by getAttribute() assert_equals: expected "" but got "USE-CREDENTIALS"
-FAIL link.crossOrigin: IDL set to "" followed by IDL get assert_equals: expected "anonymous" but got ""
</del><ins>+PASS link.crossOrigin: IDL set to "" followed by getAttribute()
+PASS link.crossOrigin: IDL set to "" followed by IDL get
</ins><span class="cx"> PASS link.crossOrigin: 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 " should not throw
</span><del>-FAIL link.crossOrigin: 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 " followed by getAttribute() assert_equals: expected " \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 " but got "USE-CREDENTIALS"
-FAIL link.crossOrigin: 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 " followed by IDL get assert_equals: expected "anonymous" 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 "
</del><ins>+PASS link.crossOrigin: 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 " followed by getAttribute()
+PASS link.crossOrigin: 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 " followed by IDL get
</ins><span class="cx"> PASS link.crossOrigin: IDL set to undefined should not throw
</span><del>-FAIL link.crossOrigin: IDL set to undefined followed by getAttribute() assert_equals: expected "undefined" but got "USE-CREDENTIALS"
-FAIL link.crossOrigin: IDL set to undefined followed by IDL get assert_equals: expected (string) "anonymous" but got (undefined) undefined
</del><ins>+FAIL link.crossOrigin: IDL set to undefined followed by getAttribute() assert_equals: expected (string) "undefined" but got (object) null
+FAIL link.crossOrigin: IDL set to undefined followed by IDL get assert_equals: expected (string) "anonymous" but got (object) null
</ins><span class="cx"> PASS link.crossOrigin: IDL set to 7 should not throw
</span><del>-FAIL link.crossOrigin: IDL set to 7 followed by getAttribute() assert_equals: expected "7" but got "USE-CREDENTIALS"
-FAIL link.crossOrigin: IDL set to 7 followed by IDL get assert_equals: expected (string) "anonymous" but got (number) 7
</del><ins>+PASS link.crossOrigin: IDL set to 7 followed by getAttribute()
+PASS link.crossOrigin: IDL set to 7 followed by IDL get
</ins><span class="cx"> PASS link.crossOrigin: IDL set to 1.5 should not throw
</span><del>-FAIL link.crossOrigin: IDL set to 1.5 followed by getAttribute() assert_equals: expected "1.5" but got "USE-CREDENTIALS"
-FAIL link.crossOrigin: IDL set to 1.5 followed by IDL get assert_equals: expected (string) "anonymous" but got (number) 1.5
</del><ins>+PASS link.crossOrigin: IDL set to 1.5 followed by getAttribute()
+PASS link.crossOrigin: IDL set to 1.5 followed by IDL get
</ins><span class="cx"> PASS link.crossOrigin: IDL set to true should not throw
</span><del>-FAIL link.crossOrigin: IDL set to true followed by getAttribute() assert_equals: expected "true" but got "USE-CREDENTIALS"
-FAIL link.crossOrigin: IDL set to true followed by IDL get assert_equals: expected (string) "anonymous" but got (boolean) true
</del><ins>+PASS link.crossOrigin: IDL set to true followed by getAttribute()
+PASS link.crossOrigin: IDL set to true followed by IDL get
</ins><span class="cx"> PASS link.crossOrigin: IDL set to false should not throw
</span><del>-FAIL link.crossOrigin: IDL set to false followed by getAttribute() assert_equals: expected "false" but got "USE-CREDENTIALS"
-FAIL link.crossOrigin: IDL set to false followed by IDL get assert_equals: expected (string) "anonymous" but got (boolean) false
</del><ins>+PASS link.crossOrigin: IDL set to false followed by getAttribute()
+PASS link.crossOrigin: IDL set to false followed by IDL get
</ins><span class="cx"> PASS link.crossOrigin: IDL set to object "[object Object]" should not throw
</span><del>-FAIL link.crossOrigin: IDL set to object "[object Object]" followed by getAttribute() assert_equals: expected "[object Object]" but got "USE-CREDENTIALS"
-FAIL link.crossOrigin: IDL set to object "[object Object]" followed by IDL get assert_equals: expected (string) "anonymous" but got (object) object "[object Object]"
</del><ins>+PASS link.crossOrigin: IDL set to object "[object Object]" followed by getAttribute()
+PASS link.crossOrigin: IDL set to object "[object Object]" followed by IDL get
</ins><span class="cx"> PASS link.crossOrigin: IDL set to NaN should not throw
</span><del>-FAIL link.crossOrigin: IDL set to NaN followed by getAttribute() assert_equals: expected "NaN" but got "USE-CREDENTIALS"
-FAIL link.crossOrigin: IDL set to NaN followed by IDL get assert_equals: expected (string) "anonymous" but got (number) NaN
</del><ins>+PASS link.crossOrigin: IDL set to NaN followed by getAttribute()
+PASS link.crossOrigin: IDL set to NaN followed by IDL get
</ins><span class="cx"> PASS link.crossOrigin: IDL set to Infinity should not throw
</span><del>-FAIL link.crossOrigin: IDL set to Infinity followed by getAttribute() assert_equals: expected "Infinity" but got "USE-CREDENTIALS"
-FAIL link.crossOrigin: IDL set to Infinity followed by IDL get assert_equals: expected (string) "anonymous" but got (number) Infinity
</del><ins>+PASS link.crossOrigin: IDL set to Infinity followed by getAttribute()
+PASS link.crossOrigin: IDL set to Infinity followed by IDL get
</ins><span class="cx"> PASS link.crossOrigin: IDL set to -Infinity should not throw
</span><del>-FAIL link.crossOrigin: IDL set to -Infinity followed by getAttribute() assert_equals: expected "-Infinity" but got "USE-CREDENTIALS"
-FAIL link.crossOrigin: IDL set to -Infinity followed by IDL get assert_equals: expected (string) "anonymous" but got (number) -Infinity
</del><ins>+PASS link.crossOrigin: IDL set to -Infinity followed by getAttribute()
+PASS link.crossOrigin: IDL set to -Infinity followed by IDL get
</ins><span class="cx"> PASS link.crossOrigin: IDL set to "\0" should not throw
</span><del>-FAIL link.crossOrigin: IDL set to "\0" followed by getAttribute() assert_equals: expected "\0" but got "USE-CREDENTIALS"
-FAIL link.crossOrigin: IDL set to "\0" followed by IDL get assert_equals: expected "anonymous" but got "\0"
</del><ins>+PASS link.crossOrigin: IDL set to "\0" followed by getAttribute()
+PASS link.crossOrigin: IDL set to "\0" followed by IDL get
</ins><span class="cx"> PASS link.crossOrigin: IDL set to null should not throw
</span><span class="cx"> FAIL link.crossOrigin: IDL set to null followed by IDL get assert_equals: expected (string) "anonymous" but got (object) null
</span><span class="cx"> PASS link.crossOrigin: IDL set to object "test-toString" should not throw
</span><del>-FAIL link.crossOrigin: IDL set to object "test-toString" followed by getAttribute() assert_equals: expected "test-toString" but got "USE-CREDENTIALS"
-FAIL link.crossOrigin: IDL set to object "test-toString" followed by IDL get assert_equals: expected (string) "anonymous" but got (object) object "test-toString"
</del><ins>+PASS link.crossOrigin: IDL set to object "test-toString" followed by getAttribute()
+PASS link.crossOrigin: IDL set to object "test-toString" followed by IDL get
</ins><span class="cx"> PASS link.crossOrigin: IDL set to object "test-valueOf" should not throw
</span><del>-FAIL link.crossOrigin: IDL set to object "test-valueOf" followed by getAttribute() assert_equals: expected "test-valueOf" but got "USE-CREDENTIALS"
-FAIL link.crossOrigin: IDL set to object "test-valueOf" followed by IDL get assert_equals: expected (string) "anonymous" but got (object) object "test-valueOf"
</del><ins>+PASS link.crossOrigin: IDL set to object "test-valueOf" followed by getAttribute()
+PASS link.crossOrigin: IDL set to object "test-valueOf" followed by IDL get
</ins><span class="cx"> PASS link.crossOrigin: IDL set to "anonymous" should not throw
</span><del>-FAIL link.crossOrigin: IDL set to "anonymous" followed by getAttribute() assert_equals: expected "anonymous" but got "USE-CREDENTIALS"
</del><ins>+PASS link.crossOrigin: IDL set to "anonymous" followed by getAttribute()
</ins><span class="cx"> PASS link.crossOrigin: IDL set to "anonymous" followed by IDL get
</span><span class="cx"> PASS link.crossOrigin: IDL set to "xanonymous" should not throw
</span><del>-FAIL link.crossOrigin: IDL set to "xanonymous" followed by getAttribute() assert_equals: expected "xanonymous" but got "USE-CREDENTIALS"
-FAIL link.crossOrigin: IDL set to "xanonymous" followed by IDL get assert_equals: expected "anonymous" but got "xanonymous"
</del><ins>+PASS link.crossOrigin: IDL set to "xanonymous" followed by getAttribute()
+PASS link.crossOrigin: IDL set to "xanonymous" followed by IDL get
</ins><span class="cx"> PASS link.crossOrigin: IDL set to "anonymous\0" should not throw
</span><del>-FAIL link.crossOrigin: IDL set to "anonymous\0" followed by getAttribute() assert_equals: expected "anonymous\0" but got "USE-CREDENTIALS"
-FAIL link.crossOrigin: IDL set to "anonymous\0" followed by IDL get assert_equals: expected "anonymous" but got "anonymous\0"
</del><ins>+PASS link.crossOrigin: IDL set to "anonymous\0" followed by getAttribute()
+PASS link.crossOrigin: IDL set to "anonymous\0" followed by IDL get
</ins><span class="cx"> PASS link.crossOrigin: IDL set to "nonymous" should not throw
</span><del>-FAIL link.crossOrigin: IDL set to "nonymous" followed by getAttribute() assert_equals: expected "nonymous" but got "USE-CREDENTIALS"
-FAIL link.crossOrigin: IDL set to "nonymous" followed by IDL get assert_equals: expected "anonymous" but got "nonymous"
</del><ins>+PASS link.crossOrigin: IDL set to "nonymous" followed by getAttribute()
+PASS link.crossOrigin: IDL set to "nonymous" followed by IDL get
</ins><span class="cx"> PASS link.crossOrigin: IDL set to "ANONYMOUS" should not throw
</span><del>-FAIL link.crossOrigin: IDL set to "ANONYMOUS" followed by getAttribute() assert_equals: expected "ANONYMOUS" but got "USE-CREDENTIALS"
-FAIL link.crossOrigin: IDL set to "ANONYMOUS" followed by IDL get assert_equals: expected "anonymous" but got "ANONYMOUS"
</del><ins>+PASS link.crossOrigin: IDL set to "ANONYMOUS" followed by getAttribute()
+PASS link.crossOrigin: IDL set to "ANONYMOUS" followed by IDL get
</ins><span class="cx"> PASS link.crossOrigin: IDL set to "use-credentials" should not throw
</span><del>-FAIL link.crossOrigin: IDL set to "use-credentials" followed by getAttribute() assert_equals: expected "use-credentials" but got "USE-CREDENTIALS"
</del><ins>+PASS link.crossOrigin: IDL set to "use-credentials" followed by getAttribute()
</ins><span class="cx"> PASS link.crossOrigin: IDL set to "use-credentials" followed by IDL get
</span><span class="cx"> PASS link.crossOrigin: IDL set to "xuse-credentials" should not throw
</span><del>-FAIL link.crossOrigin: IDL set to "xuse-credentials" followed by getAttribute() assert_equals: expected "xuse-credentials" but got "USE-CREDENTIALS"
-FAIL link.crossOrigin: IDL set to "xuse-credentials" followed by IDL get assert_equals: expected "anonymous" but got "xuse-credentials"
</del><ins>+PASS link.crossOrigin: IDL set to "xuse-credentials" followed by getAttribute()
+PASS link.crossOrigin: IDL set to "xuse-credentials" followed by IDL get
</ins><span class="cx"> PASS link.crossOrigin: IDL set to "use-credentials\0" should not throw
</span><del>-FAIL link.crossOrigin: IDL set to "use-credentials\0" followed by getAttribute() assert_equals: expected "use-credentials\0" but got "USE-CREDENTIALS"
-FAIL link.crossOrigin: IDL set to "use-credentials\0" followed by IDL get assert_equals: expected "anonymous" but got "use-credentials\0"
</del><ins>+PASS link.crossOrigin: IDL set to "use-credentials\0" followed by getAttribute()
+PASS link.crossOrigin: IDL set to "use-credentials\0" followed by IDL get
</ins><span class="cx"> PASS link.crossOrigin: IDL set to "se-credentials" should not throw
</span><del>-FAIL link.crossOrigin: IDL set to "se-credentials" followed by getAttribute() assert_equals: expected "se-credentials" but got "USE-CREDENTIALS"
-FAIL link.crossOrigin: IDL set to "se-credentials" followed by IDL get assert_equals: expected "anonymous" but got "se-credentials"
</del><ins>+PASS link.crossOrigin: IDL set to "se-credentials" followed by getAttribute()
+PASS link.crossOrigin: IDL set to "se-credentials" followed by IDL get
</ins><span class="cx"> PASS link.crossOrigin: IDL set to "USE-CREDENTIALS" should not throw
</span><span class="cx"> PASS link.crossOrigin: IDL set to "USE-CREDENTIALS" followed by getAttribute()
</span><del>-FAIL link.crossOrigin: IDL set to "USE-CREDENTIALS" followed by IDL get assert_equals: expected "use-credentials" but got "USE-CREDENTIALS"
</del><ins>+PASS link.crossOrigin: IDL set to "USE-CREDENTIALS" followed by IDL get
</ins><span class="cx"> PASS link.rel: typeof IDL attribute
</span><span class="cx"> PASS link.rel: IDL get with DOM attribute unset
</span><span class="cx"> PASS link.rel: setAttribute() to "" followed by getAttribute()
</span></span></pre></div>
<a id="trunkLayoutTestsplatformiossimulatorimportedw3cwebplatformtestshtmldominterfacesexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/ios-simulator/imported/w3c/web-platform-tests/html/dom/interfaces-expected.txt (199649 => 199650)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/ios-simulator/imported/w3c/web-platform-tests/html/dom/interfaces-expected.txt        2016-04-18 05:36:31 UTC (rev 199649)
+++ trunk/LayoutTests/platform/ios-simulator/imported/w3c/web-platform-tests/html/dom/interfaces-expected.txt        2016-04-18 06:06:42 UTC (rev 199650)
</span><span class="lines">@@ -1366,7 +1366,7 @@
</span><span class="cx"> PASS HTMLLinkElement interface: existence and properties of interface prototype object
</span><span class="cx"> PASS HTMLLinkElement interface: existence and properties of interface prototype object's "constructor" property
</span><span class="cx"> PASS HTMLLinkElement interface: attribute href
</span><del>-FAIL HTMLLinkElement interface: attribute crossOrigin assert_true: The prototype object must have a property "crossOrigin" expected true got false
</del><ins>+PASS HTMLLinkElement interface: attribute crossOrigin
</ins><span class="cx"> PASS HTMLLinkElement interface: attribute rel
</span><span class="cx"> PASS HTMLLinkElement interface: attribute relList
</span><span class="cx"> PASS HTMLLinkElement interface: attribute media
</span><span class="lines">@@ -1379,7 +1379,7 @@
</span><span class="cx"> PASS HTMLLinkElement must be primary interface of document.createElement("link")
</span><span class="cx"> PASS Stringification of document.createElement("link")
</span><span class="cx"> PASS HTMLLinkElement interface: document.createElement("link") must inherit property "href" with the proper type (0)
</span><del>-FAIL HTMLLinkElement interface: document.createElement("link") must inherit property "crossOrigin" with the proper type (1) assert_inherits: property "crossOrigin" not found in prototype chain
</del><ins>+PASS HTMLLinkElement interface: document.createElement("link") must inherit property "crossOrigin" with the proper type (1)
</ins><span class="cx"> PASS HTMLLinkElement interface: document.createElement("link") must inherit property "rel" with the proper type (2)
</span><span class="cx"> PASS HTMLLinkElement interface: document.createElement("link") must inherit property "relList" with the proper type (3)
</span><span class="cx"> PASS HTMLLinkElement interface: document.createElement("link") must inherit property "media" with the proper type (4)
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (199649 => 199650)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-04-18 05:36:31 UTC (rev 199649)
+++ trunk/Source/WebCore/ChangeLog        2016-04-18 06:06:42 UTC (rev 199650)
</span><span class="lines">@@ -1,3 +1,56 @@
</span><ins>+2016-04-17 Yoav Weiss <yoav@yoav.ws>
+
+ Initial Link preload support
+ https://bugs.webkit.org/show_bug.cgi?id=156334
+
+ Added basic `<link rel=preload>` functionality that enables preloading
+ of resources according to their type.
+
+ Reviewed by Darin Adler.
+
+ Tests: http/tests/preload/download_resources.html
+ http/tests/preload/dynamic_adding_preload.html
+ http/tests/preload/dynamic_remove_preload_href.html
+ http/tests/preload/dynamic_removing_preload.html
+
+ * bindings/generic/RuntimeEnabledFeatures.cpp: Added a runtime flag for the feature.
+ (WebCore::RuntimeEnabledFeatures::RuntimeEnabledFeatures):
+ * bindings/generic/RuntimeEnabledFeatures.h: Added a runtime flag for the feature.
+ (WebCore::RuntimeEnabledFeatures::setLinkPreloadEnabled):
+ (WebCore::RuntimeEnabledFeatures::linkPreloadEnabled):
+ * html/HTMLAttributeNames.in: Added an `as` attribute.
+ * html/HTMLLinkElement.cpp:
+ (WebCore::HTMLLinkElement::process): Added `as` and `crossorigin` attribute values to the loadLink() call.
+ (WebCore::HTMLLinkElement::setCrossOrigin): Setter for crossOrigin.
+ (WebCore::HTMLLinkElement::crossOrigin): Getter for crossOrigin.
+ * html/HTMLLinkElement.idl: Added `as` and `crossorigin` to HTMLLinkElement.
+ * html/HTMLLinkElement.h: Added getter and setter for crossorigin.
+ * html/LinkRelAttribute.cpp:
+ (WebCore::LinkRelAttribute::LinkRelAttribute): Added "preload" as a potential value.
+ * html/LinkRelAttribute.h: Added isLinkPreload.
+ * loader/LinkLoader.cpp:
+ (WebCore::LinkLoader::resourceTypeFromAsAttribute): Translates an `as` value into a resource type.
+ (WebCore::preloadIfNeeded): Triggers a resource preload when link element is a preload one.
+ (WebCore::LinkLoader::loadLink): Added a call to preloadIfNeeded.
+ * loader/LinkLoader.h: Added signatures.
+ * loader/ResourceLoadInfo.cpp:
+ (WebCore::toResourceType): Added LinkPreload as a possible CachedResource::type.
+ * loader/SubresourceLoader.cpp:
+ (WebCore::logResourceLoaded): Added LinkPreload as a possible CachedResource::type.
+ * loader/cache/CachedResource.cpp: Turned defaultPriorityForResourceType into a static member, as it's now also called from LinkLoader.
+ (WebCore::CachedResource::defaultPriorityForResourceType): Added LinkPreload as a possible CachedResource::type, giving it low priority.
+ (WebCore::defaultPriorityForResourceType): Deleted.
+ * loader/cache/CachedResource.h: Added LinkPreload as a possible CachedResource::type. Added defaultPriorityForResourceType as static.
+ * loader/cache/CachedResourceLoader.cpp:
+ (WebCore::contentTypeFromResourceType): Added LinkPreload as a possible CachedResource::type.
+ (WebCore::createResource): Added creation of a LinkPreload resource if needed.
+ (WebCore::CachedResourceLoader::checkInsecureContent): Added LinkPreload as a possible CachedResource::type.
+ (WebCore::CachedResourceLoader::canRequest): Added LinkPreload as a possible CachedResource::type.
+ * testing/Internals.cpp: Added function to turn on the link preload feature.
+ (WebCore::setLinkPreloadSupport):
+ * testing/Internals.idl: Added function to turn on the link preload feature.
+ * testing/Internals.h: Added function signature to turn on the link preload feature.
+
</ins><span class="cx"> 2016-04-17 Conrad Shultz <conrad_shultz@apple.com>
</span><span class="cx">
</span><span class="cx"> Try (again) to fix debug builds after r199643.
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsgenericRuntimeEnabledFeaturescpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/generic/RuntimeEnabledFeatures.cpp (199649 => 199650)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/generic/RuntimeEnabledFeatures.cpp        2016-04-18 05:36:31 UTC (rev 199649)
+++ trunk/Source/WebCore/bindings/generic/RuntimeEnabledFeatures.cpp        2016-04-18 06:06:42 UTC (rev 199650)
</span><span class="lines">@@ -50,6 +50,7 @@
</span><span class="cx"> , m_isTouchEnabled(true)
</span><span class="cx"> , m_isDeviceMotionEnabled(true)
</span><span class="cx"> , m_isDeviceOrientationEnabled(true)
</span><ins>+ , m_isLinkPreloadEnabled(false)
</ins><span class="cx"> , m_isCSSShapesEnabled(true)
</span><span class="cx"> , m_isCSSRegionsEnabled(false)
</span><span class="cx"> , m_isCSSCompositingEnabled(false)
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsgenericRuntimeEnabledFeaturesh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/generic/RuntimeEnabledFeatures.h (199649 => 199650)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/generic/RuntimeEnabledFeatures.h        2016-04-18 05:36:31 UTC (rev 199649)
+++ trunk/Source/WebCore/bindings/generic/RuntimeEnabledFeatures.h        2016-04-18 06:06:42 UTC (rev 199650)
</span><span class="lines">@@ -123,6 +123,9 @@
</span><span class="cx"> bool deviceOrientationEventEnabled() const { return m_isDeviceOrientationEnabled; }
</span><span class="cx"> bool ondeviceorientationEnabled() const { return m_isDeviceOrientationEnabled; }
</span><span class="cx">
</span><ins>+ void setLinkPreloadEnabled(bool isEnabled) { m_isLinkPreloadEnabled = isEnabled; }
+ bool linkPreloadEnabled() const { return m_isLinkPreloadEnabled; }
+
</ins><span class="cx"> #if ENABLE(JAVASCRIPT_I18N_API)
</span><span class="cx"> bool javaScriptI18NAPIEnabled() const;
</span><span class="cx"> void setJavaScriptI18NAPIEnabled(bool isEnabled) { m_isJavaScriptI18NAPIEnabled = isEnabled; }
</span><span class="lines">@@ -248,6 +251,7 @@
</span><span class="cx"> bool m_isTouchEnabled;
</span><span class="cx"> bool m_isDeviceMotionEnabled;
</span><span class="cx"> bool m_isDeviceOrientationEnabled;
</span><ins>+ bool m_isLinkPreloadEnabled;
</ins><span class="cx"> bool m_isCSSShapesEnabled;
</span><span class="cx"> bool m_isCSSRegionsEnabled;
</span><span class="cx"> bool m_isCSSCompositingEnabled;
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLAttributeNamesin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLAttributeNames.in (199649 => 199650)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLAttributeNames.in        2016-04-18 05:36:31 UTC (rev 199649)
+++ trunk/Source/WebCore/html/HTMLAttributeNames.in        2016-04-18 06:06:42 UTC (rev 199650)
</span><span class="lines">@@ -59,6 +59,7 @@
</span><span class="cx"> aria-valuemin
</span><span class="cx"> aria-valuenow
</span><span class="cx"> aria-valuetext
</span><ins>+as
</ins><span class="cx"> async
</span><span class="cx"> autocomplete
</span><span class="cx"> autofocus
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLLinkElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLLinkElement.cpp (199649 => 199650)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLLinkElement.cpp        2016-04-18 05:36:31 UTC (rev 199649)
+++ trunk/Source/WebCore/html/HTMLLinkElement.cpp        2016-04-18 06:06:42 UTC (rev 199650)
</span><span class="lines">@@ -194,6 +194,16 @@
</span><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void HTMLLinkElement::setCrossOrigin(const AtomicString& value)
+{
+ setAttributeWithoutSynchronization(crossoriginAttr, value);
+}
+
+String HTMLLinkElement::crossOrigin() const
+{
+ return parseCORSSettingsAttribute(fastGetAttribute(crossoriginAttr));
+}
+
</ins><span class="cx"> void HTMLLinkElement::process()
</span><span class="cx"> {
</span><span class="cx"> if (!inDocument() || m_isInShadowTree) {
</span><span class="lines">@@ -203,7 +213,7 @@
</span><span class="cx">
</span><span class="cx"> URL url = getNonEmptyURLAttribute(hrefAttr);
</span><span class="cx">
</span><del>- if (!m_linkLoader.loadLink(m_relAttribute, url, document()))
</del><ins>+ if (!m_linkLoader.loadLink(m_relAttribute, url, fastGetAttribute(asAttr), fastGetAttribute(crossoriginAttr), document()))
</ins><span class="cx"> return;
</span><span class="cx">
</span><span class="cx"> bool treatAsStyleSheet = m_relAttribute.isStyleSheet
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLLinkElementh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLLinkElement.h (199649 => 199650)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLLinkElement.h        2016-04-18 05:36:31 UTC (rev 199649)
+++ trunk/Source/WebCore/html/HTMLLinkElement.h        2016-04-18 06:06:42 UTC (rev 199650)
</span><span class="lines">@@ -67,6 +67,9 @@
</span><span class="cx"> bool isEnabledViaScript() const { return m_disabledState == EnabledViaScript; }
</span><span class="cx"> DOMTokenList& sizes();
</span><span class="cx">
</span><ins>+ void setCrossOrigin(const AtomicString&);
+ String crossOrigin() const;
+
</ins><span class="cx"> void dispatchPendingEvent(LinkEventSender*);
</span><span class="cx"> static void dispatchPendingLoadEvents();
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLLinkElementidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLLinkElement.idl (199649 => 199650)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLLinkElement.idl        2016-04-18 05:36:31 UTC (rev 199649)
+++ trunk/Source/WebCore/html/HTMLLinkElement.idl        2016-04-18 06:06:42 UTC (rev 199650)
</span><span class="lines">@@ -35,6 +35,8 @@
</span><span class="cx"> #endif
</span><span class="cx"> [Reflect] attribute DOMString target;
</span><span class="cx"> [Reflect] attribute DOMString type;
</span><ins>+ [Reflect] attribute DOMString as;
+ attribute DOMString? crossOrigin;
</ins><span class="cx">
</span><span class="cx"> // DOM Level 2 Style
</span><span class="cx"> readonly attribute StyleSheet sheet;
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlLinkRelAttributecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/LinkRelAttribute.cpp (199649 => 199650)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/LinkRelAttribute.cpp        2016-04-18 05:36:31 UTC (rev 199649)
+++ trunk/Source/WebCore/html/LinkRelAttribute.cpp        2016-04-18 06:06:42 UTC (rev 199650)
</span><span class="lines">@@ -32,6 +32,7 @@
</span><span class="cx"> #include "config.h"
</span><span class="cx"> #include "LinkRelAttribute.h"
</span><span class="cx">
</span><ins>+#include "RuntimeEnabledFeatures.h"
</ins><span class="cx"> #include <wtf/text/WTFString.h>
</span><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="lines">@@ -54,6 +55,8 @@
</span><span class="cx"> #endif
</span><span class="cx"> else if (equalLettersIgnoringASCIICase(rel, "dns-prefetch"))
</span><span class="cx"> isDNSPrefetch = true;
</span><ins>+ else if (RuntimeEnabledFeatures::sharedFeatures().linkPreloadEnabled() && equalLettersIgnoringASCIICase(rel, "preload"))
+ isLinkPreload = true;
</ins><span class="cx"> else if (equalLettersIgnoringASCIICase(rel, "alternate stylesheet") || equalLettersIgnoringASCIICase(rel, "stylesheet alternate")) {
</span><span class="cx"> isStyleSheet = true;
</span><span class="cx"> isAlternate = true;
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlLinkRelAttributeh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/LinkRelAttribute.h (199649 => 199650)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/LinkRelAttribute.h        2016-04-18 05:36:31 UTC (rev 199649)
+++ trunk/Source/WebCore/html/LinkRelAttribute.h        2016-04-18 06:06:42 UTC (rev 199650)
</span><span class="lines">@@ -42,6 +42,7 @@
</span><span class="cx"> IconType iconType { InvalidIcon };
</span><span class="cx"> bool isAlternate { false };
</span><span class="cx"> bool isDNSPrefetch { false };
</span><ins>+ bool isLinkPreload { false };
</ins><span class="cx"> #if ENABLE(LINK_PREFETCH)
</span><span class="cx"> bool isLinkPrefetch { false };
</span><span class="cx"> bool isLinkSubresource { false };
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderLinkLoadercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/LinkLoader.cpp (199649 => 199650)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/LinkLoader.cpp        2016-04-18 05:36:31 UTC (rev 199649)
+++ trunk/Source/WebCore/loader/LinkLoader.cpp        2016-04-18 06:06:42 UTC (rev 199650)
</span><span class="lines">@@ -37,11 +37,13 @@
</span><span class="cx"> #include "CachedResourceLoader.h"
</span><span class="cx"> #include "CachedResourceRequest.h"
</span><span class="cx"> #include "ContainerNode.h"
</span><ins>+#include "CrossOriginAccessControl.h"
</ins><span class="cx"> #include "Document.h"
</span><span class="cx"> #include "Frame.h"
</span><span class="cx"> #include "FrameLoaderClient.h"
</span><span class="cx"> #include "FrameView.h"
</span><span class="cx"> #include "LinkRelAttribute.h"
</span><ins>+#include "RuntimeEnabledFeatures.h"
</ins><span class="cx"> #include "Settings.h"
</span><span class="cx"> #include "StyleResolver.h"
</span><span class="cx">
</span><span class="lines">@@ -83,8 +85,57 @@
</span><span class="cx"> m_cachedLinkResource = nullptr;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-bool LinkLoader::loadLink(const LinkRelAttribute& relAttribute, const URL& href, Document& document)
</del><ins>+Optional<CachedResource::Type> LinkLoader::resourceTypeFromAsAttribute(const String& as)
</ins><span class="cx"> {
</span><ins>+ if (as.isEmpty())
+ return CachedResource::LinkPreload;
+ if (equalLettersIgnoringASCIICase(as, "image"))
+ return CachedResource::ImageResource;
+ if (equalLettersIgnoringASCIICase(as, "script"))
+ return CachedResource::Script;
+ if (equalLettersIgnoringASCIICase(as, "style"))
+ return CachedResource::CSSStyleSheet;
+ if (equalLettersIgnoringASCIICase(as, "media"))
+ return CachedResource::MediaResource;
+ if (equalLettersIgnoringASCIICase(as, "font"))
+ return CachedResource::FontResource;
+#if ENABLE(VIDEO_TRACK)
+ if (equalLettersIgnoringASCIICase(as, "track"))
+ return CachedResource::TextTrackResource;
+#endif
+ return Nullopt;
+}
+
+static void preloadIfNeeded(const LinkRelAttribute& relAttribute, const URL& href, Document& document, const String& as, const String& crossOriginMode)
+{
+ if (!document.loader() || !relAttribute.isLinkPreload)
+ return;
+
+ ASSERT(RuntimeEnabledFeatures::sharedFeatures().linkPreloadEnabled());
+ if (!href.isValid()) {
+ document.addConsoleMessage(MessageSource::Other, MessageLevel::Error, String("<link rel=preload> has an invalid `href` value"));
+ return;
+ }
+ auto type = LinkLoader::resourceTypeFromAsAttribute(as);
+ if (!type) {
+ document.addConsoleMessage(MessageSource::Other, MessageLevel::Error, String("<link rel=preload> must have a valid `as` value"));
+ return;
+ }
+
+ ResourceRequest resourceRequest(document.completeURL(href));
+ CachedResourceRequest linkRequest(resourceRequest, CachedResource::defaultPriorityForResourceType(type.value()));
+ linkRequest.setInitiator("link");
+
+ if (!crossOriginMode.isNull()) {
+ StoredCredentials allowCredentials = equalLettersIgnoringASCIICase(crossOriginMode, "use-credentials") ? AllowStoredCredentials : DoNotAllowStoredCredentials;
+ updateRequestForAccessControl(linkRequest.mutableResourceRequest(), document.securityOrigin(), allowCredentials);
+ }
+ linkRequest.setForPreload(true);
+ document.cachedResourceLoader().preload(type.value(), linkRequest, emptyString());
+}
+
+bool LinkLoader::loadLink(const LinkRelAttribute& relAttribute, const URL& href, const String& as, const String& crossOrigin, Document& document)
+{
</ins><span class="cx"> // We'll record this URL per document, even if we later only use it in top level frames
</span><span class="cx"> if (relAttribute.iconType != InvalidIcon && href.isValid() && !href.isEmpty()) {
</span><span class="cx"> if (!m_client.shouldLoadLink())
</span><span class="lines">@@ -101,6 +152,9 @@
</span><span class="cx"> document.frame()->loader().client().prefetchDNS(href.host());
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ if (m_client.shouldLoadLink())
+ preloadIfNeeded(relAttribute, href, document, as, crossOrigin);
+
</ins><span class="cx"> #if ENABLE(LINK_PREFETCH)
</span><span class="cx"> if ((relAttribute.isLinkPrefetch || relAttribute.isLinkSubresource) && href.isValid() && document.frame()) {
</span><span class="cx"> if (!m_client.shouldLoadLink())
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderLinkLoaderh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/LinkLoader.h (199649 => 199650)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/LinkLoader.h        2016-04-18 05:36:31 UTC (rev 199649)
+++ trunk/Source/WebCore/loader/LinkLoader.h        2016-04-18 06:06:42 UTC (rev 199650)
</span><span class="lines">@@ -32,6 +32,7 @@
</span><span class="cx"> #ifndef LinkLoader_h
</span><span class="cx"> #define LinkLoader_h
</span><span class="cx">
</span><ins>+#include "CachedResource.h"
</ins><span class="cx"> #include "CachedResourceClient.h"
</span><span class="cx"> #include "CachedResourceHandle.h"
</span><span class="cx"> #include "LinkLoaderClient.h"
</span><span class="lines">@@ -49,7 +50,8 @@
</span><span class="cx"> explicit LinkLoader(LinkLoaderClient&);
</span><span class="cx"> virtual ~LinkLoader();
</span><span class="cx">
</span><del>- bool loadLink(const LinkRelAttribute&, const URL&, Document&);
</del><ins>+ bool loadLink(const LinkRelAttribute&, const URL&, const String& as, const String& crossOrigin, Document&);
+ static Optional<CachedResource::Type> resourceTypeFromAsAttribute(const String& as);
</ins><span class="cx">
</span><span class="cx"> private:
</span><span class="cx"> void notifyFinished(CachedResource*) override;
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderResourceLoadInfocpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/ResourceLoadInfo.cpp (199649 => 199650)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/ResourceLoadInfo.cpp        2016-04-18 05:36:31 UTC (rev 199649)
+++ trunk/Source/WebCore/loader/ResourceLoadInfo.cpp        2016-04-18 06:06:42 UTC (rev 199650)
</span><span class="lines">@@ -56,6 +56,7 @@
</span><span class="cx"> return ResourceType::Font;
</span><span class="cx">
</span><span class="cx"> case CachedResource::MediaResource:
</span><ins>+ case CachedResource::LinkPreload:
</ins><span class="cx"> case CachedResource::RawResource:
</span><span class="cx"> return ResourceType::Raw;
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderSubresourceLoadercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/SubresourceLoader.cpp (199649 => 199650)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/SubresourceLoader.cpp        2016-04-18 05:36:31 UTC (rev 199649)
+++ trunk/Source/WebCore/loader/SubresourceLoader.cpp        2016-04-18 06:06:42 UTC (rev 199650)
</span><span class="lines">@@ -371,6 +371,7 @@
</span><span class="cx"> case CachedResource::SVGDocumentResource:
</span><span class="cx"> resourceType = DiagnosticLoggingKeys::svgDocumentKey();
</span><span class="cx"> break;
</span><ins>+ case CachedResource::LinkPreload:
</ins><span class="cx"> #if ENABLE(LINK_PREFETCH)
</span><span class="cx"> case CachedResource::LinkPrefetch:
</span><span class="cx"> case CachedResource::LinkSubresource:
</span></span></pre></div>
<a id="trunkSourceWebCoreloadercacheCachedResourcecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/cache/CachedResource.cpp (199649 => 199650)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/cache/CachedResource.cpp        2016-04-18 05:36:31 UTC (rev 199649)
+++ trunk/Source/WebCore/loader/cache/CachedResource.cpp        2016-04-18 06:06:42 UTC (rev 199650)
</span><span class="lines">@@ -63,7 +63,7 @@
</span><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><del>-static ResourceLoadPriority defaultPriorityForResourceType(CachedResource::Type type)
</del><ins>+ResourceLoadPriority CachedResource::defaultPriorityForResourceType(Type type)
</ins><span class="cx"> {
</span><span class="cx"> switch (type) {
</span><span class="cx"> case CachedResource::MainResource:
</span><span class="lines">@@ -86,6 +86,8 @@
</span><span class="cx"> #endif
</span><span class="cx"> case CachedResource::SVGDocumentResource:
</span><span class="cx"> return ResourceLoadPriority::Low;
</span><ins>+ case CachedResource::LinkPreload:
+ return ResourceLoadPriority::Low;
</ins><span class="cx"> #if ENABLE(LINK_PREFETCH)
</span><span class="cx"> case CachedResource::LinkPrefetch:
</span><span class="cx"> return ResourceLoadPriority::VeryLow;
</span></span></pre></div>
<a id="trunkSourceWebCoreloadercacheCachedResourceh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/cache/CachedResource.h (199649 => 199650)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/cache/CachedResource.h        2016-04-18 05:36:31 UTC (rev 199649)
+++ trunk/Source/WebCore/loader/cache/CachedResource.h        2016-04-18 06:06:42 UTC (rev 199650)
</span><span class="lines">@@ -75,6 +75,7 @@
</span><span class="cx"> #if ENABLE(XSLT)
</span><span class="cx"> , XSLStyleSheet
</span><span class="cx"> #endif
</span><ins>+ , LinkPreload
</ins><span class="cx"> #if ENABLE(LINK_PREFETCH)
</span><span class="cx"> , LinkPrefetch
</span><span class="cx"> , LinkSubresource
</span><span class="lines">@@ -263,6 +264,7 @@
</span><span class="cx"> #endif
</span><span class="cx">
</span><span class="cx"> unsigned long identifierForLoadWithoutResourceLoader() const { return m_identifierForLoadWithoutResourceLoader; }
</span><ins>+ static ResourceLoadPriority defaultPriorityForResourceType(Type);
</ins><span class="cx">
</span><span class="cx"> protected:
</span><span class="cx"> void setEncodedSize(unsigned);
</span></span></pre></div>
<a id="trunkSourceWebCoreloadercacheCachedResourceLoadercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/cache/CachedResourceLoader.cpp (199649 => 199650)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/cache/CachedResourceLoader.cpp        2016-04-18 05:36:31 UTC (rev 199649)
+++ trunk/Source/WebCore/loader/cache/CachedResourceLoader.cpp        2016-04-18 06:06:42 UTC (rev 199650)
</span><span class="lines">@@ -108,6 +108,8 @@
</span><span class="cx"> case CachedResource::XSLStyleSheet:
</span><span class="cx"> return new CachedXSLStyleSheet(request, sessionID);
</span><span class="cx"> #endif
</span><ins>+ case CachedResource::LinkPreload:
+ return new CachedResource(request, CachedResource::LinkPreload, sessionID);
</ins><span class="cx"> #if ENABLE(LINK_PREFETCH)
</span><span class="cx"> case CachedResource::LinkPrefetch:
</span><span class="cx"> return new CachedResource(request, CachedResource::LinkPrefetch, sessionID);
</span><span class="lines">@@ -313,6 +315,7 @@
</span><span class="cx"> return MixedContentChecker::ContentType::Active;
</span><span class="cx"> #endif
</span><span class="cx">
</span><ins>+ case CachedResource::LinkPreload:
</ins><span class="cx"> #if ENABLE(LINK_PREFETCH)
</span><span class="cx"> case CachedResource::LinkPrefetch:
</span><span class="cx"> case CachedResource::LinkSubresource:
</span><span class="lines">@@ -353,7 +356,8 @@
</span><span class="cx"> #if ENABLE(SVG_FONTS)
</span><span class="cx"> case CachedResource::SVGFontResource:
</span><span class="cx"> #endif
</span><del>- case CachedResource::FontResource: {
</del><ins>+ case CachedResource::FontResource:
+ case CachedResource::LinkPreload: {
</ins><span class="cx"> // These resources can corrupt only the frame's pixels.
</span><span class="cx"> if (Frame* f = frame()) {
</span><span class="cx"> Frame& topFrame = f->tree().top();
</span><span class="lines">@@ -399,6 +403,7 @@
</span><span class="cx"> case CachedResource::MediaResource:
</span><span class="cx"> case CachedResource::FontResource:
</span><span class="cx"> case CachedResource::RawResource:
</span><ins>+ case CachedResource::LinkPreload:
</ins><span class="cx"> #if ENABLE(LINK_PREFETCH)
</span><span class="cx"> case CachedResource::LinkPrefetch:
</span><span class="cx"> case CachedResource::LinkSubresource:
</span><span class="lines">@@ -454,6 +459,8 @@
</span><span class="cx"> }
</span><span class="cx"> case CachedResource::MainResource:
</span><span class="cx"> case CachedResource::RawResource:
</span><ins>+ // FIXME: Preload should be subject to connect-src.
+ case CachedResource::LinkPreload:
</ins><span class="cx"> #if ENABLE(LINK_PREFETCH)
</span><span class="cx"> case CachedResource::LinkPrefetch:
</span><span class="cx"> case CachedResource::LinkSubresource:
</span></span></pre></div>
<a id="trunkSourceWebCoretestingInternalscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/testing/Internals.cpp (199649 => 199650)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/testing/Internals.cpp        2016-04-18 05:36:31 UTC (rev 199649)
+++ trunk/Source/WebCore/testing/Internals.cpp        2016-04-18 06:06:42 UTC (rev 199650)
</span><span class="lines">@@ -3328,4 +3328,9 @@
</span><span class="cx"> #endif
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void Internals::setLinkPreloadSupport(bool enable)
+{
+ RuntimeEnabledFeatures::sharedFeatures().setLinkPreloadEnabled(enable);
</ins><span class="cx"> }
</span><ins>+
+}
</ins></span></pre></div>
<a id="trunkSourceWebCoretestingInternalsh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/testing/Internals.h (199649 => 199650)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/testing/Internals.h        2016-04-18 05:36:31 UTC (rev 199649)
+++ trunk/Source/WebCore/testing/Internals.h        2016-04-18 06:06:42 UTC (rev 199650)
</span><span class="lines">@@ -471,6 +471,7 @@
</span><span class="cx"> String composedTreeAsText(Node&);
</span><span class="cx">
</span><span class="cx"> void setViewportForceAlwaysUserScalable(bool);
</span><ins>+ void setLinkPreloadSupport(bool);
</ins><span class="cx">
</span><span class="cx"> private:
</span><span class="cx"> explicit Internals(Document&);
</span></span></pre></div>
<a id="trunkSourceWebCoretestingInternalsidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/testing/Internals.idl (199649 => 199650)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/testing/Internals.idl        2016-04-18 05:36:31 UTC (rev 199649)
+++ trunk/Source/WebCore/testing/Internals.idl        2016-04-18 06:06:42 UTC (rev 199650)
</span><span class="lines">@@ -445,4 +445,5 @@
</span><span class="cx"> DOMString composedTreeAsText(Node parent);
</span><span class="cx">
</span><span class="cx"> void setViewportForceAlwaysUserScalable(boolean scalable);
</span><ins>+ void setLinkPreloadSupport(boolean scalable);
</ins><span class="cx"> };
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (199649 => 199650)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2016-04-18 05:36:31 UTC (rev 199649)
+++ trunk/Source/WebKit2/ChangeLog        2016-04-18 06:06:42 UTC (rev 199650)
</span><span class="lines">@@ -1,3 +1,13 @@
</span><ins>+2016-04-17 Yoav Weiss <yoav@yoav.ws>
+
+ Initial Link preload support
+ https://bugs.webkit.org/show_bug.cgi?id=156334
+
+ Reviewed by Darin Adler.
+
+ * WebProcess/Network/WebLoaderStrategy.cpp:
+ (WebKit::maximumBufferingTime): Added LinkPreload as a possible CachedResource::type.
+
</ins><span class="cx"> 2016-04-17 Chris Dumez <cdumez@apple.com>
</span><span class="cx">
</span><span class="cx"> [WK2][iOS] Do not dlopen() QuickLook in the NetworkProcess
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessNetworkWebLoaderStrategycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/Network/WebLoaderStrategy.cpp (199649 => 199650)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/Network/WebLoaderStrategy.cpp        2016-04-18 05:36:31 UTC (rev 199649)
+++ trunk/Source/WebKit2/WebProcess/Network/WebLoaderStrategy.cpp        2016-04-18 06:06:42 UTC (rev 199650)
</span><span class="lines">@@ -110,6 +110,7 @@
</span><span class="cx"> case CachedResource::MainResource:
</span><span class="cx"> case CachedResource::RawResource:
</span><span class="cx"> case CachedResource::SVGDocumentResource:
</span><ins>+ case CachedResource::LinkPreload:
</ins><span class="cx"> #if ENABLE(LINK_PREFETCH)
</span><span class="cx"> case CachedResource::LinkPrefetch:
</span><span class="cx"> case CachedResource::LinkSubresource:
</span></span></pre>
</div>
</div>
</body>
</html>