<!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>[204732] 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/204732">204732</a></dd>
<dt>Author</dt> <dd>rniwa@webkit.org</dd>
<dt>Date</dt> <dd>2016-08-22 12:45:01 -0700 (Mon, 22 Aug 2016)</dd>
</dl>
<h3>Log Message</h3>
<pre>Rename CustomElementsRegistry to CustomElementRegistry
https://bugs.webkit.org/show_bug.cgi?id=161028
Reviewed by Darin Adler.
Source/JavaScriptCore:
Added customElements and CustomElementRegistry to the common identifiers list as they're used on JSDOMWindow
to hide window.customElements and CustomElementRegistry interface behind a runtime flag.
* runtime/CommonIdentifiers.h:
Source/WebCore:
Renamed CustomElementsRegistry to CustomElementRegistry per https://github.com/w3c/webcomponents/issues/548.
Also hide window.customElements and CustomElementRegistry interface behind a runtime enabled.
* CMakeLists.txt:
* DerivedSources.cpp:
* DerivedSources.make:
* WebCore.xcodeproj/project.pbxproj:
* bindings/js/JSCustomElementRegistryCustom.cpp: Renamed from JSCustomElementsRegistryCustom.cpp.
(WebCore::getCustomElementCallback):
(WebCore::JSCustomElementRegistry::define):
* bindings/js/JSHTMLElementCustom.cpp:
(WebCore::constructJSHTMLElement):
* dom/CustomElementReactionQueue.cpp:
(WebCore::findInterfaceForCustomElement):
* dom/CustomElementRegistry.cpp: Renamed from CustomElementsRegistry.cpp.
(WebCore::CustomElementRegistry::create):
(WebCore::CustomElementRegistry::CustomElementRegistry):
(WebCore::CustomElementRegistry::~CustomElementRegistry):
(WebCore::CustomElementRegistry::addElementDefinition):
(WebCore::CustomElementRegistry::addUpgradeCandidate):
(WebCore::CustomElementRegistry::findInterface):
(WebCore::CustomElementRegistry::containsConstructor):
* dom/CustomElementRegistry.h: Renamed from CustomElementsRegistry.h.
* dom/CustomElementRegistry.idl: Renamed from CustomElementsRegistry.idl.
* dom/Document.cpp:
(WebCore::createUpgradeCandidateElement):
(WebCore::createHTMLElementWithNameValidation):
(WebCore::createFallbackHTMLElement):
* dom/Element.cpp:
* html/parser/HTMLConstructionSite.cpp:
(WebCore::HTMLConstructionSite::createHTMLElementOrFindCustomElementInterface):
* page/DOMWindow.cpp:
(WebCore::DOMWindow::ensureCustomElementRegistry):
* page/DOMWindow.h:
* page/DOMWindow.idl:
LayoutTests:
Updated the tests and expected results after the rename.
* fast/custom-elements/CustomElementRegistry-expected.txt: Renamed from LayoutTests/fast/custom-elements/CustomElementsRegistry-expected.txt.
* fast/custom-elements/CustomElementRegistry.html: Renamed from LayoutTests/fast/custom-elements/CustomElementsRegistry.html.
* platform/efl/js/dom/global-constructors-attributes-expected.txt:
* platform/gtk/js/dom/global-constructors-attributes-expected.txt:
* platform/mac-wk1/js/dom/global-constructors-attributes-expected.txt:
* platform/mac-yosemite/js/dom/global-constructors-attributes-expected.txt:
* platform/mac/js/dom/global-constructors-attributes-expected.txt:
* platform/win/js/dom/global-constructors-attributes-expected.txt:</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsplatformefljsdomglobalconstructorsattributesexpectedtxt">trunk/LayoutTests/platform/efl/js/dom/global-constructors-attributes-expected.txt</a></li>
<li><a href="#trunkLayoutTestsplatformgtkjsdomglobalconstructorsattributesexpectedtxt">trunk/LayoutTests/platform/gtk/js/dom/global-constructors-attributes-expected.txt</a></li>
<li><a href="#trunkLayoutTestsplatformmacjsdomglobalconstructorsattributesexpectedtxt">trunk/LayoutTests/platform/mac/js/dom/global-constructors-attributes-expected.txt</a></li>
<li><a href="#trunkLayoutTestsplatformmacwk1jsdomglobalconstructorsattributesexpectedtxt">trunk/LayoutTests/platform/mac-wk1/js/dom/global-constructors-attributes-expected.txt</a></li>
<li><a href="#trunkLayoutTestsplatformmacyosemitejsdomglobalconstructorsattributesexpectedtxt">trunk/LayoutTests/platform/mac-yosemite/js/dom/global-constructors-attributes-expected.txt</a></li>
<li><a href="#trunkLayoutTestsplatformwinjsdomglobalconstructorsattributesexpectedtxt">trunk/LayoutTests/platform/win/js/dom/global-constructors-attributes-expected.txt</a></li>
<li><a href="#trunkSourceJavaScriptCoreChangeLog">trunk/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeCommonIdentifiersh">trunk/Source/JavaScriptCore/runtime/CommonIdentifiers.h</a></li>
<li><a href="#trunkSourceWebCoreCMakeListstxt">trunk/Source/WebCore/CMakeLists.txt</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreDerivedSourcescpp">trunk/Source/WebCore/DerivedSources.cpp</a></li>
<li><a href="#trunkSourceWebCoreDerivedSourcesmake">trunk/Source/WebCore/DerivedSources.make</a></li>
<li><a href="#trunkSourceWebCoreWebCorexcodeprojprojectpbxproj">trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceWebCorebindingsjsJSHTMLElementCustomcpp">trunk/Source/WebCore/bindings/js/JSHTMLElementCustom.cpp</a></li>
<li><a href="#trunkSourceWebCoredomCustomElementReactionQueuecpp">trunk/Source/WebCore/dom/CustomElementReactionQueue.cpp</a></li>
<li><a href="#trunkSourceWebCoredomDocumentcpp">trunk/Source/WebCore/dom/Document.cpp</a></li>
<li><a href="#trunkSourceWebCoredomElementcpp">trunk/Source/WebCore/dom/Element.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlparserHTMLConstructionSitecpp">trunk/Source/WebCore/html/parser/HTMLConstructionSite.cpp</a></li>
<li><a href="#trunkSourceWebCorepageDOMWindowcpp">trunk/Source/WebCore/page/DOMWindow.cpp</a></li>
<li><a href="#trunkSourceWebCorepageDOMWindowh">trunk/Source/WebCore/page/DOMWindow.h</a></li>
<li><a href="#trunkSourceWebCorepageDOMWindowidl">trunk/Source/WebCore/page/DOMWindow.idl</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsfastcustomelementsCustomElementRegistryexpectedtxt">trunk/LayoutTests/fast/custom-elements/CustomElementRegistry-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastcustomelementsCustomElementRegistryhtml">trunk/LayoutTests/fast/custom-elements/CustomElementRegistry.html</a></li>
<li><a href="#trunkSourceWebCorebindingsjsJSCustomElementRegistryCustomcpp">trunk/Source/WebCore/bindings/js/JSCustomElementRegistryCustom.cpp</a></li>
<li><a href="#trunkSourceWebCoredomCustomElementRegistrycpp">trunk/Source/WebCore/dom/CustomElementRegistry.cpp</a></li>
<li><a href="#trunkSourceWebCoredomCustomElementRegistryh">trunk/Source/WebCore/dom/CustomElementRegistry.h</a></li>
<li><a href="#trunkSourceWebCoredomCustomElementRegistryidl">trunk/Source/WebCore/dom/CustomElementRegistry.idl</a></li>
</ul>
<h3>Removed Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsfastcustomelementsCustomElementsRegistryexpectedtxt">trunk/LayoutTests/fast/custom-elements/CustomElementsRegistry-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastcustomelementsCustomElementsRegistryhtml">trunk/LayoutTests/fast/custom-elements/CustomElementsRegistry.html</a></li>
<li><a href="#trunkSourceWebCorebindingsjsJSCustomElementsRegistryCustomcpp">trunk/Source/WebCore/bindings/js/JSCustomElementsRegistryCustom.cpp</a></li>
<li><a href="#trunkSourceWebCoredomCustomElementsRegistrycpp">trunk/Source/WebCore/dom/CustomElementsRegistry.cpp</a></li>
<li><a href="#trunkSourceWebCoredomCustomElementsRegistryh">trunk/Source/WebCore/dom/CustomElementsRegistry.h</a></li>
<li><a href="#trunkSourceWebCoredomCustomElementsRegistryidl">trunk/Source/WebCore/dom/CustomElementsRegistry.idl</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (204731 => 204732)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2016-08-22 19:12:09 UTC (rev 204731)
+++ trunk/LayoutTests/ChangeLog        2016-08-22 19:45:01 UTC (rev 204732)
</span><span class="lines">@@ -1,3 +1,21 @@
</span><ins>+2016-08-22 Ryosuke Niwa <rniwa@webkit.org>
+
+ Rename CustomElementsRegistry to CustomElementRegistry
+ https://bugs.webkit.org/show_bug.cgi?id=161028
+
+ Reviewed by Darin Adler.
+
+ Updated the tests and expected results after the rename.
+
+ * fast/custom-elements/CustomElementRegistry-expected.txt: Renamed from LayoutTests/fast/custom-elements/CustomElementsRegistry-expected.txt.
+ * fast/custom-elements/CustomElementRegistry.html: Renamed from LayoutTests/fast/custom-elements/CustomElementsRegistry.html.
+ * platform/efl/js/dom/global-constructors-attributes-expected.txt:
+ * platform/gtk/js/dom/global-constructors-attributes-expected.txt:
+ * platform/mac-wk1/js/dom/global-constructors-attributes-expected.txt:
+ * platform/mac-yosemite/js/dom/global-constructors-attributes-expected.txt:
+ * platform/mac/js/dom/global-constructors-attributes-expected.txt:
+ * platform/win/js/dom/global-constructors-attributes-expected.txt:
+
</ins><span class="cx"> 2016-08-22 Daniel Bates <dabates@apple.com>
</span><span class="cx">
</span><span class="cx"> Attempt to fix the iOS 9 Simulator test bots after <https://trac.webkit.org/changeset/204720>
</span></span></pre></div>
<a id="trunkLayoutTestsfastcustomelementsCustomElementRegistryexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/custom-elements/CustomElementRegistry-expected.txt (0 => 204732)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/custom-elements/CustomElementRegistry-expected.txt         (rev 0)
+++ trunk/LayoutTests/fast/custom-elements/CustomElementRegistry-expected.txt        2016-08-22 19:45:01 UTC (rev 204732)
</span><span class="lines">@@ -0,0 +1,20 @@
</span><ins>+
+PASS CustomElementRegistry interface must have define as a method
+PASS customElements.define must throw with an invalid name
+PASS customElements.define must throw when there is already a custom element of the same name
+PASS customElements.define must throw when there is already a custom element with the same class
+PASS customElements.define must throw when the element interface is not a constructor
+PASS customElements.define must get "prototype" property of the constructor
+PASS customElements.define must rethrow an exception thrown while getting "prototype" property of the constructor
+PASS customElements.define must throw when "prototype" property of the constructor is not an object
+PASS customElements.define must get callbacks of the constructor prototype
+PASS customElements.define must rethrow an exception thrown while getting callbacks on the constructor prototype
+PASS customElements.define must rethrow an exception thrown while converting a callback value to Function callback type
+PASS customElements.define must get "observedAttributes" property on the constructor prototype when "attributeChangedCallback" is present
+PASS customElements.define must rethrow an exception thrown while getting observedAttributes on the constructor prototype
+PASS customElements.define must rethrow an exception thrown while converting the value of observedAttributes to sequence<DOMString>
+PASS customElements.define must rethrow an exception thrown while iterating over observedAttributes to sequence<DOMString>
+PASS customElements.define must rethrow an exception thrown while retrieving Symbol.iterator on observedAttributes
+PASS customElements.define must not throw even if "observedAttributes" fails to convert if "attributeChangedCallback" is not defined
+PASS customElements.define must define an instantiatable custom element
+
</ins></span></pre></div>
<a id="trunkLayoutTestsfastcustomelementsCustomElementRegistryhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/custom-elements/CustomElementRegistry.html (0 => 204732)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/custom-elements/CustomElementRegistry.html         (rev 0)
+++ trunk/LayoutTests/fast/custom-elements/CustomElementRegistry.html        2016-08-22 19:45:01 UTC (rev 204732)
</span><span class="lines">@@ -0,0 +1,272 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<head>
+<title>Custom Elements: CustomElementRegistry interface</title>
+<meta name="author" title="Ryosuke Niwa" href="mailto:rniwa@webkit.org">
+<meta name="assert" content="CustomElementRegistry interface must exist">
+<script src="../../resources/testharness.js"></script>
+<script src="../../resources/testharnessreport.js"></script>
+<link rel='stylesheet' href='../../resources/testharness.css'>
+</head>
+<body>
+<div id="log"></div>
+<script>
+
+test(function () {
+ assert_true('define' in CustomElementRegistry.prototype, '"define" exists on CustomElementRegistry.prototype');
+ assert_true('define' in customElements, '"define" exists on window.customElements');
+}, 'CustomElementRegistry interface must have define as a method');
+
+test(function () {
+ class MyCustomElement extends HTMLElement {};
+
+ assert_throws({'name': 'SyntaxError'}, function () { customElements.define(null, MyCustomElement); },
+ 'customElements.define must throw a SyntaxError if the tag name is null');
+ assert_throws({'name': 'SyntaxError'}, function () { customElements.define('', MyCustomElement); },
+ 'customElements.define must throw a SyntaxError if the tag name is empty');
+ assert_throws({'name': 'SyntaxError'}, function () { customElements.define('abc', MyCustomElement); },
+ 'customElements.define must throw a SyntaxError if the tag name does not contain "-"');
+ assert_throws({'name': 'SyntaxError'}, function () { customElements.define('a-Bc', MyCustomElement); },
+ 'customElements.define must throw a SyntaxError if the tag name contains an upper case letter');
+
+ var builtinTagNames = [
+ 'annotation-xml',
+ 'color-profile',
+ 'font-face',
+ 'font-face-src',
+ 'font-face-uri',
+ 'font-face-format',
+ 'font-face-name',
+ 'missing-glyph'
+ ];
+
+ for (var tagName of builtinTagNames) {
+ assert_throws({'name': 'SyntaxError'}, function () { customElements.define(tagName, MyCustomElement); },
+ 'customElements.define must throw a SyntaxError if the tag name is "' + tagName + '"');
+ }
+
+}, 'customElements.define must throw with an invalid name');
+
+test(function () {
+ class SomeCustomElement extends HTMLElement {};
+ class OtherCustomElement extends HTMLElement {};
+
+ customElements.define('some-custom-element', SomeCustomElement);
+ assert_throws({'name': 'NotSupportedError'}, function () { customElements.define('some-custom-element', OtherCustomElement); },
+ 'customElements.define must throw a NotSupportedError if the specified tag name is already used');
+
+}, 'customElements.define must throw when there is already a custom element of the same name');
+
+test(function () {
+ class AnotherCustomElement extends HTMLElement {};
+
+ customElements.define('another-custom-element', AnotherCustomElement);
+ assert_throws({'name': 'NotSupportedError'}, function () { customElements.define('some-other-element', AnotherCustomElement); },
+ 'customElements.define must throw a NotSupportedError if the specified class already defines an element');
+
+}, 'customElements.define must throw when there is already a custom element with the same class');
+
+test(function () {
+ assert_throws({'name': 'TypeError'}, function () { customElements.define('invalid-element', 1); },
+ 'customElements.define must throw a TypeError when the element interface is a number');
+ assert_throws({'name': 'TypeError'}, function () { customElements.define('invalid-element', '123'); },
+ 'customElements.define must throw a TypeError when the element interface is a string');
+ assert_throws({'name': 'TypeError'}, function () { customElements.define('invalid-element', {}); },
+ 'customElements.define must throw a TypeError when the element interface is an object');
+ assert_throws({'name': 'TypeError'}, function () { customElements.define('invalid-element', []); },
+ 'customElements.define must throw a TypeError when the element interface is an array');
+}, 'customElements.define must throw when the element interface is not a constructor');
+
+test(function () {
+ var calls = [];
+ var proxy = new Proxy(class extends HTMLElement { }, {
+ get: function (target, name) {
+ calls.push(name);
+ return target[name];
+ }
+ });
+ customElements.define('proxy-element', proxy);
+ assert_array_equals(calls, ['prototype']);
+}, 'customElements.define must get "prototype" property of the constructor');
+
+test(function () {
+ var proxy = new Proxy(class extends HTMLElement { }, {
+ get: function (target, name) {
+ throw {name: 'expectedError'};
+ }
+ });
+ assert_throws({'name': 'expectedError'}, function () { customElements.define('element-with-string-prototype', proxy); });
+}, 'customElements.define must rethrow an exception thrown while getting "prototype" property of the constructor');
+
+test(function () {
+ var returnedValue;
+ var proxy = new Proxy(class extends HTMLElement { }, {
+ get: function (target, name) { return returnedValue; }
+ });
+
+ returnedValue = null;
+ assert_throws({'name': 'TypeError'}, function () { customElements.define('element-with-string-prototype', proxy); },
+ 'customElements.define must throw when "prototype" property of the constructor is null');
+ returnedValue = undefined;
+ assert_throws({'name': 'TypeError'}, function () { customElements.define('element-with-string-prototype', proxy); },
+ 'customElements.define must throw when "prototype" property of the constructor is undefined');
+ returnedValue = 'hello';
+ assert_throws({'name': 'TypeError'}, function () { customElements.define('element-with-string-prototype', proxy); },
+ 'customElements.define must throw when "prototype" property of the constructor is a string');
+ returnedValue = 1;
+ assert_throws({'name': 'TypeError'}, function () { customElements.define('element-with-string-prototype', proxy); },
+ 'customElements.define must throw when "prototype" property of the constructor is a number');
+
+}, 'customElements.define must throw when "prototype" property of the constructor is not an object');
+
+test(function () {
+ var constructor = function () {}
+ var calls = [];
+ constructor.prototype = new Proxy(constructor.prototype, {
+ get: function (target, name) {
+ calls.push(name);
+ return target[name];
+ }
+ });
+ customElements.define('element-with-proxy-prototype', constructor);
+ assert_array_equals(calls, ['connectedCallback', 'disconnectedCallback', 'adoptedCallback', 'attributeChangedCallback']);
+}, 'customElements.define must get callbacks of the constructor prototype');
+
+test(function () {
+ var constructor = function () {}
+ var calls = [];
+ constructor.prototype = new Proxy(constructor.prototype, {
+ get: function (target, name) {
+ calls.push(name);
+ if (name == 'disconnectedCallback')
+ throw {name: 'expectedError'};
+ return target[name];
+ }
+ });
+ assert_throws({'name': 'expectedError'}, function () { customElements.define('element-with-throwing-callback', constructor); });
+ assert_array_equals(calls, ['connectedCallback', 'disconnectedCallback'],
+ 'customElements.define must not get callbacks after one of the get throws');
+}, 'customElements.define must rethrow an exception thrown while getting callbacks on the constructor prototype');
+
+test(function () {
+ var constructor = function () {}
+ var calls = [];
+ constructor.prototype = new Proxy(constructor.prototype, {
+ get: function (target, name) {
+ calls.push(name);
+ if (name == 'adoptedCallback')
+ return 1;
+ return target[name];
+ }
+ });
+ assert_throws({'name': 'TypeError'}, function () { customElements.define('element-with-throwing-callback', constructor); });
+ assert_array_equals(calls, ['connectedCallback', 'disconnectedCallback', 'adoptedCallback'],
+ 'customElements.define must not get callbacks after one of the conversion throws');
+}, 'customElements.define must rethrow an exception thrown while converting a callback value to Function callback type');
+
+test(function () {
+ var constructor = function () {}
+ constructor.prototype.attributeChangedCallback = function () { };
+ var prototypeCalls = [];
+ var callOrder = 0;
+ constructor.prototype = new Proxy(constructor.prototype, {
+ get: function (target, name) {
+ if (name == 'prototype' || name == 'observedAttributes')
+ throw 'Unexpected access to observedAttributes';
+ prototypeCalls.push(callOrder++);
+ prototypeCalls.push(name);
+ return target[name];
+ }
+ });
+ var constructorCalls = [];
+ var proxy = new Proxy(constructor, {
+ get: function (target, name) {
+ constructorCalls.push(callOrder++);
+ constructorCalls.push(name);
+ return target[name];
+ }
+ });
+ customElements.define('element-with-attribute-changed-callback', proxy);
+ assert_array_equals(prototypeCalls, [1, 'connectedCallback', 2, 'disconnectedCallback', 3, 'adoptedCallback', 4, 'attributeChangedCallback']);
+ assert_array_equals(constructorCalls, [0, 'prototype', 5, 'observedAttributes']);
+}, 'customElements.define must get "observedAttributes" property on the constructor prototype when "attributeChangedCallback" is present');
+
+test(function () {
+ var constructor = function () {}
+ constructor.prototype.attributeChangedCallback = function () { };
+ var calls = [];
+ var proxy = new Proxy(constructor, {
+ get: function (target, name) {
+ calls.push(name);
+ if (name == 'observedAttributes')
+ throw {name: 'expectedError'};
+ return target[name];
+ }
+ });
+ assert_throws({'name': 'expectedError'}, function () { customElements.define('element-with-throwing-observed-attributes', proxy); });
+ assert_array_equals(calls, ['prototype', 'observedAttributes'],
+ 'customElements.define must get "prototype" and "observedAttributes" on the constructor');
+}, 'customElements.define must rethrow an exception thrown while getting observedAttributes on the constructor prototype');
+
+test(function () {
+ var constructor = function () {}
+ constructor.prototype.attributeChangedCallback = function () { };
+ var calls = [];
+ var proxy = new Proxy(constructor, {
+ get: function (target, name) {
+ calls.push(name);
+ if (name == 'observedAttributes')
+ return 1;
+ return target[name];
+ }
+ });
+ assert_throws({'name': 'TypeError'}, function () { customElements.define('element-with-invalid-observed-attributes', proxy); });
+ assert_array_equals(calls, ['prototype', 'observedAttributes'],
+ 'customElements.define must get "prototype" and "observedAttributes" on the constructor');
+}, 'customElements.define must rethrow an exception thrown while converting the value of observedAttributes to sequence<DOMString>');
+
+test(function () {
+ var constructor = function () {}
+ constructor.prototype.attributeChangedCallback = function () { };
+ constructor.observedAttributes = {[Symbol.iterator]: function *() {
+ yield 'foo';
+ throw {name: 'SomeError'};
+ }};
+ assert_throws({'name': 'SomeError'}, function () { customElements.define('element-with-generator-observed-attributes', constructor); });
+}, 'customElements.define must rethrow an exception thrown while iterating over observedAttributes to sequence<DOMString>');
+
+test(function () {
+ var constructor = function () {}
+ constructor.prototype.attributeChangedCallback = function () { };
+ constructor.observedAttributes = {[Symbol.iterator]: 1};
+ assert_throws({'name': 'TypeError'}, function () { customElements.define('element-with-observed-attributes-with-uncallable-iterator', constructor); });
+}, 'customElements.define must rethrow an exception thrown while retrieving Symbol.iterator on observedAttributes');
+
+test(function () {
+ var constructor = function () {}
+ constructor.observedAttributes = 1;
+ customElements.define('element-without-callback-with-invalid-observed-attributes', constructor);
+}, 'customElements.define must not throw even if "observedAttributes" fails to convert if "attributeChangedCallback" is not defined');
+
+test(function () {
+ class MyCustomElement extends HTMLElement {};
+ customElements.define('my-custom-element', MyCustomElement);
+
+ var instance = new MyCustomElement;
+ assert_true(instance instanceof MyCustomElement,
+ 'An instance of a custom HTML element be an instance of the associated interface');
+
+ assert_true(instance instanceof HTMLElement,
+ 'An instance of a custom HTML element must inherit from HTMLElement');
+
+ assert_equals(instance.localName, 'my-custom-element',
+ 'An instance of a custom element must use the associated tag name');
+
+ assert_equals(instance.namespaceURI, 'http://www.w3.org/1999/xhtml',
+ 'A custom element HTML must use HTML namespace');
+
+}, 'customElements.define must define an instantiatable custom element');
+
+</script>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestsfastcustomelementsCustomElementsRegistryexpectedtxt"></a>
<div class="delfile"><h4>Deleted: trunk/LayoutTests/fast/custom-elements/CustomElementsRegistry-expected.txt (204731 => 204732)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/custom-elements/CustomElementsRegistry-expected.txt        2016-08-22 19:12:09 UTC (rev 204731)
+++ trunk/LayoutTests/fast/custom-elements/CustomElementsRegistry-expected.txt        2016-08-22 19:45:01 UTC (rev 204732)
</span><span class="lines">@@ -1,20 +0,0 @@
</span><del>-
-PASS CustomElementsRegistry interface must have define as a method
-PASS customElements.define must throw with an invalid name
-PASS customElements.define must throw when there is already a custom element of the same name
-PASS customElements.define must throw when there is already a custom element with the same class
-PASS customElements.define must throw when the element interface is not a constructor
-PASS customElements.define must get "prototype" property of the constructor
-PASS customElements.define must rethrow an exception thrown while getting "prototype" property of the constructor
-PASS customElements.define must throw when "prototype" property of the constructor is not an object
-PASS customElements.define must get callbacks of the constructor prototype
-PASS customElements.define must rethrow an exception thrown while getting callbacks on the constructor prototype
-PASS customElements.define must rethrow an exception thrown while converting a callback value to Function callback type
-PASS customElements.define must get "observedAttributes" property on the constructor prototype when "attributeChangedCallback" is present
-PASS customElements.define must rethrow an exception thrown while getting observedAttributes on the constructor prototype
-PASS customElements.define must rethrow an exception thrown while converting the value of observedAttributes to sequence<DOMString>
-PASS customElements.define must rethrow an exception thrown while iterating over observedAttributes to sequence<DOMString>
-PASS customElements.define must rethrow an exception thrown while retrieving Symbol.iterator on observedAttributes
-PASS customElements.define must not throw even if "observedAttributes" fails to convert if "attributeChangedCallback" is not defined
-PASS customElements.define must define an instantiatable custom element
-
</del></span></pre></div>
<a id="trunkLayoutTestsfastcustomelementsCustomElementsRegistryhtml"></a>
<div class="delfile"><h4>Deleted: trunk/LayoutTests/fast/custom-elements/CustomElementsRegistry.html (204731 => 204732)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/custom-elements/CustomElementsRegistry.html        2016-08-22 19:12:09 UTC (rev 204731)
+++ trunk/LayoutTests/fast/custom-elements/CustomElementsRegistry.html        2016-08-22 19:45:01 UTC (rev 204732)
</span><span class="lines">@@ -1,272 +0,0 @@
</span><del>-<!DOCTYPE html>
-<html>
-<head>
-<title>Custom Elements: CustomElementsRegistry interface</title>
-<meta name="author" title="Ryosuke Niwa" href="mailto:rniwa@webkit.org">
-<meta name="assert" content="CustomElementsRegistry interface must exist">
-<script src="../../resources/testharness.js"></script>
-<script src="../../resources/testharnessreport.js"></script>
-<link rel='stylesheet' href='../../resources/testharness.css'>
-</head>
-<body>
-<div id="log"></div>
-<script>
-
-test(function () {
- assert_true('define' in CustomElementsRegistry.prototype, '"define" exists on CustomElementsRegistry.prototype');
- assert_true('define' in customElements, '"define" exists on window.customElements');
-}, 'CustomElementsRegistry interface must have define as a method');
-
-test(function () {
- class MyCustomElement extends HTMLElement {};
-
- assert_throws({'name': 'SyntaxError'}, function () { customElements.define(null, MyCustomElement); },
- 'customElements.define must throw a SyntaxError if the tag name is null');
- assert_throws({'name': 'SyntaxError'}, function () { customElements.define('', MyCustomElement); },
- 'customElements.define must throw a SyntaxError if the tag name is empty');
- assert_throws({'name': 'SyntaxError'}, function () { customElements.define('abc', MyCustomElement); },
- 'customElements.define must throw a SyntaxError if the tag name does not contain "-"');
- assert_throws({'name': 'SyntaxError'}, function () { customElements.define('a-Bc', MyCustomElement); },
- 'customElements.define must throw a SyntaxError if the tag name contains an upper case letter');
-
- var builtinTagNames = [
- 'annotation-xml',
- 'color-profile',
- 'font-face',
- 'font-face-src',
- 'font-face-uri',
- 'font-face-format',
- 'font-face-name',
- 'missing-glyph'
- ];
-
- for (var tagName of builtinTagNames) {
- assert_throws({'name': 'SyntaxError'}, function () { customElements.define(tagName, MyCustomElement); },
- 'customElements.define must throw a SyntaxError if the tag name is "' + tagName + '"');
- }
-
-}, 'customElements.define must throw with an invalid name');
-
-test(function () {
- class SomeCustomElement extends HTMLElement {};
- class OtherCustomElement extends HTMLElement {};
-
- customElements.define('some-custom-element', SomeCustomElement);
- assert_throws({'name': 'NotSupportedError'}, function () { customElements.define('some-custom-element', OtherCustomElement); },
- 'customElements.define must throw a NotSupportedError if the specified tag name is already used');
-
-}, 'customElements.define must throw when there is already a custom element of the same name');
-
-test(function () {
- class AnotherCustomElement extends HTMLElement {};
-
- customElements.define('another-custom-element', AnotherCustomElement);
- assert_throws({'name': 'NotSupportedError'}, function () { customElements.define('some-other-element', AnotherCustomElement); },
- 'customElements.define must throw a NotSupportedError if the specified class already defines an element');
-
-}, 'customElements.define must throw when there is already a custom element with the same class');
-
-test(function () {
- assert_throws({'name': 'TypeError'}, function () { customElements.define('invalid-element', 1); },
- 'customElements.define must throw a TypeError when the element interface is a number');
- assert_throws({'name': 'TypeError'}, function () { customElements.define('invalid-element', '123'); },
- 'customElements.define must throw a TypeError when the element interface is a string');
- assert_throws({'name': 'TypeError'}, function () { customElements.define('invalid-element', {}); },
- 'customElements.define must throw a TypeError when the element interface is an object');
- assert_throws({'name': 'TypeError'}, function () { customElements.define('invalid-element', []); },
- 'customElements.define must throw a TypeError when the element interface is an array');
-}, 'customElements.define must throw when the element interface is not a constructor');
-
-test(function () {
- var calls = [];
- var proxy = new Proxy(class extends HTMLElement { }, {
- get: function (target, name) {
- calls.push(name);
- return target[name];
- }
- });
- customElements.define('proxy-element', proxy);
- assert_array_equals(calls, ['prototype']);
-}, 'customElements.define must get "prototype" property of the constructor');
-
-test(function () {
- var proxy = new Proxy(class extends HTMLElement { }, {
- get: function (target, name) {
- throw {name: 'expectedError'};
- }
- });
- assert_throws({'name': 'expectedError'}, function () { customElements.define('element-with-string-prototype', proxy); });
-}, 'customElements.define must rethrow an exception thrown while getting "prototype" property of the constructor');
-
-test(function () {
- var returnedValue;
- var proxy = new Proxy(class extends HTMLElement { }, {
- get: function (target, name) { return returnedValue; }
- });
-
- returnedValue = null;
- assert_throws({'name': 'TypeError'}, function () { customElements.define('element-with-string-prototype', proxy); },
- 'customElements.define must throw when "prototype" property of the constructor is null');
- returnedValue = undefined;
- assert_throws({'name': 'TypeError'}, function () { customElements.define('element-with-string-prototype', proxy); },
- 'customElements.define must throw when "prototype" property of the constructor is undefined');
- returnedValue = 'hello';
- assert_throws({'name': 'TypeError'}, function () { customElements.define('element-with-string-prototype', proxy); },
- 'customElements.define must throw when "prototype" property of the constructor is a string');
- returnedValue = 1;
- assert_throws({'name': 'TypeError'}, function () { customElements.define('element-with-string-prototype', proxy); },
- 'customElements.define must throw when "prototype" property of the constructor is a number');
-
-}, 'customElements.define must throw when "prototype" property of the constructor is not an object');
-
-test(function () {
- var constructor = function () {}
- var calls = [];
- constructor.prototype = new Proxy(constructor.prototype, {
- get: function (target, name) {
- calls.push(name);
- return target[name];
- }
- });
- customElements.define('element-with-proxy-prototype', constructor);
- assert_array_equals(calls, ['connectedCallback', 'disconnectedCallback', 'adoptedCallback', 'attributeChangedCallback']);
-}, 'customElements.define must get callbacks of the constructor prototype');
-
-test(function () {
- var constructor = function () {}
- var calls = [];
- constructor.prototype = new Proxy(constructor.prototype, {
- get: function (target, name) {
- calls.push(name);
- if (name == 'disconnectedCallback')
- throw {name: 'expectedError'};
- return target[name];
- }
- });
- assert_throws({'name': 'expectedError'}, function () { customElements.define('element-with-throwing-callback', constructor); });
- assert_array_equals(calls, ['connectedCallback', 'disconnectedCallback'],
- 'customElements.define must not get callbacks after one of the get throws');
-}, 'customElements.define must rethrow an exception thrown while getting callbacks on the constructor prototype');
-
-test(function () {
- var constructor = function () {}
- var calls = [];
- constructor.prototype = new Proxy(constructor.prototype, {
- get: function (target, name) {
- calls.push(name);
- if (name == 'adoptedCallback')
- return 1;
- return target[name];
- }
- });
- assert_throws({'name': 'TypeError'}, function () { customElements.define('element-with-throwing-callback', constructor); });
- assert_array_equals(calls, ['connectedCallback', 'disconnectedCallback', 'adoptedCallback'],
- 'customElements.define must not get callbacks after one of the conversion throws');
-}, 'customElements.define must rethrow an exception thrown while converting a callback value to Function callback type');
-
-test(function () {
- var constructor = function () {}
- constructor.prototype.attributeChangedCallback = function () { };
- var prototypeCalls = [];
- var callOrder = 0;
- constructor.prototype = new Proxy(constructor.prototype, {
- get: function (target, name) {
- if (name == 'prototype' || name == 'observedAttributes')
- throw 'Unexpected access to observedAttributes';
- prototypeCalls.push(callOrder++);
- prototypeCalls.push(name);
- return target[name];
- }
- });
- var constructorCalls = [];
- var proxy = new Proxy(constructor, {
- get: function (target, name) {
- constructorCalls.push(callOrder++);
- constructorCalls.push(name);
- return target[name];
- }
- });
- customElements.define('element-with-attribute-changed-callback', proxy);
- assert_array_equals(prototypeCalls, [1, 'connectedCallback', 2, 'disconnectedCallback', 3, 'adoptedCallback', 4, 'attributeChangedCallback']);
- assert_array_equals(constructorCalls, [0, 'prototype', 5, 'observedAttributes']);
-}, 'customElements.define must get "observedAttributes" property on the constructor prototype when "attributeChangedCallback" is present');
-
-test(function () {
- var constructor = function () {}
- constructor.prototype.attributeChangedCallback = function () { };
- var calls = [];
- var proxy = new Proxy(constructor, {
- get: function (target, name) {
- calls.push(name);
- if (name == 'observedAttributes')
- throw {name: 'expectedError'};
- return target[name];
- }
- });
- assert_throws({'name': 'expectedError'}, function () { customElements.define('element-with-throwing-observed-attributes', proxy); });
- assert_array_equals(calls, ['prototype', 'observedAttributes'],
- 'customElements.define must get "prototype" and "observedAttributes" on the constructor');
-}, 'customElements.define must rethrow an exception thrown while getting observedAttributes on the constructor prototype');
-
-test(function () {
- var constructor = function () {}
- constructor.prototype.attributeChangedCallback = function () { };
- var calls = [];
- var proxy = new Proxy(constructor, {
- get: function (target, name) {
- calls.push(name);
- if (name == 'observedAttributes')
- return 1;
- return target[name];
- }
- });
- assert_throws({'name': 'TypeError'}, function () { customElements.define('element-with-invalid-observed-attributes', proxy); });
- assert_array_equals(calls, ['prototype', 'observedAttributes'],
- 'customElements.define must get "prototype" and "observedAttributes" on the constructor');
-}, 'customElements.define must rethrow an exception thrown while converting the value of observedAttributes to sequence<DOMString>');
-
-test(function () {
- var constructor = function () {}
- constructor.prototype.attributeChangedCallback = function () { };
- constructor.observedAttributes = {[Symbol.iterator]: function *() {
- yield 'foo';
- throw {name: 'SomeError'};
- }};
- assert_throws({'name': 'SomeError'}, function () { customElements.define('element-with-generator-observed-attributes', constructor); });
-}, 'customElements.define must rethrow an exception thrown while iterating over observedAttributes to sequence<DOMString>');
-
-test(function () {
- var constructor = function () {}
- constructor.prototype.attributeChangedCallback = function () { };
- constructor.observedAttributes = {[Symbol.iterator]: 1};
- assert_throws({'name': 'TypeError'}, function () { customElements.define('element-with-observed-attributes-with-uncallable-iterator', constructor); });
-}, 'customElements.define must rethrow an exception thrown while retrieving Symbol.iterator on observedAttributes');
-
-test(function () {
- var constructor = function () {}
- constructor.observedAttributes = 1;
- customElements.define('element-without-callback-with-invalid-observed-attributes', constructor);
-}, 'customElements.define must not throw even if "observedAttributes" fails to convert if "attributeChangedCallback" is not defined');
-
-test(function () {
- class MyCustomElement extends HTMLElement {};
- customElements.define('my-custom-element', MyCustomElement);
-
- var instance = new MyCustomElement;
- assert_true(instance instanceof MyCustomElement,
- 'An instance of a custom HTML element be an instance of the associated interface');
-
- assert_true(instance instanceof HTMLElement,
- 'An instance of a custom HTML element must inherit from HTMLElement');
-
- assert_equals(instance.localName, 'my-custom-element',
- 'An instance of a custom element must use the associated tag name');
-
- assert_equals(instance.namespaceURI, 'http://www.w3.org/1999/xhtml',
- 'A custom element HTML must use HTML namespace');
-
-}, 'customElements.define must define an instantiatable custom element');
-
-</script>
-</body>
-</html>
</del></span></pre></div>
<a id="trunkLayoutTestsplatformefljsdomglobalconstructorsattributesexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/efl/js/dom/global-constructors-attributes-expected.txt (204731 => 204732)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/efl/js/dom/global-constructors-attributes-expected.txt        2016-08-22 19:12:09 UTC (rev 204731)
+++ trunk/LayoutTests/platform/efl/js/dom/global-constructors-attributes-expected.txt        2016-08-22 19:45:01 UTC (rev 204732)
</span><span class="lines">@@ -263,11 +263,11 @@
</span><span class="cx"> PASS Object.getOwnPropertyDescriptor(global, 'Crypto').hasOwnProperty('set') is false
</span><span class="cx"> PASS Object.getOwnPropertyDescriptor(global, 'Crypto').enumerable is false
</span><span class="cx"> PASS Object.getOwnPropertyDescriptor(global, 'Crypto').configurable is true
</span><del>-PASS Object.getOwnPropertyDescriptor(global, 'CustomElementsRegistry').value is CustomElementsRegistry
-PASS Object.getOwnPropertyDescriptor(global, 'CustomElementsRegistry').hasOwnProperty('get') is false
-PASS Object.getOwnPropertyDescriptor(global, 'CustomElementsRegistry').hasOwnProperty('set') is false
-PASS Object.getOwnPropertyDescriptor(global, 'CustomElementsRegistry').enumerable is false
-PASS Object.getOwnPropertyDescriptor(global, 'CustomElementsRegistry').configurable is true
</del><ins>+PASS Object.getOwnPropertyDescriptor(global, 'CustomElementRegistry').value is CustomElementRegistry
+PASS Object.getOwnPropertyDescriptor(global, 'CustomElementRegistry').hasOwnProperty('get') is false
+PASS Object.getOwnPropertyDescriptor(global, 'CustomElementRegistry').hasOwnProperty('set') is false
+PASS Object.getOwnPropertyDescriptor(global, 'CustomElementRegistry').enumerable is false
+PASS Object.getOwnPropertyDescriptor(global, 'CustomElementRegistry').configurable is true
</ins><span class="cx"> PASS Object.getOwnPropertyDescriptor(global, 'CustomEvent').value is CustomEvent
</span><span class="cx"> PASS Object.getOwnPropertyDescriptor(global, 'CustomEvent').hasOwnProperty('get') is false
</span><span class="cx"> PASS Object.getOwnPropertyDescriptor(global, 'CustomEvent').hasOwnProperty('set') is false
</span></span></pre></div>
<a id="trunkLayoutTestsplatformgtkjsdomglobalconstructorsattributesexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/gtk/js/dom/global-constructors-attributes-expected.txt (204731 => 204732)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/gtk/js/dom/global-constructors-attributes-expected.txt        2016-08-22 19:12:09 UTC (rev 204731)
+++ trunk/LayoutTests/platform/gtk/js/dom/global-constructors-attributes-expected.txt        2016-08-22 19:45:01 UTC (rev 204732)
</span><span class="lines">@@ -298,11 +298,11 @@
</span><span class="cx"> PASS Object.getOwnPropertyDescriptor(global, 'Crypto').hasOwnProperty('set') is false
</span><span class="cx"> PASS Object.getOwnPropertyDescriptor(global, 'Crypto').enumerable is false
</span><span class="cx"> PASS Object.getOwnPropertyDescriptor(global, 'Crypto').configurable is true
</span><del>-PASS Object.getOwnPropertyDescriptor(global, 'CustomElementsRegistry').value is CustomElementsRegistry
-PASS Object.getOwnPropertyDescriptor(global, 'CustomElementsRegistry').hasOwnProperty('get') is false
-PASS Object.getOwnPropertyDescriptor(global, 'CustomElementsRegistry').hasOwnProperty('set') is false
-PASS Object.getOwnPropertyDescriptor(global, 'CustomElementsRegistry').enumerable is false
-PASS Object.getOwnPropertyDescriptor(global, 'CustomElementsRegistry').configurable is true
</del><ins>+PASS Object.getOwnPropertyDescriptor(global, 'CustomElementRegistry').value is CustomElementRegistry
+PASS Object.getOwnPropertyDescriptor(global, 'CustomElementRegistry').hasOwnProperty('get') is false
+PASS Object.getOwnPropertyDescriptor(global, 'CustomElementRegistry').hasOwnProperty('set') is false
+PASS Object.getOwnPropertyDescriptor(global, 'CustomElementRegistry').enumerable is false
+PASS Object.getOwnPropertyDescriptor(global, 'CustomElementRegistry').configurable is true
</ins><span class="cx"> PASS Object.getOwnPropertyDescriptor(global, 'CustomEvent').value is CustomEvent
</span><span class="cx"> PASS Object.getOwnPropertyDescriptor(global, 'CustomEvent').hasOwnProperty('get') is false
</span><span class="cx"> PASS Object.getOwnPropertyDescriptor(global, 'CustomEvent').hasOwnProperty('set') is false
</span></span></pre></div>
<a id="trunkLayoutTestsplatformmacjsdomglobalconstructorsattributesexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/mac/js/dom/global-constructors-attributes-expected.txt (204731 => 204732)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac/js/dom/global-constructors-attributes-expected.txt        2016-08-22 19:12:09 UTC (rev 204731)
+++ trunk/LayoutTests/platform/mac/js/dom/global-constructors-attributes-expected.txt        2016-08-22 19:45:01 UTC (rev 204732)
</span><span class="lines">@@ -298,11 +298,11 @@
</span><span class="cx"> PASS Object.getOwnPropertyDescriptor(global, 'Crypto').hasOwnProperty('set') is false
</span><span class="cx"> PASS Object.getOwnPropertyDescriptor(global, 'Crypto').enumerable is false
</span><span class="cx"> PASS Object.getOwnPropertyDescriptor(global, 'Crypto').configurable is true
</span><del>-PASS Object.getOwnPropertyDescriptor(global, 'CustomElementsRegistry').value is CustomElementsRegistry
-PASS Object.getOwnPropertyDescriptor(global, 'CustomElementsRegistry').hasOwnProperty('get') is false
-PASS Object.getOwnPropertyDescriptor(global, 'CustomElementsRegistry').hasOwnProperty('set') is false
-PASS Object.getOwnPropertyDescriptor(global, 'CustomElementsRegistry').enumerable is false
-PASS Object.getOwnPropertyDescriptor(global, 'CustomElementsRegistry').configurable is true
</del><ins>+PASS Object.getOwnPropertyDescriptor(global, 'CustomElementRegistry').value is CustomElementRegistry
+PASS Object.getOwnPropertyDescriptor(global, 'CustomElementRegistry').hasOwnProperty('get') is false
+PASS Object.getOwnPropertyDescriptor(global, 'CustomElementRegistry').hasOwnProperty('set') is false
+PASS Object.getOwnPropertyDescriptor(global, 'CustomElementRegistry').enumerable is false
+PASS Object.getOwnPropertyDescriptor(global, 'CustomElementRegistry').configurable is true
</ins><span class="cx"> PASS Object.getOwnPropertyDescriptor(global, 'CustomEvent').value is CustomEvent
</span><span class="cx"> PASS Object.getOwnPropertyDescriptor(global, 'CustomEvent').hasOwnProperty('get') is false
</span><span class="cx"> PASS Object.getOwnPropertyDescriptor(global, 'CustomEvent').hasOwnProperty('set') is false
</span></span></pre></div>
<a id="trunkLayoutTestsplatformmacwk1jsdomglobalconstructorsattributesexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/mac-wk1/js/dom/global-constructors-attributes-expected.txt (204731 => 204732)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac-wk1/js/dom/global-constructors-attributes-expected.txt        2016-08-22 19:12:09 UTC (rev 204731)
+++ trunk/LayoutTests/platform/mac-wk1/js/dom/global-constructors-attributes-expected.txt        2016-08-22 19:45:01 UTC (rev 204732)
</span><span class="lines">@@ -298,11 +298,11 @@
</span><span class="cx"> PASS Object.getOwnPropertyDescriptor(global, 'Crypto').hasOwnProperty('set') is false
</span><span class="cx"> PASS Object.getOwnPropertyDescriptor(global, 'Crypto').enumerable is false
</span><span class="cx"> PASS Object.getOwnPropertyDescriptor(global, 'Crypto').configurable is true
</span><del>-PASS Object.getOwnPropertyDescriptor(global, 'CustomElementsRegistry').value is CustomElementsRegistry
-PASS Object.getOwnPropertyDescriptor(global, 'CustomElementsRegistry').hasOwnProperty('get') is false
-PASS Object.getOwnPropertyDescriptor(global, 'CustomElementsRegistry').hasOwnProperty('set') is false
-PASS Object.getOwnPropertyDescriptor(global, 'CustomElementsRegistry').enumerable is false
-PASS Object.getOwnPropertyDescriptor(global, 'CustomElementsRegistry').configurable is true
</del><ins>+PASS Object.getOwnPropertyDescriptor(global, 'CustomElementRegistry').value is CustomElementRegistry
+PASS Object.getOwnPropertyDescriptor(global, 'CustomElementRegistry').hasOwnProperty('get') is false
+PASS Object.getOwnPropertyDescriptor(global, 'CustomElementRegistry').hasOwnProperty('set') is false
+PASS Object.getOwnPropertyDescriptor(global, 'CustomElementRegistry').enumerable is false
+PASS Object.getOwnPropertyDescriptor(global, 'CustomElementRegistry').configurable is true
</ins><span class="cx"> PASS Object.getOwnPropertyDescriptor(global, 'CustomEvent').value is CustomEvent
</span><span class="cx"> PASS Object.getOwnPropertyDescriptor(global, 'CustomEvent').hasOwnProperty('get') is false
</span><span class="cx"> PASS Object.getOwnPropertyDescriptor(global, 'CustomEvent').hasOwnProperty('set') is false
</span></span></pre></div>
<a id="trunkLayoutTestsplatformmacyosemitejsdomglobalconstructorsattributesexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/mac-yosemite/js/dom/global-constructors-attributes-expected.txt (204731 => 204732)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac-yosemite/js/dom/global-constructors-attributes-expected.txt        2016-08-22 19:12:09 UTC (rev 204731)
+++ trunk/LayoutTests/platform/mac-yosemite/js/dom/global-constructors-attributes-expected.txt        2016-08-22 19:45:01 UTC (rev 204732)
</span><span class="lines">@@ -298,11 +298,11 @@
</span><span class="cx"> PASS Object.getOwnPropertyDescriptor(global, 'Crypto').hasOwnProperty('set') is false
</span><span class="cx"> PASS Object.getOwnPropertyDescriptor(global, 'Crypto').enumerable is false
</span><span class="cx"> PASS Object.getOwnPropertyDescriptor(global, 'Crypto').configurable is true
</span><del>-PASS Object.getOwnPropertyDescriptor(global, 'CustomElementsRegistry').value is CustomElementsRegistry
-PASS Object.getOwnPropertyDescriptor(global, 'CustomElementsRegistry').hasOwnProperty('get') is false
-PASS Object.getOwnPropertyDescriptor(global, 'CustomElementsRegistry').hasOwnProperty('set') is false
-PASS Object.getOwnPropertyDescriptor(global, 'CustomElementsRegistry').enumerable is false
-PASS Object.getOwnPropertyDescriptor(global, 'CustomElementsRegistry').configurable is true
</del><ins>+PASS Object.getOwnPropertyDescriptor(global, 'CustomElementRegistry').value is CustomElementRegistry
+PASS Object.getOwnPropertyDescriptor(global, 'CustomElementRegistry').hasOwnProperty('get') is false
+PASS Object.getOwnPropertyDescriptor(global, 'CustomElementRegistry').hasOwnProperty('set') is false
+PASS Object.getOwnPropertyDescriptor(global, 'CustomElementRegistry').enumerable is false
+PASS Object.getOwnPropertyDescriptor(global, 'CustomElementRegistry').configurable is true
</ins><span class="cx"> PASS Object.getOwnPropertyDescriptor(global, 'CustomEvent').value is CustomEvent
</span><span class="cx"> PASS Object.getOwnPropertyDescriptor(global, 'CustomEvent').hasOwnProperty('get') is false
</span><span class="cx"> PASS Object.getOwnPropertyDescriptor(global, 'CustomEvent').hasOwnProperty('set') is false
</span></span></pre></div>
<a id="trunkLayoutTestsplatformwinjsdomglobalconstructorsattributesexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/win/js/dom/global-constructors-attributes-expected.txt (204731 => 204732)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/win/js/dom/global-constructors-attributes-expected.txt        2016-08-22 19:12:09 UTC (rev 204731)
+++ trunk/LayoutTests/platform/win/js/dom/global-constructors-attributes-expected.txt        2016-08-22 19:45:01 UTC (rev 204732)
</span><span class="lines">@@ -198,11 +198,11 @@
</span><span class="cx"> PASS Object.getOwnPropertyDescriptor(global, 'Crypto').hasOwnProperty('set') is false
</span><span class="cx"> PASS Object.getOwnPropertyDescriptor(global, 'Crypto').enumerable is false
</span><span class="cx"> PASS Object.getOwnPropertyDescriptor(global, 'Crypto').configurable is true
</span><del>-PASS Object.getOwnPropertyDescriptor(global, 'CustomElementsRegistry').value is CustomElementsRegistry
-PASS Object.getOwnPropertyDescriptor(global, 'CustomElementsRegistry').hasOwnProperty('get') is false
-PASS Object.getOwnPropertyDescriptor(global, 'CustomElementsRegistry').hasOwnProperty('set') is false
-PASS Object.getOwnPropertyDescriptor(global, 'CustomElementsRegistry').enumerable is false
-PASS Object.getOwnPropertyDescriptor(global, 'CustomElementsRegistry').configurable is true
</del><ins>+PASS Object.getOwnPropertyDescriptor(global, 'CustomElementRegistry').value is CustomElementRegistry
+PASS Object.getOwnPropertyDescriptor(global, 'CustomElementRegistry').hasOwnProperty('get') is false
+PASS Object.getOwnPropertyDescriptor(global, 'CustomElementRegistry').hasOwnProperty('set') is false
+PASS Object.getOwnPropertyDescriptor(global, 'CustomElementRegistry').enumerable is false
+PASS Object.getOwnPropertyDescriptor(global, 'CustomElementRegistry').configurable is true
</ins><span class="cx"> PASS Object.getOwnPropertyDescriptor(global, 'CustomEvent').value is CustomEvent
</span><span class="cx"> PASS Object.getOwnPropertyDescriptor(global, 'CustomEvent').hasOwnProperty('get') is false
</span><span class="cx"> PASS Object.getOwnPropertyDescriptor(global, 'CustomEvent').hasOwnProperty('set') is false
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ChangeLog (204731 => 204732)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ChangeLog        2016-08-22 19:12:09 UTC (rev 204731)
+++ trunk/Source/JavaScriptCore/ChangeLog        2016-08-22 19:45:01 UTC (rev 204732)
</span><span class="lines">@@ -1,3 +1,15 @@
</span><ins>+2016-08-22 Ryosuke Niwa <rniwa@webkit.org>
+
+ Rename CustomElementsRegistry to CustomElementRegistry
+ https://bugs.webkit.org/show_bug.cgi?id=161028
+
+ Reviewed by Darin Adler.
+
+ Added customElements and CustomElementRegistry to the common identifiers list as they're used on JSDOMWindow
+ to hide window.customElements and CustomElementRegistry interface behind a runtime flag.
+
+ * runtime/CommonIdentifiers.h:
+
</ins><span class="cx"> 2016-08-22 Mark Lam <mark.lam@apple.com>
</span><span class="cx">
</span><span class="cx"> Remove dead code.
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeCommonIdentifiersh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/CommonIdentifiers.h (204731 => 204732)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/CommonIdentifiers.h        2016-08-22 19:12:09 UTC (rev 204731)
+++ trunk/Source/JavaScriptCore/runtime/CommonIdentifiers.h        2016-08-22 19:45:01 UTC (rev 204732)
</span><span class="lines">@@ -37,6 +37,7 @@
</span><span class="cx"> macro(BYTES_PER_ELEMENT) \
</span><span class="cx"> macro(Boolean) \
</span><span class="cx"> macro(Collator) \
</span><ins>+ macro(CustomElementRegistry) \
</ins><span class="cx"> macro(Date) \
</span><span class="cx"> macro(DateTimeFormat) \
</span><span class="cx"> macro(DocumentTimeline) \
</span><span class="lines">@@ -135,6 +136,7 @@
</span><span class="cx"> macro(constructor) \
</span><span class="cx"> macro(count) \
</span><span class="cx"> macro(counters) \
</span><ins>+ macro(customElements) \
</ins><span class="cx"> macro(day) \
</span><span class="cx"> macro(defineProperty) \
</span><span class="cx"> macro(description) \
</span></span></pre></div>
<a id="trunkSourceWebCoreCMakeListstxt"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/CMakeLists.txt (204731 => 204732)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/CMakeLists.txt        2016-08-22 19:12:09 UTC (rev 204731)
+++ trunk/Source/WebCore/CMakeLists.txt        2016-08-22 19:45:01 UTC (rev 204732)
</span><span class="lines">@@ -375,7 +375,7 @@
</span><span class="cx"> dom/ClientRectList.idl
</span><span class="cx"> dom/Comment.idl
</span><span class="cx"> dom/CompositionEvent.idl
</span><del>- dom/CustomElementsRegistry.idl
</del><ins>+ dom/CustomElementRegistry.idl
</ins><span class="cx"> dom/CustomEvent.idl
</span><span class="cx"> dom/DOMCoreException.idl
</span><span class="cx"> dom/DOMError.idl
</span><span class="lines">@@ -1136,7 +1136,7 @@
</span><span class="cx"> bindings/js/JSCryptoKeySerializationJWK.cpp
</span><span class="cx"> bindings/js/JSCryptoOperationData.cpp
</span><span class="cx"> bindings/js/JSCustomElementInterface.cpp
</span><del>- bindings/js/JSCustomElementsRegistryCustom.cpp
</del><ins>+ bindings/js/JSCustomElementRegistryCustom.cpp
</ins><span class="cx"> bindings/js/JSCustomEventCustom.cpp
</span><span class="cx"> bindings/js/JSCustomSQLStatementErrorCallback.cpp
</span><span class="cx"> bindings/js/JSCustomXPathNSResolver.cpp
</span><span class="lines">@@ -1438,7 +1438,7 @@
</span><span class="cx"> dom/ContainerNodeAlgorithms.cpp
</span><span class="cx"> dom/ContextDestructionObserver.cpp
</span><span class="cx"> dom/CustomElementReactionQueue.cpp
</span><del>- dom/CustomElementsRegistry.cpp
</del><ins>+ dom/CustomElementRegistry.cpp
</ins><span class="cx"> dom/CustomEvent.cpp
</span><span class="cx"> dom/DOMCoreException.cpp
</span><span class="cx"> dom/DOMError.cpp
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (204731 => 204732)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-08-22 19:12:09 UTC (rev 204731)
+++ trunk/Source/WebCore/ChangeLog        2016-08-22 19:45:01 UTC (rev 204732)
</span><span class="lines">@@ -1,3 +1,47 @@
</span><ins>+2016-08-22 Ryosuke Niwa <rniwa@webkit.org>
+
+ Rename CustomElementsRegistry to CustomElementRegistry
+ https://bugs.webkit.org/show_bug.cgi?id=161028
+
+ Reviewed by Darin Adler.
+
+ Renamed CustomElementsRegistry to CustomElementRegistry per https://github.com/w3c/webcomponents/issues/548.
+
+ Also hide window.customElements and CustomElementRegistry interface behind a runtime enabled.
+
+ * CMakeLists.txt:
+ * DerivedSources.cpp:
+ * DerivedSources.make:
+ * WebCore.xcodeproj/project.pbxproj:
+ * bindings/js/JSCustomElementRegistryCustom.cpp: Renamed from JSCustomElementsRegistryCustom.cpp.
+ (WebCore::getCustomElementCallback):
+ (WebCore::JSCustomElementRegistry::define):
+ * bindings/js/JSHTMLElementCustom.cpp:
+ (WebCore::constructJSHTMLElement):
+ * dom/CustomElementReactionQueue.cpp:
+ (WebCore::findInterfaceForCustomElement):
+ * dom/CustomElementRegistry.cpp: Renamed from CustomElementsRegistry.cpp.
+ (WebCore::CustomElementRegistry::create):
+ (WebCore::CustomElementRegistry::CustomElementRegistry):
+ (WebCore::CustomElementRegistry::~CustomElementRegistry):
+ (WebCore::CustomElementRegistry::addElementDefinition):
+ (WebCore::CustomElementRegistry::addUpgradeCandidate):
+ (WebCore::CustomElementRegistry::findInterface):
+ (WebCore::CustomElementRegistry::containsConstructor):
+ * dom/CustomElementRegistry.h: Renamed from CustomElementsRegistry.h.
+ * dom/CustomElementRegistry.idl: Renamed from CustomElementsRegistry.idl.
+ * dom/Document.cpp:
+ (WebCore::createUpgradeCandidateElement):
+ (WebCore::createHTMLElementWithNameValidation):
+ (WebCore::createFallbackHTMLElement):
+ * dom/Element.cpp:
+ * html/parser/HTMLConstructionSite.cpp:
+ (WebCore::HTMLConstructionSite::createHTMLElementOrFindCustomElementInterface):
+ * page/DOMWindow.cpp:
+ (WebCore::DOMWindow::ensureCustomElementRegistry):
+ * page/DOMWindow.h:
+ * page/DOMWindow.idl:
+
</ins><span class="cx"> 2016-08-22 Chris Dumez <cdumez@apple.com>
</span><span class="cx">
</span><span class="cx"> Add support for GlobalEventHandlers.oncuechange attribute
</span></span></pre></div>
<a id="trunkSourceWebCoreDerivedSourcescpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/DerivedSources.cpp (204731 => 204732)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/DerivedSources.cpp        2016-08-22 19:12:09 UTC (rev 204731)
+++ trunk/Source/WebCore/DerivedSources.cpp        2016-08-22 19:45:01 UTC (rev 204732)
</span><span class="lines">@@ -138,7 +138,7 @@
</span><span class="cx"> #include "JSCSSValue.cpp"
</span><span class="cx"> #include "JSCSSValueList.cpp"
</span><span class="cx"> #if ENABLE(CUSTOM_ELEMENTS)
</span><del>-#include "JSCustomElementsRegistry.cpp"
</del><ins>+#include "JSCustomElementRegistry.cpp"
</ins><span class="cx"> #endif
</span><span class="cx"> #include "JSCustomEvent.cpp"
</span><span class="cx"> #include "JSDatabase.cpp"
</span></span></pre></div>
<a id="trunkSourceWebCoreDerivedSourcesmake"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/DerivedSources.make (204731 => 204732)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/DerivedSources.make        2016-08-22 19:12:09 UTC (rev 204731)
+++ trunk/Source/WebCore/DerivedSources.make        2016-08-22 19:45:01 UTC (rev 204732)
</span><span class="lines">@@ -286,7 +286,7 @@
</span><span class="cx"> $(WebCore)/dom/ClientRectList.idl \
</span><span class="cx"> $(WebCore)/dom/Comment.idl \
</span><span class="cx"> $(WebCore)/dom/CompositionEvent.idl \
</span><del>- $(WebCore)/dom/CustomElementsRegistry.idl \
</del><ins>+ $(WebCore)/dom/CustomElementRegistry.idl \
</ins><span class="cx"> $(WebCore)/dom/CustomEvent.idl \
</span><span class="cx"> $(WebCore)/dom/DOMCoreException.idl \
</span><span class="cx"> $(WebCore)/dom/DOMError.idl \
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (204731 => 204732)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2016-08-22 19:12:09 UTC (rev 204731)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2016-08-22 19:45:01 UTC (rev 204732)
</span><span class="lines">@@ -3587,7 +3587,7 @@
</span><span class="cx">                 9BAB6C6D12550631001626D4 /* EditingStyle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9BAB6C6B12550631001626D4 /* EditingStyle.cpp */; };
</span><span class="cx">                 9BAF3B2412C1A39800014BF1 /* WritingDirection.h in Headers */ = {isa = PBXBuildFile; fileRef = 9BAF3B2312C1A39800014BF1 /* WritingDirection.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 9BB737651B41C03500AE13EB /* NSAttributedStringSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 9BB737641B41C03500AE13EB /* NSAttributedStringSPI.h */; };
</span><del>-                9BC5F9E01D5AAF6B002B749D /* JSCustomElementsRegistryCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9BC5F9DF1D5AAF6A002B749D /* JSCustomElementsRegistryCustom.cpp */; };
</del><ins>+                9BC5F9E01D5AAF6B002B749D /* JSCustomElementRegistryCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9BC5F9DF1D5AAF6A002B749D /* JSCustomElementRegistryCustom.cpp */; };
</ins><span class="cx">                 9BC6C21B13CCC97B008E0337 /* HTMLTextFormControlElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 9BC6C21913CCC97B008E0337 /* HTMLTextFormControlElement.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 9BC6C21C13CCC97B008E0337 /* HTMLTextFormControlElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9BC6C21A13CCC97B008E0337 /* HTMLTextFormControlElement.cpp */; };
</span><span class="cx">                 9BD0BF9312A42BF50072FD43 /* ScopedEventQueue.h in Headers */ = {isa = PBXBuildFile; fileRef = 9BD0BF9112A42BF50072FD43 /* ScopedEventQueue.h */; };
</span><span class="lines">@@ -3594,13 +3594,13 @@
</span><span class="cx">                 9BD0BF9412A42BF50072FD43 /* ScopedEventQueue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9BD0BF9212A42BF50072FD43 /* ScopedEventQueue.cpp */; };
</span><span class="cx">                 9BD4E9161C462872005065BC /* JSCustomElementInterface.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9BD4E9141C462872005065BC /* JSCustomElementInterface.cpp */; };
</span><span class="cx">                 9BD4E9171C462872005065BC /* JSCustomElementInterface.h in Headers */ = {isa = PBXBuildFile; fileRef = 9BD4E9151C462872005065BC /* JSCustomElementInterface.h */; };
</span><del>-                9BD4E91A1C462CFC005065BC /* CustomElementsRegistry.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9BD4E9181C462CFC005065BC /* CustomElementsRegistry.cpp */; };
-                9BD4E91B1C462CFC005065BC /* CustomElementsRegistry.h in Headers */ = {isa = PBXBuildFile; fileRef = 9BD4E9191C462CFC005065BC /* CustomElementsRegistry.h */; };
</del><ins>+                9BD4E91A1C462CFC005065BC /* CustomElementRegistry.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9BD4E9181C462CFC005065BC /* CustomElementRegistry.cpp */; };
+                9BD4E91B1C462CFC005065BC /* CustomElementRegistry.h in Headers */ = {isa = PBXBuildFile; fileRef = 9BD4E9191C462CFC005065BC /* CustomElementRegistry.h */; };
</ins><span class="cx">                 9BD8A95A18BEFC7600987E9A /* CollectionIndexCache.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9BD8A95918BEFC7600987E9A /* CollectionIndexCache.cpp */; };
</span><span class="cx">                 9BDA64D71B975CE5009C4387 /* JSShadowRoot.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9B6BC9601B975966005AE1F0 /* JSShadowRoot.cpp */; };
</span><span class="cx">                 9BDA64D81B975CF2009C4387 /* JSShadowRoot.h in Headers */ = {isa = PBXBuildFile; fileRef = 9B6BC9611B975966005AE1F0 /* JSShadowRoot.h */; };
</span><del>-                9BE6710B1D5AEB2100345514 /* JSCustomElementsRegistry.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9BE671091D5AEB0400345514 /* JSCustomElementsRegistry.cpp */; };
-                9BE6710C1D5AEB2500345514 /* JSCustomElementsRegistry.h in Headers */ = {isa = PBXBuildFile; fileRef = 9BE6710A1D5AEB0400345514 /* JSCustomElementsRegistry.h */; };
</del><ins>+                9BE6710B1D5AEB2100345514 /* JSCustomElementRegistry.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9BE671091D5AEB0400345514 /* JSCustomElementRegistry.cpp */; };
+                9BE6710C1D5AEB2500345514 /* JSCustomElementRegistry.h in Headers */ = {isa = PBXBuildFile; fileRef = 9BE6710A1D5AEB0400345514 /* JSCustomElementRegistry.h */; };
</ins><span class="cx">                 9BF9A8801648DD2F001C6B23 /* JSHTMLFormControlsCollection.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9BF9A87E1648DD2F001C6B23 /* JSHTMLFormControlsCollection.cpp */; };
</span><span class="cx">                 9BF9A8811648DD2F001C6B23 /* JSHTMLFormControlsCollection.h in Headers */ = {isa = PBXBuildFile; fileRef = 9BF9A87F1648DD2F001C6B23 /* JSHTMLFormControlsCollection.h */; };
</span><span class="cx">                 9D6380101AF173220031A15C /* StyleSelfAlignmentData.h in Headers */ = {isa = PBXBuildFile; fileRef = 9D63800F1AF16E160031A15C /* StyleSelfAlignmentData.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="lines">@@ -10762,8 +10762,8 @@
</span><span class="cx">                 9BAB6C6B12550631001626D4 /* EditingStyle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = EditingStyle.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 9BAF3B2312C1A39800014BF1 /* WritingDirection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WritingDirection.h; sourceTree = "<group>"; };
</span><span class="cx">                 9BB737641B41C03500AE13EB /* NSAttributedStringSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NSAttributedStringSPI.h; sourceTree = "<group>"; };
</span><del>-                9BC5F9DE1D5AAD5D002B749D /* CustomElementsRegistry.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = CustomElementsRegistry.idl; sourceTree = "<group>"; };
-                9BC5F9DF1D5AAF6A002B749D /* JSCustomElementsRegistryCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSCustomElementsRegistryCustom.cpp; sourceTree = "<group>"; };
</del><ins>+                9BC5F9DE1D5AAD5D002B749D /* CustomElementRegistry.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = CustomElementRegistry.idl; sourceTree = "<group>"; };
+                9BC5F9DF1D5AAF6A002B749D /* JSCustomElementRegistryCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSCustomElementRegistryCustom.cpp; sourceTree = "<group>"; };
</ins><span class="cx">                 9BC6C21913CCC97B008E0337 /* HTMLTextFormControlElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HTMLTextFormControlElement.h; sourceTree = "<group>"; };
</span><span class="cx">                 9BC6C21A13CCC97B008E0337 /* HTMLTextFormControlElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLTextFormControlElement.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 9BD0BF9112A42BF50072FD43 /* ScopedEventQueue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScopedEventQueue.h; sourceTree = "<group>"; };
</span><span class="lines">@@ -10770,11 +10770,11 @@
</span><span class="cx">                 9BD0BF9212A42BF50072FD43 /* ScopedEventQueue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScopedEventQueue.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 9BD4E9141C462872005065BC /* JSCustomElementInterface.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSCustomElementInterface.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 9BD4E9151C462872005065BC /* JSCustomElementInterface.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCustomElementInterface.h; sourceTree = "<group>"; };
</span><del>-                9BD4E9181C462CFC005065BC /* CustomElementsRegistry.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CustomElementsRegistry.cpp; sourceTree = "<group>"; };
-                9BD4E9191C462CFC005065BC /* CustomElementsRegistry.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CustomElementsRegistry.h; sourceTree = "<group>"; };
</del><ins>+                9BD4E9181C462CFC005065BC /* CustomElementRegistry.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CustomElementRegistry.cpp; sourceTree = "<group>"; };
+                9BD4E9191C462CFC005065BC /* CustomElementRegistry.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CustomElementRegistry.h; sourceTree = "<group>"; };
</ins><span class="cx">                 9BD8A95918BEFC7600987E9A /* CollectionIndexCache.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CollectionIndexCache.cpp; sourceTree = "<group>"; };
</span><del>-                9BE671091D5AEB0400345514 /* JSCustomElementsRegistry.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSCustomElementsRegistry.cpp; sourceTree = "<group>"; };
-                9BE6710A1D5AEB0400345514 /* JSCustomElementsRegistry.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCustomElementsRegistry.h; sourceTree = "<group>"; };
</del><ins>+                9BE671091D5AEB0400345514 /* JSCustomElementRegistry.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSCustomElementRegistry.cpp; sourceTree = "<group>"; };
+                9BE6710A1D5AEB0400345514 /* JSCustomElementRegistry.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCustomElementRegistry.h; sourceTree = "<group>"; };
</ins><span class="cx">                 9BF9A87E1648DD2F001C6B23 /* JSHTMLFormControlsCollection.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSHTMLFormControlsCollection.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 9BF9A87F1648DD2F001C6B23 /* JSHTMLFormControlsCollection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSHTMLFormControlsCollection.h; sourceTree = "<group>"; };
</span><span class="cx">                 9D63800F1AF16E160031A15C /* StyleSelfAlignmentData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StyleSelfAlignmentData.h; sourceTree = "<group>"; };
</span><span class="lines">@@ -19375,8 +19375,8 @@
</span><span class="cx">                                 93F9B6DF0BA0FB7200854064 /* JSComment.h */,
</span><span class="cx">                                 FE6FD48B0F676E9300092873 /* JSCoordinates.cpp */,
</span><span class="cx">                                 FE6FD48C0F676E9300092873 /* JSCoordinates.h */,
</span><del>-                                9BE671091D5AEB0400345514 /* JSCustomElementsRegistry.cpp */,
-                                9BE6710A1D5AEB0400345514 /* JSCustomElementsRegistry.h */,
</del><ins>+                                9BE671091D5AEB0400345514 /* JSCustomElementRegistry.cpp */,
+                                9BE6710A1D5AEB0400345514 /* JSCustomElementRegistry.h */,
</ins><span class="cx">                                 BCA83E4D0D7CE1E9003421A8 /* JSDataTransfer.cpp */,
</span><span class="cx">                                 BCA83E4E0D7CE1E9003421A8 /* JSDataTransfer.h */,
</span><span class="cx">                                 31FB1A63120A5D3F00DC02A0 /* JSDeviceMotionEvent.cpp */,
</span><span class="lines">@@ -20924,7 +20924,7 @@
</span><span class="cx">                                 BC5825F20C0B89380053F1B5 /* JSCSSStyleDeclarationCustom.cpp */,
</span><span class="cx">                                 AD726FEA16D9F40B003A4E6D /* JSCSSStyleDeclarationCustom.h */,
</span><span class="cx">                                 BC20FB7E0C0E8E6C00D1447F /* JSCSSValueCustom.cpp */,
</span><del>-                                9BC5F9DF1D5AAF6A002B749D /* JSCustomElementsRegistryCustom.cpp */,
</del><ins>+                                9BC5F9DF1D5AAF6A002B749D /* JSCustomElementRegistryCustom.cpp */,
</ins><span class="cx">                                 DEC2975D1B4DEB2A005F5945 /* JSCustomEventCustom.cpp */,
</span><span class="cx">                                 07FBDE2B18FED178001A7CFF /* JSDataCueCustom.cpp */,
</span><span class="cx">                                 BCA83E510D7CE205003421A8 /* JSDataTransferCustom.cpp */,
</span><span class="lines">@@ -22761,9 +22761,9 @@
</span><span class="cx">                                 97627B8C14FB3CEE002CDCA1 /* ContextDestructionObserver.h */,
</span><span class="cx">                                 9B56C9A91C89329A00C456DF /* CustomElementReactionQueue.cpp */,
</span><span class="cx">                                 9B56C9A81C89312800C456DF /* CustomElementReactionQueue.h */,
</span><del>-                                9BD4E9181C462CFC005065BC /* CustomElementsRegistry.cpp */,
-                                9BD4E9191C462CFC005065BC /* CustomElementsRegistry.h */,
-                                9BC5F9DE1D5AAD5D002B749D /* CustomElementsRegistry.idl */,
</del><ins>+                                9BD4E9181C462CFC005065BC /* CustomElementRegistry.cpp */,
+                                9BD4E9191C462CFC005065BC /* CustomElementRegistry.h */,
+                                9BC5F9DE1D5AAD5D002B749D /* CustomElementRegistry.idl */,
</ins><span class="cx">                                 62CD32561157E57C0063B0A7 /* CustomEvent.cpp */,
</span><span class="cx">                                 62CD32571157E57C0063B0A7 /* CustomEvent.h */,
</span><span class="cx">                                 62CD32581157E57C0063B0A7 /* CustomEvent.idl */,
</span><span class="lines">@@ -24010,7 +24010,7 @@
</span><span class="cx">                                 BC2272A20E82E87C00E7F975 /* CursorData.h in Headers */,
</span><span class="cx">                                 BC2272AD0E82E8F300E7F975 /* CursorList.h in Headers */,
</span><span class="cx">                                 93D437A01D57B19A00AB85EA /* CustomElementReactionQueue.h in Headers */,
</span><del>-                                9BD4E91B1C462CFC005065BC /* CustomElementsRegistry.h in Headers */,
</del><ins>+                                9BD4E91B1C462CFC005065BC /* CustomElementRegistry.h in Headers */,
</ins><span class="cx">                                 62CD325A1157E57C0063B0A7 /* CustomEvent.h in Headers */,
</span><span class="cx">                                 A8CB413E0E8633FD0032C4F0 /* DashArray.h in Headers */,
</span><span class="cx">                                 A80E6D0B0A1989CA007FB8C5 /* DashboardRegion.h in Headers */,
</span><span class="lines">@@ -24756,7 +24756,7 @@
</span><span class="cx">                                 14CF78A609F58CD800EB3665 /* JSCSSValue.h in Headers */,
</span><span class="cx">                                 A8D05FAC0A23B30F005E7203 /* JSCSSValueList.h in Headers */,
</span><span class="cx">                                 9BD4E9171C462872005065BC /* JSCustomElementInterface.h in Headers */,
</span><del>-                                9BE6710C1D5AEB2500345514 /* JSCustomElementsRegistry.h in Headers */,
</del><ins>+                                9BE6710C1D5AEB2500345514 /* JSCustomElementRegistry.h in Headers */,
</ins><span class="cx">                                 E4778B80115A581A00B5D372 /* JSCustomEvent.h in Headers */,
</span><span class="cx">                                 E10B937C0B73C00A003ED890 /* JSCustomXPathNSResolver.h in Headers */,
</span><span class="cx">                                 1AE82F900CAAFA9D002237AE /* JSDatabase.h in Headers */,
</span><span class="lines">@@ -27653,7 +27653,7 @@
</span><span class="cx">                                 265541521489B233000DFC5D /* CursorIOS.cpp in Sources */,
</span><span class="cx">                                 93F19A2608245E59001E9ABC /* CursorMac.mm in Sources */,
</span><span class="cx">                                 9B56C9AA1C89329A00C456DF /* CustomElementReactionQueue.cpp in Sources */,
</span><del>-                                9BD4E91A1C462CFC005065BC /* CustomElementsRegistry.cpp in Sources */,
</del><ins>+                                9BD4E91A1C462CFC005065BC /* CustomElementRegistry.cpp in Sources */,
</ins><span class="cx">                                 62CD32591157E57C0063B0A7 /* CustomEvent.cpp in Sources */,
</span><span class="cx">                                 97BC6A201505F081001B74AC /* Database.cpp in Sources */,
</span><span class="cx">                                 97BC6A231505F081001B74AC /* DatabaseAuthorizer.cpp in Sources */,
</span><span class="lines">@@ -28342,8 +28342,8 @@
</span><span class="cx">                                 BC20FB7F0C0E8E6C00D1447F /* JSCSSValueCustom.cpp in Sources */,
</span><span class="cx">                                 A8D05FAB0A23B30F005E7203 /* JSCSSValueList.cpp in Sources */,
</span><span class="cx">                                 9BD4E9161C462872005065BC /* JSCustomElementInterface.cpp in Sources */,
</span><del>-                                9BE6710B1D5AEB2100345514 /* JSCustomElementsRegistry.cpp in Sources */,
-                                9BC5F9E01D5AAF6B002B749D /* JSCustomElementsRegistryCustom.cpp in Sources */,
</del><ins>+                                9BE6710B1D5AEB2100345514 /* JSCustomElementRegistry.cpp in Sources */,
+                                9BC5F9E01D5AAF6B002B749D /* JSCustomElementRegistryCustom.cpp in Sources */,
</ins><span class="cx">                                 E4778B7F115A581A00B5D372 /* JSCustomEvent.cpp in Sources */,
</span><span class="cx">                                 DEC297611B4F2F8D005F5945 /* JSCustomEventCustom.cpp in Sources */,
</span><span class="cx">                                 51EC92650CE90DD400F90308 /* JSCustomSQLStatementErrorCallback.cpp in Sources */,
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsjsJSCustomElementRegistryCustomcpp"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/bindings/js/JSCustomElementRegistryCustom.cpp (0 => 204732)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/JSCustomElementRegistryCustom.cpp         (rev 0)
+++ trunk/Source/WebCore/bindings/js/JSCustomElementRegistryCustom.cpp        2016-08-22 19:45:01 UTC (rev 204732)
</span><span class="lines">@@ -0,0 +1,151 @@
</span><ins>+/*
+ * Copyright (C) 2015, 2016 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "JSCustomElementRegistry.h"
+
+#include "CustomElementRegistry.h"
+#include "Document.h"
+#include "HTMLNames.h"
+#include "JSCustomElementInterface.h"
+#include "JSDOMBinding.h"
+#include "JSDOMConvert.h"
+
+using namespace JSC;
+
+namespace WebCore {
+
+#if ENABLE(CUSTOM_ELEMENTS)
+
+static JSObject* getCustomElementCallback(ExecState& state, JSObject& prototype, const Identifier& id)
+{
+ JSValue callback = prototype.get(&state, id);
+ if (state.hadException())
+ return nullptr;
+ if (callback.isUndefined())
+ return nullptr;
+ if (!callback.isFunction()) {
+ throwTypeError(&state, ASCIILiteral("A custom element callback must be a function"));
+ return nullptr;
+ }
+ return callback.getObject();
+}
+
+// https://html.spec.whatwg.org/#dom-customelementregistry-define
+JSValue JSCustomElementRegistry::define(ExecState& state)
+{
+ if (UNLIKELY(state.argumentCount() < 2))
+ return state.vm().throwException(&state, createNotEnoughArgumentsError(&state));
+
+ AtomicString localName(state.uncheckedArgument(0).toString(&state)->toAtomicString(&state));
+ if (UNLIKELY(state.hadException()))
+ return jsUndefined();
+
+ JSValue constructorValue = state.uncheckedArgument(1);
+ if (!constructorValue.isConstructor())
+ return throwTypeError(&state, ASCIILiteral("The second argument must be a constructor"));
+ JSObject* constructor = constructorValue.getObject();
+
+ // FIXME: Throw a TypeError if constructor doesn't inherit from HTMLElement.
+ // https://github.com/w3c/webcomponents/issues/541
+
+ switch (Document::validateCustomElementName(localName)) {
+ case CustomElementNameValidationStatus::Valid:
+ break;
+ case CustomElementNameValidationStatus::ConflictsWithBuiltinNames:
+ return throwSyntaxError(&state, ASCIILiteral("Custom element name cannot be same as one of the builtin elements"));
+ case CustomElementNameValidationStatus::NoHyphen:
+ return throwSyntaxError(&state, ASCIILiteral("Custom element name must contain a hyphen"));
+ case CustomElementNameValidationStatus::ContainsUpperCase:
+ return throwSyntaxError(&state, ASCIILiteral("Custom element name cannot contain an upper case letter"));
+ }
+
+ // FIXME: Check re-entrancy here.
+ // https://github.com/w3c/webcomponents/issues/545
+
+ CustomElementRegistry& registry = wrapped();
+ if (registry.findInterface(localName)) {
+ throwNotSupportedError(state, ASCIILiteral("Cannot define multiple custom elements with the same tag name"));
+ return jsUndefined();
+ }
+
+ if (registry.containsConstructor(constructor)) {
+ throwNotSupportedError(state, ASCIILiteral("Cannot define multiple custom elements with the same class"));
+ return jsUndefined();
+ }
+
+ auto& vm = globalObject()->vm();
+ JSValue prototypeValue = constructor->get(&state, vm.propertyNames->prototype);
+ if (state.hadException())
+ return jsUndefined();
+ if (!prototypeValue.isObject())
+ return throwTypeError(&state, ASCIILiteral("Custom element constructor's prototype must be an object"));
+ JSObject& prototypeObject = *asObject(prototypeValue);
+
+ QualifiedName name(nullAtom, localName, HTMLNames::xhtmlNamespaceURI);
+ auto elementInterface = JSCustomElementInterface::create(name, constructor, globalObject());
+
+ auto* connectedCallback = getCustomElementCallback(state, prototypeObject, Identifier::fromString(&vm, "connectedCallback"));
+ if (state.hadException())
+ return jsUndefined();
+ if (connectedCallback)
+ elementInterface->setConnectedCallback(connectedCallback);
+
+ auto* disconnectedCallback = getCustomElementCallback(state, prototypeObject, Identifier::fromString(&vm, "disconnectedCallback"));
+ if (state.hadException())
+ return jsUndefined();
+ if (disconnectedCallback)
+ elementInterface->setDisconnectedCallback(disconnectedCallback);
+
+ // FIXME: Add the support for adoptedCallback.
+ getCustomElementCallback(state, prototypeObject, Identifier::fromString(&vm, "adoptedCallback"));
+ if (state.hadException())
+ return jsUndefined();
+
+ auto* attributeChangedCallback = getCustomElementCallback(state, prototypeObject, Identifier::fromString(&vm, "attributeChangedCallback"));
+ if (state.hadException())
+ return jsUndefined();
+ if (attributeChangedCallback) {
+ auto value = convertOptional<Vector<String>>(state, constructor->get(&state, Identifier::fromString(&state, "observedAttributes")));
+ if (state.hadException())
+ return jsUndefined();
+ if (value)
+ elementInterface->setAttributeChangedCallback(attributeChangedCallback, *value);
+ }
+
+ PrivateName uniquePrivateName;
+ globalObject()->putDirect(vm, uniquePrivateName, constructor);
+
+ registry.addElementDefinition(WTFMove(elementInterface));
+
+ // FIXME: 17. Let map be registry's upgrade candidates map.
+ // FIXME: 18. Upgrade a newly-defined element given map and definition.
+ // FIXME: 19. Resolve whenDefined promise.
+
+ return jsUndefined();
+}
+#endif
+
+}
</ins></span></pre></div>
<a id="trunkSourceWebCorebindingsjsJSCustomElementsRegistryCustomcpp"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/bindings/js/JSCustomElementsRegistryCustom.cpp (204731 => 204732)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/JSCustomElementsRegistryCustom.cpp        2016-08-22 19:12:09 UTC (rev 204731)
+++ trunk/Source/WebCore/bindings/js/JSCustomElementsRegistryCustom.cpp        2016-08-22 19:45:01 UTC (rev 204732)
</span><span class="lines">@@ -1,151 +0,0 @@
</span><del>-/*
- * Copyright (C) 2015, 2016 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "JSCustomElementsRegistry.h"
-
-#include "CustomElementsRegistry.h"
-#include "Document.h"
-#include "HTMLNames.h"
-#include "JSCustomElementInterface.h"
-#include "JSDOMBinding.h"
-#include "JSDOMConvert.h"
-
-using namespace JSC;
-
-namespace WebCore {
-
-#if ENABLE(CUSTOM_ELEMENTS)
-
-static JSObject* getCustomElementCallback(ExecState& state, JSObject& prototype, const Identifier& id)
-{
- JSValue callback = prototype.get(&state, id);
- if (state.hadException())
- return nullptr;
- if (callback.isUndefined())
- return nullptr;
- if (!callback.isFunction()) {
- throwTypeError(&state, ASCIILiteral("A custom element callback must be a function"));
- return nullptr;
- }
- return callback.getObject();
-}
-
-// https://html.spec.whatwg.org/#dom-customelementsregistry-define
-JSValue JSCustomElementsRegistry::define(ExecState& state)
-{
- if (UNLIKELY(state.argumentCount() < 2))
- return state.vm().throwException(&state, createNotEnoughArgumentsError(&state));
-
- AtomicString localName(state.uncheckedArgument(0).toString(&state)->toAtomicString(&state));
- if (UNLIKELY(state.hadException()))
- return jsUndefined();
-
- JSValue constructorValue = state.uncheckedArgument(1);
- if (!constructorValue.isConstructor())
- return throwTypeError(&state, ASCIILiteral("The second argument must be a constructor"));
- JSObject* constructor = constructorValue.getObject();
-
- // FIXME: Throw a TypeError if constructor doesn't inherit from HTMLElement.
- // https://github.com/w3c/webcomponents/issues/541
-
- switch (Document::validateCustomElementName(localName)) {
- case CustomElementNameValidationStatus::Valid:
- break;
- case CustomElementNameValidationStatus::ConflictsWithBuiltinNames:
- return throwSyntaxError(&state, ASCIILiteral("Custom element name cannot be same as one of the builtin elements"));
- case CustomElementNameValidationStatus::NoHyphen:
- return throwSyntaxError(&state, ASCIILiteral("Custom element name must contain a hyphen"));
- case CustomElementNameValidationStatus::ContainsUpperCase:
- return throwSyntaxError(&state, ASCIILiteral("Custom element name cannot contain an upper case letter"));
- }
-
- // FIXME: Check re-entrancy here.
- // https://github.com/w3c/webcomponents/issues/545
-
- CustomElementsRegistry& registry = wrapped();
- if (registry.findInterface(localName)) {
- throwNotSupportedError(state, ASCIILiteral("Cannot define multiple custom elements with the same tag name"));
- return jsUndefined();
- }
-
- if (registry.containsConstructor(constructor)) {
- throwNotSupportedError(state, ASCIILiteral("Cannot define multiple custom elements with the same class"));
- return jsUndefined();
- }
-
- auto& vm = globalObject()->vm();
- JSValue prototypeValue = constructor->get(&state, vm.propertyNames->prototype);
- if (state.hadException())
- return jsUndefined();
- if (!prototypeValue.isObject())
- return throwTypeError(&state, ASCIILiteral("Custom element constructor's prototype must be an object"));
- JSObject& prototypeObject = *asObject(prototypeValue);
-
- QualifiedName name(nullAtom, localName, HTMLNames::xhtmlNamespaceURI);
- auto elementInterface = JSCustomElementInterface::create(name, constructor, globalObject());
-
- auto* connectedCallback = getCustomElementCallback(state, prototypeObject, Identifier::fromString(&vm, "connectedCallback"));
- if (state.hadException())
- return jsUndefined();
- if (connectedCallback)
- elementInterface->setConnectedCallback(connectedCallback);
-
- auto* disconnectedCallback = getCustomElementCallback(state, prototypeObject, Identifier::fromString(&vm, "disconnectedCallback"));
- if (state.hadException())
- return jsUndefined();
- if (disconnectedCallback)
- elementInterface->setDisconnectedCallback(disconnectedCallback);
-
- // FIXME: Add the support for adoptedCallback.
- getCustomElementCallback(state, prototypeObject, Identifier::fromString(&vm, "adoptedCallback"));
- if (state.hadException())
- return jsUndefined();
-
- auto* attributeChangedCallback = getCustomElementCallback(state, prototypeObject, Identifier::fromString(&vm, "attributeChangedCallback"));
- if (state.hadException())
- return jsUndefined();
- if (attributeChangedCallback) {
- auto value = convertOptional<Vector<String>>(state, constructor->get(&state, Identifier::fromString(&state, "observedAttributes")));
- if (state.hadException())
- return jsUndefined();
- if (value)
- elementInterface->setAttributeChangedCallback(attributeChangedCallback, *value);
- }
-
- PrivateName uniquePrivateName;
- globalObject()->putDirect(vm, uniquePrivateName, constructor);
-
- registry.addElementDefinition(WTFMove(elementInterface));
-
- // FIXME: 17. Let map be registry's upgrade candidates map.
- // FIXME: 18. Upgrade a newly-defined element given map and definition.
- // FIXME: 19. Resolve whenDefined promise.
-
- return jsUndefined();
-}
-#endif
-
-}
</del></span></pre></div>
<a id="trunkSourceWebCorebindingsjsJSHTMLElementCustomcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/js/JSHTMLElementCustom.cpp (204731 => 204732)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/JSHTMLElementCustom.cpp        2016-08-22 19:12:09 UTC (rev 204731)
+++ trunk/Source/WebCore/bindings/js/JSHTMLElementCustom.cpp        2016-08-22 19:45:01 UTC (rev 204732)
</span><span class="lines">@@ -26,7 +26,7 @@
</span><span class="cx"> #include "config.h"
</span><span class="cx"> #include "JSHTMLElement.h"
</span><span class="cx">
</span><del>-#include "CustomElementsRegistry.h"
</del><ins>+#include "CustomElementRegistry.h"
</ins><span class="cx"> #include "DOMWindow.h"
</span><span class="cx"> #include "Document.h"
</span><span class="cx"> #include "HTMLFormElement.h"
</span><span class="lines">@@ -53,7 +53,7 @@
</span><span class="cx"> if (!window)
</span><span class="cx"> return throwVMTypeError(&exec, ASCIILiteral("new.target is not a valid custom element constructor"));
</span><span class="cx">
</span><del>- auto* registry = window->customElementsRegistry();
</del><ins>+ auto* registry = window->customElementRegistry();
</ins><span class="cx"> if (!registry)
</span><span class="cx"> return throwVMTypeError(&exec, ASCIILiteral("new.target is not a valid custom element constructor"));
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoredomCustomElementReactionQueuecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/CustomElementReactionQueue.cpp (204731 => 204732)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/CustomElementReactionQueue.cpp        2016-08-22 19:12:09 UTC (rev 204731)
+++ trunk/Source/WebCore/dom/CustomElementReactionQueue.cpp        2016-08-22 19:45:01 UTC (rev 204732)
</span><span class="lines">@@ -28,7 +28,7 @@
</span><span class="cx">
</span><span class="cx"> #if ENABLE(CUSTOM_ELEMENTS)
</span><span class="cx">
</span><del>-#include "CustomElementsRegistry.h"
</del><ins>+#include "CustomElementRegistry.h"
</ins><span class="cx"> #include "DOMWindow.h"
</span><span class="cx"> #include "Document.h"
</span><span class="cx"> #include "Element.h"
</span><span class="lines">@@ -113,7 +113,7 @@
</span><span class="cx"> if (!window)
</span><span class="cx"> return nullptr;
</span><span class="cx">
</span><del>- auto* registry = window->customElementsRegistry();
</del><ins>+ auto* registry = window->customElementRegistry();
</ins><span class="cx"> if (!registry)
</span><span class="cx"> return nullptr;
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoredomCustomElementRegistrycpp"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/dom/CustomElementRegistry.cpp (0 => 204732)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/CustomElementRegistry.cpp         (rev 0)
+++ trunk/Source/WebCore/dom/CustomElementRegistry.cpp        2016-08-22 19:45:01 UTC (rev 204732)
</span><span class="lines">@@ -0,0 +1,110 @@
</span><ins>+/*
+ * Copyright (C) 2015, 2016 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "CustomElementRegistry.h"
+
+#if ENABLE(CUSTOM_ELEMENTS)
+
+#include "Document.h"
+#include "Element.h"
+#include "JSCustomElementInterface.h"
+#include "MathMLNames.h"
+#include "QualifiedName.h"
+#include "SVGNames.h"
+#include <runtime/JSCJSValueInlines.h>
+#include <wtf/text/AtomicString.h>
+
+namespace WebCore {
+
+Ref<CustomElementRegistry> CustomElementRegistry::create()
+{
+ return adoptRef(*new CustomElementRegistry());
+}
+
+CustomElementRegistry::CustomElementRegistry()
+{ }
+
+CustomElementRegistry::~CustomElementRegistry()
+{ }
+
+void CustomElementRegistry::addElementDefinition(Ref<JSCustomElementInterface>&& elementInterface)
+{
+ AtomicString localName = elementInterface->name().localName();
+ ASSERT(!m_nameMap.contains(localName));
+ m_constructorMap.add(elementInterface->constructor(), elementInterface.ptr());
+ m_nameMap.add(localName, elementInterface.copyRef());
+
+ auto candidateList = m_upgradeCandidatesMap.find(localName);
+ if (candidateList == m_upgradeCandidatesMap.end())
+ return;
+
+ Vector<RefPtr<Element>> list(WTFMove(candidateList->value));
+
+ m_upgradeCandidatesMap.remove(localName);
+
+ for (auto& candidate : list) {
+ ASSERT(candidate);
+ elementInterface->upgradeElement(*candidate);
+ }
+
+ // We should not be adding more upgrade candidate for this local name.
+ ASSERT(!m_upgradeCandidatesMap.contains(localName));
+}
+
+void CustomElementRegistry::addUpgradeCandidate(Element& candidate)
+{
+ auto result = m_upgradeCandidatesMap.ensure(candidate.localName(), [] {
+ return Vector<RefPtr<Element>>();
+ });
+ auto& nodeVector = result.iterator->value;
+ ASSERT(!nodeVector.contains(&candidate));
+ nodeVector.append(&candidate);
+}
+
+JSCustomElementInterface* CustomElementRegistry::findInterface(const QualifiedName& name) const
+{
+ auto it = m_nameMap.find(name.localName());
+ return it == m_nameMap.end() || it->value->name() != name ? nullptr : const_cast<JSCustomElementInterface*>(it->value.ptr());
+}
+
+JSCustomElementInterface* CustomElementRegistry::findInterface(const AtomicString& name) const
+{
+ return m_nameMap.get(name);
+}
+
+JSCustomElementInterface* CustomElementRegistry::findInterface(const JSC::JSObject* constructor) const
+{
+ return m_constructorMap.get(constructor);
+}
+
+bool CustomElementRegistry::containsConstructor(const JSC::JSObject* constructor) const
+{
+ return m_constructorMap.contains(constructor);
+}
+
+}
+
+#endif
</ins></span></pre></div>
<a id="trunkSourceWebCoredomCustomElementRegistryh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/dom/CustomElementRegistry.h (0 => 204732)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/CustomElementRegistry.h         (rev 0)
+++ trunk/Source/WebCore/dom/CustomElementRegistry.h        2016-08-22 19:45:01 UTC (rev 204732)
</span><span class="lines">@@ -0,0 +1,70 @@
</span><ins>+/*
+ * Copyright (C) 2015, 2016 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#if ENABLE(CUSTOM_ELEMENTS)
+
+#include "QualifiedName.h"
+#include <wtf/HashMap.h>
+#include <wtf/text/AtomicString.h>
+#include <wtf/text/AtomicStringHash.h>
+
+namespace JSC {
+
+class JSObject;
+
+}
+
+namespace WebCore {
+
+class Element;
+class JSCustomElementInterface;
+class QualifiedName;
+
+class CustomElementRegistry : public RefCounted<CustomElementRegistry> {
+public:
+ static Ref<CustomElementRegistry> create();
+ ~CustomElementRegistry();
+
+ void addElementDefinition(Ref<JSCustomElementInterface>&&);
+ void addUpgradeCandidate(Element&);
+
+ JSCustomElementInterface* findInterface(const QualifiedName&) const;
+ JSCustomElementInterface* findInterface(const AtomicString&) const;
+ JSCustomElementInterface* findInterface(const JSC::JSObject*) const;
+ bool containsConstructor(const JSC::JSObject*) const;
+
+private:
+ CustomElementRegistry();
+
+ HashMap<AtomicString, Vector<RefPtr<Element>>> m_upgradeCandidatesMap;
+ HashMap<AtomicString, Ref<JSCustomElementInterface>> m_nameMap;
+ HashMap<const JSC::JSObject*, JSCustomElementInterface*> m_constructorMap;
+};
+
+}
+
+#endif
</ins></span></pre></div>
<a id="trunkSourceWebCoredomCustomElementRegistryidl"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/dom/CustomElementRegistry.idl (0 => 204732)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/CustomElementRegistry.idl         (rev 0)
+++ trunk/Source/WebCore/dom/CustomElementRegistry.idl        2016-08-22 19:45:01 UTC (rev 204732)
</span><span class="lines">@@ -0,0 +1,35 @@
</span><ins>+/*
+* Copyright (C) 2016 Apple Inc. All rights reserved.
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions
+* are met:
+* 1. Redistributions of source code must retain the above copyright
+* notice, this list of conditions and the following disclaimer.
+* 2. Redistributions in binary form must reproduce the above copyright
+* notice, this list of conditions and the following disclaimer in the
+* documentation and/or other materials provided with the distribution.
+*
+* THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+[
+ Conditional=CUSTOM_ELEMENTS,
+ EnabledAtRuntime=CustomElements,
+ JSGenerateToNativeObject,
+ ImplementationLacksVTable
+] interface CustomElementRegistry {
+
+ [CEReactions, Custom] void define(DOMString name, Function constructor);
+
+};
</ins></span></pre></div>
<a id="trunkSourceWebCoredomCustomElementsRegistrycpp"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/dom/CustomElementsRegistry.cpp (204731 => 204732)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/CustomElementsRegistry.cpp        2016-08-22 19:12:09 UTC (rev 204731)
+++ trunk/Source/WebCore/dom/CustomElementsRegistry.cpp        2016-08-22 19:45:01 UTC (rev 204732)
</span><span class="lines">@@ -1,110 +0,0 @@
</span><del>-/*
- * Copyright (C) 2015, 2016 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "CustomElementsRegistry.h"
-
-#if ENABLE(CUSTOM_ELEMENTS)
-
-#include "Document.h"
-#include "Element.h"
-#include "JSCustomElementInterface.h"
-#include "MathMLNames.h"
-#include "QualifiedName.h"
-#include "SVGNames.h"
-#include <runtime/JSCJSValueInlines.h>
-#include <wtf/text/AtomicString.h>
-
-namespace WebCore {
-
-Ref<CustomElementsRegistry> CustomElementsRegistry::create()
-{
- return adoptRef(*new CustomElementsRegistry());
-}
-
-CustomElementsRegistry::CustomElementsRegistry()
-{ }
-
-CustomElementsRegistry::~CustomElementsRegistry()
-{ }
-
-void CustomElementsRegistry::addElementDefinition(Ref<JSCustomElementInterface>&& elementInterface)
-{
- AtomicString localName = elementInterface->name().localName();
- ASSERT(!m_nameMap.contains(localName));
- m_constructorMap.add(elementInterface->constructor(), elementInterface.ptr());
- m_nameMap.add(localName, elementInterface.copyRef());
-
- auto candidateList = m_upgradeCandidatesMap.find(localName);
- if (candidateList == m_upgradeCandidatesMap.end())
- return;
-
- Vector<RefPtr<Element>> list(WTFMove(candidateList->value));
-
- m_upgradeCandidatesMap.remove(localName);
-
- for (auto& candidate : list) {
- ASSERT(candidate);
- elementInterface->upgradeElement(*candidate);
- }
-
- // We should not be adding more upgrade candidate for this local name.
- ASSERT(!m_upgradeCandidatesMap.contains(localName));
-}
-
-void CustomElementsRegistry::addUpgradeCandidate(Element& candidate)
-{
- auto result = m_upgradeCandidatesMap.ensure(candidate.localName(), [] {
- return Vector<RefPtr<Element>>();
- });
- auto& nodeVector = result.iterator->value;
- ASSERT(!nodeVector.contains(&candidate));
- nodeVector.append(&candidate);
-}
-
-JSCustomElementInterface* CustomElementsRegistry::findInterface(const QualifiedName& name) const
-{
- auto it = m_nameMap.find(name.localName());
- return it == m_nameMap.end() || it->value->name() != name ? nullptr : const_cast<JSCustomElementInterface*>(it->value.ptr());
-}
-
-JSCustomElementInterface* CustomElementsRegistry::findInterface(const AtomicString& name) const
-{
- return m_nameMap.get(name);
-}
-
-JSCustomElementInterface* CustomElementsRegistry::findInterface(const JSC::JSObject* constructor) const
-{
- return m_constructorMap.get(constructor);
-}
-
-bool CustomElementsRegistry::containsConstructor(const JSC::JSObject* constructor) const
-{
- return m_constructorMap.contains(constructor);
-}
-
-}
-
-#endif
</del></span></pre></div>
<a id="trunkSourceWebCoredomCustomElementsRegistryh"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/dom/CustomElementsRegistry.h (204731 => 204732)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/CustomElementsRegistry.h        2016-08-22 19:12:09 UTC (rev 204731)
+++ trunk/Source/WebCore/dom/CustomElementsRegistry.h        2016-08-22 19:45:01 UTC (rev 204732)
</span><span class="lines">@@ -1,70 +0,0 @@
</span><del>-/*
- * Copyright (C) 2015, 2016 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#pragma once
-
-#if ENABLE(CUSTOM_ELEMENTS)
-
-#include "QualifiedName.h"
-#include <wtf/HashMap.h>
-#include <wtf/text/AtomicString.h>
-#include <wtf/text/AtomicStringHash.h>
-
-namespace JSC {
-
-class JSObject;
-
-}
-
-namespace WebCore {
-
-class Element;
-class JSCustomElementInterface;
-class QualifiedName;
-
-class CustomElementsRegistry : public RefCounted<CustomElementsRegistry> {
-public:
- static Ref<CustomElementsRegistry> create();
- ~CustomElementsRegistry();
-
- void addElementDefinition(Ref<JSCustomElementInterface>&&);
- void addUpgradeCandidate(Element&);
-
- JSCustomElementInterface* findInterface(const QualifiedName&) const;
- JSCustomElementInterface* findInterface(const AtomicString&) const;
- JSCustomElementInterface* findInterface(const JSC::JSObject*) const;
- bool containsConstructor(const JSC::JSObject*) const;
-
-private:
- CustomElementsRegistry();
-
- HashMap<AtomicString, Vector<RefPtr<Element>>> m_upgradeCandidatesMap;
- HashMap<AtomicString, Ref<JSCustomElementInterface>> m_nameMap;
- HashMap<const JSC::JSObject*, JSCustomElementInterface*> m_constructorMap;
-};
-
-}
-
-#endif
</del></span></pre></div>
<a id="trunkSourceWebCoredomCustomElementsRegistryidl"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/dom/CustomElementsRegistry.idl (204731 => 204732)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/CustomElementsRegistry.idl        2016-08-22 19:12:09 UTC (rev 204731)
+++ trunk/Source/WebCore/dom/CustomElementsRegistry.idl        2016-08-22 19:45:01 UTC (rev 204732)
</span><span class="lines">@@ -1,34 +0,0 @@
</span><del>-/*
-* Copyright (C) 2016 Apple Inc. All rights reserved.
-*
-* Redistribution and use in source and binary forms, with or without
-* modification, are permitted provided that the following conditions
-* are met:
-* 1. Redistributions of source code must retain the above copyright
-* notice, this list of conditions and the following disclaimer.
-* 2. Redistributions in binary form must reproduce the above copyright
-* notice, this list of conditions and the following disclaimer in the
-* documentation and/or other materials provided with the distribution.
-*
-* THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
-* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
-* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
-* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-[
- Conditional=CUSTOM_ELEMENTS,
- JSGenerateToNativeObject,
- ImplementationLacksVTable
-] interface CustomElementsRegistry {
-
- [CEReactions, Custom] void define(DOMString name, Function constructor);
-
-};
</del></span></pre></div>
<a id="trunkSourceWebCoredomDocumentcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Document.cpp (204731 => 204732)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Document.cpp        2016-08-22 19:12:09 UTC (rev 204731)
+++ trunk/Source/WebCore/dom/Document.cpp        2016-08-22 19:45:01 UTC (rev 204732)
</span><span class="lines">@@ -45,7 +45,7 @@
</span><span class="cx"> #include "ContentSecurityPolicy.h"
</span><span class="cx"> #include "CookieJar.h"
</span><span class="cx"> #include "CustomElementReactionQueue.h"
</span><del>-#include "CustomElementsRegistry.h"
</del><ins>+#include "CustomElementRegistry.h"
</ins><span class="cx"> #include "CustomEvent.h"
</span><span class="cx"> #include "DOMImplementation.h"
</span><span class="cx"> #include "DOMNamedFlowCollection.h"
</span><span class="lines">@@ -891,7 +891,7 @@
</span><span class="cx">
</span><span class="cx"> auto element = HTMLElement::create(name, document);
</span><span class="cx"> element->setIsUnresolvedCustomElement();
</span><del>- window->ensureCustomElementsRegistry().addUpgradeCandidate(element.get());
</del><ins>+ window->ensureCustomElementRegistry().addUpgradeCandidate(element.get());
</ins><span class="cx"> return WTFMove(element);
</span><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="lines">@@ -905,7 +905,7 @@
</span><span class="cx"> #if ENABLE(CUSTOM_ELEMENTS)
</span><span class="cx"> auto* window = document.domWindow();
</span><span class="cx"> if (window) {
</span><del>- auto* registry = window->customElementsRegistry();
</del><ins>+ auto* registry = window->customElementRegistry();
</ins><span class="cx"> if (UNLIKELY(registry)) {
</span><span class="cx"> if (auto* elementInterface = registry->findInterface(localName))
</span><span class="cx"> return elementInterface->constructElement(localName, JSCustomElementInterface::ShouldClearException::DoNotClear);
</span><span class="lines">@@ -1088,7 +1088,7 @@
</span><span class="cx"> #if ENABLE(CUSTOM_ELEMENTS)
</span><span class="cx"> auto* window = document.domWindow();
</span><span class="cx"> if (window) {
</span><del>- auto* registry = window->customElementsRegistry();
</del><ins>+ auto* registry = window->customElementRegistry();
</ins><span class="cx"> if (UNLIKELY(registry)) {
</span><span class="cx"> if (auto* elementInterface = registry->findInterface(name)) {
</span><span class="cx"> auto element = HTMLElement::create(name, document);
</span></span></pre></div>
<a id="trunkSourceWebCoredomElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Element.cpp (204731 => 204732)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Element.cpp        2016-08-22 19:12:09 UTC (rev 204731)
+++ trunk/Source/WebCore/dom/Element.cpp        2016-08-22 19:45:01 UTC (rev 204732)
</span><span class="lines">@@ -38,7 +38,7 @@
</span><span class="cx"> #include "ComposedTreeAncestorIterator.h"
</span><span class="cx"> #include "ContainerNodeAlgorithms.h"
</span><span class="cx"> #include "CustomElementReactionQueue.h"
</span><del>-#include "CustomElementsRegistry.h"
</del><ins>+#include "CustomElementRegistry.h"
</ins><span class="cx"> #include "DOMTokenList.h"
</span><span class="cx"> #include "Dictionary.h"
</span><span class="cx"> #include "DocumentAnimation.h"
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlparserHTMLConstructionSitecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/parser/HTMLConstructionSite.cpp (204731 => 204732)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/parser/HTMLConstructionSite.cpp        2016-08-22 19:12:09 UTC (rev 204731)
+++ trunk/Source/WebCore/html/parser/HTMLConstructionSite.cpp        2016-08-22 19:45:01 UTC (rev 204732)
</span><span class="lines">@@ -28,7 +28,7 @@
</span><span class="cx"> #include "HTMLTreeBuilder.h"
</span><span class="cx">
</span><span class="cx"> #include "Comment.h"
</span><del>-#include "CustomElementsRegistry.h"
</del><ins>+#include "CustomElementRegistry.h"
</ins><span class="cx"> #include "DOMWindow.h"
</span><span class="cx"> #include "DocumentFragment.h"
</span><span class="cx"> #include "DocumentType.h"
</span><span class="lines">@@ -661,7 +661,7 @@
</span><span class="cx"> #if ENABLE(CUSTOM_ELEMENTS)
</span><span class="cx"> auto* window = ownerDocument.domWindow();
</span><span class="cx"> if (customElementInterface && window) {
</span><del>- auto* registry = window->customElementsRegistry();
</del><ins>+ auto* registry = window->customElementRegistry();
</ins><span class="cx"> if (UNLIKELY(registry)) {
</span><span class="cx"> if (auto* elementInterface = registry->findInterface(localName)) {
</span><span class="cx"> *customElementInterface = elementInterface;
</span><span class="lines">@@ -678,7 +678,7 @@
</span><span class="cx"> if (window && Document::validateCustomElementName(localName) == CustomElementNameValidationStatus::Valid) {
</span><span class="cx"> element = HTMLElement::create(qualifiedName, ownerDocument);
</span><span class="cx"> element->setIsUnresolvedCustomElement();
</span><del>- window->ensureCustomElementsRegistry().addUpgradeCandidate(*element);
</del><ins>+ window->ensureCustomElementRegistry().addUpgradeCandidate(*element);
</ins><span class="cx"> } else
</span><span class="cx"> #endif
</span><span class="cx"> element = HTMLUnknownElement::create(qualifiedName, ownerDocument);
</span></span></pre></div>
<a id="trunkSourceWebCorepageDOMWindowcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/DOMWindow.cpp (204731 => 204732)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/DOMWindow.cpp        2016-08-22 19:12:09 UTC (rev 204731)
+++ trunk/Source/WebCore/page/DOMWindow.cpp        2016-08-22 19:45:01 UTC (rev 204732)
</span><span class="lines">@@ -38,7 +38,7 @@
</span><span class="cx"> #include "ContentExtensionActions.h"
</span><span class="cx"> #include "ContentExtensionRule.h"
</span><span class="cx"> #include "Crypto.h"
</span><del>-#include "CustomElementsRegistry.h"
</del><ins>+#include "CustomElementRegistry.h"
</ins><span class="cx"> #include "DOMApplicationCache.h"
</span><span class="cx"> #include "DOMSelection.h"
</span><span class="cx"> #include "DOMStringList.h"
</span><span class="lines">@@ -621,11 +621,11 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> #if ENABLE(CUSTOM_ELEMENTS)
</span><del>-CustomElementsRegistry& DOMWindow::ensureCustomElementsRegistry()
</del><ins>+CustomElementRegistry& DOMWindow::ensureCustomElementRegistry()
</ins><span class="cx"> {
</span><del>- if (!m_customElementsRegistry)
- m_customElementsRegistry = CustomElementsRegistry::create();
- return *m_customElementsRegistry;
</del><ins>+ if (!m_customElementRegistry)
+ m_customElementRegistry = CustomElementRegistry::create();
+ return *m_customElementRegistry;
</ins><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCorepageDOMWindowh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/DOMWindow.h (204731 => 204732)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/DOMWindow.h        2016-08-22 19:12:09 UTC (rev 204731)
+++ trunk/Source/WebCore/page/DOMWindow.h        2016-08-22 19:45:01 UTC (rev 204732)
</span><span class="lines">@@ -48,7 +48,7 @@
</span><span class="cx"> class CSSRuleList;
</span><span class="cx"> class CSSStyleDeclaration;
</span><span class="cx"> class Crypto;
</span><del>- class CustomElementsRegistry;
</del><ins>+ class CustomElementRegistry;
</ins><span class="cx"> class DOMApplicationCache;
</span><span class="cx"> class DOMSelection;
</span><span class="cx"> class DOMURL;
</span><span class="lines">@@ -305,8 +305,8 @@
</span><span class="cx"> DOMApplicationCache* optionalApplicationCache() const { return m_applicationCache.get(); }
</span><span class="cx">
</span><span class="cx"> #if ENABLE(CUSTOM_ELEMENTS)
</span><del>- CustomElementsRegistry* customElementsRegistry() { return m_customElementsRegistry.get(); }
- CustomElementsRegistry& ensureCustomElementsRegistry();
</del><ins>+ CustomElementRegistry* customElementRegistry() { return m_customElementRegistry.get(); }
+ CustomElementRegistry& ensureCustomElementRegistry();
</ins><span class="cx"> #endif
</span><span class="cx">
</span><span class="cx"> #if ENABLE(ORIENTATION_EVENTS)
</span><span class="lines">@@ -422,7 +422,7 @@
</span><span class="cx"> mutable RefPtr<DOMApplicationCache> m_applicationCache;
</span><span class="cx">
</span><span class="cx"> #if ENABLE(CUSTOM_ELEMENTS)
</span><del>- RefPtr<CustomElementsRegistry> m_customElementsRegistry;
</del><ins>+ RefPtr<CustomElementRegistry> m_customElementRegistry;
</ins><span class="cx"> #endif
</span><span class="cx">
</span><span class="cx"> #if ENABLE(WEB_TIMING)
</span></span></pre></div>
<a id="trunkSourceWebCorepageDOMWindowidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/DOMWindow.idl (204731 => 204732)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/DOMWindow.idl        2016-08-22 19:12:09 UTC (rev 204731)
+++ trunk/Source/WebCore/page/DOMWindow.idl        2016-08-22 19:45:01 UTC (rev 204732)
</span><span class="lines">@@ -195,7 +195,7 @@
</span><span class="cx"> attribute DOMURLConstructor webkitURL; // FIXME: deprecate this.
</span><span class="cx"> attribute MutationObserverConstructor WebKitMutationObserver; // FIXME: Add metrics to determine when we can remove this.
</span><span class="cx">
</span><del>- [Conditional=CUSTOM_ELEMENTS, ImplementedAs=ensureCustomElementsRegistry] readonly attribute CustomElementsRegistry customElements;
</del><ins>+ [Conditional=CUSTOM_ELEMENTS, EnabledAtRuntime=CustomElements, ImplementedAs=ensureCustomElementRegistry] readonly attribute CustomElementRegistry customElements;
</ins><span class="cx"> #endif
</span><span class="cx">
</span><span class="cx"> // Event Handlers
</span></span></pre>
</div>
</div>
</body>
</html>