<!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>[204219] 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/204219">204219</a></dd>
<dt>Author</dt> <dd>cdumez@apple.com</dd>
<dt>Date</dt> <dd>2016-08-05 22:34:57 -0700 (Fri, 05 Aug 2016)</dd>
</dl>
<h3>Log Message</h3>
<pre>DOMException should be constructible
https://bugs.webkit.org/show_bug.cgi?id=160626
Reviewed by Darin Adler.
LayoutTests/imported/w3c:
Import WebIDL tests from W3C web-platform-tests.
* web-platform-tests/WebIDL/ecmascript-binding/es-exceptions/DOMException-constants-expected.txt: Added.
* web-platform-tests/WebIDL/ecmascript-binding/es-exceptions/DOMException-constants.html: Added.
* web-platform-tests/WebIDL/ecmascript-binding/es-exceptions/DOMException-constructor-expected.txt: Added.
* web-platform-tests/WebIDL/ecmascript-binding/es-exceptions/DOMException-constructor.html: Added.
* web-platform-tests/WebIDL/ecmascript-binding/es-exceptions/constructor-object-expected.txt: Added.
* web-platform-tests/WebIDL/ecmascript-binding/es-exceptions/constructor-object.html: Added.
* web-platform-tests/WebIDL/ecmascript-binding/es-exceptions/constructor-object.js: Added.
* web-platform-tests/WebIDL/ecmascript-binding/es-exceptions/constructor-object.worker.js: Added.
* web-platform-tests/WebIDL/ecmascript-binding/es-exceptions/exceptions-expected.txt: Added.
* web-platform-tests/WebIDL/ecmascript-binding/es-exceptions/exceptions.html: Added.
* web-platform-tests/WebIDL/ecmascript-binding/has-instance-expected.txt: Added.
* web-platform-tests/WebIDL/ecmascript-binding/has-instance.html: Added.
* web-platform-tests/WebIDL/ecmascript-binding/interface-object-expected.txt: Added.
* web-platform-tests/WebIDL/ecmascript-binding/interface-object.html: Added.
Source/WebCore:
DOMException should be constructible:
- http://heycam.github.io/webidl/#dfn-DOMException
- http://heycam.github.io/webidl/#es-DOMException-constructor-object
DOMException already has a constructor in Firefox and Chrome so this
aligns our behavior with other browsers.
Test: imported/w3c/web-platform-tests/WebIDL/ecmascript-binding/es-exceptions/DOMException-constructor.html
* dom/DOMCoreException.cpp:
(WebCore::errorCodeFromName):
(WebCore::DOMCoreException::create):
(WebCore::DOMCoreException::DOMCoreException):
* dom/DOMCoreException.h:
* dom/DOMCoreException.idl:
* dom/ExceptionBase.cpp:
(WebCore::ExceptionBase::ExceptionBase):
* dom/ExceptionBase.h:</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsimportedw3cChangeLog">trunk/LayoutTests/imported/w3c/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoredomDOMCoreExceptioncpp">trunk/Source/WebCore/dom/DOMCoreException.cpp</a></li>
<li><a href="#trunkSourceWebCoredomDOMCoreExceptionh">trunk/Source/WebCore/dom/DOMCoreException.h</a></li>
<li><a href="#trunkSourceWebCoredomDOMCoreExceptionidl">trunk/Source/WebCore/dom/DOMCoreException.idl</a></li>
<li><a href="#trunkSourceWebCoredomExceptionBasecpp">trunk/Source/WebCore/dom/ExceptionBase.cpp</a></li>
<li><a href="#trunkSourceWebCoredomExceptionBaseh">trunk/Source/WebCore/dom/ExceptionBase.h</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li>trunk/LayoutTests/imported/w3c/web-platform-tests/WebIDL/</li>
<li>trunk/LayoutTests/imported/w3c/web-platform-tests/WebIDL/ecmascript-binding/</li>
<li>trunk/LayoutTests/imported/w3c/web-platform-tests/WebIDL/ecmascript-binding/es-exceptions/</li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestsWebIDLecmascriptbindingesexceptionsDOMExceptionconstantsexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/WebIDL/ecmascript-binding/es-exceptions/DOMException-constants-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestsWebIDLecmascriptbindingesexceptionsDOMExceptionconstantshtml">trunk/LayoutTests/imported/w3c/web-platform-tests/WebIDL/ecmascript-binding/es-exceptions/DOMException-constants.html</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestsWebIDLecmascriptbindingesexceptionsDOMExceptionconstructorexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/WebIDL/ecmascript-binding/es-exceptions/DOMException-constructor-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestsWebIDLecmascriptbindingesexceptionsDOMExceptionconstructorhtml">trunk/LayoutTests/imported/w3c/web-platform-tests/WebIDL/ecmascript-binding/es-exceptions/DOMException-constructor.html</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestsWebIDLecmascriptbindingesexceptionsconstructorobjectexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/WebIDL/ecmascript-binding/es-exceptions/constructor-object-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestsWebIDLecmascriptbindingesexceptionsconstructorobjecthtml">trunk/LayoutTests/imported/w3c/web-platform-tests/WebIDL/ecmascript-binding/es-exceptions/constructor-object.html</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestsWebIDLecmascriptbindingesexceptionsconstructorobjectjs">trunk/LayoutTests/imported/w3c/web-platform-tests/WebIDL/ecmascript-binding/es-exceptions/constructor-object.js</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestsWebIDLecmascriptbindingesexceptionsconstructorobjectworkerjs">trunk/LayoutTests/imported/w3c/web-platform-tests/WebIDL/ecmascript-binding/es-exceptions/constructor-object.worker.js</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestsWebIDLecmascriptbindingesexceptionsexceptionsexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/WebIDL/ecmascript-binding/es-exceptions/exceptions-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestsWebIDLecmascriptbindingesexceptionsexceptionshtml">trunk/LayoutTests/imported/w3c/web-platform-tests/WebIDL/ecmascript-binding/es-exceptions/exceptions.html</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestsWebIDLecmascriptbindinghasinstanceexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/WebIDL/ecmascript-binding/has-instance-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestsWebIDLecmascriptbindinghasinstancehtml">trunk/LayoutTests/imported/w3c/web-platform-tests/WebIDL/ecmascript-binding/has-instance.html</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestsWebIDLecmascriptbindinginterfaceobjectexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/WebIDL/ecmascript-binding/interface-object-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestsWebIDLecmascriptbindinginterfaceobjecthtml">trunk/LayoutTests/imported/w3c/web-platform-tests/WebIDL/ecmascript-binding/interface-object.html</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsimportedw3cChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/ChangeLog (204218 => 204219)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/ChangeLog        2016-08-06 03:48:10 UTC (rev 204218)
+++ trunk/LayoutTests/imported/w3c/ChangeLog        2016-08-06 05:34:57 UTC (rev 204219)
</span><span class="lines">@@ -1,5 +1,29 @@
</span><span class="cx"> 2016-08-05 Chris Dumez <cdumez@apple.com>
</span><span class="cx">
</span><ins>+ DOMException should be constructible
+ https://bugs.webkit.org/show_bug.cgi?id=160626
+
+ Reviewed by Darin Adler.
+
+ Import WebIDL tests from W3C web-platform-tests.
+
+ * web-platform-tests/WebIDL/ecmascript-binding/es-exceptions/DOMException-constants-expected.txt: Added.
+ * web-platform-tests/WebIDL/ecmascript-binding/es-exceptions/DOMException-constants.html: Added.
+ * web-platform-tests/WebIDL/ecmascript-binding/es-exceptions/DOMException-constructor-expected.txt: Added.
+ * web-platform-tests/WebIDL/ecmascript-binding/es-exceptions/DOMException-constructor.html: Added.
+ * web-platform-tests/WebIDL/ecmascript-binding/es-exceptions/constructor-object-expected.txt: Added.
+ * web-platform-tests/WebIDL/ecmascript-binding/es-exceptions/constructor-object.html: Added.
+ * web-platform-tests/WebIDL/ecmascript-binding/es-exceptions/constructor-object.js: Added.
+ * web-platform-tests/WebIDL/ecmascript-binding/es-exceptions/constructor-object.worker.js: Added.
+ * web-platform-tests/WebIDL/ecmascript-binding/es-exceptions/exceptions-expected.txt: Added.
+ * web-platform-tests/WebIDL/ecmascript-binding/es-exceptions/exceptions.html: Added.
+ * web-platform-tests/WebIDL/ecmascript-binding/has-instance-expected.txt: Added.
+ * web-platform-tests/WebIDL/ecmascript-binding/has-instance.html: Added.
+ * web-platform-tests/WebIDL/ecmascript-binding/interface-object-expected.txt: Added.
+ * web-platform-tests/WebIDL/ecmascript-binding/interface-object.html: Added.
+
+2016-08-05 Chris Dumez <cdumez@apple.com>
+
</ins><span class="cx"> Align Range.insertNode() input validation with the specification
</span><span class="cx"> https://bugs.webkit.org/show_bug.cgi?id=160624
</span><span class="cx">
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestsWebIDLecmascriptbindingesexceptionsDOMExceptionconstantsexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/WebIDL/ecmascript-binding/es-exceptions/DOMException-constants-expected.txt (0 => 204219)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/WebIDL/ecmascript-binding/es-exceptions/DOMException-constants-expected.txt         (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/WebIDL/ecmascript-binding/es-exceptions/DOMException-constants-expected.txt        2016-08-06 05:34:57 UTC (rev 204219)
</span><span class="lines">@@ -0,0 +1,53 @@
</span><ins>+
+PASS DOMException constants
+PASS Constant INDEX_SIZE_ERR on DOMException constructor object
+PASS Constant INDEX_SIZE_ERR on DOMException prototype object
+PASS Constant DOMSTRING_SIZE_ERR on DOMException constructor object
+PASS Constant DOMSTRING_SIZE_ERR on DOMException prototype object
+PASS Constant HIERARCHY_REQUEST_ERR on DOMException constructor object
+PASS Constant HIERARCHY_REQUEST_ERR on DOMException prototype object
+PASS Constant WRONG_DOCUMENT_ERR on DOMException constructor object
+PASS Constant WRONG_DOCUMENT_ERR on DOMException prototype object
+PASS Constant INVALID_CHARACTER_ERR on DOMException constructor object
+PASS Constant INVALID_CHARACTER_ERR on DOMException prototype object
+PASS Constant NO_DATA_ALLOWED_ERR on DOMException constructor object
+PASS Constant NO_DATA_ALLOWED_ERR on DOMException prototype object
+PASS Constant NO_MODIFICATION_ALLOWED_ERR on DOMException constructor object
+PASS Constant NO_MODIFICATION_ALLOWED_ERR on DOMException prototype object
+PASS Constant NOT_FOUND_ERR on DOMException constructor object
+PASS Constant NOT_FOUND_ERR on DOMException prototype object
+PASS Constant NOT_SUPPORTED_ERR on DOMException constructor object
+PASS Constant NOT_SUPPORTED_ERR on DOMException prototype object
+PASS Constant INUSE_ATTRIBUTE_ERR on DOMException constructor object
+PASS Constant INUSE_ATTRIBUTE_ERR on DOMException prototype object
+PASS Constant INVALID_STATE_ERR on DOMException constructor object
+PASS Constant INVALID_STATE_ERR on DOMException prototype object
+PASS Constant SYNTAX_ERR on DOMException constructor object
+PASS Constant SYNTAX_ERR on DOMException prototype object
+PASS Constant INVALID_MODIFICATION_ERR on DOMException constructor object
+PASS Constant INVALID_MODIFICATION_ERR on DOMException prototype object
+PASS Constant NAMESPACE_ERR on DOMException constructor object
+PASS Constant NAMESPACE_ERR on DOMException prototype object
+PASS Constant INVALID_ACCESS_ERR on DOMException constructor object
+PASS Constant INVALID_ACCESS_ERR on DOMException prototype object
+PASS Constant VALIDATION_ERR on DOMException constructor object
+PASS Constant VALIDATION_ERR on DOMException prototype object
+PASS Constant TYPE_MISMATCH_ERR on DOMException constructor object
+PASS Constant TYPE_MISMATCH_ERR on DOMException prototype object
+PASS Constant SECURITY_ERR on DOMException constructor object
+PASS Constant SECURITY_ERR on DOMException prototype object
+PASS Constant NETWORK_ERR on DOMException constructor object
+PASS Constant NETWORK_ERR on DOMException prototype object
+PASS Constant ABORT_ERR on DOMException constructor object
+PASS Constant ABORT_ERR on DOMException prototype object
+PASS Constant URL_MISMATCH_ERR on DOMException constructor object
+PASS Constant URL_MISMATCH_ERR on DOMException prototype object
+PASS Constant QUOTA_EXCEEDED_ERR on DOMException constructor object
+PASS Constant QUOTA_EXCEEDED_ERR on DOMException prototype object
+PASS Constant TIMEOUT_ERR on DOMException constructor object
+PASS Constant TIMEOUT_ERR on DOMException prototype object
+PASS Constant INVALID_NODE_TYPE_ERR on DOMException constructor object
+PASS Constant INVALID_NODE_TYPE_ERR on DOMException prototype object
+PASS Constant DATA_CLONE_ERR on DOMException constructor object
+PASS Constant DATA_CLONE_ERR on DOMException prototype object
+
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestsWebIDLecmascriptbindingesexceptionsDOMExceptionconstantshtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/WebIDL/ecmascript-binding/es-exceptions/DOMException-constants.html (0 => 204219)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/WebIDL/ecmascript-binding/es-exceptions/DOMException-constants.html         (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/WebIDL/ecmascript-binding/es-exceptions/DOMException-constants.html        2016-08-06 05:34:57 UTC (rev 204219)
</span><span class="lines">@@ -0,0 +1,59 @@
</span><ins>+<!doctype html>
+<meta charset=utf-8>
+<title>DOMException constants</title>
+<link rel=help href="https://heycam.github.io/webidl/#es-DOMException-constructor-object">
+<link rel=help href="https://heycam.github.io/webidl/#es-DOMException-prototype-object">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id="log"></div>
+<script>
+test(function() {
+ // https://www.w3.org/Bugs/Public/show_bug.cgi?id=27732
+ var constants = [
+ "INDEX_SIZE_ERR",
+ "DOMSTRING_SIZE_ERR",
+ "HIERARCHY_REQUEST_ERR",
+ "WRONG_DOCUMENT_ERR",
+ "INVALID_CHARACTER_ERR",
+ "NO_DATA_ALLOWED_ERR",
+ "NO_MODIFICATION_ALLOWED_ERR",
+ "NOT_FOUND_ERR",
+ "NOT_SUPPORTED_ERR",
+ "INUSE_ATTRIBUTE_ERR",
+ "INVALID_STATE_ERR",
+ "SYNTAX_ERR",
+ "INVALID_MODIFICATION_ERR",
+ "NAMESPACE_ERR",
+ "INVALID_ACCESS_ERR",
+ "VALIDATION_ERR",
+ "TYPE_MISMATCH_ERR",
+ "SECURITY_ERR",
+ "NETWORK_ERR",
+ "ABORT_ERR",
+ "URL_MISMATCH_ERR",
+ "QUOTA_EXCEEDED_ERR",
+ "TIMEOUT_ERR",
+ "INVALID_NODE_TYPE_ERR",
+ "DATA_CLONE_ERR"
+ ]
+ var objects = [
+ [DOMException, "DOMException constructor object"],
+ [DOMException.prototype, "DOMException prototype object"]
+ ]
+ constants.forEach(function(name, i) {
+ objects.forEach(function(o) {
+ var object = o[0], description = o[1];
+ test(function() {
+ assert_equals(object[name], i + 1, name)
+ assert_own_property(object, name)
+ var pd = Object.getOwnPropertyDescriptor(object, name)
+ assert_false("get" in pd, "property has getter")
+ assert_false("set" in pd, "property has setter")
+ assert_false(pd.writable, "not writable")
+ assert_true(pd.enumerable, "enumerable")
+ assert_false(pd.configurable, "not configurable")
+ }, "Constant " + name + " on " + description)
+ })
+ })
+})
+</script>
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestsWebIDLecmascriptbindingesexceptionsDOMExceptionconstructorexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/WebIDL/ecmascript-binding/es-exceptions/DOMException-constructor-expected.txt (0 => 204219)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/WebIDL/ecmascript-binding/es-exceptions/DOMException-constructor-expected.txt         (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/WebIDL/ecmascript-binding/es-exceptions/DOMException-constructor-expected.txt        2016-08-06 05:34:57 UTC (rev 204219)
</span><span class="lines">@@ -0,0 +1,35 @@
</span><ins>+
+PASS new DOMException()
+FAIL new DOMException(): own-ness assert_false: The name property should be inherited expected false got true
+PASS new DOMException(null)
+PASS new DOMException(undefined)
+FAIL new DOMException(undefined): own-ness assert_false: The name property should be inherited expected false got true
+PASS new DOMException("foo")
+FAIL new DOMException("foo"): own-ness assert_false: The name property should be inherited expected false got true
+PASS new DOMException("bar", undefined)
+PASS new DOMException("bar", "NotSupportedError")
+PASS new DOMException("bar", "NotSupportedError"): own-ness
+PASS new DOMException("bar", "foo")
+PASS new DOMexception("msg", "IndexSizeError")
+PASS new DOMexception("msg", "HierarchyRequestError")
+PASS new DOMexception("msg", "WrongDocumentError")
+PASS new DOMexception("msg", "InvalidCharacterError")
+PASS new DOMexception("msg", "NoModificationAllowedError")
+PASS new DOMexception("msg", "NotFoundError")
+PASS new DOMexception("msg", "NotSupportedError")
+PASS new DOMexception("msg", "InUseAttributeError")
+PASS new DOMexception("msg", "InvalidStateError")
+PASS new DOMexception("msg", "SyntaxError")
+PASS new DOMexception("msg", "InvalidModificationError")
+PASS new DOMexception("msg", "NamespaceError")
+PASS new DOMexception("msg", "InvalidAccessError")
+PASS new DOMexception("msg", "SecurityError")
+PASS new DOMexception("msg", "NetworkError")
+PASS new DOMexception("msg", "AbortError")
+PASS new DOMexception("msg", "URLMismatchError")
+PASS new DOMexception("msg", "QuotaExceededError")
+PASS new DOMexception("msg", "TimeoutError")
+PASS new DOMexception("msg", "InvalidNodeTypeError")
+PASS new DOMexception("msg", "DataCloneError")
+PASS new DOMException("bar", "UnknownError")
+
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestsWebIDLecmascriptbindingesexceptionsDOMExceptionconstructorhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/WebIDL/ecmascript-binding/es-exceptions/DOMException-constructor.html (0 => 204219)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/WebIDL/ecmascript-binding/es-exceptions/DOMException-constructor.html         (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/WebIDL/ecmascript-binding/es-exceptions/DOMException-constructor.html        2016-08-06 05:34:57 UTC (rev 204219)
</span><span class="lines">@@ -0,0 +1,139 @@
</span><ins>+<!doctype html>
+<meta charset=utf-8>
+<title>DOMException constructor</title>
+<link rel=help href="https://heycam.github.io/webidl/#es-DOMException-constructor-object">
+<link rel=help href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-error.prototype.message">
+<link rel=help href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-error.prototype.name">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id="log"></div>
+<script>
+test(function() {
+ var ex = new DOMException();
+ assert_equals(ex.name, "Error",
+ "Not passing a name should end up with 'Error' as the name");
+ assert_equals(ex.message, "",
+ "Not passing a message should end up with empty string as the message");
+}, 'new DOMException()');
+
+test(function() {
+ var ex = new DOMException();
+ assert_false(ex.hasOwnProperty("name"),
+ "The name property should be inherited");
+ assert_false(ex.hasOwnProperty("message"),
+ "The message property should be inherited");
+}, 'new DOMException(): own-ness');
+
+test(function() {
+ var ex = new DOMException(null);
+ assert_equals(ex.name, "Error",
+ "Not passing a name should end up with 'Error' as the name");
+ assert_equals(ex.message, "null",
+ "Passing null as message should end up with stringified 'null' as the message");
+}, 'new DOMException(null)');
+
+test(function() {
+ var ex = new DOMException(undefined);
+ assert_equals(ex.name, "Error",
+ "Not passing a name should end up with 'Error' as the name");
+ assert_equals(ex.message, "",
+ "Not passing a message should end up with empty string as the message");
+}, 'new DOMException(undefined)');
+
+test(function() {
+ var ex = new DOMException(undefined);
+ assert_false(ex.hasOwnProperty("name"),
+ "The name property should be inherited");
+ assert_false(ex.hasOwnProperty("message"),
+ "The message property should be inherited");
+}, 'new DOMException(undefined): own-ness');
+
+test(function() {
+ var ex = new DOMException("foo");
+ assert_equals(ex.name, "Error",
+ "Not passing a name should still end up with 'Error' as the name");
+ assert_equals(ex.message, "foo", "Should be using passed-in message");
+}, 'new DOMException("foo")');
+
+test(function() {
+ var ex = new DOMException("foo");
+ assert_false(ex.hasOwnProperty("name"),
+ "The name property should be inherited");
+ assert_true(ex.hasOwnProperty("message"),
+ "The message property should be own");
+}, 'new DOMException("foo"): own-ness');
+
+test(function() {
+ var ex = new DOMException("bar", undefined);
+ assert_equals(ex.name, "Error",
+ "Passing undefined for name should end up with 'Error' as the name");
+ assert_equals(ex.message, "bar", "Should still be using passed-in message");
+}, 'new DOMException("bar", undefined)');
+
+test(function() {
+ var ex = new DOMException("bar", "NotSupportedError");
+ assert_equals(ex.name, "NotSupportedError", "Should be using the passed-in name");
+ assert_equals(ex.message, "bar", "Should still be using passed-in message");
+ assert_equals(ex.code, DOMException.NOT_SUPPORTED_ERR,
+ "Should have the right exception code");
+}, 'new DOMException("bar", "NotSupportedError")');
+
+test(function() {
+ var ex = new DOMException("bar", "NotSupportedError");
+ assert_true(ex.hasOwnProperty("name"),
+ "The name property should be own");
+ assert_true(ex.hasOwnProperty("message"),
+ "The message property should be own");
+}, 'new DOMException("bar", "NotSupportedError"): own-ness');
+
+test(function() {
+ var ex = new DOMException("bar", "foo");
+ assert_equals(ex.name, "foo", "Should be using the passed-in name");
+ assert_equals(ex.message, "bar", "Should still be using passed-in message");
+ assert_equals(ex.code, 0,
+ "Should have 0 for code for a name not in the exception names table");
+}, 'new DOMException("bar", "foo")');
+
+[
+ {name: "IndexSizeError", code: 1},
+ {name: "HierarchyRequestError", code: 3},
+ {name: "WrongDocumentError", code: 4},
+ {name: "InvalidCharacterError", code: 5},
+ {name: "NoModificationAllowedError", code: 7},
+ {name: "NotFoundError", code: 8},
+ {name: "NotSupportedError", code: 9},
+ {name: "InUseAttributeError", code: 10},
+ {name: "InvalidStateError", code: 11},
+ {name: "SyntaxError", code: 12},
+ {name: "InvalidModificationError", code: 13},
+ {name: "NamespaceError", code: 14},
+ {name: "InvalidAccessError", code: 15},
+ {name: "SecurityError", code: 18},
+ {name: "NetworkError", code: 19},
+ {name: "AbortError", code: 20},
+ {name: "URLMismatchError", code: 21},
+ {name: "QuotaExceededError", code: 22},
+ {name: "TimeoutError", code: 23},
+ {name: "InvalidNodeTypeError", code: 24},
+ {name: "DataCloneError", code: 25}
+].forEach(function(test_case) {
+ test(function() {
+ var ex = new DOMException("msg", test_case.name);
+ assert_equals(ex.name, test_case.name,
+ "Should be using the passed-in name");
+ assert_equals(ex.message, "msg",
+ "Should be using the passed-in message");
+ assert_equals(ex.code, test_case.code,
+ "Should have matching legacy code from error names table");
+ },'new DOMexception("msg", "' + test_case.name + '")');
+});
+
+test(function() {
+ var ex = new DOMException("bar", "UnknownError");
+ assert_equals(ex.name, "UnknownError", "Should be using the passed-in name");
+ assert_equals(ex.message, "bar", "Should still be using passed-in message");
+ assert_equals(ex.code, 0,
+ "Should have 0 for code for a name in the exception names table with no legacy code");
+}, 'new DOMException("bar", "UnknownError")');
+
+</script>
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestsWebIDLecmascriptbindingesexceptionsconstructorobjectexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/WebIDL/ecmascript-binding/es-exceptions/constructor-object-expected.txt (0 => 204219)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/WebIDL/ecmascript-binding/es-exceptions/constructor-object-expected.txt         (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/WebIDL/ecmascript-binding/es-exceptions/constructor-object-expected.txt        2016-08-06 05:34:57 UTC (rev 204219)
</span><span class="lines">@@ -0,0 +1,10 @@
</span><ins>+
+FAIL existence and properties of DOMException assert_equals: prototype of self's property "DOMException" is not Error expected function "function Error() {
+ [native code]
+}" but got function "function () {
+ [native code]
+}"
+PASS existence and properties of DOMException.prototype
+PASS existence of name and code properties on DOMException.prototype
+PASS existence and properties of exception interface prototype object's "constructor" property
+
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestsWebIDLecmascriptbindingesexceptionsconstructorobjecthtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/WebIDL/ecmascript-binding/es-exceptions/constructor-object.html (0 => 204219)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/WebIDL/ecmascript-binding/es-exceptions/constructor-object.html         (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/WebIDL/ecmascript-binding/es-exceptions/constructor-object.html        2016-08-06 05:34:57 UTC (rev 204219)
</span><span class="lines">@@ -0,0 +1,11 @@
</span><ins>+<!doctype html>
+<meta charset=utf-8>
+<title>DOMException constructor and prototype object</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src=constructor-object.js></script>
+<div id="log"></div>
+<script>
+setup({ explicit_done: true })
+run_test()
+</script>
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestsWebIDLecmascriptbindingesexceptionsconstructorobjectjs"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/WebIDL/ecmascript-binding/es-exceptions/constructor-object.js (0 => 204219)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/WebIDL/ecmascript-binding/es-exceptions/constructor-object.js         (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/WebIDL/ecmascript-binding/es-exceptions/constructor-object.js        2016-08-06 05:34:57 UTC (rev 204219)
</span><span class="lines">@@ -0,0 +1,111 @@
</span><ins>+function run_test() {
+ test(function() {
+ // "There MUST exist a property on the ECMAScript global object whose
+ // name is “DOMException” and value is an object called the
+ // DOMException constructor object, which provides access to legacy
+ // DOMException code constants. The property has the attributes
+ // { [[Writable]]: true, [[Enumerable]]: false,
+ // [[Configurable]]: true }."
+ assert_own_property(self, "DOMException",
+ "self does not have own property \"DOMException\"");
+ var desc = Object.getOwnPropertyDescriptor(self, "DOMException");
+ assert_false("get" in desc, "self's property \"DOMException\" has getter");
+ assert_false("set" in desc, "self's property \"DOMException\" has setter");
+ assert_true(desc.writable, "self's property \"DOMException\" is not writable");
+ assert_false(desc.enumerable, "self's property \"DOMException\" is enumerable");
+ assert_true(desc.configurable, "self's property \"DOMException\" is not configurable");
+
+ // "The DOMException constructor object MUST be a function object but
+ // with a [[Prototype]] value of %Error% ([ECMA-262], section 6.1.7.4)."
+ assert_equals(Object.getPrototypeOf(self.DOMException), Error,
+ "prototype of self's property \"DOMException\" is not Error");
+
+ // "Its [[Get]] internal property is set as described in ECMA-262
+ // section 9.1.8."
+ // Not much to test for this.
+ // "Its [[Construct]] internal property is set as described in ECMA-262
+ // section 19.2.2.3."
+ // "Its @@hasInstance property is set as described in ECMA-262 section
+ // 19.2.3.8, unless otherwise specified."
+
+ // String() returns something implementation-dependent, because it
+ // calls Function#toString.
+ assert_class_string(self.DOMException, "Function",
+ "class string of DOMException");
+
+ // "For every legacy code listed in the error names table, there MUST
+ // be a property on the DOMException constructor object whose name and
+ // value are as indicated in the table. The property has attributes
+ // { [[Writable]]: false, [[Enumerable]]: true,
+ // [[Configurable]]: false }."
+ // See DOMException-constants.html.
+ }, "existence and properties of DOMException");
+
+ test(function() {
+ assert_own_property(self, "DOMException",
+ "self does not have own property \"DOMException\"");
+
+ // "The DOMException constructor object MUST also have a property named
+ // “prototype” with attributes { [[Writable]]: false,
+ // [[Enumerable]]: false, [[Configurable]]: false } whose value is an
+ // object called the DOMException prototype object. This object also
+ // provides access to the legacy code values."
+ assert_own_property(self.DOMException, "prototype",
+ 'exception "DOMException" does not have own property "prototype"');
+ var desc = Object.getOwnPropertyDescriptor(self.DOMException, "prototype");
+ assert_false("get" in desc, "DOMException.prototype has getter");
+ assert_false("set" in desc, "DOMException.prototype has setter");
+ assert_false(desc.writable, "DOMException.prototype is writable");
+ assert_false(desc.enumerable, "DOMException.prototype is enumerable");
+ assert_false(desc.configurable, "DOMException.prototype is configurable");
+
+ // "The DOMException prototype object MUST have an internal
+ // [[Prototype]] property whose value is %ErrorPrototype% ([ECMA-262],
+ // section 6.1.7.4)."
+ assert_own_property(self, "Error",
+ 'should inherit from Error, but self has no such property');
+ assert_own_property(self.Error, "prototype",
+ 'should inherit from Error, but that object has no "prototype" property');
+ assert_equals(Object.getPrototypeOf(self.DOMException.prototype),
+ self.Error.prototype,
+ 'prototype of DOMException.prototype is not Error.prototype');
+
+ // "The class string of the DOMException prototype object is
+ // “DOMExceptionPrototype”."
+ assert_class_string(self.DOMException.prototype, "DOMExceptionPrototype",
+ "class string of DOMException.prototype");
+ }, "existence and properties of DOMException.prototype");
+
+ test(function() {
+ assert_false(self.DOMException.prototype.hasOwnProperty("name"),
+ "DOMException.prototype should not have an own \"name\" " +
+ "property.");
+ assert_false(self.DOMException.prototype.hasOwnProperty("code"),
+ "DOMException.prototype should not have an own \"name\" " +
+ "property.");
+ }, "existence of name and code properties on DOMException.prototype");
+
+ test(function() {
+ assert_own_property(self, "DOMException",
+ "self does not have own property \"DOMException\"");
+ assert_own_property(self.DOMException, "prototype",
+ 'interface "DOMException" does not have own property "prototype"');
+
+ // "There MUST be a property named “constructor” on the DOMException
+ // prototype object with attributes { [[Writable]]: true,
+ // [[Enumerable]]: false, [[Configurable]]: true } and whose value is
+ // the DOMException constructor object."
+ assert_own_property(self.DOMException.prototype, "constructor",
+ "DOMException" + '.prototype does not have own property "constructor"');
+ var desc = Object.getOwnPropertyDescriptor(self.DOMException.prototype, "constructor");
+ assert_false("get" in desc, "DOMException.prototype.constructor has getter");
+ assert_false("set" in desc, "DOMException.prototype.constructor has setter");
+ assert_true(desc.writable, "DOMException.prototype.constructor is not writable");
+ assert_false(desc.enumerable, "DOMException.prototype.constructor is enumerable");
+ assert_true(desc.configurable, "DOMException.prototype.constructor in not configurable");
+ assert_equals(self.DOMException.prototype.constructor, self.DOMException,
+ "DOMException.prototype.constructor is not the same object as DOMException");
+ }, "existence and properties of exception interface prototype object's \"constructor\" property");
+
+ done();
+}
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestsWebIDLecmascriptbindingesexceptionsconstructorobjectworkerjs"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/WebIDL/ecmascript-binding/es-exceptions/constructor-object.worker.js (0 => 204219)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/WebIDL/ecmascript-binding/es-exceptions/constructor-object.worker.js         (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/WebIDL/ecmascript-binding/es-exceptions/constructor-object.worker.js        2016-08-06 05:34:57 UTC (rev 204219)
</span><span class="lines">@@ -0,0 +1,3 @@
</span><ins>+importScripts("/resources/testharness.js")
+importScripts("constructor-object.js")
+run_test();
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestsWebIDLecmascriptbindingesexceptionsexceptionsexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/WebIDL/ecmascript-binding/es-exceptions/exceptions-expected.txt (0 => 204219)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/WebIDL/ecmascript-binding/es-exceptions/exceptions-expected.txt         (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/WebIDL/ecmascript-binding/es-exceptions/exceptions-expected.txt        2016-08-06 05:34:57 UTC (rev 204219)
</span><span class="lines">@@ -0,0 +1,20 @@
</span><ins>+
+PASS Object.getPrototypeOf(exception) === DOMException.prototype
+PASS exception.hasOwnProperty("name")
+PASS exception.name === "HierarchyRequestError"
+FAIL Object.getOwnPropertyDescriptor(exception, "name") assert_true: must be writable expected true got undefined
+FAIL Object.getOwnPropertyDescriptor(exception, "message") assert_true: must be writable expected true got undefined
+PASS typeof exception.message === "string"
+PASS Object.prototype.toString.call(exception) === "[object DOMException]"
+PASS exception.code === DOMException.HIERARCHY_REQUEST_ERR
+FAIL Object.getOwnPropertyDescriptor(exception, "code") assert_true: must be writable expected true got undefined
+PASS In iframe: Object.getPrototypeOf(exception) === DOMException.prototype
+PASS In iframe: exception.hasOwnProperty("name")
+PASS In iframe: exception.name === "HierarchyRequestError"
+FAIL In iframe: Object.getOwnPropertyDescriptor(exception, "name") assert_true: must be writable expected true got undefined
+FAIL In iframe: Object.getOwnPropertyDescriptor(exception, "message") assert_true: must be writable expected true got undefined
+PASS In iframe: typeof exception.message === "string"
+PASS In iframe: Object.prototype.toString.call(exception) === "[object DOMException]"
+PASS In iframe: exception.code === DOMException.HIERARCHY_REQUEST_ERR
+FAIL In iframe: Object.getOwnPropertyDescriptor(exception, "code") assert_true: must be writable expected true got undefined
+
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestsWebIDLecmascriptbindingesexceptionsexceptionshtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/WebIDL/ecmascript-binding/es-exceptions/exceptions.html (0 => 204219)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/WebIDL/ecmascript-binding/es-exceptions/exceptions.html         (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/WebIDL/ecmascript-binding/es-exceptions/exceptions.html        2016-08-06 05:34:57 UTC (rev 204219)
</span><span class="lines">@@ -0,0 +1,136 @@
</span><ins>+<!doctype html>
+<title>DOMException-throwing tests</title>
+<link rel=author title="Aryeh Gregor" href=ayg@aryeh.name>
+<div id=log></div>
+<script src=/resources/testharness.js></script>
+<script src=/resources/testharnessreport.js></script>
+<script>
+/**
+ * This file just picks one case where browsers are supposed to throw an
+ * exception, and tests the heck out of whether it meets the spec. In the
+ * future, all these checks should be in assert_throws(), but we don't want
+ * every browser failing every assert_throws() check until they fix every
+ * single bug in their exception-throwing.
+ *
+ * We don't go out of our way to test everything that's already tested by
+ * interfaces.html, like whether all constants are present on the object, but
+ * some things are duplicated.
+ */
+setup({explicit_done: true});
+
+function testException(exception, global, desc) {
+ // https://heycam.github.io/webidl/#es-exception-objects
+ // (as of 2015-01-03): "The value of the internal [[Prototype]] property of a
+ // DOMException object MUST be the DOMException prototype object from the
+ // global environment the exception object is associated with."
+ test(function() {
+ assert_equals(global.Object.getPrototypeOf(exception),
+ global.DOMException.prototype);
+ }, desc + "Object.getPrototypeOf(exception) === DOMException.prototype");
+
+
+ // https://heycam.github.io/webidl/#es-creating-throwing-exceptions
+ // (as of 2015-01-03): "Call the [[DefineOwnProperty]] internal method of /O/
+ // passing “name”, Property Descriptor { [[Value]]: /N/, [[Writable]]: true,
+ // [[Enumerable]]: true, [[Configurable]]: true }, and false as arguments."
+ test(function() {
+ assert_true(exception.hasOwnProperty("name"));
+ }, desc + "exception.hasOwnProperty(\"name\")");
+
+ test(function() {
+ assert_equals(exception.name, "HierarchyRequestError");
+ }, desc + "exception.name === \"HierarchyRequestError\"");
+
+ test(function() {
+ var desc = global.Object.getOwnPropertyDescriptor(exception, "name");
+ assert_true(desc.writable, "must be writable");
+ assert_true(desc.enumerable, "must be enumerable");
+ assert_true(desc.configurable, "must be configurable");
+ }, desc + "Object.getOwnPropertyDescriptor(exception, \"name\")");
+
+
+ // https://heycam.github.io/webidl/#es-creating-throwing-exceptions
+ // (as of 2015-01-03): "If the optional user agent-defined message /M/ was
+ // specified, then this list has a single element whose value is the result
+ // of converting /M/ to a String value. Otherwise, the list is empty."
+ //
+ // https://heycam.github.io/webidl/#es-DOMException-constructor-object
+ // (as of 2015-01-03): "Call the [[DefineOwnProperty]] internal method of /O/
+ // passing “message”, Property Descriptor { [[Value]]: /S/,
+ // [[Writable]]: true, [[Enumerable]]: false, [[Configurable]]: true }, and
+ // false as arguments."
+ test(function() {
+ if (exception.hasOwnProperty("message")) {
+ var desc = global.Object.getOwnPropertyDescriptor(exception, "message");
+ assert_true(desc.writable, "must be writable");
+ assert_false(desc.enumerable, "must not be enumerable");
+ assert_true(desc.configurable, "must be configurable");
+ }
+ }, desc + "Object.getOwnPropertyDescriptor(exception, \"message\")");
+
+ test(function() {
+ if (exception.hasOwnProperty("message")) {
+ // Can't test anything more specific, since it's implementation-defined :(
+ assert_equals(typeof exception.message, "string");
+ } else {
+ // Error.prototype.message
+ assert_equals(exception.message, "");
+ }
+ }, desc + "typeof exception.message === \"string\"");
+
+
+ // https://heycam.github.io/webidl/#es-exception-objects
+ // (as of 2015-01-03): "The class string of a DOMException object MUST be
+ // “DOMException”."
+ test(function() {
+ assert_equals(global.Object.prototype.toString.call(exception),
+ "[object DOMException]");
+ }, desc + "Object.prototype.toString.call(exception) === \"[object DOMException]\"");
+
+
+ // https://heycam.github.io/webidl/#es-creating-throwing-exceptions
+ // (as of 2015-01-03): "Call the [[DefineOwnProperty]] internal method of /O/
+ // passing “code”, Property Descriptor { [[Value]]: /code/,
+ // [[Writable]]: true, [[Enumerable]]: true, [[Configurable]]: true }, and
+ // false as arguments."
+ test(function() {
+ assert_equals(exception.code, global.DOMException.HIERARCHY_REQUEST_ERR);
+ }, desc + "exception.code === DOMException.HIERARCHY_REQUEST_ERR");
+
+ test(function() {
+ var desc = global.Object.getOwnPropertyDescriptor(exception, "name");
+ assert_true(desc.writable, "must be writable");
+ assert_true(desc.enumerable, "must be enumerable");
+ assert_true(desc.configurable, "must be configurable");
+ }, desc + "Object.getOwnPropertyDescriptor(exception, \"code\")");
+}
+
+
+// Test in current window
+var exception = null;
+try {
+ // This should throw a HierarchyRequestError in every browser since the
+ // Stone Age, so we're really only testing exception-throwing details.
+ document.documentElement.appendChild(document);
+} catch(e) {
+ exception = e;
+}
+testException(exception, window, "");
+
+// Test in iframe
+var iframe = document.createElement("iframe");
+iframe.src = "about:blank";
+iframe.onload = function() {
+ var exception = null;
+ try {
+ iframe.contentDocument.documentElement.appendChild(iframe.contentDocument);
+ } catch(e) {
+ exception = e;
+ }
+ testException(exception, iframe.contentWindow, "In iframe: ");
+
+ document.body.removeChild(iframe);
+ done();
+};
+document.body.appendChild(iframe);
+</script>
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestsWebIDLecmascriptbindinghasinstanceexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/WebIDL/ecmascript-binding/has-instance-expected.txt (0 => 204219)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/WebIDL/ecmascript-binding/has-instance-expected.txt         (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/WebIDL/ecmascript-binding/has-instance-expected.txt        2016-08-06 05:34:57 UTC (rev 204219)
</span><span class="lines">@@ -0,0 +1,3 @@
</span><ins>+
+PASS Manually-constructed prototype chains are correctly handled by instanceof
+
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestsWebIDLecmascriptbindinghasinstancehtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/WebIDL/ecmascript-binding/has-instance.html (0 => 204219)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/WebIDL/ecmascript-binding/has-instance.html         (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/WebIDL/ecmascript-binding/has-instance.html        2016-08-06 05:34:57 UTC (rev 204219)
</span><span class="lines">@@ -0,0 +1,13 @@
</span><ins>+<!doctype html>
+<meta charset="utf-8">
+<title></title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script>
+test(function() {
+ var obj = Object.create(Element.prototype);
+ assert_true(obj instanceof Element);
+ assert_true(obj instanceof Node);
+ assert_false(obj instanceof Attr);
+}, "Manually-constructed prototype chains are correctly handled by instanceof");
+</script>
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestsWebIDLecmascriptbindinginterfaceobjectexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/WebIDL/ecmascript-binding/interface-object-expected.txt (0 => 204219)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/WebIDL/ecmascript-binding/interface-object-expected.txt         (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/WebIDL/ecmascript-binding/interface-object-expected.txt        2016-08-06 05:34:57 UTC (rev 204219)
</span><span class="lines">@@ -0,0 +1,6 @@
</span><ins>+
+PASS An interface object deleted after it has been accessed is undefined
+PASS An interface object deleted before it has been defined is undefined
+PASS Interface objects deleted multiple times stay deleted
+PASS Fancy property names don't break the resolve hook on Window
+
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestsWebIDLecmascriptbindinginterfaceobjecthtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/WebIDL/ecmascript-binding/interface-object.html (0 => 204219)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/WebIDL/ecmascript-binding/interface-object.html         (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/WebIDL/ecmascript-binding/interface-object.html        2016-08-06 05:34:57 UTC (rev 204219)
</span><span class="lines">@@ -0,0 +1,28 @@
</span><ins>+<!doctype html>
+<meta charset="utf-8">
+<title>Interface objects</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script>
+test(function () {
+ assert_equals(typeof window.Blob, "function")
+ delete window.Blob;
+ assert_equals(window.Blob, undefined);
+}, "An interface object deleted after it has been accessed is undefined");
+
+test(function () {
+ delete window.File;
+ assert_equals(window.File, undefined);
+}, "An interface object deleted before it has been defined is undefined");
+
+test(function () {
+ delete window.ImageData;
+ assert_equals(Object.getOwnPropertyDescriptor(window, "ImageData"), undefined);
+ delete window.ImageData;
+ assert_equals(Object.getOwnPropertyDescriptor(window, "ImageData"), undefined);
+}, "Interface objects deleted multiple times stay deleted");
+
+test(function () {
+ assert_equals(window["abc\udc88"], undefined);
+}, "Fancy property names don't break the resolve hook on Window");
+</script>
</ins></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (204218 => 204219)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-08-06 03:48:10 UTC (rev 204218)
+++ trunk/Source/WebCore/ChangeLog        2016-08-06 05:34:57 UTC (rev 204219)
</span><span class="lines">@@ -1,5 +1,31 @@
</span><span class="cx"> 2016-08-05 Chris Dumez <cdumez@apple.com>
</span><span class="cx">
</span><ins>+ DOMException should be constructible
+ https://bugs.webkit.org/show_bug.cgi?id=160626
+
+ Reviewed by Darin Adler.
+
+ DOMException should be constructible:
+ - http://heycam.github.io/webidl/#dfn-DOMException
+ - http://heycam.github.io/webidl/#es-DOMException-constructor-object
+
+ DOMException already has a constructor in Firefox and Chrome so this
+ aligns our behavior with other browsers.
+
+ Test: imported/w3c/web-platform-tests/WebIDL/ecmascript-binding/es-exceptions/DOMException-constructor.html
+
+ * dom/DOMCoreException.cpp:
+ (WebCore::errorCodeFromName):
+ (WebCore::DOMCoreException::create):
+ (WebCore::DOMCoreException::DOMCoreException):
+ * dom/DOMCoreException.h:
+ * dom/DOMCoreException.idl:
+ * dom/ExceptionBase.cpp:
+ (WebCore::ExceptionBase::ExceptionBase):
+ * dom/ExceptionBase.h:
+
+2016-08-05 Chris Dumez <cdumez@apple.com>
+
</ins><span class="cx"> Align Range.insertNode() input validation with the specification
</span><span class="cx"> https://bugs.webkit.org/show_bug.cgi?id=160624
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoredomDOMCoreExceptioncpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/DOMCoreException.cpp (204218 => 204219)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/DOMCoreException.cpp        2016-08-06 03:48:10 UTC (rev 204218)
+++ trunk/Source/WebCore/dom/DOMCoreException.cpp        2016-08-06 05:34:57 UTC (rev 204219)
</span><span class="lines">@@ -33,47 +33,68 @@
</span><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><ins>+// http://heycam.github.io/webidl/#idl-DOMException-error-names
</ins><span class="cx"> static const struct CoreException {
</span><span class="cx"> const char* const name;
</span><span class="cx"> const char* const description;
</span><ins>+ ExceptionCode code;
</ins><span class="cx"> } coreExceptions[] = {
</span><del>- { "IndexSizeError", "The index is not in the allowed range." },
- { 0, 0 }, // DOMStringSizeError
- { "HierarchyRequestError", "The operation would yield an incorrect node tree." },
- { "WrongDocumentError", "The object is in the wrong document." },
- { "InvalidCharacterError", "The string contains invalid characters." },
- { 0, 0 }, // NoDataAllowedError
- { "NoModificationAllowedError", "The object can not be modified." },
- { "NotFoundError", "The object can not be found here." },
- { "NotSupportedError", "The operation is not supported." },
- { "InUseAttributeError", "The attribute is in use." },
- { "InvalidStateError", "The object is in an invalid state." },
- { "SyntaxError", "The string did not match the expected pattern." },
- { "InvalidModificationError", " The object can not be modified in this way." },
- { "NamespaceError", "The operation is not allowed by Namespaces in XML." },
- { "InvalidAccessError", "The object does not support the operation or argument." },
- { 0, 0 }, // ValidationError
- { "TypeMismatchError", "The type of an object was incompatible with the expected type of the parameter associated to the object." },
- { "SecurityError", "The operation is insecure." },
- { "NetworkError", " A network error occurred." },
- { "AbortError", "The operation was aborted." },
- { "URLMismatchError", "The given URL does not match another URL." },
- { "QuotaExceededError", "The quota has been exceeded." },
- { "TimeoutError", "The operation timed out." },
- { "InvalidNodeTypeError", "The supplied node is incorrect or has an incorrect ancestor for this operation." },
- { "DataCloneError", "The object can not be cloned." },
- { "EncodingError", "The encoding operation (either encoded or decoding) failed." },
- { "NotReadableError", "The I/O read operation failed." },
- { "UnknownError", "The operation failed for an unknown transient reason (e.g. out of memory)." },
- { "ConstraintError", "A mutation operation in a transaction failed because a constraint was not satisfied." },
- { "DataError", "Provided data is inadequate." },
- { "TransactionInactiveError", "A request was placed against a transaction which is currently not active, or which is finished." },
- { "ReadOnlyError", "The mutating operation was attempted in a \"readonly\" transaction." },
- { "VersionError", "An attempt was made to open a database using a lower version than the existing version." },
- { "OperationError", "The operation failed for an operation-specific reason." },
- { "NotAllowedError", "The request is not allowed by the user agent or the platform in the current context, possibly because the user denied permission." }
</del><ins>+ { "IndexSizeError", "The index is not in the allowed range.", 1 },
+ { nullptr, nullptr, 0 }, // DOMStringSizeError
+ { "HierarchyRequestError", "The operation would yield an incorrect node tree.", 3 },
+ { "WrongDocumentError", "The object is in the wrong document.", 4 },
+ { "InvalidCharacterError", "The string contains invalid characters.", 5 },
+ { nullptr, nullptr, 0 }, // NoDataAllowedError
+ { "NoModificationAllowedError", "The object can not be modified.", 7 },
+ { "NotFoundError", "The object can not be found here.", 8 },
+ { "NotSupportedError", "The operation is not supported.", 9 },
+ { "InUseAttributeError", "The attribute is in use.", 10 },
+ { "InvalidStateError", "The object is in an invalid state.", 11 },
+ { "SyntaxError", "The string did not match the expected pattern.", 12 },
+ { "InvalidModificationError", " The object can not be modified in this way.", 13 },
+ { "NamespaceError", "The operation is not allowed by Namespaces in XML.", 14 },
+ { "InvalidAccessError", "The object does not support the operation or argument.", 15 },
+ { nullptr, nullptr, 0 }, // ValidationError
+ { "TypeMismatchError", "The type of an object was incompatible with the expected type of the parameter associated to the object.", 17 },
+ { "SecurityError", "The operation is insecure.", 18 },
+ { "NetworkError", " A network error occurred.", 19 },
+ { "AbortError", "The operation was aborted.", 20 },
+ { "URLMismatchError", "The given URL does not match another URL.", 21 },
+ { "QuotaExceededError", "The quota has been exceeded.", 22 },
+ { "TimeoutError", "The operation timed out.", 23 },
+ { "InvalidNodeTypeError", "The supplied node is incorrect or has an incorrect ancestor for this operation.", 24 },
+ { "DataCloneError", "The object can not be cloned.", 25 },
+ { "EncodingError", "The encoding operation (either encoded or decoding) failed.", 0 },
+ { "NotReadableError", "The I/O read operation failed.", 0 },
+ { "UnknownError", "The operation failed for an unknown transient reason (e.g. out of memory).", 0 },
+ { "ConstraintError", "A mutation operation in a transaction failed because a constraint was not satisfied.", 0 },
+ { "DataError", "Provided data is inadequate.", 0 },
+ { "TransactionInactiveError", "A request was placed against a transaction which is currently not active, or which is finished.", 0 },
+ { "ReadOnlyError", "The mutating operation was attempted in a \"readonly\" transaction.", 0 },
+ { "VersionError", "An attempt was made to open a database using a lower version than the existing version.", 0 },
+ { "OperationError", "The operation failed for an operation-specific reason.", 0 },
+ { "NotAllowedError", "The request is not allowed by the user agent or the platform in the current context, possibly because the user denied permission.", 0 }
</ins><span class="cx"> };
</span><span class="cx">
</span><ins>+static ExceptionCode errorCodeFromName(const String& name)
+{
+ for (auto& entry : coreExceptions) {
+ if (entry.name == name)
+ return entry.code;
+ }
+ return 0;
+}
+
+Ref<DOMCoreException> DOMCoreException::create(const String& message, const String& name)
+{
+ return adoptRef(*new DOMCoreException(errorCodeFromName(name), message, name));
+}
+
+DOMCoreException::DOMCoreException(ExceptionCode ec, const String& message, const String& name)
+ : ExceptionBase(ec, name, message, ASCIILiteral("DOM"))
+{
+}
+
</ins><span class="cx"> bool DOMCoreException::initializeDescription(ExceptionCode ec, ExceptionCodeDescription* description)
</span><span class="cx"> {
</span><span class="cx"> description->typeName = "DOM";
</span></span></pre></div>
<a id="trunkSourceWebCoredomDOMCoreExceptionh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/DOMCoreException.h (204218 => 204219)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/DOMCoreException.h        2016-08-06 03:48:10 UTC (rev 204218)
+++ trunk/Source/WebCore/dom/DOMCoreException.h        2016-08-06 05:34:57 UTC (rev 204219)
</span><span class="lines">@@ -39,10 +39,12 @@
</span><span class="cx"> {
</span><span class="cx"> return adoptRef(*new DOMCoreException(description));
</span><span class="cx"> }
</span><ins>+ static Ref<DOMCoreException> create(const String& message, const String& name);
</ins><span class="cx">
</span><span class="cx"> static bool initializeDescription(ExceptionCode, ExceptionCodeDescription*);
</span><span class="cx">
</span><span class="cx"> protected:
</span><ins>+ DOMCoreException(ExceptionCode, const String& message, const String& name);
</ins><span class="cx"> explicit DOMCoreException(const ExceptionCodeDescription& description)
</span><span class="cx"> : ExceptionBase(description)
</span><span class="cx"> {
</span></span></pre></div>
<a id="trunkSourceWebCoredomDOMCoreExceptionidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/DOMCoreException.idl (204218 => 204219)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/DOMCoreException.idl        2016-08-06 03:48:10 UTC (rev 204218)
+++ trunk/Source/WebCore/dom/DOMCoreException.idl        2016-08-06 05:34:57 UTC (rev 204219)
</span><span class="lines">@@ -27,6 +27,7 @@
</span><span class="cx"> */
</span><span class="cx">
</span><span class="cx"> [
</span><ins>+ Constructor(optional DOMString message = "", optional DOMString name = "Error"),
</ins><span class="cx"> DoNotCheckConstants,
</span><span class="cx"> Exposed=(Window,Worker),
</span><span class="cx"> InterfaceName=DOMException,
</span></span></pre></div>
<a id="trunkSourceWebCoredomExceptionBasecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/ExceptionBase.cpp (204218 => 204219)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/ExceptionBase.cpp        2016-08-06 03:48:10 UTC (rev 204218)
+++ trunk/Source/WebCore/dom/ExceptionBase.cpp        2016-08-06 05:34:57 UTC (rev 204219)
</span><span class="lines">@@ -41,6 +41,14 @@
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ExceptionBase::ExceptionBase(unsigned short code, const String& name, const String& message, const String& typeName)
+ : m_code(code)
+ , m_name(name)
+ , m_message(message)
+ , m_typeName(typeName)
+{
+}
+
</ins><span class="cx"> String ExceptionBase::toString() const
</span><span class="cx"> {
</span><span class="cx"> if (!m_toString.isEmpty())
</span></span></pre></div>
<a id="trunkSourceWebCoredomExceptionBaseh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/ExceptionBase.h (204218 => 204219)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/ExceptionBase.h        2016-08-06 03:48:10 UTC (rev 204218)
+++ trunk/Source/WebCore/dom/ExceptionBase.h        2016-08-06 05:34:57 UTC (rev 204219)
</span><span class="lines">@@ -47,6 +47,7 @@
</span><span class="cx">
</span><span class="cx"> protected:
</span><span class="cx"> explicit ExceptionBase(const ExceptionCodeDescription&);
</span><ins>+ ExceptionBase(unsigned short code, const String& name, const String& message, const String& typeName);
</ins><span class="cx">
</span><span class="cx"> private:
</span><span class="cx"> unsigned short m_code;
</span></span></pre>
</div>
</div>
</body>
</html>