<!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>[206561] 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/206561">206561</a></dd>
<dt>Author</dt> <dd>cdumez@apple.com</dd>
<dt>Date</dt> <dd>2016-09-28 16:49:50 -0700 (Wed, 28 Sep 2016)</dd>
</dl>
<h3>Log Message</h3>
<pre>Add support for DOMTokenList.supports()
https://bugs.webkit.org/show_bug.cgi?id=162659
Reviewed by Ryosuke Niwa.
LayoutTests/imported/w3c:
Rebaseline W3C tests now that more checks are passing.
* web-platform-tests/dom/interfaces-expected.txt:
* web-platform-tests/html/semantics/document-metadata/the-link-element/link-rellist-expected.txt:
Source/WebCore:
Add support for DOMTokenList.supports():
- https://dom.spec.whatwg.org/#dom-domtokenlist-supports
Firefox and Chrome already recently implemented it (Chrome since
version 50 and Firefox since version 49).
Test: fast/dom/DOMTokenList-supports.html
* dom/SecurityContext.cpp:
(WebCore::SecurityContext::isSupportedSandboxPolicy):
(WebCore::SecurityContext::enforceSandboxFlags): Deleted.
* dom/SecurityContext.h:
* html/DOMTokenList.cpp:
(WebCore::DOMTokenList::DOMTokenList):
(WebCore::DOMTokenList::supports):
(WebCore::DOMTokenList::replace): Deleted.
* html/DOMTokenList.h:
(WebCore::DOMTokenList::DOMTokenList):
* html/DOMTokenList.idl:
* html/HTMLAnchorElement.cpp:
(WebCore::HTMLAnchorElement::parseAttribute):
(WebCore::HTMLAnchorElement::relList):
* html/HTMLAnchorElement.idl:
* html/HTMLAreaElement.idl:
* html/HTMLIFrameElement.cpp:
(WebCore::HTMLIFrameElement::sandbox):
* html/HTMLLinkElement.cpp:
(WebCore::HTMLLinkElement::relList):
* html/HTMLTableCellElement.idl:
* html/LinkRelAttribute.cpp:
(WebCore::LinkRelAttribute::isSupported):
(WebCore::LinkRelAttribute::LinkRelAttribute): Deleted.
* html/LinkRelAttribute.h:
LayoutTests:
Add layout test coverage. Our pass rate is identical to Firefox 49,
everything passes except HTMLElement.dropzone. Chrome 53's pass rate
is lower because relList is not a DOMTokenList on anchor / area,
they do not support HTMLElement.dropzone and their
DOMTokenList.supports() is case-sensitive.
* fast/dom/DOMTokenList-supports-expected.txt: Added.
* fast/dom/DOMTokenList-supports.html: Added.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsimportedw3cChangeLog">trunk/LayoutTests/imported/w3c/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestsdominterfacesexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/dom/interfaces-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestshtmlsemanticsdocumentmetadatathelinkelementlinkrellistexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/document-metadata/the-link-element/link-rellist-expected.txt</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoredomSecurityContextcpp">trunk/Source/WebCore/dom/SecurityContext.cpp</a></li>
<li><a href="#trunkSourceWebCoredomSecurityContexth">trunk/Source/WebCore/dom/SecurityContext.h</a></li>
<li><a href="#trunkSourceWebCorehtmlDOMTokenListcpp">trunk/Source/WebCore/html/DOMTokenList.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlDOMTokenListh">trunk/Source/WebCore/html/DOMTokenList.h</a></li>
<li><a href="#trunkSourceWebCorehtmlDOMTokenListidl">trunk/Source/WebCore/html/DOMTokenList.idl</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLAnchorElementcpp">trunk/Source/WebCore/html/HTMLAnchorElement.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLAnchorElementidl">trunk/Source/WebCore/html/HTMLAnchorElement.idl</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLAreaElementidl">trunk/Source/WebCore/html/HTMLAreaElement.idl</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLIFrameElementcpp">trunk/Source/WebCore/html/HTMLIFrameElement.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLLinkElementcpp">trunk/Source/WebCore/html/HTMLLinkElement.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLTableCellElementidl">trunk/Source/WebCore/html/HTMLTableCellElement.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>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsfastdomDOMTokenListsupportsexpectedtxt">trunk/LayoutTests/fast/dom/DOMTokenList-supports-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastdomDOMTokenListsupportshtml">trunk/LayoutTests/fast/dom/DOMTokenList-supports.html</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (206560 => 206561)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2016-09-28 23:34:54 UTC (rev 206560)
+++ trunk/LayoutTests/ChangeLog        2016-09-28 23:49:50 UTC (rev 206561)
</span><span class="lines">@@ -1,3 +1,19 @@
</span><ins>+2016-09-28 Chris Dumez <cdumez@apple.com>
+
+ Add support for DOMTokenList.supports()
+ https://bugs.webkit.org/show_bug.cgi?id=162659
+
+ Reviewed by Ryosuke Niwa.
+
+ Add layout test coverage. Our pass rate is identical to Firefox 49,
+ everything passes except HTMLElement.dropzone. Chrome 53's pass rate
+ is lower because relList is not a DOMTokenList on anchor / area,
+ they do not support HTMLElement.dropzone and their
+ DOMTokenList.supports() is case-sensitive.
+
+ * fast/dom/DOMTokenList-supports-expected.txt: Added.
+ * fast/dom/DOMTokenList-supports.html: Added.
+
</ins><span class="cx"> 2016-09-28 Ryosuke Niwa <rniwa@webkit.org>
</span><span class="cx">
</span><span class="cx"> DOMTokenList’s value and stringifier should not return parsed tokens
</span></span></pre></div>
<a id="trunkLayoutTestsfastdomDOMTokenListsupportsexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/dom/DOMTokenList-supports-expected.txt (0 => 206561)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/DOMTokenList-supports-expected.txt         (rev 0)
+++ trunk/LayoutTests/fast/dom/DOMTokenList-supports-expected.txt        2016-09-28 23:49:50 UTC (rev 206561)
</span><span class="lines">@@ -0,0 +1,62 @@
</span><ins>+Test support for DOMTokenList.supports()
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS DOMTokenList.prototype.supports is an instance of Function
+
+* HTMLLinkElement.relList
+PASS link.relList.__proto__ is DOMTokenList.prototype
+PASS link.relList.supports(linkRelSupportedValues[i]) is true
+PASS link.relList.supports(linkRelSupportedValues[i].toUpperCase()) is true
+PASS link.relList.supports(linkRelSupportedValues[i]) is true
+PASS link.relList.supports(linkRelSupportedValues[i].toUpperCase()) is true
+PASS link.relList.supports(linkRelSupportedValues[i]) is true
+PASS link.relList.supports(linkRelSupportedValues[i].toUpperCase()) is true
+PASS link.relList.supports(linkRelSupportedValues[i]) is true
+PASS link.relList.supports(linkRelSupportedValues[i].toUpperCase()) is true
+PASS link.relList.supports('unsupported') is false
+
+* HTMLAnchorElement.relList
+PASS anchor.relList.__proto__ is DOMTokenList.prototype
+PASS anchor.relList.supports(anchorRelSupportedValues[i]) is true
+PASS anchor.relList.supports(anchorRelSupportedValues[i].toUpperCase()) is true
+PASS anchor.relList.supports('unsupported') is false
+
+* HTMLAreaElement.relList
+PASS area.relList.__proto__ is DOMTokenList.prototype
+PASS area.relList.supports(areaRelSupportedValues[i]) is true
+PASS area.relList.supports(areaRelSupportedValues[i].toUpperCase()) is true
+PASS area.relList.supports('unsupported') is false
+
+* HTMLIFrameElement.sandbox
+PASS iframe.sandbox.__proto__ is DOMTokenList.prototype
+PASS iframe.sandbox.supports(iframeSandboxSupportedValues[i]) is true
+PASS iframe.sandbox.supports(iframeSandboxSupportedValues[i].toUpperCase()) is true
+PASS iframe.sandbox.supports(iframeSandboxSupportedValues[i]) is true
+PASS iframe.sandbox.supports(iframeSandboxSupportedValues[i].toUpperCase()) is true
+PASS iframe.sandbox.supports(iframeSandboxSupportedValues[i]) is true
+PASS iframe.sandbox.supports(iframeSandboxSupportedValues[i].toUpperCase()) is true
+PASS iframe.sandbox.supports(iframeSandboxSupportedValues[i]) is true
+PASS iframe.sandbox.supports(iframeSandboxSupportedValues[i].toUpperCase()) is true
+PASS iframe.sandbox.supports(iframeSandboxSupportedValues[i]) is true
+PASS iframe.sandbox.supports(iframeSandboxSupportedValues[i].toUpperCase()) is true
+PASS iframe.sandbox.supports(iframeSandboxSupportedValues[i]) is true
+PASS iframe.sandbox.supports(iframeSandboxSupportedValues[i].toUpperCase()) is true
+PASS iframe.sandbox.supports('unsupported') is false
+
+* HTMLLinkElement.sizes
+PASS link.sizes.__proto__ is DOMTokenList.prototype
+PASS link.sizes.supports('token') threw exception TypeError: Type error.
+
+* HTMLOutputElement.htmlFor
+PASS output.htmlFor.__proto__ is DOMTokenList.prototype
+PASS output.htmlFor.supports('token') threw exception TypeError: Type error.
+
+* HTMLElement.dropzone
+FAIL HTMLElement.dropzone is not supported.
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsfastdomDOMTokenListsupportshtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/dom/DOMTokenList-supports.html (0 => 206561)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/DOMTokenList-supports.html         (rev 0)
+++ trunk/LayoutTests/fast/dom/DOMTokenList-supports.html        2016-09-28 23:49:50 UTC (rev 206561)
</span><span class="lines">@@ -0,0 +1,82 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<body>
+<script src="../../resources/js-test-pre.js"></script>
+<script>
+description("Test support for DOMTokenList.supports()");
+
+shouldBeType("DOMTokenList.prototype.supports", "Function");
+
+debug("");
+debug("* HTMLLinkElement.relList");
+var link = document.createElement("link");
+shouldBe("link.relList.__proto__", "DOMTokenList.prototype");
+var linkRelSupportedValues = ["alternate", "dns-prefetch", "icon", "stylesheet"];
+for (var i = 0; i < linkRelSupportedValues.length; i++) {
+ shouldBeTrue("link.relList.supports(linkRelSupportedValues[i])");
+ shouldBeTrue("link.relList.supports(linkRelSupportedValues[i].toUpperCase())");
+}
+shouldBeFalse("link.relList.supports('unsupported')");
+
+debug("");
+debug("* HTMLAnchorElement.relList");
+var anchor = document.createElement("a");
+shouldBe("anchor.relList.__proto__", "DOMTokenList.prototype");
+var anchorRelSupportedValues = ["noreferrer"];
+for (var i = 0; i < anchorRelSupportedValues.length; i++) {
+ shouldBeTrue("anchor.relList.supports(anchorRelSupportedValues[i])");
+ shouldBeTrue("anchor.relList.supports(anchorRelSupportedValues[i].toUpperCase())");
+}
+shouldBeFalse("anchor.relList.supports('unsupported')");
+
+debug("");
+debug("* HTMLAreaElement.relList");
+var area = document.createElement("area");
+shouldBe("area.relList.__proto__", "DOMTokenList.prototype");
+var areaRelSupportedValues = ["noreferrer"];
+for (var i = 0; i < areaRelSupportedValues.length; i++) {
+ shouldBeTrue("area.relList.supports(areaRelSupportedValues[i])");
+ shouldBeTrue("area.relList.supports(areaRelSupportedValues[i].toUpperCase())");
+}
+shouldBeFalse("area.relList.supports('unsupported')");
+
+debug("");
+debug("* HTMLIFrameElement.sandbox");
+var iframe = document.createElement("iframe");
+shouldBe("iframe.sandbox.__proto__", "DOMTokenList.prototype");
+var iframeSandboxSupportedValues = ["allow-forms", "allow-same-origin", "allow-scripts", "allow-top-navigation", "allow-pointer-lock", "allow-popups"];
+for (var i = 0; i < iframeSandboxSupportedValues.length; i++) {
+ shouldBeTrue("iframe.sandbox.supports(iframeSandboxSupportedValues[i])");
+ shouldBeTrue("iframe.sandbox.supports(iframeSandboxSupportedValues[i].toUpperCase())");
+}
+shouldBeFalse("iframe.sandbox.supports('unsupported')");
+
+debug("");
+debug("* HTMLLinkElement.sizes");
+shouldBe("link.sizes.__proto__", "DOMTokenList.prototype");
+shouldThrowErrorName("link.sizes.supports('token')", "TypeError");
+
+debug("");
+debug("* HTMLOutputElement.htmlFor");
+var output = document.createElement("output");
+shouldBe("output.htmlFor.__proto__", "DOMTokenList.prototype");
+shouldThrowErrorName("output.htmlFor.supports('token')", "TypeError");
+
+debug("");
+debug("* HTMLElement.dropzone");
+if (link.dropzone) {
+ shouldBe("link.dropzone.__proto__", "DOMTokenList.prototype");
+ var dropzoneSupportedValues = ["copy", "move", "link"];
+ for (var i = 0; i < dropzoneSupportedValues.length; i++) {
+ shouldBeTrue("link.dropzone.supports(dropzoneSupportedValues[i])");
+ shouldBeTrue("link.dropzone.supports(dropzoneSupportedValues[i].toUpperCase())");
+ }
+ shouldBeFalse("link.dropzone.supports('unsupported')");
+} else
+ testFailed("HTMLElement.dropzone is not supported.");
+
+debug("");
+</script>
+<script src="../../resources/js-test-post.js"></script>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/ChangeLog (206560 => 206561)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/ChangeLog        2016-09-28 23:34:54 UTC (rev 206560)
+++ trunk/LayoutTests/imported/w3c/ChangeLog        2016-09-28 23:49:50 UTC (rev 206561)
</span><span class="lines">@@ -1,3 +1,15 @@
</span><ins>+2016-09-28 Chris Dumez <cdumez@apple.com>
+
+ Add support for DOMTokenList.supports()
+ https://bugs.webkit.org/show_bug.cgi?id=162659
+
+ Reviewed by Ryosuke Niwa.
+
+ Rebaseline W3C tests now that more checks are passing.
+
+ * web-platform-tests/dom/interfaces-expected.txt:
+ * web-platform-tests/html/semantics/document-metadata/the-link-element/link-rellist-expected.txt:
+
</ins><span class="cx"> 2016-09-28 Ryosuke Niwa <rniwa@webkit.org>
</span><span class="cx">
</span><span class="cx"> DOMTokenList’s value and stringifier should not return parsed tokens
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestsdominterfacesexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/dom/interfaces-expected.txt (206560 => 206561)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/dom/interfaces-expected.txt        2016-09-28 23:34:54 UTC (rev 206560)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/dom/interfaces-expected.txt        2016-09-28 23:49:50 UTC (rev 206561)
</span><span class="lines">@@ -1590,7 +1590,7 @@
</span><span class="cx"> PASS DOMTokenList interface: operation remove(DOMString)
</span><span class="cx"> PASS DOMTokenList interface: operation toggle(DOMString,boolean)
</span><span class="cx"> PASS DOMTokenList interface: operation replace(DOMString,DOMString)
</span><del>-FAIL DOMTokenList interface: operation supports(DOMString) assert_own_property: interface prototype object missing non-static operation expected property "supports" missing
</del><ins>+PASS DOMTokenList interface: operation supports(DOMString)
</ins><span class="cx"> PASS DOMTokenList interface: attribute value
</span><span class="cx"> PASS DOMTokenList interface: stringifier
</span><span class="cx"> PASS DOMTokenList must be primary interface of document.body.classList
</span><span class="lines">@@ -1608,7 +1608,7 @@
</span><span class="cx"> PASS DOMTokenList interface: calling toggle(DOMString,boolean) on document.body.classList with too few arguments must throw TypeError
</span><span class="cx"> PASS DOMTokenList interface: document.body.classList must inherit property "replace" with the proper type (6)
</span><span class="cx"> PASS DOMTokenList interface: calling replace(DOMString,DOMString) on document.body.classList with too few arguments must throw TypeError
</span><del>-FAIL DOMTokenList interface: document.body.classList must inherit property "supports" with the proper type (7) assert_inherits: property "supports" not found in prototype chain
-FAIL DOMTokenList interface: calling supports(DOMString) on document.body.classList with too few arguments must throw TypeError assert_inherits: property "supports" not found in prototype chain
</del><ins>+PASS DOMTokenList interface: document.body.classList must inherit property "supports" with the proper type (7)
+PASS DOMTokenList interface: calling supports(DOMString) on document.body.classList with too few arguments must throw TypeError
</ins><span class="cx"> PASS DOMTokenList interface: document.body.classList must inherit property "value" with the proper type (8)
</span><span class="cx">
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestshtmlsemanticsdocumentmetadatathelinkelementlinkrellistexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/document-metadata/the-link-element/link-rellist-expected.txt (206560 => 206561)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/document-metadata/the-link-element/link-rellist-expected.txt        2016-09-28 23:34:54 UTC (rev 206560)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/document-metadata/the-link-element/link-rellist-expected.txt        2016-09-28 23:49:50 UTC (rev 206561)
</span><span class="lines">@@ -1,3 +1,3 @@
</span><span class="cx">
</span><del>-FAIL link.relList: non-string contains list.supports is not a function. (In 'list.supports("stylesheet")', 'list.supports' is undefined)
</del><ins>+PASS link.relList: non-string contains
</ins><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (206560 => 206561)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-09-28 23:34:54 UTC (rev 206560)
+++ trunk/Source/WebCore/ChangeLog        2016-09-28 23:49:50 UTC (rev 206561)
</span><span class="lines">@@ -1,3 +1,44 @@
</span><ins>+2016-09-28 Chris Dumez <cdumez@apple.com>
+
+ Add support for DOMTokenList.supports()
+ https://bugs.webkit.org/show_bug.cgi?id=162659
+
+ Reviewed by Ryosuke Niwa.
+
+ Add support for DOMTokenList.supports():
+ - https://dom.spec.whatwg.org/#dom-domtokenlist-supports
+
+ Firefox and Chrome already recently implemented it (Chrome since
+ version 50 and Firefox since version 49).
+
+ Test: fast/dom/DOMTokenList-supports.html
+
+ * dom/SecurityContext.cpp:
+ (WebCore::SecurityContext::isSupportedSandboxPolicy):
+ (WebCore::SecurityContext::enforceSandboxFlags): Deleted.
+ * dom/SecurityContext.h:
+ * html/DOMTokenList.cpp:
+ (WebCore::DOMTokenList::DOMTokenList):
+ (WebCore::DOMTokenList::supports):
+ (WebCore::DOMTokenList::replace): Deleted.
+ * html/DOMTokenList.h:
+ (WebCore::DOMTokenList::DOMTokenList):
+ * html/DOMTokenList.idl:
+ * html/HTMLAnchorElement.cpp:
+ (WebCore::HTMLAnchorElement::parseAttribute):
+ (WebCore::HTMLAnchorElement::relList):
+ * html/HTMLAnchorElement.idl:
+ * html/HTMLAreaElement.idl:
+ * html/HTMLIFrameElement.cpp:
+ (WebCore::HTMLIFrameElement::sandbox):
+ * html/HTMLLinkElement.cpp:
+ (WebCore::HTMLLinkElement::relList):
+ * html/HTMLTableCellElement.idl:
+ * html/LinkRelAttribute.cpp:
+ (WebCore::LinkRelAttribute::isSupported):
+ (WebCore::LinkRelAttribute::LinkRelAttribute): Deleted.
+ * html/LinkRelAttribute.h:
+
</ins><span class="cx"> 2016-09-28 Ryosuke Niwa <rniwa@webkit.org>
</span><span class="cx">
</span><span class="cx"> DOMTokenList’s value and stringifier should not return parsed tokens
</span></span></pre></div>
<a id="trunkSourceWebCoredomSecurityContextcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/SecurityContext.cpp (206560 => 206561)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/SecurityContext.cpp        2016-09-28 23:34:54 UTC (rev 206560)
+++ trunk/Source/WebCore/dom/SecurityContext.cpp        2016-09-28 23:49:50 UTC (rev 206561)
</span><span class="lines">@@ -31,6 +31,7 @@
</span><span class="cx"> #include "HTMLParserIdioms.h"
</span><span class="cx"> #include "SecurityOrigin.h"
</span><span class="cx"> #include "SecurityOriginPolicy.h"
</span><ins>+#include <wtf/NeverDestroyed.h>
</ins><span class="cx"> #include <wtf/text/StringBuilder.h>
</span><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="lines">@@ -84,6 +85,20 @@
</span><span class="cx"> setSecurityOriginPolicy(SecurityOriginPolicy::create(SecurityOrigin::createUnique()));
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+bool SecurityContext::isSupportedSandboxPolicy(const String& policy)
+{
+ static const char* supportedPolicies[] = {
+ "allow-forms", "allow-same-origin", "allow-scripts", "allow-top-navigation", "allow-pointer-lock", "allow-popups"
+ };
+
+ for (auto* supportedPolicy : supportedPolicies) {
+ if (equalIgnoringASCIICase(policy, supportedPolicy))
+ return true;
+ }
+ return false;
+}
+
+// Keep SecurityContext::isSupportedSandboxPolicy() in sync when updating this function.
</ins><span class="cx"> SandboxFlags SecurityContext::parseSandboxPolicy(const String& policy, String& invalidTokensErrorMessage)
</span><span class="cx"> {
</span><span class="cx"> // http://www.w3.org/TR/html5/the-iframe-element.html#attr-iframe-sandbox
</span></span></pre></div>
<a id="trunkSourceWebCoredomSecurityContexth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/SecurityContext.h (206560 => 206561)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/SecurityContext.h        2016-09-28 23:34:54 UTC (rev 206560)
+++ trunk/Source/WebCore/dom/SecurityContext.h        2016-09-28 23:49:50 UTC (rev 206561)
</span><span class="lines">@@ -75,6 +75,8 @@
</span><span class="cx"> WEBCORE_EXPORT SecurityOrigin* securityOrigin() const;
</span><span class="cx">
</span><span class="cx"> static SandboxFlags parseSandboxPolicy(const String& policy, String& invalidTokensErrorMessage);
</span><ins>+ static bool isSupportedSandboxPolicy(const String&);
+
</ins><span class="cx"> bool foundMixedContent() const { return m_foundMixedContent; }
</span><span class="cx"> void setFoundMixedContent() { m_foundMixedContent = true; }
</span><span class="cx"> bool geolocationAccessed() const { return m_geolocationAccessed; }
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlDOMTokenListcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/DOMTokenList.cpp (206560 => 206561)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/DOMTokenList.cpp        2016-09-28 23:34:54 UTC (rev 206560)
+++ trunk/Source/WebCore/html/DOMTokenList.cpp        2016-09-28 23:49:50 UTC (rev 206561)
</span><span class="lines">@@ -36,9 +36,10 @@
</span><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><del>-DOMTokenList::DOMTokenList(Element& element, const QualifiedName& attributeName)
</del><ins>+DOMTokenList::DOMTokenList(Element& element, const QualifiedName& attributeName, WTF::Function<bool(const String&)>&& isSupportedToken)
</ins><span class="cx"> : m_element(element)
</span><span class="cx"> , m_attributeName(attributeName)
</span><ins>+ , m_isSupportedToken(WTFMove(isSupportedToken))
</ins><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -177,6 +178,16 @@
</span><span class="cx"> updateAssociatedAttributeFromTokens();
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+// https://dom.spec.whatwg.org/#concept-domtokenlist-validation
+bool DOMTokenList::supports(const String& token, ExceptionCode& ec)
+{
+ if (!m_isSupportedToken) {
+ ec = TypeError;
+ return false;
+ }
+ return m_isSupportedToken(token);
+}
+
</ins><span class="cx"> // https://dom.spec.whatwg.org/#dom-domtokenlist-value
</span><span class="cx"> const AtomicString& DOMTokenList::value() const
</span><span class="cx"> {
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlDOMTokenListh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/DOMTokenList.h (206560 => 206561)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/DOMTokenList.h        2016-09-28 23:34:54 UTC (rev 206560)
+++ trunk/Source/WebCore/html/DOMTokenList.h        2016-09-28 23:49:50 UTC (rev 206561)
</span><span class="lines">@@ -32,7 +32,7 @@
</span><span class="cx"> class DOMTokenList {
</span><span class="cx"> WTF_MAKE_NONCOPYABLE(DOMTokenList); WTF_MAKE_FAST_ALLOCATED;
</span><span class="cx"> public:
</span><del>- DOMTokenList(Element&, const QualifiedName& attributeName);
</del><ins>+ DOMTokenList(Element&, const QualifiedName& attributeName, WTF::Function<bool(const String&)>&& isSupportedToken = { });
</ins><span class="cx">
</span><span class="cx"> void associatedAttributeValueChanged(const AtomicString&);
</span><span class="cx">
</span><span class="lines">@@ -49,6 +49,7 @@
</span><span class="cx"> void remove(const AtomicString&, ExceptionCode&);
</span><span class="cx"> WEBCORE_EXPORT bool toggle(const AtomicString&, Optional<bool> force, ExceptionCode&);
</span><span class="cx"> void replace(const AtomicString& token, const AtomicString& newToken, ExceptionCode&);
</span><ins>+ bool supports(const String& token, ExceptionCode&);
</ins><span class="cx">
</span><span class="cx"> Element& element() const { return m_element; }
</span><span class="cx">
</span><span class="lines">@@ -72,6 +73,7 @@
</span><span class="cx"> bool m_inUpdateAssociatedAttributeFromTokens { false };
</span><span class="cx"> bool m_tokensNeedUpdating { true };
</span><span class="cx"> Vector<AtomicString> m_tokens;
</span><ins>+ WTF::Function<bool(const String&)> m_isSupportedToken;
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> inline unsigned DOMTokenList::length() const
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlDOMTokenListidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/DOMTokenList.idl (206560 => 206561)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/DOMTokenList.idl        2016-09-28 23:34:54 UTC (rev 206560)
+++ trunk/Source/WebCore/html/DOMTokenList.idl        2016-09-28 23:49:50 UTC (rev 206561)
</span><span class="lines">@@ -34,6 +34,7 @@
</span><span class="cx"> [RaisesException] void remove(DOMString... tokens);
</span><span class="cx"> [RaisesException] boolean toggle(DOMString token, optional boolean force);
</span><span class="cx"> [RaisesException] void replace(DOMString token, DOMString newToken);
</span><ins>+ [RaisesException] boolean supports(DOMString token);
</ins><span class="cx">
</span><span class="cx"> iterable<DOMString>;
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLAnchorElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLAnchorElement.cpp (206560 => 206561)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLAnchorElement.cpp        2016-09-28 23:34:54 UTC (rev 206560)
+++ trunk/Source/WebCore/html/HTMLAnchorElement.cpp        2016-09-28 23:49:50 UTC (rev 206561)
</span><span class="lines">@@ -248,6 +248,7 @@
</span><span class="cx"> } else if (name == nameAttr || name == titleAttr) {
</span><span class="cx"> // Do nothing.
</span><span class="cx"> } else if (name == relAttr) {
</span><ins>+ // Update HTMLAnchorElement::relList() if more rel attributes values are supported.
</ins><span class="cx"> if (SpaceSplitString::spaceSplitStringContainsValue(value, "noreferrer", true))
</span><span class="cx"> m_linkRelations |= RelationNoReferrer;
</span><span class="cx"> if (m_relList)
</span><span class="lines">@@ -302,7 +303,9 @@
</span><span class="cx"> DOMTokenList& HTMLAnchorElement::relList()
</span><span class="cx"> {
</span><span class="cx"> if (!m_relList)
</span><del>- m_relList = std::make_unique<DOMTokenList>(*this, HTMLNames::relAttr);
</del><ins>+ m_relList = std::make_unique<DOMTokenList>(*this, HTMLNames::relAttr, [](const String& token) {
+ return equalIgnoringASCIICase(token, "noreferrer");
+ });
</ins><span class="cx"> return *m_relList;
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLAnchorElementidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLAnchorElement.idl (206560 => 206561)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLAnchorElement.idl        2016-09-28 23:34:54 UTC (rev 206560)
+++ trunk/Source/WebCore/html/HTMLAnchorElement.idl        2016-09-28 23:49:50 UTC (rev 206561)
</span><span class="lines">@@ -24,10 +24,7 @@
</span><span class="cx"> [Conditional=DOWNLOAD_ATTRIBUTE, EnabledAtRuntime=DownloadAttribute, Reflect] attribute DOMString download;
</span><span class="cx"> [Reflect] attribute DOMString hreflang;
</span><span class="cx"> [Reflect] attribute DOMString name;
</span><del>-
- // FIXME: This is supposed to be: [PutForwards=value] readonly attribute DOMTokenList ping;
</del><span class="cx"> [Reflect] attribute USVString ping;
</span><del>-
</del><span class="cx"> [Reflect] attribute DOMString rel;
</span><span class="cx"> [Reflect] attribute DOMString rev;
</span><span class="cx"> [Reflect] attribute DOMString shape;
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLAreaElementidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLAreaElement.idl (206560 => 206561)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLAreaElement.idl        2016-09-28 23:34:54 UTC (rev 206560)
+++ trunk/Source/WebCore/html/HTMLAreaElement.idl        2016-09-28 23:49:50 UTC (rev 206561)
</span><span class="lines">@@ -22,11 +22,7 @@
</span><span class="cx"> [Reflect] attribute DOMString alt;
</span><span class="cx"> [Reflect] attribute DOMString coords;
</span><span class="cx"> [Reflect] attribute boolean noHref;
</span><del>-
- // FIXME: This is supposed to be:
- // [PutForwards=value] readonly attribute DOMTokenList ping;
</del><span class="cx"> [Reflect] attribute USVString ping;
</span><del>-
</del><span class="cx"> [Reflect] attribute DOMString rel;
</span><span class="cx"> [Reflect] attribute DOMString shape;
</span><span class="cx"> [Reflect] attribute DOMString target;
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLIFrameElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLIFrameElement.cpp (206560 => 206561)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLIFrameElement.cpp        2016-09-28 23:34:54 UTC (rev 206560)
+++ trunk/Source/WebCore/html/HTMLIFrameElement.cpp        2016-09-28 23:49:50 UTC (rev 206561)
</span><span class="lines">@@ -51,7 +51,9 @@
</span><span class="cx"> DOMTokenList& HTMLIFrameElement::sandbox()
</span><span class="cx"> {
</span><span class="cx"> if (!m_sandbox)
</span><del>- m_sandbox = std::make_unique<DOMTokenList>(*this, sandboxAttr);
</del><ins>+ m_sandbox = std::make_unique<DOMTokenList>(*this, sandboxAttr, [](const String& token) {
+ return SecurityContext::isSupportedSandboxPolicy(token);
+ });
</ins><span class="cx"> return *m_sandbox;
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLLinkElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLLinkElement.cpp (206560 => 206561)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLLinkElement.cpp        2016-09-28 23:34:54 UTC (rev 206560)
+++ trunk/Source/WebCore/html/HTMLLinkElement.cpp        2016-09-28 23:49:50 UTC (rev 206561)
</span><span class="lines">@@ -444,7 +444,9 @@
</span><span class="cx"> DOMTokenList& HTMLLinkElement::relList()
</span><span class="cx"> {
</span><span class="cx"> if (!m_relList)
</span><del>- m_relList = std::make_unique<DOMTokenList>(*this, HTMLNames::relAttr);
</del><ins>+ m_relList = std::make_unique<DOMTokenList>(*this, HTMLNames::relAttr, [](const String& token) {
+ return LinkRelAttribute::isSupported(token);
+ });
</ins><span class="cx"> return *m_relList;
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLTableCellElementidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLTableCellElement.idl (206560 => 206561)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLTableCellElement.idl        2016-09-28 23:34:54 UTC (rev 206560)
+++ trunk/Source/WebCore/html/HTMLTableCellElement.idl        2016-09-28 23:49:50 UTC (rev 206561)
</span><span class="lines">@@ -29,8 +29,6 @@
</span><span class="cx"> [ImplementedAs=colSpanForBindings] attribute unsigned long colSpan;
</span><span class="cx"> [ImplementedAs=rowSpanForBindings] attribute unsigned long rowSpan;
</span><span class="cx">
</span><del>- // FIXME: This is supposed to be:
- // [PutForwards=value] readonly attribute DOMTokenList headers;
</del><span class="cx"> [Reflect] attribute DOMString headers;
</span><span class="cx">
</span><span class="cx"> [Reflect] attribute DOMString height;
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlLinkRelAttributecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/LinkRelAttribute.cpp (206560 => 206561)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/LinkRelAttribute.cpp        2016-09-28 23:34:54 UTC (rev 206560)
+++ trunk/Source/WebCore/html/LinkRelAttribute.cpp        2016-09-28 23:49:50 UTC (rev 206561)
</span><span class="lines">@@ -42,6 +42,7 @@
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+// Keep LinkRelAttribute::isSupported() in sync when updating this constructor.
</ins><span class="cx"> LinkRelAttribute::LinkRelAttribute(const String& rel)
</span><span class="cx"> {
</span><span class="cx"> if (equalLettersIgnoringASCIICase(rel, "stylesheet"))
</span><span class="lines">@@ -86,4 +87,25 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+// https://html.spec.whatwg.org/#linkTypes
+bool LinkRelAttribute::isSupported(const String& attribute)
+{
+ static const char* supportedAttributes[] = {
+ "alternate", "dns-prefetch", "icon", "stylesheet", "apple-touch-icon", "apple-touch-icon-precomposed",
+#if ENABLE(LINK_PREFETCH)
+ "prefetch", "subresource",
+#endif
+ };
+
+ for (auto* supportedAttribute : supportedAttributes) {
+ if (equalIgnoringASCIICase(attribute, supportedAttribute))
+ return true;
+ }
+
+ if (RuntimeEnabledFeatures::sharedFeatures().linkPreloadEnabled() && equalIgnoringASCIICase(attribute, "preload"))
+ return true;
+
+ return false;
</ins><span class="cx"> }
</span><ins>+
+}
</ins></span></pre></div>
<a id="trunkSourceWebCorehtmlLinkRelAttributeh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/LinkRelAttribute.h (206560 => 206561)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/LinkRelAttribute.h        2016-09-28 23:34:54 UTC (rev 206560)
+++ trunk/Source/WebCore/html/LinkRelAttribute.h        2016-09-28 23:49:50 UTC (rev 206561)
</span><span class="lines">@@ -52,6 +52,8 @@
</span><span class="cx">
</span><span class="cx"> LinkRelAttribute();
</span><span class="cx"> explicit LinkRelAttribute(const String&);
</span><ins>+
+ static bool isSupported(const String&);
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> }
</span></span></pre>
</div>
</div>
</body>
</html>