<!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>[213081] 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/213081">213081</a></dd>
<dt>Author</dt> <dd>jiewen_tan@apple.com</dd>
<dt>Date</dt> <dd>2017-02-27 11:01:13 -0800 (Mon, 27 Feb 2017)</dd>
</dl>
<h3>Log Message</h3>
<pre>[CredentialManagement] Add IDL definitions for Credential, SiteBoundCredential, and PasswordCredential
https://bugs.webkit.org/show_bug.cgi?id=168616
<rdar://problem/30167149>
Reviewed by Daniel Bates.
Source/WebCore:
This patch adds IDL definitions for:
1. Credential(https://w3c.github.io/webappsec-credential-management/#interfaces-credential-types-credential),
2. SiteBoundCredential(https://w3c.github.io/webappsec-credential-management/#interfaces-credential-types-siteboundcredential), and
3. PasswordCredential(https://w3c.github.io/webappsec-credential-management/#interfaces-credential-types-passwordcredential).
Test: credentials/idlharness.html
* CMakeLists.txt:
* DerivedSources.make:
* Modules/credentials/BasicCredential.cpp: Added.
(WebCore::BasicCredential::BasicCredential):
(WebCore::BasicCredential::~BasicCredential):
(WebCore::BasicCredential::type):
* Modules/credentials/BasicCredential.h: Added.
(WebCore::BasicCredential::id):
* Modules/credentials/BasicCredential.idl: Added.
* Modules/credentials/CredentialData.h: Added.
* Modules/credentials/CredentialData.idl: Added.
* Modules/credentials/PasswordCredential.cpp: Added.
(WebCore::PasswordCredential::PasswordCredential):
(WebCore::PasswordCredential::PasswordCredential):
Dummy constructors for now.
* Modules/credentials/PasswordCredential.h: Added.
(WebCore::PasswordCredential::create):
(WebCore::PasswordCredential::create):
(WebCore::PasswordCredential::setIdName):
(WebCore::PasswordCredential::idName):
(WebCore::PasswordCredential::setPasswordName):
(WebCore::PasswordCredential::passwordName):
(WebCore::PasswordCredential::setAdditionalData):
(WebCore::PasswordCredential::additionalData):
* Modules/credentials/PasswordCredential.idl: Added.
* Modules/credentials/SiteBoundCredential.cpp: Added.
(WebCore::SiteBoundCredential::SiteBoundCredential):
(WebCore::SiteBoundCredential::~SiteBoundCredential):
* Modules/credentials/SiteBoundCredential.h: Added.
(WebCore::SiteBoundCredential::name):
(WebCore::SiteBoundCredential::iconURL):
(WebCore::SiteBoundCredential::setOrigin):
(WebCore::SiteBoundCredential::origin):
* Modules/credentials/SiteBoundCredential.idl: Added.
* Modules/credentials/SiteBoundCredentialData.h: Added.
* Modules/credentials/SiteBoundCredentialData.idl: Added.
* WebCore.xcodeproj/project.pbxproj:
LayoutTests:
* credentials/idlharness-expected.txt: Added.
* credentials/idlharness.html: Added.
* platform/mac-elcapitan/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:
* resources/WebIDLParser.js: Added.
* resources/idlharness.js: Renamed from LayoutTests/imported/w3c/resources/idlharness.js.
Removed LayoutTests/imported/w3c/resources/idlharness.js since it is not needed any more.
Added resources/idlharness.js for idl harness.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsplatformmacjsdomglobalconstructorsattributesexpectedtxt">trunk/LayoutTests/platform/mac/js/dom/global-constructors-attributes-expected.txt</a></li>
<li><a href="#trunkLayoutTestsplatformmacelcapitanjsdomglobalconstructorsattributesexpectedtxt">trunk/LayoutTests/platform/mac-elcapitan/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="#trunkSourceWebCoreCMakeListstxt">trunk/Source/WebCore/CMakeLists.txt</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</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>
</ul>
<h3>Added Paths</h3>
<ul>
<li>trunk/LayoutTests/credentials/</li>
<li><a href="#trunkLayoutTestscredentialsidlharnessexpectedtxt">trunk/LayoutTests/credentials/idlharness-expected.txt</a></li>
<li><a href="#trunkLayoutTestscredentialsidlharnesshtml">trunk/LayoutTests/credentials/idlharness.html</a></li>
<li><a href="#trunkLayoutTestsresourcesWebIDLParserjs">trunk/LayoutTests/resources/WebIDLParser.js</a></li>
<li><a href="#trunkLayoutTestsresourcesidlharnessjs">trunk/LayoutTests/resources/idlharness.js</a></li>
<li>trunk/Source/WebCore/Modules/credentials/</li>
<li><a href="#trunkSourceWebCoreModulescredentialsBasicCredentialcpp">trunk/Source/WebCore/Modules/credentials/BasicCredential.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulescredentialsBasicCredentialh">trunk/Source/WebCore/Modules/credentials/BasicCredential.h</a></li>
<li><a href="#trunkSourceWebCoreModulescredentialsBasicCredentialidl">trunk/Source/WebCore/Modules/credentials/BasicCredential.idl</a></li>
<li><a href="#trunkSourceWebCoreModulescredentialsCredentialDatah">trunk/Source/WebCore/Modules/credentials/CredentialData.h</a></li>
<li><a href="#trunkSourceWebCoreModulescredentialsCredentialDataidl">trunk/Source/WebCore/Modules/credentials/CredentialData.idl</a></li>
<li><a href="#trunkSourceWebCoreModulescredentialsPasswordCredentialcpp">trunk/Source/WebCore/Modules/credentials/PasswordCredential.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulescredentialsPasswordCredentialh">trunk/Source/WebCore/Modules/credentials/PasswordCredential.h</a></li>
<li><a href="#trunkSourceWebCoreModulescredentialsPasswordCredentialidl">trunk/Source/WebCore/Modules/credentials/PasswordCredential.idl</a></li>
<li><a href="#trunkSourceWebCoreModulescredentialsSiteBoundCredentialcpp">trunk/Source/WebCore/Modules/credentials/SiteBoundCredential.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulescredentialsSiteBoundCredentialh">trunk/Source/WebCore/Modules/credentials/SiteBoundCredential.h</a></li>
<li><a href="#trunkSourceWebCoreModulescredentialsSiteBoundCredentialidl">trunk/Source/WebCore/Modules/credentials/SiteBoundCredential.idl</a></li>
<li><a href="#trunkSourceWebCoreModulescredentialsSiteBoundCredentialDatah">trunk/Source/WebCore/Modules/credentials/SiteBoundCredentialData.h</a></li>
<li><a href="#trunkSourceWebCoreModulescredentialsSiteBoundCredentialDataidl">trunk/Source/WebCore/Modules/credentials/SiteBoundCredentialData.idl</a></li>
</ul>
<h3>Removed Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsimportedw3cresourcesidlharnessjs">trunk/LayoutTests/imported/w3c/resources/idlharness.js</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (213080 => 213081)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2017-02-27 18:22:49 UTC (rev 213080)
+++ trunk/LayoutTests/ChangeLog        2017-02-27 19:01:13 UTC (rev 213081)
</span><span class="lines">@@ -1,3 +1,22 @@
</span><ins>+2017-02-27 Jiewen Tan <jiewen_tan@apple.com>
+
+ [CredentialManagement] Add IDL definitions for Credential, SiteBoundCredential, and PasswordCredential
+ https://bugs.webkit.org/show_bug.cgi?id=168616
+ <rdar://problem/30167149>
+
+ Reviewed by Daniel Bates.
+
+ * credentials/idlharness-expected.txt: Added.
+ * credentials/idlharness.html: Added.
+ * platform/mac-elcapitan/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:
+ * resources/WebIDLParser.js: Added.
+ * resources/idlharness.js: Renamed from LayoutTests/imported/w3c/resources/idlharness.js.
+ Removed LayoutTests/imported/w3c/resources/idlharness.js since it is not needed any more.
+ Added resources/idlharness.js for idl harness.
+
</ins><span class="cx"> 2017-02-27 Jer Noble <jer.noble@apple.com>
</span><span class="cx">
</span><span class="cx"> [WebRTC] Fix remote audio rendering
</span></span></pre></div>
<a id="trunkLayoutTestscredentialsidlharnessexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/credentials/idlharness-expected.txt (0 => 213081)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/credentials/idlharness-expected.txt         (rev 0)
+++ trunk/LayoutTests/credentials/idlharness-expected.txt        2017-02-27 19:01:13 UTC (rev 213081)
</span><span class="lines">@@ -0,0 +1,37 @@
</span><ins>+idlharness test
+
+This test validates the WebIDL included in the Credential Management API.
+
+
+PASS Credential interface: existence and properties of interface object
+PASS Credential interface object length
+PASS Credential interface object name
+PASS Credential interface: existence and properties of interface prototype object
+PASS Credential interface: existence and properties of interface prototype object's "constructor" property
+PASS Credential interface: attribute id
+PASS Credential interface: attribute type
+PASS SiteBoundCredential interface: existence and properties of interface object
+PASS SiteBoundCredential interface object length
+PASS SiteBoundCredential interface object name
+PASS SiteBoundCredential interface: existence and properties of interface prototype object
+PASS SiteBoundCredential interface: existence and properties of interface prototype object's "constructor" property
+PASS SiteBoundCredential interface: attribute name
+PASS SiteBoundCredential interface: attribute iconURL
+PASS PasswordCredential interface: existence and properties of interface object
+PASS PasswordCredential interface object length
+PASS PasswordCredential interface object name
+PASS PasswordCredential interface: existence and properties of interface prototype object
+PASS PasswordCredential interface: existence and properties of interface prototype object's "constructor" property
+PASS PasswordCredential interface: attribute idName
+PASS PasswordCredential interface: attribute passwordName
+PASS PasswordCredential interface: attribute additionalData
+PASS PasswordCredential must be primary interface of new PasswordCredential({ password: "12345", id: "12345" })
+PASS Stringification of new PasswordCredential({ password: "12345", id: "12345" })
+PASS PasswordCredential interface: new PasswordCredential({ password: "12345", id: "12345" }) must inherit property "idName" with the proper type (0)
+PASS PasswordCredential interface: new PasswordCredential({ password: "12345", id: "12345" }) must inherit property "passwordName" with the proper type (1)
+PASS PasswordCredential interface: new PasswordCredential({ password: "12345", id: "12345" }) must inherit property "additionalData" with the proper type (2)
+PASS SiteBoundCredential interface: new PasswordCredential({ password: "12345", id: "12345" }) must inherit property "name" with the proper type (0)
+PASS SiteBoundCredential interface: new PasswordCredential({ password: "12345", id: "12345" }) must inherit property "iconURL" with the proper type (1)
+PASS Credential interface: new PasswordCredential({ password: "12345", id: "12345" }) must inherit property "id" with the proper type (0)
+PASS Credential interface: new PasswordCredential({ password: "12345", id: "12345" }) must inherit property "type" with the proper type (1)
+
</ins></span></pre></div>
<a id="trunkLayoutTestscredentialsidlharnesshtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/credentials/idlharness.html (0 => 213081)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/credentials/idlharness.html         (rev 0)
+++ trunk/LayoutTests/credentials/idlharness.html        2017-02-27 19:01:13 UTC (rev 213081)
</span><span class="lines">@@ -0,0 +1,76 @@
</span><ins>+<!DOCTYPE html>
+<script src="../resources/testharness.js"></script>
+<script src="../resources/testharnessreport.js"></script>
+<script src="../resources/WebIDLParser.js"></script>
+<script src="../resources/idlharness.js"></script>
+
+<h1>idlharness test</h1>
+<p>This test validates the WebIDL included in the Credential Management API.</p>
+
+<script type="text/plain" class="untested-idl">
+interface Window {};
+</script>
+
+<script type="text/plain" class="idl">
+// 3.1.1 Credential
+
+dictionary CredentialData {
+ required USVString id;
+};
+
+[SecureContext] interface Credential {
+ readonly attribute USVString id;
+ readonly attribute DOMString type;
+};
+
+// No Transferable at this moment
+// Credential implements Transferable;
+
+dictionary SiteBoundCredentialData : CredentialData {
+ USVString name;
+ USVString iconURL;
+};
+
+[SecureContext] interface SiteBoundCredential : Credential {
+ readonly attribute USVString name;
+ readonly attribute USVString iconURL;
+};
+
+// 3.1.3 PasswordCredential
+
+dictionary PasswordCredentialData : SiteBoundCredentialData {
+ required USVString password;
+};
+
+typedef (FormData or URLSearchParams) CredentialBodyType;
+
+[Constructor(PasswordCredentialData data),
+ Constructor(HTMLFormElement form),
+ Exposed=Window,
+ SecureContext]
+interface PasswordCredential : SiteBoundCredential {
+ attribute USVString idName;
+ attribute USVString passwordName;
+
+ attribute CredentialBodyType? additionalData;
+};
+
+</script>
+
+<script>
+function select(selector) {
+ return [].slice.call(document.querySelectorAll(selector))
+ .map(function(e) { return e.textContent; })
+ .join('\n\n');
+}
+
+var idl = select('.idl')
+var untested = select('.untested-idl');
+var idl_array = new IdlArray();
+idl_array.add_untested_idls(untested);
+idl_array.add_idls(idl);
+idl_array.add_objects({
+ PasswordCredential: ['new PasswordCredential({ password: "12345", id: "12345" })'],
+});
+idl_array.test();
+</script>
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cresourcesidlharnessjs"></a>
<div class="delfile"><h4>Deleted: trunk/LayoutTests/imported/w3c/resources/idlharness.js (213080 => 213081)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/resources/idlharness.js        2017-02-27 18:22:49 UTC (rev 213080)
+++ trunk/LayoutTests/imported/w3c/resources/idlharness.js        2017-02-27 19:01:13 UTC (rev 213081)
</span><span class="lines">@@ -1,1850 +0,0 @@
</span><del>-/*
-Distributed under both the W3C Test Suite License [1] and the W3C
-3-clause BSD License [2]. To contribute to a W3C Test Suite, see the
-policies and contribution forms [3].
-
-[1] http://www.w3.org/Consortium/Legal/2008/04-testsuite-license
-[2] http://www.w3.org/Consortium/Legal/2008/03-bsd-license
-[3] http://www.w3.org/2004/10/27-testcases
-*/
-
-/* For user documentation see docs/idlharness.md */
-
-/**
- * Notes for people who want to edit this file (not just use it as a library):
- *
- * Most of the interesting stuff happens in the derived classes of IdlObject,
- * especially IdlInterface. The entry point for all IdlObjects is .test(),
- * which is called by IdlArray.test(). An IdlObject is conceptually just
- * "thing we want to run tests on", and an IdlArray is an array of IdlObjects
- * with some additional data thrown in.
- *
- * The object model is based on what WebIDLParser.js produces, which is in turn
- * based on its pegjs grammar. If you want to figure out what properties an
- * object will have from WebIDLParser.js, the best way is to look at the
- * grammar:
- *
- * https://github.com/darobin/webidl.js/blob/master/lib/grammar.peg
- *
- * So for instance:
- *
- * // interface definition
- * interface
- * = extAttrs:extendedAttributeList? S? "interface" S name:identifier w herit:ifInheritance? w "{" w mem:ifMember* w "}" w ";" w
- * { return { type: "interface", name: name, inheritance: herit, members: mem, extAttrs: extAttrs }; }
- *
- * This means that an "interface" object will have a .type property equal to
- * the string "interface", a .name property equal to the identifier that the
- * parser found, an .inheritance property equal to either null or the result of
- * the "ifInheritance" production found elsewhere in the grammar, and so on.
- * After each grammatical production is a JavaScript function in curly braces
- * that gets called with suitable arguments and returns some JavaScript value.
- *
- * (Note that the version of WebIDLParser.js we use might sometimes be
- * out-of-date or forked.)
- *
- * The members and methods of the classes defined by this file are all at least
- * briefly documented, hopefully.
- */
-(function(){
-"use strict";
-/// Helpers ///
-function constValue (cnt) {
- if (cnt.type === "null") return null;
- if (cnt.type === "NaN") return NaN;
- if (cnt.type === "Infinity") return cnt.negative ? -Infinity : Infinity;
- return cnt.value;
-}
-
-function minOverloadLength(overloads) {
- if (!overloads.length) {
- return 0;
- }
-
- return overloads.map(function(attr) {
- return attr.arguments ? attr.arguments.filter(function(arg) {
- return !arg.optional && !arg.variadic;
- }).length : 0;
- })
- .reduce(function(m, n) { return Math.min(m, n); });
-}
-
-function throwOrReject(a_test, operation, fn, obj, args, message, cb) {
- if (operation.idlType.generic !== "Promise") {
- assert_throws(new TypeError(), function() {
- fn.apply(obj, args);
- }, message);
- cb();
- } else {
- try {
- promise_rejects(a_test, new TypeError(), fn.apply(obj, args)).then(cb, cb);
- } catch (e){
- a_test.step(function() {
- assert_unreached("Throws \"" + e + "\" instead of rejecting promise");
- cb();
- });
- }
- }
-}
-
-function awaitNCallbacks(n, cb, ctx) {
- var counter = 0;
- return function() {
- counter++;
- if (counter >= n) {
- cb();
- }
- };
-}
-
-var fround = (function(){
- if (Math.fround) return Math.fround;
-
- var arr = new Float32Array(1);
- return function fround(n) {
- arr[0] = n;
- return arr[0];
- };
-})();
-
-/// IdlArray ///
-// Entry point
-self.IdlArray = function()
-//@{
-{
- /**
- * A map from strings to the corresponding named IdlObject, such as
- * IdlInterface or IdlException. These are the things that test() will run
- * tests on.
- */
- this.members = {};
-
- /**
- * A map from strings to arrays of strings. The keys are interface or
- * exception names, and are expected to also exist as keys in this.members
- * (otherwise they'll be ignored). This is populated by add_objects() --
- * see documentation at the start of the file. The actual tests will be
- * run by calling this.members[name].test_object(obj) for each obj in
- * this.objects[name]. obj is a string that will be eval'd to produce a
- * JavaScript value, which is supposed to be an object implementing the
- * given IdlObject (interface, exception, etc.).
- */
- this.objects = {};
-
- /**
- * When adding multiple collections of IDLs one at a time, an earlier one
- * might contain a partial interface or implements statement that depends
- * on a later one. Save these up and handle them right before we run
- * tests.
- *
- * .partials is simply an array of objects from WebIDLParser.js'
- * "partialinterface" production. .implements maps strings to arrays of
- * strings, such that
- *
- * A implements B;
- * A implements C;
- * D implements E;
- *
- * results in { A: ["B", "C"], D: ["E"] }.
- */
- this.partials = [];
- this["implements"] = {};
-};
-
-//@}
-IdlArray.prototype.add_idls = function(raw_idls)
-//@{
-{
- /** Entry point. See documentation at beginning of file. */
- this.internal_add_idls(WebIDL2.parse(raw_idls));
-};
-
-//@}
-IdlArray.prototype.add_untested_idls = function(raw_idls)
-//@{
-{
- /** Entry point. See documentation at beginning of file. */
- var parsed_idls = WebIDL2.parse(raw_idls);
- for (var i = 0; i < parsed_idls.length; i++)
- {
- parsed_idls[i].untested = true;
- if ("members" in parsed_idls[i])
- {
- for (var j = 0; j < parsed_idls[i].members.length; j++)
- {
- parsed_idls[i].members[j].untested = true;
- }
- }
- }
- this.internal_add_idls(parsed_idls);
-};
-
-//@}
-IdlArray.prototype.internal_add_idls = function(parsed_idls)
-//@{
-{
- /**
- * Internal helper called by add_idls() and add_untested_idls().
- * parsed_idls is an array of objects that come from WebIDLParser.js's
- * "definitions" production. The add_untested_idls() entry point
- * additionally sets an .untested property on each object (and its
- * .members) so that they'll be skipped by test() -- they'll only be
- * used for base interfaces of tested interfaces, return types, etc.
- */
- parsed_idls.forEach(function(parsed_idl)
- {
- if (parsed_idl.type == "interface" && parsed_idl.partial)
- {
- this.partials.push(parsed_idl);
- return;
- }
-
- if (parsed_idl.type == "implements")
- {
- if (!(parsed_idl.target in this["implements"]))
- {
- this["implements"][parsed_idl.target] = [];
- }
- this["implements"][parsed_idl.target].push(parsed_idl["implements"]);
- return;
- }
-
- parsed_idl.array = this;
- if (parsed_idl.name in this.members)
- {
- throw "Duplicate identifier " + parsed_idl.name;
- }
- switch(parsed_idl.type)
- {
- case "interface":
- this.members[parsed_idl.name] =
- new IdlInterface(parsed_idl, /* is_callback = */ false);
- break;
-
- case "dictionary":
- // Nothing to test, but we need the dictionary info around for type
- // checks
- this.members[parsed_idl.name] = new IdlDictionary(parsed_idl);
- break;
-
- case "typedef":
- this.members[parsed_idl.name] = new IdlTypedef(parsed_idl);
- break;
-
- case "callback":
- // TODO
- console.log("callback not yet supported");
- break;
-
- case "enum":
- this.members[parsed_idl.name] = new IdlEnum(parsed_idl);
- break;
-
- case "callback interface":
- this.members[parsed_idl.name] =
- new IdlInterface(parsed_idl, /* is_callback = */ true);
- break;
-
- default:
- throw parsed_idl.name + ": " + parsed_idl.type + " not yet supported";
- }
- }.bind(this));
-};
-
-//@}
-IdlArray.prototype.add_objects = function(dict)
-//@{
-{
- /** Entry point. See documentation at beginning of file. */
- for (var k in dict)
- {
- if (k in this.objects)
- {
- this.objects[k] = this.objects[k].concat(dict[k]);
- }
- else
- {
- this.objects[k] = dict[k];
- }
- }
-};
-
-//@}
-IdlArray.prototype.prevent_multiple_testing = function(name)
-//@{
-{
- /** Entry point. See documentation at beginning of file. */
- this.members[name].prevent_multiple_testing = true;
-};
-
-//@}
-IdlArray.prototype.recursively_get_implements = function(interface_name)
-//@{
-{
- /**
- * Helper function for test(). Returns an array of things that implement
- * interface_name, so if the IDL contains
- *
- * A implements B;
- * B implements C;
- * B implements D;
- *
- * then recursively_get_implements("A") should return ["B", "C", "D"].
- */
- var ret = this["implements"][interface_name];
- if (ret === undefined)
- {
- return [];
- }
- for (var i = 0; i < this["implements"][interface_name].length; i++)
- {
- ret = ret.concat(this.recursively_get_implements(ret[i]));
- if (ret.indexOf(ret[i]) != ret.lastIndexOf(ret[i]))
- {
- throw "Circular implements statements involving " + ret[i];
- }
- }
- return ret;
-};
-
-function exposed_in(globals) {
- if ('document' in self) {
- return globals.indexOf("Window") >= 0;
- }
- if ('DedicatedWorkerGlobalScope' in self &&
- self instanceof DedicatedWorkerGlobalScope) {
- return globals.indexOf("Worker") >= 0 ||
- globals.indexOf("DedicatedWorker") >= 0;
- }
- if ('SharedWorkerGlobalScope' in self &&
- self instanceof SharedWorkerGlobalScope) {
- return globals.indexOf("Worker") >= 0 ||
- globals.indexOf("SharedWorker") >= 0;
- }
- if ('ServiceWorkerGlobalScope' in self &&
- self instanceof ServiceWorkerGlobalScope) {
- return globals.indexOf("Worker") >= 0 ||
- globals.indexOf("ServiceWorker") >= 0;
- }
- throw "Unexpected global object";
-}
-
-//@}
-IdlArray.prototype.test = function()
-//@{
-{
- /** Entry point. See documentation at beginning of file. */
-
- // First merge in all the partial interfaces and implements statements we
- // encountered.
- this.partials.forEach(function(parsed_idl)
- {
- if (!(parsed_idl.name in this.members)
- || !(this.members[parsed_idl.name] instanceof IdlInterface))
- {
- throw "Partial interface " + parsed_idl.name + " with no original interface";
- }
- if (parsed_idl.extAttrs)
- {
- parsed_idl.extAttrs.forEach(function(extAttr)
- {
- this.members[parsed_idl.name].extAttrs.push(extAttr);
- }.bind(this));
- }
- parsed_idl.members.forEach(function(member)
- {
- this.members[parsed_idl.name].members.push(new IdlInterfaceMember(member));
- }.bind(this));
- }.bind(this));
- this.partials = [];
-
- for (var lhs in this["implements"])
- {
- this.recursively_get_implements(lhs).forEach(function(rhs)
- {
- var errStr = lhs + " implements " + rhs + ", but ";
- if (!(lhs in this.members)) throw errStr + lhs + " is undefined.";
- if (!(this.members[lhs] instanceof IdlInterface)) throw errStr + lhs + " is not an interface.";
- if (!(rhs in this.members)) throw errStr + rhs + " is undefined.";
- if (!(this.members[rhs] instanceof IdlInterface)) throw errStr + rhs + " is not an interface.";
- this.members[rhs].members.forEach(function(member)
- {
- this.members[lhs].members.push(new IdlInterfaceMember(member));
- }.bind(this));
- }.bind(this));
- }
- this["implements"] = {};
-
- Object.getOwnPropertyNames(this.members).forEach(function(memberName) {
- var member = this.members[memberName];
- if (!(member instanceof IdlInterface)) {
- return;
- }
-
- var exposed = member.extAttrs.filter(function(a) { return a.name == "Exposed" });
- if (exposed.length > 1) {
- throw "Unexpected Exposed extended attributes on " + memberName + ": " + exposed;
- }
-
- var globals = exposed.length === 1
- ? exposed[0].rhs.value
- : ["Window"];
- member.exposed = exposed_in(globals);
- }.bind(this));
-
- // Now run test() on every member, and test_object() for every object.
- for (var name in this.members)
- {
- this.members[name].test();
- if (name in this.objects)
- {
- this.objects[name].forEach(function(str)
- {
- this.members[name].test_object(str);
- }.bind(this));
- }
- }
-};
-
-//@}
-IdlArray.prototype.assert_type_is = function(value, type)
-//@{
-{
- /**
- * Helper function that tests that value is an instance of type according
- * to the rules of WebIDL. value is any JavaScript value, and type is an
- * object produced by WebIDLParser.js' "type" production. That production
- * is fairly elaborate due to the complexity of WebIDL's types, so it's
- * best to look at the grammar to figure out what properties it might have.
- */
- if (type.idlType == "any")
- {
- // No assertions to make
- return;
- }
-
- if (type.nullable && value === null)
- {
- // This is fine
- return;
- }
-
- if (type.array)
- {
- // TODO: not supported yet
- return;
- }
-
- if (type.sequence)
- {
- assert_true(Array.isArray(value), "is not array");
- if (!value.length)
- {
- // Nothing we can do.
- return;
- }
- this.assert_type_is(value[0], type.idlType.idlType);
- return;
- }
-
- type = type.idlType;
-
- switch(type)
- {
- case "void":
- assert_equals(value, undefined);
- return;
-
- case "boolean":
- assert_equals(typeof value, "boolean");
- return;
-
- case "byte":
- assert_equals(typeof value, "number");
- assert_equals(value, Math.floor(value), "not an integer");
- assert_true(-128 <= value && value <= 127, "byte " + value + " not in range [-128, 127]");
- return;
-
- case "octet":
- assert_equals(typeof value, "number");
- assert_equals(value, Math.floor(value), "not an integer");
- assert_true(0 <= value && value <= 255, "octet " + value + " not in range [0, 255]");
- return;
-
- case "short":
- assert_equals(typeof value, "number");
- assert_equals(value, Math.floor(value), "not an integer");
- assert_true(-32768 <= value && value <= 32767, "short " + value + " not in range [-32768, 32767]");
- return;
-
- case "unsigned short":
- assert_equals(typeof value, "number");
- assert_equals(value, Math.floor(value), "not an integer");
- assert_true(0 <= value && value <= 65535, "unsigned short " + value + " not in range [0, 65535]");
- return;
-
- case "long":
- assert_equals(typeof value, "number");
- assert_equals(value, Math.floor(value), "not an integer");
- assert_true(-2147483648 <= value && value <= 2147483647, "long " + value + " not in range [-2147483648, 2147483647]");
- return;
-
- case "unsigned long":
- assert_equals(typeof value, "number");
- assert_equals(value, Math.floor(value), "not an integer");
- assert_true(0 <= value && value <= 4294967295, "unsigned long " + value + " not in range [0, 4294967295]");
- return;
-
- case "long long":
- assert_equals(typeof value, "number");
- return;
-
- case "unsigned long long":
- case "DOMTimeStamp":
- assert_equals(typeof value, "number");
- assert_true(0 <= value, "unsigned long long is negative");
- return;
-
- case "float":
- assert_equals(typeof value, "number");
- assert_equals(value, fround(value), "float rounded to 32-bit float should be itself");
- assert_not_equals(value, Infinity);
- assert_not_equals(value, -Infinity);
- assert_not_equals(value, NaN);
- return;
-
- case "DOMHighResTimeStamp":
- case "double":
- assert_equals(typeof value, "number");
- assert_not_equals(value, Infinity);
- assert_not_equals(value, -Infinity);
- assert_not_equals(value, NaN);
- return;
-
- case "unrestricted float":
- assert_equals(typeof value, "number");
- assert_equals(value, fround(value), "unrestricted float rounded to 32-bit float should be itself");
- return;
-
- case "unrestricted double":
- assert_equals(typeof value, "number");
- return;
-
- case "DOMString":
- assert_equals(typeof value, "string");
- return;
-
- case "ByteString":
- assert_equals(typeof value, "string");
- assert_regexp_match(value, /^[\x00-\x7F]*$/);
- return;
-
- case "USVString":
- assert_equals(typeof value, "string");
- assert_regexp_match(value, /^([\x00-\ud7ff\ue000-\uffff]|[\ud800-\udbff][\udc00-\udfff])*$/);
- return;
-
- case "object":
- assert_true(typeof value == "object" || typeof value == "function", "wrong type: not object or function");
- return;
- }
-
- if (!(type in this.members))
- {
- throw "Unrecognized type " + type;
- }
-
- if (this.members[type] instanceof IdlInterface)
- {
- // We don't want to run the full
- // IdlInterface.prototype.test_instance_of, because that could result
- // in an infinite loop. TODO: This means we don't have tests for
- // NoInterfaceObject interfaces, and we also can't test objects that
- // come from another self.
- assert_true(typeof value == "object" || typeof value == "function", "wrong type: not object or function");
- if (value instanceof Object
- && !this.members[type].has_extended_attribute("NoInterfaceObject")
- && type in self)
- {
- assert_true(value instanceof self[type], "not instanceof " + type);
- }
- }
- else if (this.members[type] instanceof IdlEnum)
- {
- assert_equals(typeof value, "string");
- }
- else if (this.members[type] instanceof IdlDictionary)
- {
- // TODO: Test when we actually have something to test this on
- }
- else if (this.members[type] instanceof IdlTypedef)
- {
- // TODO: Test when we actually have something to test this on
- }
- else
- {
- throw "Type " + type + " isn't an interface or dictionary";
- }
-};
-//@}
-
-/// IdlObject ///
-function IdlObject() {}
-IdlObject.prototype.test = function()
-//@{
-{
- /**
- * By default, this does nothing, so no actual tests are run for IdlObjects
- * that don't define any (e.g., IdlDictionary at the time of this writing).
- */
-};
-
-//@}
-IdlObject.prototype.has_extended_attribute = function(name)
-//@{
-{
- /**
- * This is only meaningful for things that support extended attributes,
- * such as interfaces, exceptions, and members.
- */
- return this.extAttrs.some(function(o)
- {
- return o.name == name;
- });
-};
-
-//@}
-
-/// IdlDictionary ///
-// Used for IdlArray.prototype.assert_type_is
-function IdlDictionary(obj)
-//@{
-{
- /**
- * obj is an object produced by the WebIDLParser.js "dictionary"
- * production.
- */
-
- /** Self-explanatory. */
- this.name = obj.name;
-
- /** An array of objects produced by the "dictionaryMember" production. */
- this.members = obj.members;
-
- /**
- * The name (as a string) of the dictionary type we inherit from, or null
- * if there is none.
- */
- this.base = obj.inheritance;
-}
-
-//@}
-IdlDictionary.prototype = Object.create(IdlObject.prototype);
-
-/// IdlInterface ///
-function IdlInterface(obj, is_callback) {
- /**
- * obj is an object produced by the WebIDLParser.js "interface" production.
- */
-
- /** Self-explanatory. */
- this.name = obj.name;
-
- /** A back-reference to our IdlArray. */
- this.array = obj.array;
-
- /**
- * An indicator of whether we should run tests on the interface object and
- * interface prototype object. Tests on members are controlled by .untested
- * on each member, not this.
- */
- this.untested = obj.untested;
-
- /** An array of objects produced by the "ExtAttr" production. */
- this.extAttrs = obj.extAttrs;
-
- /** An array of IdlInterfaceMembers. */
- this.members = obj.members.map(function(m){return new IdlInterfaceMember(m); });
- if (this.has_extended_attribute("Unforgeable")) {
- this.members
- .filter(function(m) { return !m["static"] && (m.type == "attribute" || m.type == "operation"); })
- .forEach(function(m) { return m.isUnforgeable = true; });
- }
-
- /**
- * The name (as a string) of the type we inherit from, or null if there is
- * none.
- */
- this.base = obj.inheritance;
-
- this._is_callback = is_callback;
-}
-IdlInterface.prototype = Object.create(IdlObject.prototype);
-IdlInterface.prototype.is_callback = function()
-//@{
-{
- return this._is_callback;
-};
-//@}
-
-IdlInterface.prototype.has_constants = function()
-//@{
-{
- return this.members.some(function(member) {
- return member.type === "const";
- });
-};
-//@}
-
-IdlInterface.prototype.is_global = function()
-//@{
-{
- return this.extAttrs.some(function(attribute) {
- return attribute.name === "Global" ||
- attribute.name === "PrimaryGlobal";
- });
-};
-//@}
-
-IdlInterface.prototype.test = function()
-//@{
-{
- if (this.has_extended_attribute("NoInterfaceObject"))
- {
- // No tests to do without an instance. TODO: We should still be able
- // to run tests on the prototype object, if we obtain one through some
- // other means.
- return;
- }
-
- if (!this.exposed) {
- test(function() {
- assert_false(this.name in self);
- }.bind(this), this.name + " interface: existence and properties of interface object");
- return;
- }
-
- if (!this.untested)
- {
- // First test things to do with the exception/interface object and
- // exception/interface prototype object.
- this.test_self();
- }
- // Then test things to do with its members (constants, fields, attributes,
- // operations, . . .). These are run even if .untested is true, because
- // members might themselves be marked as .untested. This might happen to
- // interfaces if the interface itself is untested but a partial interface
- // that extends it is tested -- then the interface itself and its initial
- // members will be marked as untested, but the members added by the partial
- // interface are still tested.
- this.test_members();
-};
-//@}
-
-IdlInterface.prototype.test_self = function()
-//@{
-{
- test(function()
- {
- // This function tests WebIDL as of 2015-01-13.
-
- // "For every interface that is exposed in a given ECMAScript global
- // environment and:
- // * is a callback interface that has constants declared on it, or
- // * is a non-callback interface that is not declared with the
- // [NoInterfaceObject] extended attribute,
- // a corresponding property MUST exist on the ECMAScript global object.
- // The name of the property is the identifier of the interface, and its
- // value is an object called the interface object.
- // The property has the attributes { [[Writable]]: true,
- // [[Enumerable]]: false, [[Configurable]]: true }."
- if (this.is_callback() && !this.has_constants()) {
- return;
- }
-
- // TODO: Should we test here that the property is actually writable
- // etc., or trust getOwnPropertyDescriptor?
- assert_own_property(self, this.name,
- "self does not have own property " + format_value(this.name));
- var desc = Object.getOwnPropertyDescriptor(self, this.name);
- assert_false("get" in desc, "self's property " + format_value(this.name) + " has getter");
- assert_false("set" in desc, "self's property " + format_value(this.name) + " has setter");
- assert_true(desc.writable, "self's property " + format_value(this.name) + " is not writable");
- assert_false(desc.enumerable, "self's property " + format_value(this.name) + " is enumerable");
- assert_true(desc.configurable, "self's property " + format_value(this.name) + " is not configurable");
-
- if (this.is_callback()) {
- // "The internal [[Prototype]] property of an interface object for
- // a callback interface MUST be the Object.prototype object."
- assert_equals(Object.getPrototypeOf(self[this.name]), Object.prototype,
- "prototype of self's property " + format_value(this.name) + " is not Object.prototype");
-
- return;
- }
-
- // "The interface object for a given non-callback interface is a
- // function object."
- // "If an object is defined to be a function object, then it has
- // characteristics as follows:"
-
- // Its [[Prototype]] internal property is otherwise specified (see
- // below).
-
- // "* 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."
- // Tested below if no constructor is defined. TODO: test constructors
- // if defined.
-
- // "* Its @@hasInstance property is set as described in ECMA-262
- // section 19.2.3.8, unless otherwise specified."
- // TODO
-
- // ES6 (rev 30) 19.1.3.6:
- // "Else, if O has a [[Call]] internal method, then let builtinTag be
- // "Function"."
- assert_class_string(self[this.name], "Function", "class string of " + this.name);
-
- // "The [[Prototype]] internal property of an interface object for a
- // non-callback interface is determined as follows:"
- var prototype = Object.getPrototypeOf(self[this.name]);
- if (this.base) {
- // "* If the interface inherits from some other interface, the
- // value of [[Prototype]] is the interface object for that other
- // interface."
- var has_interface_object =
- !this.array
- .members[this.base]
- .has_extended_attribute("NoInterfaceObject");
- if (has_interface_object) {
- assert_own_property(self, this.base,
- 'should inherit from ' + this.base +
- ', but self has no such property');
- assert_equals(prototype, self[this.base],
- 'prototype of ' + this.name + ' is not ' +
- this.base);
- }
- } else {
- // "If the interface doesn't inherit from any other interface, the
- // value of [[Prototype]] is %FunctionPrototype% ([ECMA-262],
- // section 6.1.7.4)."
- assert_equals(prototype, Function.prototype,
- "prototype of self's property " + format_value(this.name) + " is not Function.prototype");
- }
-
- if (!this.has_extended_attribute("Constructor")) {
- // "The internal [[Call]] method of the interface object behaves as
- // follows . . .
- //
- // "If I was not declared with a [Constructor] extended attribute,
- // then throw a TypeError."
- assert_throws(new TypeError(), function() {
- self[this.name]();
- }.bind(this), "interface object didn't throw TypeError when called as a function");
- assert_throws(new TypeError(), function() {
- new self[this.name]();
- }.bind(this), "interface object didn't throw TypeError when called as a constructor");
- }
- }.bind(this), this.name + " interface: existence and properties of interface object");
-
- if (!this.is_callback()) {
- test(function() {
- // This function tests WebIDL as of 2014-10-25.
- // https://heycam.github.io/webidl/#es-interface-call
-
- assert_own_property(self, this.name,
- "self does not have own property " + format_value(this.name));
-
- // "Interface objects for non-callback interfaces MUST have a
- // property named “length” with attributes { [[Writable]]: false,
- // [[Enumerable]]: false, [[Configurable]]: true } whose value is
- // a Number."
- assert_own_property(self[this.name], "length");
- var desc = Object.getOwnPropertyDescriptor(self[this.name], "length");
- assert_false("get" in desc, this.name + ".length has getter");
- assert_false("set" in desc, this.name + ".length has setter");
- assert_false(desc.writable, this.name + ".length is writable");
- assert_false(desc.enumerable, this.name + ".length is enumerable");
- assert_true(desc.configurable, this.name + ".length is not configurable");
-
- var constructors = this.extAttrs
- .filter(function(attr) { return attr.name == "Constructor"; });
- var expected_length = minOverloadLength(constructors);
- assert_equals(self[this.name].length, expected_length, "wrong value for " + this.name + ".length");
- }.bind(this), this.name + " interface object length");
- }
-
- if (!this.is_callback() || this.has_constants()) {
- test(function() {
- // This function tests WebIDL as of 2015-11-17.
- // https://heycam.github.io/webidl/#interface-object
-
- assert_own_property(self, this.name,
- "self does not have own property " + format_value(this.name));
-
- // "All interface objects must have a property named “name” with
- // attributes { [[Writable]]: false, [[Enumerable]]: false,
- // [[Configurable]]: true } whose value is the identifier of the
- // corresponding interface."
-
- assert_own_property(self[this.name], "name");
- var desc = Object.getOwnPropertyDescriptor(self[this.name], "name");
- assert_false("get" in desc, this.name + ".name has getter");
- assert_false("set" in desc, this.name + ".name has setter");
- assert_false(desc.writable, this.name + ".name is writable");
- assert_false(desc.enumerable, this.name + ".name is enumerable");
- assert_true(desc.configurable, this.name + ".name is not configurable");
- assert_equals(self[this.name].name, this.name, "wrong value for " + this.name + ".name");
- }.bind(this), this.name + " interface object name");
- }
-
- // TODO: Test named constructors if I find any interfaces that have them.
-
- test(function()
- {
- // This function tests WebIDL as of 2015-01-21.
- // https://heycam.github.io/webidl/#interface-object
-
- if (this.is_callback() && !this.has_constants()) {
- return;
- }
-
- assert_own_property(self, this.name,
- "self does not have own property " + format_value(this.name));
-
- if (this.is_callback()) {
- assert_false("prototype" in self[this.name],
- this.name + ' should not have a "prototype" property');
- return;
- }
-
- // "An interface object for a non-callback interface must have a
- // property named “prototype” with attributes { [[Writable]]: false,
- // [[Enumerable]]: false, [[Configurable]]: false } whose value is an
- // object called the interface prototype object. This object has
- // properties that correspond to the regular attributes and regular
- // operations defined on the interface, and is described in more detail
- // in section 4.5.4 below."
- assert_own_property(self[this.name], "prototype",
- 'interface "' + this.name + '" does not have own property "prototype"');
- var desc = Object.getOwnPropertyDescriptor(self[this.name], "prototype");
- assert_false("get" in desc, this.name + ".prototype has getter");
- assert_false("set" in desc, this.name + ".prototype has setter");
- assert_false(desc.writable, this.name + ".prototype is writable");
- assert_false(desc.enumerable, this.name + ".prototype is enumerable");
- assert_false(desc.configurable, this.name + ".prototype is configurable");
-
- // Next, test that the [[Prototype]] of the interface prototype object
- // is correct. (This is made somewhat difficult by the existence of
- // [NoInterfaceObject].)
- // TODO: Aryeh thinks there's at least other place in this file where
- // we try to figure out if an interface prototype object is
- // correct. Consolidate that code.
-
- // "The interface prototype object for a given interface A must have an
- // internal [[Prototype]] property whose value is returned from the
- // following steps:
- // "If A is declared with the [Global] or [PrimaryGlobal] extended
- // attribute, and A supports named properties, then return the named
- // properties object for A, as defined in section 4.5.5 below.
- // "Otherwise, if A is declared to inherit from another interface, then
- // return the interface prototype object for the inherited interface.
- // "Otherwise, if A is declared with the [ArrayClass] extended
- // attribute, then return %ArrayPrototype% ([ECMA-262], section
- // 6.1.7.4).
- // "Otherwise, return %ObjectPrototype% ([ECMA-262], section 6.1.7.4).
- // ([ECMA-262], section 15.2.4).
- if (this.name === "Window") {
- assert_class_string(Object.getPrototypeOf(self[this.name].prototype),
- 'WindowProperties',
- 'Class name for prototype of Window' +
- '.prototype is not "WindowProperties"');
- } else {
- var inherit_interface, inherit_interface_has_interface_object;
- if (this.base) {
- inherit_interface = this.base;
- inherit_interface_has_interface_object =
- !this.array
- .members[inherit_interface]
- .has_extended_attribute("NoInterfaceObject");
- } else if (this.has_extended_attribute('ArrayClass')) {
- inherit_interface = 'Array';
- inherit_interface_has_interface_object = true;
- } else {
- inherit_interface = 'Object';
- inherit_interface_has_interface_object = true;
- }
- if (inherit_interface_has_interface_object) {
- assert_own_property(self, inherit_interface,
- 'should inherit from ' + inherit_interface + ', but self has no such property');
- assert_own_property(self[inherit_interface], 'prototype',
- 'should inherit from ' + inherit_interface + ', but that object has no "prototype" property');
- assert_equals(Object.getPrototypeOf(self[this.name].prototype),
- self[inherit_interface].prototype,
- 'prototype of ' + this.name + '.prototype is not ' + inherit_interface + '.prototype');
- } else {
- // We can't test that we get the correct object, because this is the
- // only way to get our hands on it. We only test that its class
- // string, at least, is correct.
- assert_class_string(Object.getPrototypeOf(self[this.name].prototype),
- inherit_interface + 'Prototype',
- 'Class name for prototype of ' + this.name +
- '.prototype is not "' + inherit_interface + 'Prototype"');
- }
- }
-
- // "The class string of an interface prototype object is the
- // concatenation of the interface’s identifier and the string
- // “Prototype”."
- assert_class_string(self[this.name].prototype, this.name + "Prototype",
- "class string of " + this.name + ".prototype");
- // String() should end up calling {}.toString if nothing defines a
- // stringifier.
- if (!this.has_stringifier()) {
- assert_equals(String(self[this.name].prototype), "[object " + this.name + "Prototype]",
- "String(" + this.name + ".prototype)");
- }
- }.bind(this), this.name + " interface: existence and properties of interface prototype object");
-
- test(function()
- {
- if (this.is_callback() && !this.has_constants()) {
- return;
- }
-
- assert_own_property(self, this.name,
- "self does not have own property " + format_value(this.name));
-
- if (this.is_callback()) {
- assert_false("prototype" in self[this.name],
- this.name + ' should not have a "prototype" property');
- return;
- }
-
- assert_own_property(self[this.name], "prototype",
- 'interface "' + this.name + '" does not have own property "prototype"');
-
- // "If the [NoInterfaceObject] extended attribute was not specified on
- // the interface, then the interface prototype object must also have a
- // property named “constructor” with attributes { [[Writable]]: true,
- // [[Enumerable]]: false, [[Configurable]]: true } whose value is a
- // reference to the interface object for the interface."
- assert_own_property(self[this.name].prototype, "constructor",
- this.name + '.prototype does not have own property "constructor"');
- var desc = Object.getOwnPropertyDescriptor(self[this.name].prototype, "constructor");
- assert_false("get" in desc, this.name + ".prototype.constructor has getter");
- assert_false("set" in desc, this.name + ".prototype.constructor has setter");
- assert_true(desc.writable, this.name + ".prototype.constructor is not writable");
- assert_false(desc.enumerable, this.name + ".prototype.constructor is enumerable");
- assert_true(desc.configurable, this.name + ".prototype.constructor in not configurable");
- assert_equals(self[this.name].prototype.constructor, self[this.name],
- this.name + '.prototype.constructor is not the same object as ' + this.name);
- }.bind(this), this.name + ' interface: existence and properties of interface prototype object\'s "constructor" property');
-};
-
-//@}
-IdlInterface.prototype.test_member_const = function(member)
-//@{
-{
- if (!this.has_constants()) {
- throw "Internal error: test_member_const called without any constants";
- }
-
- test(function()
- {
- assert_own_property(self, this.name,
- "self does not have own property " + format_value(this.name));
-
- // "For each constant defined on an interface A, there must be
- // a corresponding property on the interface object, if it
- // exists."
- assert_own_property(self[this.name], member.name);
- // "The value of the property is that which is obtained by
- // converting the constant’s IDL value to an ECMAScript
- // value."
- assert_equals(self[this.name][member.name], constValue(member.value),
- "property has wrong value");
- // "The property has attributes { [[Writable]]: false,
- // [[Enumerable]]: true, [[Configurable]]: false }."
- var desc = Object.getOwnPropertyDescriptor(self[this.name], member.name);
- assert_false("get" in desc, "property has getter");
- assert_false("set" in desc, "property has setter");
- assert_false(desc.writable, "property is writable");
- assert_true(desc.enumerable, "property is not enumerable");
- assert_false(desc.configurable, "property is configurable");
- }.bind(this), this.name + " interface: constant " + member.name + " on interface object");
-
- // "In addition, a property with the same characteristics must
- // exist on the interface prototype object."
- test(function()
- {
- assert_own_property(self, this.name,
- "self does not have own property " + format_value(this.name));
-
- if (this.is_callback()) {
- assert_false("prototype" in self[this.name],
- this.name + ' should not have a "prototype" property');
- return;
- }
-
- assert_own_property(self[this.name], "prototype",
- 'interface "' + this.name + '" does not have own property "prototype"');
-
- assert_own_property(self[this.name].prototype, member.name);
- assert_equals(self[this.name].prototype[member.name], constValue(member.value),
- "property has wrong value");
- var desc = Object.getOwnPropertyDescriptor(self[this.name], member.name);
- assert_false("get" in desc, "property has getter");
- assert_false("set" in desc, "property has setter");
- assert_false(desc.writable, "property is writable");
- assert_true(desc.enumerable, "property is not enumerable");
- assert_false(desc.configurable, "property is configurable");
- }.bind(this), this.name + " interface: constant " + member.name + " on interface prototype object");
-};
-
-
-//@}
-IdlInterface.prototype.test_member_attribute = function(member)
-//@{
-{
- test(function()
- {
- if (this.is_callback() && !this.has_constants()) {
- return;
- }
-
- assert_own_property(self, this.name,
- "self does not have own property " + format_value(this.name));
- assert_own_property(self[this.name], "prototype",
- 'interface "' + this.name + '" does not have own property "prototype"');
-
- if (member["static"]) {
- assert_own_property(self[this.name], member.name,
- "The interface object must have a property " +
- format_value(member.name));
- } else if (this.is_global()) {
- assert_own_property(self, member.name,
- "The global object must have a property " +
- format_value(member.name));
- assert_false(member.name in self[this.name].prototype,
- "The prototype object must not have a property " +
- format_value(member.name));
-
- var getter = Object.getOwnPropertyDescriptor(self, member.name).get;
- assert_equals(typeof(getter), "function",
- format_value(member.name) + " must have a getter");
-
- // Try/catch around the get here, since it can legitimately throw.
- // If it does, we obviously can't check for equality with direct
- // invocation of the getter.
- var gotValue;
- var propVal;
- try {
- propVal = self[member.name];
- gotValue = true;
- } catch (e) {
- gotValue = false;
- }
- if (gotValue) {
- assert_equals(propVal, getter.call(undefined),
- "Gets on a global should not require an explicit this");
- }
-
- this.do_interface_attribute_asserts(self, member);
- } else {
- assert_true(member.name in self[this.name].prototype,
- "The prototype object must have a property " +
- format_value(member.name));
-
- if (!member.has_extended_attribute("LenientThis")) {
- assert_throws(new TypeError(), function() {
- self[this.name].prototype[member.name];
- }.bind(this), "getting property on prototype object must throw TypeError");
- } else {
- assert_equals(self[this.name].prototype[member.name], undefined,
- "getting property on prototype object must return undefined");
- }
- this.do_interface_attribute_asserts(self[this.name].prototype, member);
- }
- }.bind(this), this.name + " interface: attribute " + member.name);
-};
-
-//@}
-IdlInterface.prototype.test_member_operation = function(member)
-//@{
-{
- var a_test = async_test(this.name + " interface: operation " + member.name +
- "(" + member.arguments.map(
- function(m) {return m.idlType.idlType; } )
- +")");
- a_test.step(function()
- {
- // This function tests WebIDL as of 2015-12-29.
- // https://heycam.github.io/webidl/#es-operations
-
- if (this.is_callback() && !this.has_constants()) {
- a_test.done();
- return;
- }
-
- assert_own_property(self, this.name,
- "self does not have own property " + format_value(this.name));
-
- if (this.is_callback()) {
- assert_false("prototype" in self[this.name],
- this.name + ' should not have a "prototype" property');
- a_test.done();
- return;
- }
-
- assert_own_property(self[this.name], "prototype",
- 'interface "' + this.name + '" does not have own property "prototype"');
-
- // "For each unique identifier of an exposed operation defined on the
- // interface, there must exist a corresponding property, unless the
- // effective overload set for that identifier and operation and with an
- // argument count of 0 has no entries."
-
- // TODO: Consider [Exposed].
-
- // "The location of the property is determined as follows:"
- var memberHolderObject;
- // "* If the operation is static, then the property exists on the
- // interface object."
- if (member["static"]) {
- assert_own_property(self[this.name], member.name,
- "interface object missing static operation");
- memberHolderObject = self[this.name];
- // "* Otherwise, [...] if the interface was declared with the [Global]
- // or [PrimaryGlobal] extended attribute, then the property exists
- // on every object that implements the interface."
- } else if (this.is_global()) {
- assert_own_property(self, member.name,
- "global object missing non-static operation");
- memberHolderObject = self;
- // "* Otherwise, the property exists solely on the interface’s
- // interface prototype object."
- } else {
- assert_own_property(self[this.name].prototype, member.name,
- "interface prototype object missing non-static operation");
- memberHolderObject = self[this.name].prototype;
- }
- this.do_member_operation_asserts(memberHolderObject, member, a_test);
- }.bind(this));
-};
-
-//@}
-IdlInterface.prototype.do_member_operation_asserts = function(memberHolderObject, member, a_test)
-//@{
-{
- var done = a_test.done.bind(a_test);
- var operationUnforgeable = member.isUnforgeable;
- var desc = Object.getOwnPropertyDescriptor(memberHolderObject, member.name);
- // "The property has attributes { [[Writable]]: B,
- // [[Enumerable]]: true, [[Configurable]]: B }, where B is false if the
- // operation is unforgeable on the interface, and true otherwise".
- assert_false("get" in desc, "property has getter");
- assert_false("set" in desc, "property has setter");
- assert_equals(desc.writable, !operationUnforgeable,
- "property should be writable if and only if not unforgeable");
- assert_true(desc.enumerable, "property is not enumerable");
- assert_equals(desc.configurable, !operationUnforgeable,
- "property should be configurable if and only if not unforgeable");
- // "The value of the property is a Function object whose
- // behavior is as follows . . ."
- assert_equals(typeof memberHolderObject[member.name], "function",
- "property must be a function");
- // "The value of the Function object’s “length” property is
- // a Number determined as follows:
- // ". . .
- // "Return the length of the shortest argument list of the
- // entries in S."
- assert_equals(memberHolderObject[member.name].length,
- minOverloadLength(this.members.filter(function(m) {
- return m.type == "operation" && m.name == member.name;
- })),
- "property has wrong .length");
-
- // Make some suitable arguments
- var args = member.arguments.map(function(arg) {
- return create_suitable_object(arg.idlType);
- });
-
- // "Let O be a value determined as follows:
- // ". . .
- // "Otherwise, throw a TypeError."
- // This should be hit if the operation is not static, there is
- // no [ImplicitThis] attribute, and the this value is null.
- //
- // TODO: We currently ignore the [ImplicitThis] case. Except we manually
- // check for globals, since otherwise we'll invoke window.close(). And we
- // have to skip this test for anything that on the proto chain of "self",
- // since that does in fact have implicit-this behavior.
- if (!member["static"]) {
- var cb;
- if (!this.is_global() &&
- memberHolderObject[member.name] != self[member.name])
- {
- cb = awaitNCallbacks(2, done);
- throwOrReject(a_test, member, memberHolderObject[member.name], null, args,
- "calling operation with this = null didn't throw TypeError", cb);
- } else {
- cb = awaitNCallbacks(1, done);
- }
-
- // ". . . If O is not null and is also not a platform object
- // that implements interface I, throw a TypeError."
- //
- // TODO: Test a platform object that implements some other
- // interface. (Have to be sure to get inheritance right.)
- throwOrReject(a_test, member, memberHolderObject[member.name], {}, args,
- "calling operation with this = {} didn't throw TypeError", cb);
- } else {
- done();
- }
-}
-
-//@}
-IdlInterface.prototype.test_member_stringifier = function(member)
-//@{
-{
- test(function()
- {
- if (this.is_callback() && !this.has_constants()) {
- return;
- }
-
- assert_own_property(self, this.name,
- "self does not have own property " + format_value(this.name));
-
- if (this.is_callback()) {
- assert_false("prototype" in self[this.name],
- this.name + ' should not have a "prototype" property');
- return;
- }
-
- assert_own_property(self[this.name], "prototype",
- 'interface "' + this.name + '" does not have own property "prototype"');
-
- // ". . . the property exists on the interface prototype object."
- var interfacePrototypeObject = self[this.name].prototype;
- assert_own_property(self[this.name].prototype, "toString",
- "interface prototype object missing non-static operation");
-
- var stringifierUnforgeable = member.isUnforgeable;
- var desc = Object.getOwnPropertyDescriptor(interfacePrototypeObject, "toString");
- // "The property has attributes { [[Writable]]: B,
- // [[Enumerable]]: true, [[Configurable]]: B }, where B is false if the
- // stringifier is unforgeable on the interface, and true otherwise."
- assert_false("get" in desc, "property has getter");
- assert_false("set" in desc, "property has setter");
- assert_equals(desc.writable, !stringifierUnforgeable,
- "property should be writable if and only if not unforgeable");
- assert_true(desc.enumerable, "property is not enumerable");
- assert_equals(desc.configurable, !stringifierUnforgeable,
- "property should be configurable if and only if not unforgeable");
- // "The value of the property is a Function object, which behaves as
- // follows . . ."
- assert_equals(typeof interfacePrototypeObject.toString, "function",
- "property must be a function");
- // "The value of the Function object’s “length” property is the Number
- // value 0."
- assert_equals(interfacePrototypeObject.toString.length, 0,
- "property has wrong .length");
-
- // "Let O be the result of calling ToObject on the this value."
- assert_throws(new TypeError(), function() {
- self[this.name].prototype.toString.apply(null, []);
- }, "calling stringifier with this = null didn't throw TypeError");
-
- // "If O is not an object that implements the interface on which the
- // stringifier was declared, then throw a TypeError."
- //
- // TODO: Test a platform object that implements some other
- // interface. (Have to be sure to get inheritance right.)
- assert_throws(new TypeError(), function() {
- self[this.name].prototype.toString.apply({}, []);
- }, "calling stringifier with this = {} didn't throw TypeError");
- }.bind(this), this.name + " interface: stringifier");
-};
-
-//@}
-IdlInterface.prototype.test_members = function()
-//@{
-{
- for (var i = 0; i < this.members.length; i++)
- {
- var member = this.members[i];
- if (member.untested) {
- continue;
- }
-
- switch (member.type) {
- case "const":
- this.test_member_const(member);
- break;
-
- case "attribute":
- // For unforgeable attributes, we do the checks in
- // test_interface_of instead.
- if (!member.isUnforgeable)
- {
- this.test_member_attribute(member);
- }
- break;
-
- case "operation":
- // TODO: Need to correctly handle multiple operations with the same
- // identifier.
- // For unforgeable operations, we do the checks in
- // test_interface_of instead.
- if (member.name) {
- if (!member.isUnforgeable)
- {
- this.test_member_operation(member);
- }
- } else if (member.stringifier) {
- this.test_member_stringifier(member);
- }
- break;
-
- default:
- // TODO: check more member types.
- break;
- }
- }
-};
-
-//@}
-IdlInterface.prototype.test_object = function(desc)
-//@{
-{
- var obj, exception = null;
- try
- {
- obj = eval(desc);
- }
- catch(e)
- {
- exception = e;
- }
-
- var expected_typeof =
- this.members.some(function(member) { return member.legacycaller; })
- ? "function"
- : "object";
-
- this.test_primary_interface_of(desc, obj, exception, expected_typeof);
- var current_interface = this;
- while (current_interface)
- {
- if (!(current_interface.name in this.array.members))
- {
- throw "Interface " + current_interface.name + " not found (inherited by " + this.name + ")";
- }
- if (current_interface.prevent_multiple_testing && current_interface.already_tested)
- {
- return;
- }
- current_interface.test_interface_of(desc, obj, exception, expected_typeof);
- current_interface = this.array.members[current_interface.base];
- }
-};
-
-//@}
-IdlInterface.prototype.test_primary_interface_of = function(desc, obj, exception, expected_typeof)
-//@{
-{
- // We can't easily test that its prototype is correct if there's no
- // interface object, or the object is from a different global environment
- // (not instanceof Object). TODO: test in this case that its prototype at
- // least looks correct, even if we can't test that it's actually correct.
- if (!this.has_extended_attribute("NoInterfaceObject")
- && (typeof obj != expected_typeof || obj instanceof Object))
- {
- test(function()
- {
- assert_equals(exception, null, "Unexpected exception when evaluating object");
- assert_equals(typeof obj, expected_typeof, "wrong typeof object");
- assert_own_property(self, this.name,
- "self does not have own property " + format_value(this.name));
- assert_own_property(self[this.name], "prototype",
- 'interface "' + this.name + '" does not have own property "prototype"');
-
- // "The value of the internal [[Prototype]] property of the
- // platform object is the interface prototype object of the primary
- // interface from the platform object’s associated global
- // environment."
- assert_equals(Object.getPrototypeOf(obj),
- self[this.name].prototype,
- desc + "'s prototype is not " + this.name + ".prototype");
- }.bind(this), this.name + " must be primary interface of " + desc);
- }
-
- // "The class string of a platform object that implements one or more
- // interfaces must be the identifier of the primary interface of the
- // platform object."
- test(function()
- {
- assert_equals(exception, null, "Unexpected exception when evaluating object");
- assert_equals(typeof obj, expected_typeof, "wrong typeof object");
- assert_class_string(obj, this.name, "class string of " + desc);
- if (!this.has_stringifier())
- {
- assert_equals(String(obj), "[object " + this.name + "]", "String(" + desc + ")");
- }
- }.bind(this), "Stringification of " + desc);
-};
-
-//@}
-IdlInterface.prototype.test_interface_of = function(desc, obj, exception, expected_typeof)
-//@{
-{
- // TODO: Indexed and named properties, more checks on interface members
- this.already_tested = true;
-
- for (var i = 0; i < this.members.length; i++)
- {
- var member = this.members[i];
- if (member.type == "attribute" && member.isUnforgeable)
- {
- test(function()
- {
- assert_equals(exception, null, "Unexpected exception when evaluating object");
- assert_equals(typeof obj, expected_typeof, "wrong typeof object");
- this.do_interface_attribute_asserts(obj, member);
- }.bind(this), this.name + " interface: " + desc + ' must have own property "' + member.name + '"');
- }
- else if (member.type == "operation" &&
- member.name &&
- member.isUnforgeable)
- {
- var a_test = async_test(this.name + " interface: " + desc + ' must have own property "' + member.name + '"');
- a_test.step(function()
- {
- assert_equals(exception, null, "Unexpected exception when evaluating object");
- assert_equals(typeof obj, expected_typeof, "wrong typeof object");
- assert_own_property(obj, member.name,
- "Doesn't have the unforgeable operation property");
- this.do_member_operation_asserts(obj, member, a_test);
- }.bind(this));
- }
- else if ((member.type == "const"
- || member.type == "attribute"
- || member.type == "operation")
- && member.name)
- {
- test(function()
- {
- assert_equals(exception, null, "Unexpected exception when evaluating object");
- assert_equals(typeof obj, expected_typeof, "wrong typeof object");
- if (!member["static"]) {
- if (!this.is_global()) {
- assert_inherits(obj, member.name);
- } else {
- assert_own_property(obj, member.name);
- }
-
- if (member.type == "const")
- {
- assert_equals(obj[member.name], constValue(member.value));
- }
- if (member.type == "attribute")
- {
- // Attributes are accessor properties, so they might
- // legitimately throw an exception rather than returning
- // anything.
- var property, thrown = false;
- try
- {
- property = obj[member.name];
- }
- catch (e)
- {
- thrown = true;
- }
- if (!thrown)
- {
- this.array.assert_type_is(property, member.idlType);
- }
- }
- if (member.type == "operation")
- {
- assert_equals(typeof obj[member.name], "function");
- }
- }
- }.bind(this), this.name + " interface: " + desc + ' must inherit property "' + member.name + '" with the proper type (' + i + ')');
- }
- // TODO: This is wrong if there are multiple operations with the same
- // identifier.
- // TODO: Test passing arguments of the wrong type.
- if (member.type == "operation" && member.name && member.arguments.length)
- {
- var a_test = async_test( this.name + " interface: calling " + member.name +
- "(" + member.arguments.map(function(m) { return m.idlType.idlType; }) +
- ") on " + desc + " with too few arguments must throw TypeError");
- a_test.step(function()
- {
- assert_equals(exception, null, "Unexpected exception when evaluating object");
- assert_equals(typeof obj, expected_typeof, "wrong typeof object");
- if (!member["static"]) {
- if (!this.is_global() && !member.isUnforgeable) {
- assert_inherits(obj, member.name);
- } else {
- assert_own_property(obj, member.name);
- }
- }
- else
- {
- assert_false(member.name in obj);
- }
-
- var minLength = minOverloadLength(this.members.filter(function(m) {
- return m.type == "operation" && m.name == member.name;
- }));
- var args = [];
- var cb = awaitNCallbacks(minLength, a_test.done.bind(a_test));
- for (var i = 0; i < minLength; i++) {
- throwOrReject(a_test, member, obj[member.name], obj, args, "Called with " + i + " arguments", cb);
-
- args.push(create_suitable_object(member.arguments[i].idlType));
- }
- if (minLength === 0) {
- cb();
- }
- }.bind(this));
- }
- }
-};
-
-//@}
-IdlInterface.prototype.has_stringifier = function()
-//@{
-{
- if (this.members.some(function(member) { return member.stringifier; })) {
- return true;
- }
- if (this.base &&
- this.array.members[this.base].has_stringifier()) {
- return true;
- }
- return false;
-};
-
-//@}
-IdlInterface.prototype.do_interface_attribute_asserts = function(obj, member)
-//@{
-{
- // This function tests WebIDL as of 2015-01-27.
- // TODO: Consider [Exposed].
-
- // This is called by test_member_attribute() with the prototype as obj if
- // it is not a global, and the global otherwise, and by test_interface_of()
- // with the object as obj.
-
- // "For each exposed attribute of the interface, whether it was declared on
- // the interface itself or one of its consequential interfaces, there MUST
- // exist a corresponding property. The characteristics of this property are
- // as follows:"
-
- // "The name of the property is the identifier of the attribute."
- assert_own_property(obj, member.name);
-
- // "The property has attributes { [[Get]]: G, [[Set]]: S, [[Enumerable]]:
- // true, [[Configurable]]: configurable }, where:
- // "configurable is false if the attribute was declared with the
- // [Unforgeable] extended attribute and true otherwise;
- // "G is the attribute getter, defined below; and
- // "S is the attribute setter, also defined below."
- var desc = Object.getOwnPropertyDescriptor(obj, member.name);
- assert_false("value" in desc, 'property descriptor has value but is supposed to be accessor');
- assert_false("writable" in desc, 'property descriptor has "writable" field but is supposed to be accessor');
- assert_true(desc.enumerable, "property is not enumerable");
- if (member.isUnforgeable)
- {
- assert_false(desc.configurable, "[Unforgeable] property must not be configurable");
- }
- else
- {
- assert_true(desc.configurable, "property must be configurable");
- }
-
-
- // "The attribute getter is a Function object whose behavior when invoked
- // is as follows:"
- assert_equals(typeof desc.get, "function", "getter must be Function");
-
- // "If the attribute is a regular attribute, then:"
- if (!member["static"]) {
- // "If O is not a platform object that implements I, then:
- // "If the attribute was specified with the [LenientThis] extended
- // attribute, then return undefined.
- // "Otherwise, throw a TypeError."
- if (!member.has_extended_attribute("LenientThis")) {
- assert_throws(new TypeError(), function() {
- desc.get.call({});
- }.bind(this), "calling getter on wrong object type must throw TypeError");
- } else {
- assert_equals(desc.get.call({}), undefined,
- "calling getter on wrong object type must return undefined");
- }
- }
-
- // "The value of the Function object’s “length” property is the Number
- // value 0."
- assert_equals(desc.get.length, 0, "getter length must be 0");
-
-
- // TODO: Test calling setter on the interface prototype (should throw
- // TypeError in most cases).
- if (member.readonly
- && !member.has_extended_attribute("PutForwards")
- && !member.has_extended_attribute("Replaceable"))
- {
- // "The attribute setter is undefined if the attribute is declared
- // readonly and has neither a [PutForwards] nor a [Replaceable]
- // extended attribute declared on it."
- assert_equals(desc.set, undefined, "setter must be undefined for readonly attributes");
- }
- else
- {
- // "Otherwise, it is a Function object whose behavior when
- // invoked is as follows:"
- assert_equals(typeof desc.set, "function", "setter must be function for PutForwards, Replaceable, or non-readonly attributes");
-
- // "If the attribute is a regular attribute, then:"
- if (!member["static"]) {
- // "If /validThis/ is false and the attribute was not specified
- // with the [LenientThis] extended attribute, then throw a
- // TypeError."
- // "If the attribute is declared with a [Replaceable] extended
- // attribute, then: ..."
- // "If validThis is false, then return."
- if (!member.has_extended_attribute("LenientThis")) {
- assert_throws(new TypeError(), function() {
- desc.set.call({});
- }.bind(this), "calling setter on wrong object type must throw TypeError");
- } else {
- assert_equals(desc.set.call({}), undefined,
- "calling setter on wrong object type must return undefined");
- }
- }
-
- // "The value of the Function object’s “length” property is the Number
- // value 1."
- assert_equals(desc.set.length, 1, "setter length must be 1");
- }
-}
-//@}
-
-/// IdlInterfaceMember ///
-function IdlInterfaceMember(obj)
-//@{
-{
- /**
- * obj is an object produced by the WebIDLParser.js "ifMember" production.
- * We just forward all properties to this object without modification,
- * except for special extAttrs handling.
- */
- for (var k in obj)
- {
- this[k] = obj[k];
- }
- if (!("extAttrs" in this))
- {
- this.extAttrs = [];
- }
-
- this.isUnforgeable = this.has_extended_attribute("Unforgeable");
-}
-
-//@}
-IdlInterfaceMember.prototype = Object.create(IdlObject.prototype);
-
-/// Internal helper functions ///
-function create_suitable_object(type)
-//@{
-{
- /**
- * type is an object produced by the WebIDLParser.js "type" production. We
- * return a JavaScript value that matches the type, if we can figure out
- * how.
- */
- if (type.nullable)
- {
- return null;
- }
- switch (type.idlType)
- {
- case "any":
- case "boolean":
- return true;
-
- case "byte": case "octet": case "short": case "unsigned short":
- case "long": case "unsigned long": case "long long":
- case "unsigned long long": case "float": case "double":
- case "unrestricted float": case "unrestricted double":
- return 7;
-
- case "DOMString":
- case "ByteString":
- case "USVString":
- return "foo";
-
- case "object":
- return {a: "b"};
-
- case "Node":
- return document.createTextNode("abc");
- }
- return null;
-}
-//@}
-
-/// IdlEnum ///
-// Used for IdlArray.prototype.assert_type_is
-function IdlEnum(obj)
-//@{
-{
- /**
- * obj is an object produced by the WebIDLParser.js "dictionary"
- * production.
- */
-
- /** Self-explanatory. */
- this.name = obj.name;
-
- /** An array of values produced by the "enum" production. */
- this.values = obj.values;
-
-}
-//@}
-
-IdlEnum.prototype = Object.create(IdlObject.prototype);
-
-/// IdlTypedef ///
-// Used for IdlArray.prototype.assert_type_is
-function IdlTypedef(obj)
-//@{
-{
- /**
- * obj is an object produced by the WebIDLParser.js "typedef"
- * production.
- */
-
- /** Self-explanatory. */
- this.name = obj.name;
-
- /** An array of values produced by the "typedef" production. */
- this.values = obj.values;
-
-}
-//@}
-
-IdlTypedef.prototype = Object.create(IdlObject.prototype);
-
-}());
-// vim: set expandtab shiftwidth=4 tabstop=4 foldmarker=@{,@} foldmethod=marker:
</del></span></pre></div>
<a id="trunkLayoutTestsplatformmacjsdomglobalconstructorsattributesexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/mac/js/dom/global-constructors-attributes-expected.txt (213080 => 213081)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac/js/dom/global-constructors-attributes-expected.txt        2017-02-27 18:22:49 UTC (rev 213080)
+++ trunk/LayoutTests/platform/mac/js/dom/global-constructors-attributes-expected.txt        2017-02-27 19:01:13 UTC (rev 213081)
</span><span class="lines">@@ -303,6 +303,11 @@
</span><span class="cx"> PASS Object.getOwnPropertyDescriptor(global, 'Counter').hasOwnProperty('set') is false
</span><span class="cx"> PASS Object.getOwnPropertyDescriptor(global, 'Counter').enumerable is false
</span><span class="cx"> PASS Object.getOwnPropertyDescriptor(global, 'Counter').configurable is true
</span><ins>+PASS Object.getOwnPropertyDescriptor(global, 'Credential').value is Credential
+PASS Object.getOwnPropertyDescriptor(global, 'Credential').hasOwnProperty('get') is false
+PASS Object.getOwnPropertyDescriptor(global, 'Credential').hasOwnProperty('set') is false
+PASS Object.getOwnPropertyDescriptor(global, 'Credential').enumerable is false
+PASS Object.getOwnPropertyDescriptor(global, 'Credential').configurable is true
</ins><span class="cx"> PASS Object.getOwnPropertyDescriptor(global, 'Crypto').value is Crypto
</span><span class="cx"> PASS Object.getOwnPropertyDescriptor(global, 'Crypto').hasOwnProperty('get') is false
</span><span class="cx"> PASS Object.getOwnPropertyDescriptor(global, 'Crypto').hasOwnProperty('set') is false
</span><span class="lines">@@ -1168,6 +1173,11 @@
</span><span class="cx"> PASS Object.getOwnPropertyDescriptor(global, 'PageTransitionEvent').hasOwnProperty('set') is false
</span><span class="cx"> PASS Object.getOwnPropertyDescriptor(global, 'PageTransitionEvent').enumerable is false
</span><span class="cx"> PASS Object.getOwnPropertyDescriptor(global, 'PageTransitionEvent').configurable is true
</span><ins>+PASS Object.getOwnPropertyDescriptor(global, 'PasswordCredential').value is PasswordCredential
+PASS Object.getOwnPropertyDescriptor(global, 'PasswordCredential').hasOwnProperty('get') is false
+PASS Object.getOwnPropertyDescriptor(global, 'PasswordCredential').hasOwnProperty('set') is false
+PASS Object.getOwnPropertyDescriptor(global, 'PasswordCredential').enumerable is false
+PASS Object.getOwnPropertyDescriptor(global, 'PasswordCredential').configurable is true
</ins><span class="cx"> PASS Object.getOwnPropertyDescriptor(global, 'Path2D').value is Path2D
</span><span class="cx"> PASS Object.getOwnPropertyDescriptor(global, 'Path2D').hasOwnProperty('get') is false
</span><span class="cx"> PASS Object.getOwnPropertyDescriptor(global, 'Path2D').hasOwnProperty('set') is false
</span><span class="lines">@@ -2098,6 +2108,11 @@
</span><span class="cx"> PASS Object.getOwnPropertyDescriptor(global, 'SharedArrayBuffer').hasOwnProperty('set') is false
</span><span class="cx"> PASS Object.getOwnPropertyDescriptor(global, 'SharedArrayBuffer').enumerable is false
</span><span class="cx"> PASS Object.getOwnPropertyDescriptor(global, 'SharedArrayBuffer').configurable is true
</span><ins>+PASS Object.getOwnPropertyDescriptor(global, 'SiteBoundCredential').value is SiteBoundCredential
+PASS Object.getOwnPropertyDescriptor(global, 'SiteBoundCredential').hasOwnProperty('get') is false
+PASS Object.getOwnPropertyDescriptor(global, 'SiteBoundCredential').hasOwnProperty('set') is false
+PASS Object.getOwnPropertyDescriptor(global, 'SiteBoundCredential').enumerable is false
+PASS Object.getOwnPropertyDescriptor(global, 'SiteBoundCredential').configurable is true
</ins><span class="cx"> PASS Object.getOwnPropertyDescriptor(global, 'SourceBuffer').value is SourceBuffer
</span><span class="cx"> PASS Object.getOwnPropertyDescriptor(global, 'SourceBuffer').hasOwnProperty('get') is false
</span><span class="cx"> PASS Object.getOwnPropertyDescriptor(global, 'SourceBuffer').hasOwnProperty('set') is false
</span></span></pre></div>
<a id="trunkLayoutTestsplatformmacelcapitanjsdomglobalconstructorsattributesexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/mac-elcapitan/js/dom/global-constructors-attributes-expected.txt (213080 => 213081)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac-elcapitan/js/dom/global-constructors-attributes-expected.txt        2017-02-27 18:22:49 UTC (rev 213080)
+++ trunk/LayoutTests/platform/mac-elcapitan/js/dom/global-constructors-attributes-expected.txt        2017-02-27 19:01:13 UTC (rev 213081)
</span><span class="lines">@@ -298,6 +298,11 @@
</span><span class="cx"> PASS Object.getOwnPropertyDescriptor(global, 'Counter').hasOwnProperty('set') is false
</span><span class="cx"> PASS Object.getOwnPropertyDescriptor(global, 'Counter').enumerable is false
</span><span class="cx"> PASS Object.getOwnPropertyDescriptor(global, 'Counter').configurable is true
</span><ins>+PASS Object.getOwnPropertyDescriptor(global, 'Credential').value is Credential
+PASS Object.getOwnPropertyDescriptor(global, 'Credential').hasOwnProperty('get') is false
+PASS Object.getOwnPropertyDescriptor(global, 'Credential').hasOwnProperty('set') is false
+PASS Object.getOwnPropertyDescriptor(global, 'Credential').enumerable is false
+PASS Object.getOwnPropertyDescriptor(global, 'Credential').configurable is true
</ins><span class="cx"> PASS Object.getOwnPropertyDescriptor(global, 'Crypto').value is Crypto
</span><span class="cx"> PASS Object.getOwnPropertyDescriptor(global, 'Crypto').hasOwnProperty('get') is false
</span><span class="cx"> PASS Object.getOwnPropertyDescriptor(global, 'Crypto').hasOwnProperty('set') is false
</span><span class="lines">@@ -1163,6 +1168,11 @@
</span><span class="cx"> PASS Object.getOwnPropertyDescriptor(global, 'PageTransitionEvent').hasOwnProperty('set') is false
</span><span class="cx"> PASS Object.getOwnPropertyDescriptor(global, 'PageTransitionEvent').enumerable is false
</span><span class="cx"> PASS Object.getOwnPropertyDescriptor(global, 'PageTransitionEvent').configurable is true
</span><ins>+PASS Object.getOwnPropertyDescriptor(global, 'PasswordCredential').value is PasswordCredential
+PASS Object.getOwnPropertyDescriptor(global, 'PasswordCredential').hasOwnProperty('get') is false
+PASS Object.getOwnPropertyDescriptor(global, 'PasswordCredential').hasOwnProperty('set') is false
+PASS Object.getOwnPropertyDescriptor(global, 'PasswordCredential').enumerable is false
+PASS Object.getOwnPropertyDescriptor(global, 'PasswordCredential').configurable is true
</ins><span class="cx"> PASS Object.getOwnPropertyDescriptor(global, 'Path2D').value is Path2D
</span><span class="cx"> PASS Object.getOwnPropertyDescriptor(global, 'Path2D').hasOwnProperty('get') is false
</span><span class="cx"> PASS Object.getOwnPropertyDescriptor(global, 'Path2D').hasOwnProperty('set') is false
</span><span class="lines">@@ -2093,6 +2103,11 @@
</span><span class="cx"> PASS Object.getOwnPropertyDescriptor(global, 'SharedArrayBuffer').hasOwnProperty('set') is false
</span><span class="cx"> PASS Object.getOwnPropertyDescriptor(global, 'SharedArrayBuffer').enumerable is false
</span><span class="cx"> PASS Object.getOwnPropertyDescriptor(global, 'SharedArrayBuffer').configurable is true
</span><ins>+PASS Object.getOwnPropertyDescriptor(global, 'SiteBoundCredential').value is SiteBoundCredential
+PASS Object.getOwnPropertyDescriptor(global, 'SiteBoundCredential').hasOwnProperty('get') is false
+PASS Object.getOwnPropertyDescriptor(global, 'SiteBoundCredential').hasOwnProperty('set') is false
+PASS Object.getOwnPropertyDescriptor(global, 'SiteBoundCredential').enumerable is false
+PASS Object.getOwnPropertyDescriptor(global, 'SiteBoundCredential').configurable is true
</ins><span class="cx"> PASS Object.getOwnPropertyDescriptor(global, 'SourceBuffer').value is SourceBuffer
</span><span class="cx"> PASS Object.getOwnPropertyDescriptor(global, 'SourceBuffer').hasOwnProperty('get') is false
</span><span class="cx"> PASS Object.getOwnPropertyDescriptor(global, 'SourceBuffer').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 (213080 => 213081)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac-wk1/js/dom/global-constructors-attributes-expected.txt        2017-02-27 18:22:49 UTC (rev 213080)
+++ trunk/LayoutTests/platform/mac-wk1/js/dom/global-constructors-attributes-expected.txt        2017-02-27 19:01:13 UTC (rev 213081)
</span><span class="lines">@@ -298,6 +298,11 @@
</span><span class="cx"> PASS Object.getOwnPropertyDescriptor(global, 'Counter').hasOwnProperty('set') is false
</span><span class="cx"> PASS Object.getOwnPropertyDescriptor(global, 'Counter').enumerable is false
</span><span class="cx"> PASS Object.getOwnPropertyDescriptor(global, 'Counter').configurable is true
</span><ins>+PASS Object.getOwnPropertyDescriptor(global, 'Credential').value is Credential
+PASS Object.getOwnPropertyDescriptor(global, 'Credential').hasOwnProperty('get') is false
+PASS Object.getOwnPropertyDescriptor(global, 'Credential').hasOwnProperty('set') is false
+PASS Object.getOwnPropertyDescriptor(global, 'Credential').enumerable is false
+PASS Object.getOwnPropertyDescriptor(global, 'Credential').configurable is true
</ins><span class="cx"> PASS Object.getOwnPropertyDescriptor(global, 'Crypto').value is Crypto
</span><span class="cx"> PASS Object.getOwnPropertyDescriptor(global, 'Crypto').hasOwnProperty('get') is false
</span><span class="cx"> PASS Object.getOwnPropertyDescriptor(global, 'Crypto').hasOwnProperty('set') is false
</span><span class="lines">@@ -1163,6 +1168,11 @@
</span><span class="cx"> PASS Object.getOwnPropertyDescriptor(global, 'PageTransitionEvent').hasOwnProperty('set') is false
</span><span class="cx"> PASS Object.getOwnPropertyDescriptor(global, 'PageTransitionEvent').enumerable is false
</span><span class="cx"> PASS Object.getOwnPropertyDescriptor(global, 'PageTransitionEvent').configurable is true
</span><ins>+PASS Object.getOwnPropertyDescriptor(global, 'PasswordCredential').value is PasswordCredential
+PASS Object.getOwnPropertyDescriptor(global, 'PasswordCredential').hasOwnProperty('get') is false
+PASS Object.getOwnPropertyDescriptor(global, 'PasswordCredential').hasOwnProperty('set') is false
+PASS Object.getOwnPropertyDescriptor(global, 'PasswordCredential').enumerable is false
+PASS Object.getOwnPropertyDescriptor(global, 'PasswordCredential').configurable is true
</ins><span class="cx"> PASS Object.getOwnPropertyDescriptor(global, 'Path2D').value is Path2D
</span><span class="cx"> PASS Object.getOwnPropertyDescriptor(global, 'Path2D').hasOwnProperty('get') is false
</span><span class="cx"> PASS Object.getOwnPropertyDescriptor(global, 'Path2D').hasOwnProperty('set') is false
</span><span class="lines">@@ -2093,6 +2103,11 @@
</span><span class="cx"> PASS Object.getOwnPropertyDescriptor(global, 'SharedArrayBuffer').hasOwnProperty('set') is false
</span><span class="cx"> PASS Object.getOwnPropertyDescriptor(global, 'SharedArrayBuffer').enumerable is false
</span><span class="cx"> PASS Object.getOwnPropertyDescriptor(global, 'SharedArrayBuffer').configurable is true
</span><ins>+PASS Object.getOwnPropertyDescriptor(global, 'SiteBoundCredential').value is SiteBoundCredential
+PASS Object.getOwnPropertyDescriptor(global, 'SiteBoundCredential').hasOwnProperty('get') is false
+PASS Object.getOwnPropertyDescriptor(global, 'SiteBoundCredential').hasOwnProperty('set') is false
+PASS Object.getOwnPropertyDescriptor(global, 'SiteBoundCredential').enumerable is false
+PASS Object.getOwnPropertyDescriptor(global, 'SiteBoundCredential').configurable is true
</ins><span class="cx"> PASS Object.getOwnPropertyDescriptor(global, 'SourceBuffer').value is SourceBuffer
</span><span class="cx"> PASS Object.getOwnPropertyDescriptor(global, 'SourceBuffer').hasOwnProperty('get') is false
</span><span class="cx"> PASS Object.getOwnPropertyDescriptor(global, 'SourceBuffer').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 (213080 => 213081)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac-yosemite/js/dom/global-constructors-attributes-expected.txt        2017-02-27 18:22:49 UTC (rev 213080)
+++ trunk/LayoutTests/platform/mac-yosemite/js/dom/global-constructors-attributes-expected.txt        2017-02-27 19:01:13 UTC (rev 213081)
</span><span class="lines">@@ -298,6 +298,11 @@
</span><span class="cx"> PASS Object.getOwnPropertyDescriptor(global, 'Counter').hasOwnProperty('set') is false
</span><span class="cx"> PASS Object.getOwnPropertyDescriptor(global, 'Counter').enumerable is false
</span><span class="cx"> PASS Object.getOwnPropertyDescriptor(global, 'Counter').configurable is true
</span><ins>+PASS Object.getOwnPropertyDescriptor(global, 'Credential').value is Credential
+PASS Object.getOwnPropertyDescriptor(global, 'Credential').hasOwnProperty('get') is false
+PASS Object.getOwnPropertyDescriptor(global, 'Credential').hasOwnProperty('set') is false
+PASS Object.getOwnPropertyDescriptor(global, 'Credential').enumerable is false
+PASS Object.getOwnPropertyDescriptor(global, 'Credential').configurable is true
</ins><span class="cx"> PASS Object.getOwnPropertyDescriptor(global, 'Crypto').value is Crypto
</span><span class="cx"> PASS Object.getOwnPropertyDescriptor(global, 'Crypto').hasOwnProperty('get') is false
</span><span class="cx"> PASS Object.getOwnPropertyDescriptor(global, 'Crypto').hasOwnProperty('set') is false
</span><span class="lines">@@ -1158,6 +1163,11 @@
</span><span class="cx"> PASS Object.getOwnPropertyDescriptor(global, 'PageTransitionEvent').hasOwnProperty('set') is false
</span><span class="cx"> PASS Object.getOwnPropertyDescriptor(global, 'PageTransitionEvent').enumerable is false
</span><span class="cx"> PASS Object.getOwnPropertyDescriptor(global, 'PageTransitionEvent').configurable is true
</span><ins>+PASS Object.getOwnPropertyDescriptor(global, 'PasswordCredential').value is PasswordCredential
+PASS Object.getOwnPropertyDescriptor(global, 'PasswordCredential').hasOwnProperty('get') is false
+PASS Object.getOwnPropertyDescriptor(global, 'PasswordCredential').hasOwnProperty('set') is false
+PASS Object.getOwnPropertyDescriptor(global, 'PasswordCredential').enumerable is false
+PASS Object.getOwnPropertyDescriptor(global, 'PasswordCredential').configurable is true
</ins><span class="cx"> PASS Object.getOwnPropertyDescriptor(global, 'Path2D').value is Path2D
</span><span class="cx"> PASS Object.getOwnPropertyDescriptor(global, 'Path2D').hasOwnProperty('get') is false
</span><span class="cx"> PASS Object.getOwnPropertyDescriptor(global, 'Path2D').hasOwnProperty('set') is false
</span><span class="lines">@@ -2088,6 +2098,11 @@
</span><span class="cx"> PASS Object.getOwnPropertyDescriptor(global, 'SharedArrayBuffer').hasOwnProperty('set') is false
</span><span class="cx"> PASS Object.getOwnPropertyDescriptor(global, 'SharedArrayBuffer').enumerable is false
</span><span class="cx"> PASS Object.getOwnPropertyDescriptor(global, 'SharedArrayBuffer').configurable is true
</span><ins>+PASS Object.getOwnPropertyDescriptor(global, 'SiteBoundCredential').value is SiteBoundCredential
+PASS Object.getOwnPropertyDescriptor(global, 'SiteBoundCredential').hasOwnProperty('get') is false
+PASS Object.getOwnPropertyDescriptor(global, 'SiteBoundCredential').hasOwnProperty('set') is false
+PASS Object.getOwnPropertyDescriptor(global, 'SiteBoundCredential').enumerable is false
+PASS Object.getOwnPropertyDescriptor(global, 'SiteBoundCredential').configurable is true
</ins><span class="cx"> PASS Object.getOwnPropertyDescriptor(global, 'SourceBuffer').value is SourceBuffer
</span><span class="cx"> PASS Object.getOwnPropertyDescriptor(global, 'SourceBuffer').hasOwnProperty('get') is false
</span><span class="cx"> PASS Object.getOwnPropertyDescriptor(global, 'SourceBuffer').hasOwnProperty('set') is false
</span></span></pre></div>
<a id="trunkLayoutTestsresourcesWebIDLParserjs"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/resources/WebIDLParser.js (0 => 213081)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/resources/WebIDLParser.js         (rev 0)
+++ trunk/LayoutTests/resources/WebIDLParser.js        2017-02-27 19:01:13 UTC (rev 213081)
</span><span class="lines">@@ -0,0 +1,1012 @@
</span><ins>+
+
+(function () {
+ var tokenise = function (str) {
+ var tokens = []
+ , re = {
+ "float": /^-?(([0-9]+\.[0-9]*|[0-9]*\.[0-9]+)([Ee][-+]?[0-9]+)?|[0-9]+[Ee][-+]?[0-9]+)/
+ , "integer": /^-?(0([Xx][0-9A-Fa-f]+|[0-7]*)|[1-9][0-9]*)/
+ , "identifier": /^[A-Z_a-z][0-9A-Z_a-z]*/
+ , "string": /^"[^"]*"/
+ , "whitespace": /^(?:[\t\n\r ]+|[\t\n\r ]*((\/\/.*|\/\*(.|\n|\r)*?\*\/)[\t\n\r ]*))+/
+ , "other": /^[^\t\n\r 0-9A-Z_a-z]/
+ }
+ , types = []
+ ;
+ for (var k in re) types.push(k);
+ while (str.length > 0) {
+ var matched = false;
+ for (var i = 0, n = types.length; i < n; i++) {
+ var type = types[i];
+ str = str.replace(re[type], function (tok) {
+ tokens.push({ type: type, value: tok });
+ matched = true;
+ return "";
+ });
+ if (matched) break;
+ }
+ if (matched) continue;
+ throw new Error("Token stream not progressing");
+ }
+ return tokens;
+ };
+
+ var parse = function (tokens, opt) {
+ var line = 1;
+ tokens = tokens.slice();
+
+ var FLOAT = "float"
+ , INT = "integer"
+ , ID = "identifier"
+ , STR = "string"
+ , OTHER = "other"
+ ;
+
+ var WebIDLParseError = function (str, line, input, tokens) {
+ this.message = str;
+ this.line = line;
+ this.input = input;
+ this.tokens = tokens;
+ };
+ WebIDLParseError.prototype.toString = function () {
+ return this.message + ", line " + this.line + " (tokens: '" + this.input + "')\n" +
+ JSON.stringify(this.tokens, null, 4);
+ };
+
+ var error = function (str) {
+ var tok = "", numTokens = 0, maxTokens = 5;
+ while (numTokens < maxTokens && tokens.length > numTokens) {
+ tok += tokens[numTokens].value;
+ numTokens++;
+ }
+ throw new WebIDLParseError(str, line, tok, tokens.slice(0, 5));
+ };
+
+ var last_token = null;
+
+ var consume = function (type, value) {
+ if (!tokens.length || tokens[0].type !== type) return;
+ if (typeof value === "undefined" || tokens[0].value === value) {
+ last_token = tokens.shift();
+ if (type === ID) last_token.value = last_token.value.replace(/^_/, "");
+ return last_token;
+ }
+ };
+
+ var ws = function () {
+ if (!tokens.length) return;
+ if (tokens[0].type === "whitespace") {
+ var t = tokens.shift();
+ t.value.replace(/\n/g, function (m) { line++; return m; });
+ return t;
+ }
+ };
+
+ var all_ws = function (store, pea) { // pea == post extended attribute, tpea = same for types
+ var t = { type: "whitespace", value: "" };
+ while (true) {
+ var w = ws();
+ if (!w) break;
+ t.value += w.value;
+ }
+ if (t.value.length > 0) {
+ if (store) {
+ var w = t.value
+ , re = {
+ "ws": /^([\t\n\r ]+)/
+ , "line-comment": /^\/\/(.*)\n?/m
+ , "multiline-comment": /^\/\*((?:.|\n|\r)*?)\*\//
+ }
+ , wsTypes = []
+ ;
+ for (var k in re) wsTypes.push(k);
+ while (w.length) {
+ var matched = false;
+ for (var i = 0, n = wsTypes.length; i < n; i++) {
+ var type = wsTypes[i];
+ w = w.replace(re[type], function (tok, m1) {
+ store.push({ type: type + (pea ? ("-" + pea) : ""), value: m1 });
+ matched = true;
+ return "";
+ });
+ if (matched) break;
+ }
+ if (matched) continue;
+ throw new Error("Surprising white space construct."); // this shouldn't happen
+ }
+ }
+ return t;
+ }
+ };
+
+ var integer_type = function () {
+ var ret = "";
+ all_ws();
+ if (consume(ID, "unsigned")) ret = "unsigned ";
+ all_ws();
+ if (consume(ID, "short")) return ret + "short";
+ if (consume(ID, "long")) {
+ ret += "long";
+ all_ws();
+ if (consume(ID, "long")) return ret + " long";
+ return ret;
+ }
+ if (ret) error("Failed to parse integer type");
+ };
+
+ var float_type = function () {
+ var ret = "";
+ all_ws();
+ if (consume(ID, "unrestricted")) ret = "unrestricted ";
+ all_ws();
+ if (consume(ID, "float")) return ret + "float";
+ if (consume(ID, "double")) return ret + "double";
+ if (ret) error("Failed to parse float type");
+ };
+
+ var primitive_type = function () {
+ var num_type = integer_type() || float_type();
+ if (num_type) return num_type;
+ all_ws();
+ if (consume(ID, "boolean")) return "boolean";
+ if (consume(ID, "byte")) return "byte";
+ if (consume(ID, "octet")) return "octet";
+ };
+
+ var const_value = function () {
+ if (consume(ID, "true")) return { type: "boolean", value: true };
+ if (consume(ID, "false")) return { type: "boolean", value: false };
+ if (consume(ID, "null")) return { type: "null" };
+ if (consume(ID, "Infinity")) return { type: "Infinity", negative: false };
+ if (consume(ID, "NaN")) return { type: "NaN" };
+ var ret = consume(FLOAT) || consume(INT);
+ if (ret) return { type: "number", value: 1 * ret.value };
+ var tok = consume(OTHER, "-");
+ if (tok) {
+ if (consume(ID, "Infinity")) return { type: "Infinity", negative: true };
+ else tokens.unshift(tok);
+ }
+ };
+
+ var type_suffix = function (obj) {
+ while (true) {
+ all_ws();
+ if (consume(OTHER, "?")) {
+ if (obj.nullable) error("Can't nullable more than once");
+ obj.nullable = true;
+ }
+ else if (consume(OTHER, "[")) {
+ all_ws();
+ consume(OTHER, "]") || error("Unterminated array type");
+ if (!obj.array) {
+ obj.array = 1;
+ obj.nullableArray = [obj.nullable];
+ }
+ else {
+ obj.array++;
+ obj.nullableArray.push(obj.nullable);
+ }
+ obj.nullable = false;
+ }
+ else return;
+ }
+ };
+
+ var single_type = function () {
+ var prim = primitive_type()
+ , ret = { sequence: false, generic: null, nullable: false, array: false, union: false }
+ , name
+ , value
+ ;
+ if (prim) {
+ ret.idlType = prim;
+ }
+ else if (name = consume(ID)) {
+ value = name.value;
+ all_ws();
+ // Generic types
+ if (consume(OTHER, "<")) {
+ // backwards compat
+ if (value === "sequence") {
+ ret.sequence = true;
+ }
+ ret.generic = value;
+ ret.idlType = type() || error("Error parsing generic type " + value);
+ all_ws();
+ if (!consume(OTHER, ">")) error("Unterminated generic type " + value);
+ type_suffix(ret);
+ return ret;
+ }
+ else {
+ ret.idlType = value;
+ }
+ }
+ else {
+ return;
+ }
+ type_suffix(ret);
+ if (ret.nullable && !ret.array && ret.idlType === "any") error("Type any cannot be made nullable");
+ return ret;
+ };
+
+ var union_type = function () {
+ all_ws();
+ if (!consume(OTHER, "(")) return;
+ var ret = { sequence: false, generic: null, nullable: false, array: false, union: true, idlType: [] };
+ var fst = type() || error("Union type with no content");
+ ret.idlType.push(fst);
+ while (true) {
+ all_ws();
+ if (!consume(ID, "or")) break;
+ var typ = type() || error("No type after 'or' in union type");
+ ret.idlType.push(typ);
+ }
+ if (!consume(OTHER, ")")) error("Unterminated union type");
+ type_suffix(ret);
+ return ret;
+ };
+
+ var type = function () {
+ return single_type() || union_type();
+ };
+
+ var argument = function (store) {
+ var ret = { optional: false, variadic: false };
+ ret.extAttrs = extended_attrs(store);
+ all_ws(store, "pea");
+ var opt_token = consume(ID, "optional");
+ if (opt_token) {
+ ret.optional = true;
+ all_ws();
+ }
+ ret.idlType = type();
+ if (!ret.idlType) {
+ if (opt_token) tokens.unshift(opt_token);
+ return;
+ }
+ var type_token = last_token;
+ if (!ret.optional) {
+ all_ws();
+ if (tokens.length >= 3 &&
+ tokens[0].type === "other" && tokens[0].value === "." &&
+ tokens[1].type === "other" && tokens[1].value === "." &&
+ tokens[2].type === "other" && tokens[2].value === "."
+ ) {
+ tokens.shift();
+ tokens.shift();
+ tokens.shift();
+ ret.variadic = true;
+ }
+ }
+ all_ws();
+ var name = consume(ID);
+ if (!name) {
+ if (opt_token) tokens.unshift(opt_token);
+ tokens.unshift(type_token);
+ return;
+ }
+ ret.name = name.value;
+ if (ret.optional) {
+ all_ws();
+ ret["default"] = default_();
+ }
+ return ret;
+ };
+
+ var argument_list = function (store) {
+ var ret = []
+ , arg = argument(store ? ret : null)
+ ;
+ if (!arg) return;
+ ret.push(arg);
+ while (true) {
+ all_ws(store ? ret : null);
+ if (!consume(OTHER, ",")) return ret;
+ var nxt = argument(store ? ret : null) || error("Trailing comma in arguments list");
+ ret.push(nxt);
+ }
+ };
+
+ var type_pair = function () {
+ all_ws();
+ var k = type();
+ if (!k) return;
+ all_ws()
+ if (!consume(OTHER, ",")) return;
+ all_ws();
+ var v = type();
+ if (!v) return;
+ return [k, v];
+ };
+
+ var simple_extended_attr = function (store) {
+ all_ws();
+ var name = consume(ID);
+ if (!name) return;
+ var ret = {
+ name: name.value
+ , "arguments": null
+ };
+ all_ws();
+ var eq = consume(OTHER, "=");
+ if (eq) {
+ var rhs;
+ all_ws();
+ if (rhs = consume(ID)) {
+ ret.rhs = rhs
+ }
+ else if (consume(OTHER, "(")) {
+ // [Exposed=(Window,Worker)]
+ rhs = [];
+ var id = consume(ID);
+ if (id) {
+ rhs = [id.value];
+ }
+ identifiers(rhs);
+ consume(OTHER, ")") || error("Unexpected token in extended attribute argument list or type pair");
+ ret.rhs = {
+ type: "identifier-list",
+ value: rhs
+ };
+ }
+ if (!ret.rhs) return error("No right hand side to extended attribute assignment");
+ }
+ all_ws();
+ if (consume(OTHER, "(")) {
+ var args, pair;
+ // [Constructor(DOMString str)]
+ if (args = argument_list(store)) {
+ ret["arguments"] = args;
+ }
+ // [MapClass(DOMString, DOMString)]
+ else if (pair = type_pair()) {
+ ret.typePair = pair;
+ }
+ // [Constructor()]
+ else {
+ ret["arguments"] = [];
+ }
+ all_ws();
+ consume(OTHER, ")") || error("Unexpected token in extended attribute argument list or type pair");
+ }
+ return ret;
+ };
+
+ // Note: we parse something simpler than the official syntax. It's all that ever
+ // seems to be used
+ var extended_attrs = function (store) {
+ var eas = [];
+ all_ws(store);
+ if (!consume(OTHER, "[")) return eas;
+ eas[0] = simple_extended_attr(store) || error("Extended attribute with not content");
+ all_ws();
+ while (consume(OTHER, ",")) {
+ eas.push(simple_extended_attr(store) || error("Trailing comma in extended attribute"));
+ all_ws();
+ }
+ consume(OTHER, "]") || error("No end of extended attribute");
+ return eas;
+ };
+
+ var default_ = function () {
+ all_ws();
+ if (consume(OTHER, "=")) {
+ all_ws();
+ var def = const_value();
+ if (def) {
+ return def;
+ }
+ else if (consume(OTHER, "[")) {
+ if (!consume(OTHER, "]")) error("Default sequence value must be empty");
+ return { type: "sequence", value: [] };
+ }
+ else {
+ var str = consume(STR) || error("No value for default");
+ str.value = str.value.replace(/^"/, "").replace(/"$/, "");
+ return str;
+ }
+ }
+ };
+
+ var const_ = function (store) {
+ all_ws(store, "pea");
+ if (!consume(ID, "const")) return;
+ var ret = { type: "const", nullable: false };
+ all_ws();
+ var typ = primitive_type();
+ if (!typ) {
+ typ = consume(ID) || error("No type for const");
+ typ = typ.value;
+ }
+ ret.idlType = typ;
+ all_ws();
+ if (consume(OTHER, "?")) {
+ ret.nullable = true;
+ all_ws();
+ }
+ var name = consume(ID) || error("No name for const");
+ ret.name = name.value;
+ all_ws();
+ consume(OTHER, "=") || error("No value assignment for const");
+ all_ws();
+ var cnt = const_value();
+ if (cnt) ret.value = cnt;
+ else error("No value for const");
+ all_ws();
+ consume(OTHER, ";") || error("Unterminated const");
+ return ret;
+ };
+
+ var inheritance = function () {
+ all_ws();
+ if (consume(OTHER, ":")) {
+ all_ws();
+ var inh = consume(ID) || error ("No type in inheritance");
+ return inh.value;
+ }
+ };
+
+ var operation_rest = function (ret, store) {
+ all_ws();
+ if (!ret) ret = {};
+ var name = consume(ID);
+ ret.name = name ? name.value : null;
+ all_ws();
+ consume(OTHER, "(") || error("Invalid operation");
+ ret["arguments"] = argument_list(store) || [];
+ all_ws();
+ consume(OTHER, ")") || error("Unterminated operation");
+ all_ws();
+ consume(OTHER, ";") || error("Unterminated operation");
+ return ret;
+ };
+
+ var callback = function (store) {
+ all_ws(store, "pea");
+ var ret;
+ if (!consume(ID, "callback")) return;
+ all_ws();
+ var tok = consume(ID, "interface");
+ if (tok) {
+ tokens.unshift(tok);
+ ret = interface_();
+ ret.type = "callback interface";
+ return ret;
+ }
+ var name = consume(ID) || error("No name for callback");
+ ret = { type: "callback", name: name.value };
+ all_ws();
+ consume(OTHER, "=") || error("No assignment in callback");
+ all_ws();
+ ret.idlType = return_type();
+ all_ws();
+ consume(OTHER, "(") || error("No arguments in callback");
+ ret["arguments"] = argument_list(store) || [];
+ all_ws();
+ consume(OTHER, ")") || error("Unterminated callback");
+ all_ws();
+ consume(OTHER, ";") || error("Unterminated callback");
+ return ret;
+ };
+
+ var attribute = function (store) {
+ all_ws(store, "pea");
+ var grabbed = []
+ , ret = {
+ type: "attribute"
+ , "static": false
+ , stringifier: false
+ , inherit: false
+ , readonly: false
+ };
+ if (consume(ID, "static")) {
+ ret["static"] = true;
+ grabbed.push(last_token);
+ }
+ else if (consume(ID, "stringifier")) {
+ ret.stringifier = true;
+ grabbed.push(last_token);
+ }
+ var w = all_ws();
+ if (w) grabbed.push(w);
+ if (consume(ID, "inherit")) {
+ if (ret["static"] || ret.stringifier) error("Cannot have a static or stringifier inherit");
+ ret.inherit = true;
+ grabbed.push(last_token);
+ var w = all_ws();
+ if (w) grabbed.push(w);
+ }
+ if (consume(ID, "readonly")) {
+ ret.readonly = true;
+ grabbed.push(last_token);
+ var w = all_ws();
+ if (w) grabbed.push(w);
+ }
+ if (!consume(ID, "attribute")) {
+ tokens = grabbed.concat(tokens);
+ return;
+ }
+ all_ws();
+ ret.idlType = type() || error("No type in attribute");
+ if (ret.idlType.sequence) error("Attributes cannot accept sequence types");
+ all_ws();
+ var name = consume(ID) || error("No name in attribute");
+ ret.name = name.value;
+ all_ws();
+ consume(OTHER, ";") || error("Unterminated attribute");
+ return ret;
+ };
+
+ var return_type = function () {
+ var typ = type();
+ if (!typ) {
+ if (consume(ID, "void")) {
+ return "void";
+ }
+ else error("No return type");
+ }
+ return typ;
+ };
+
+ var operation = function (store) {
+ all_ws(store, "pea");
+ var ret = {
+ type: "operation"
+ , getter: false
+ , setter: false
+ , creator: false
+ , deleter: false
+ , legacycaller: false
+ , "static": false
+ , stringifier: false
+ };
+ while (true) {
+ all_ws();
+ if (consume(ID, "getter")) ret.getter = true;
+ else if (consume(ID, "setter")) ret.setter = true;
+ else if (consume(ID, "creator")) ret.creator = true;
+ else if (consume(ID, "deleter")) ret.deleter = true;
+ else if (consume(ID, "legacycaller")) ret.legacycaller = true;
+ else break;
+ }
+ if (ret.getter || ret.setter || ret.creator || ret.deleter || ret.legacycaller) {
+ all_ws();
+ ret.idlType = return_type();
+ operation_rest(ret, store);
+ return ret;
+ }
+ if (consume(ID, "static")) {
+ ret["static"] = true;
+ ret.idlType = return_type();
+ operation_rest(ret, store);
+ return ret;
+ }
+ else if (consume(ID, "stringifier")) {
+ ret.stringifier = true;-
+ all_ws();
+ if (consume(OTHER, ";")) return ret;
+ ret.idlType = return_type();
+ operation_rest(ret, store);
+ return ret;
+ }
+ ret.idlType = return_type();
+ all_ws();
+ if (consume(ID, "iterator")) {
+ all_ws();
+ ret.type = "iterator";
+ if (consume(ID, "object")) {
+ ret.iteratorObject = "object";
+ }
+ else if (consume(OTHER, "=")) {
+ all_ws();
+ var name = consume(ID) || error("No right hand side in iterator");
+ ret.iteratorObject = name.value;
+ }
+ all_ws();
+ consume(OTHER, ";") || error("Unterminated iterator");
+ return ret;
+ }
+ else {
+ operation_rest(ret, store);
+ return ret;
+ }
+ };
+
+ var identifiers = function (arr) {
+ while (true) {
+ all_ws();
+ if (consume(OTHER, ",")) {
+ all_ws();
+ var name = consume(ID) || error("Trailing comma in identifiers list");
+ arr.push(name.value);
+ }
+ else break;
+ }
+ };
+
+ var serialiser = function (store) {
+ all_ws(store, "pea");
+ if (!consume(ID, "serializer")) return;
+ var ret = { type: "serializer" };
+ all_ws();
+ if (consume(OTHER, "=")) {
+ all_ws();
+ if (consume(OTHER, "{")) {
+ ret.patternMap = true;
+ all_ws();
+ var id = consume(ID);
+ if (id && id.value === "getter") {
+ ret.names = ["getter"];
+ }
+ else if (id && id.value === "inherit") {
+ ret.names = ["inherit"];
+ identifiers(ret.names);
+ }
+ else if (id) {
+ ret.names = [id.value];
+ identifiers(ret.names);
+ }
+ else {
+ ret.names = [];
+ }
+ all_ws();
+ consume(OTHER, "}") || error("Unterminated serializer pattern map");
+ }
+ else if (consume(OTHER, "[")) {
+ ret.patternList = true;
+ all_ws();
+ var id = consume(ID);
+ if (id && id.value === "getter") {
+ ret.names = ["getter"];
+ }
+ else if (id) {
+ ret.names = [id.value];
+ identifiers(ret.names);
+ }
+ else {
+ ret.names = [];
+ }
+ all_ws();
+ consume(OTHER, "]") || error("Unterminated serializer pattern list");
+ }
+ else {
+ var name = consume(ID) || error("Invalid serializer");
+ ret.name = name.value;
+ }
+ all_ws();
+ consume(OTHER, ";") || error("Unterminated serializer");
+ return ret;
+ }
+ else if (consume(OTHER, ";")) {
+ // noop, just parsing
+ }
+ else {
+ ret.idlType = return_type();
+ all_ws();
+ ret.operation = operation_rest(null, store);
+ }
+ return ret;
+ };
+
+ var iterable_type = function() {
+ if (consume(ID, "iterable")) return "iterable";
+ else if (consume(ID, "legacyiterable")) return "legacyiterable";
+ else if (consume(ID, "maplike")) return "maplike";
+ else if (consume(ID, "setlike")) return "setlike";
+ else return;
+ }
+
+ var readonly_iterable_type = function() {
+ if (consume(ID, "maplike")) return "maplike";
+ else if (consume(ID, "setlike")) return "setlike";
+ else return;
+ }
+
+ var iterable = function (store) {
+ all_ws(store, "pea");
+ var grabbed = [],
+ ret = {type: null, idlType: null, readonly: false};
+ if (consume(ID, "readonly")) {
+ ret.readonly = true;
+ grabbed.push(last_token);
+ var w = all_ws();
+ if (w) grabbed.push(w);
+ }
+ var consumeItType = ret.readonly ? readonly_iterable_type : iterable_type;
+
+ var ittype = consumeItType();
+ if (!ittype) {
+ tokens = grabbed.concat(tokens);
+ return;
+ }
+
+ var secondTypeRequired = ittype === "maplike";
+ var secondTypeAllowed = secondTypeRequired || ittype === "iterable";
+ ret.type = ittype;
+ if (ret.type !== 'maplike' && ret.type !== 'setlike')
+ delete ret.readonly;
+ all_ws();
+ if (consume(OTHER, "<")) {
+ ret.idlType = type() || error("Error parsing " + ittype + " declaration");
+ all_ws();
+ if (secondTypeAllowed) {
+ var type2 = null;
+ if (consume(OTHER, ",")) {
+ all_ws();
+ type2 = type();
+ all_ws();
+ }
+ if (type2)
+ ret.idlType = [ret.idlType, type2];
+ else if (secondTypeRequired)
+ error("Missing second type argument in " + ittype + " declaration");
+ }
+ if (!consume(OTHER, ">")) error("Unterminated " + ittype + " declaration");
+ all_ws();
+ if (!consume(OTHER, ";")) error("Missing semicolon after " + ittype + " declaration");
+ }
+ else
+ error("Error parsing " + ittype + " declaration");
+
+ return ret;
+ }
+
+ var interface_ = function (isPartial, store) {
+ all_ws(isPartial ? null : store, "pea");
+ if (!consume(ID, "interface")) return;
+ all_ws();
+ var name = consume(ID) || error("No name for interface");
+ var mems = []
+ , ret = {
+ type: "interface"
+ , name: name.value
+ , partial: false
+ , members: mems
+ };
+ if (!isPartial) ret.inheritance = inheritance() || null;
+ all_ws();
+ consume(OTHER, "{") || error("Bodyless interface");
+ while (true) {
+ all_ws(store ? mems : null);
+ if (consume(OTHER, "}")) {
+ all_ws();
+ consume(OTHER, ";") || error("Missing semicolon after interface");
+ return ret;
+ }
+ var ea = extended_attrs(store ? mems : null);
+ all_ws();
+ var cnt = const_(store ? mems : null);
+ if (cnt) {
+ cnt.extAttrs = ea;
+ ret.members.push(cnt);
+ continue;
+ }
+ var mem = (opt.allowNestedTypedefs && typedef(store ? mems : null)) ||
+ iterable(store ? mems : null) ||
+ serialiser(store ? mems : null) ||
+ attribute(store ? mems : null) ||
+ operation(store ? mems : null) ||
+ error("Unknown member");
+ mem.extAttrs = ea;
+ ret.members.push(mem);
+ }
+ };
+
+ var partial = function (store) {
+ all_ws(store, "pea");
+ if (!consume(ID, "partial")) return;
+ var thing = dictionary(true, store) ||
+ interface_(true, store) ||
+ error("Partial doesn't apply to anything");
+ thing.partial = true;
+ return thing;
+ };
+
+ var dictionary = function (isPartial, store) {
+ all_ws(isPartial ? null : store, "pea");
+ if (!consume(ID, "dictionary")) return;
+ all_ws();
+ var name = consume(ID) || error("No name for dictionary");
+ var mems = []
+ , ret = {
+ type: "dictionary"
+ , name: name.value
+ , partial: false
+ , members: mems
+ };
+ if (!isPartial) ret.inheritance = inheritance() || null;
+ all_ws();
+ consume(OTHER, "{") || error("Bodyless dictionary");
+ while (true) {
+ all_ws(store ? mems : null);
+ if (consume(OTHER, "}")) {
+ all_ws();
+ consume(OTHER, ";") || error("Missing semicolon after dictionary");
+ return ret;
+ }
+ var ea = extended_attrs(store ? mems : null);
+ all_ws(store ? mems : null, "pea");
+ var required = consume(ID, "required");
+ var typ = type() || error("No type for dictionary member");
+ all_ws();
+ var name = consume(ID) || error("No name for dictionary member");
+ var dflt = default_();
+ if (required && dflt) error("Required member must not have a default");
+ ret.members.push({
+ type: "field"
+ , name: name.value
+ , required: !!required
+ , idlType: typ
+ , extAttrs: ea
+ , "default": dflt
+ });
+ all_ws();
+ consume(OTHER, ";") || error("Unterminated dictionary member");
+ }
+ };
+
+ var exception = function (store) {
+ all_ws(store, "pea");
+ if (!consume(ID, "exception")) return;
+ all_ws();
+ var name = consume(ID) || error("No name for exception");
+ var mems = []
+ , ret = {
+ type: "exception"
+ , name: name.value
+ , members: mems
+ };
+ ret.inheritance = inheritance() || null;
+ all_ws();
+ consume(OTHER, "{") || error("Bodyless exception");
+ while (true) {
+ all_ws(store ? mems : null);
+ if (consume(OTHER, "}")) {
+ all_ws();
+ consume(OTHER, ";") || error("Missing semicolon after exception");
+ return ret;
+ }
+ var ea = extended_attrs(store ? mems : null);
+ all_ws(store ? mems : null, "pea");
+ var cnt = const_();
+ if (cnt) {
+ cnt.extAttrs = ea;
+ ret.members.push(cnt);
+ }
+ else {
+ var typ = type();
+ all_ws();
+ var name = consume(ID);
+ all_ws();
+ if (!typ || !name || !consume(OTHER, ";")) error("Unknown member in exception body");
+ ret.members.push({
+ type: "field"
+ , name: name.value
+ , idlType: typ
+ , extAttrs: ea
+ });
+ }
+ }
+ };
+
+ var enum_ = function (store) {
+ all_ws(store, "pea");
+ if (!consume(ID, "enum")) return;
+ all_ws();
+ var name = consume(ID) || error("No name for enum");
+ var vals = []
+ , ret = {
+ type: "enum"
+ , name: name.value
+ , values: vals
+ };
+ all_ws();
+ consume(OTHER, "{") || error("No curly for enum");
+ var saw_comma = false;
+ while (true) {
+ all_ws(store ? vals : null);
+ if (consume(OTHER, "}")) {
+ all_ws();
+ consume(OTHER, ";") || error("No semicolon after enum");
+ return ret;
+ }
+ var val = consume(STR) || error("Unexpected value in enum");
+ ret.values.push(val.value.replace(/"/g, ""));
+ all_ws(store ? vals : null);
+ if (consume(OTHER, ",")) {
+ if (store) vals.push({ type: "," });
+ all_ws(store ? vals : null);
+ saw_comma = true;
+ }
+ else {
+ saw_comma = false;
+ }
+ }
+ };
+
+ var typedef = function (store) {
+ all_ws(store, "pea");
+ if (!consume(ID, "typedef")) return;
+ var ret = {
+ type: "typedef"
+ };
+ all_ws();
+ ret.typeExtAttrs = extended_attrs();
+ all_ws(store, "tpea");
+ ret.idlType = type() || error("No type in typedef");
+ all_ws();
+ var name = consume(ID) || error("No name in typedef");
+ ret.name = name.value;
+ all_ws();
+ consume(OTHER, ";") || error("Unterminated typedef");
+ return ret;
+ };
+
+ var implements_ = function (store) {
+ all_ws(store, "pea");
+ var target = consume(ID);
+ if (!target) return;
+ var w = all_ws();
+ if (consume(ID, "implements")) {
+ var ret = {
+ type: "implements"
+ , target: target.value
+ };
+ all_ws();
+ var imp = consume(ID) || error("Incomplete implements statement");
+ ret["implements"] = imp.value;
+ all_ws();
+ consume(OTHER, ";") || error("No terminating ; for implements statement");
+ return ret;
+ }
+ else {
+ // rollback
+ tokens.unshift(w);
+ tokens.unshift(target);
+ }
+ };
+
+ var definition = function (store) {
+ return callback(store) ||
+ interface_(false, store) ||
+ partial(store) ||
+ dictionary(false, store) ||
+ exception(store) ||
+ enum_(store) ||
+ typedef(store) ||
+ implements_(store)
+ ;
+ };
+
+ var definitions = function (store) {
+ if (!tokens.length) return [];
+ var defs = [];
+ while (true) {
+ var ea = extended_attrs(store ? defs : null)
+ , def = definition(store ? defs : null);
+ if (!def) {
+ if (ea.length) error("Stray extended attributes");
+ break;
+ }
+ def.extAttrs = ea;
+ defs.push(def);
+ }
+ return defs;
+ };
+ var res = definitions(opt.ws);
+ if (tokens.length) error("Unrecognised tokens");
+ return res;
+ };
+
+ var inNode = typeof module !== "undefined" && module.exports
+ , obj = {
+ parse: function (str, opt) {
+ if (!opt) opt = {};
+ var tokens = tokenise(str);
+ return parse(tokens, opt);
+ }
+ };
+
+ if (inNode) module.exports = obj;
+ else self.WebIDL2 = obj;
+}());
</ins></span></pre></div>
<a id="trunkLayoutTestsresourcesidlharnessjsfromrev213080trunkLayoutTestsimportedw3cresourcesidlharnessjs"></a>
<div class="copfile"><h4>Copied: trunk/LayoutTests/resources/idlharness.js (from rev 213080, trunk/LayoutTests/imported/w3c/resources/idlharness.js) (0 => 213081)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/resources/idlharness.js         (rev 0)
+++ trunk/LayoutTests/resources/idlharness.js        2017-02-27 19:01:13 UTC (rev 213081)
</span><span class="lines">@@ -0,0 +1,1968 @@
</span><ins>+/*
+Distributed under both the W3C Test Suite License [1] and the W3C
+3-clause BSD License [2]. To contribute to a W3C Test Suite, see the
+policies and contribution forms [3].
+
+[1] http://www.w3.org/Consortium/Legal/2008/04-testsuite-license
+[2] http://www.w3.org/Consortium/Legal/2008/03-bsd-license
+[3] http://www.w3.org/2004/10/27-testcases
+*/
+
+/* For user documentation see docs/idlharness.md */
+
+/**
+ * Notes for people who want to edit this file (not just use it as a library):
+ *
+ * Most of the interesting stuff happens in the derived classes of IdlObject,
+ * especially IdlInterface. The entry point for all IdlObjects is .test(),
+ * which is called by IdlArray.test(). An IdlObject is conceptually just
+ * "thing we want to run tests on", and an IdlArray is an array of IdlObjects
+ * with some additional data thrown in.
+ *
+ * The object model is based on what WebIDLParser.js produces, which is in turn
+ * based on its pegjs grammar. If you want to figure out what properties an
+ * object will have from WebIDLParser.js, the best way is to look at the
+ * grammar:
+ *
+ * https://github.com/darobin/webidl.js/blob/master/lib/grammar.peg
+ *
+ * So for instance:
+ *
+ * // interface definition
+ * interface
+ * = extAttrs:extendedAttributeList? S? "interface" S name:identifier w herit:ifInheritance? w "{" w mem:ifMember* w "}" w ";" w
+ * { return { type: "interface", name: name, inheritance: herit, members: mem, extAttrs: extAttrs }; }
+ *
+ * This means that an "interface" object will have a .type property equal to
+ * the string "interface", a .name property equal to the identifier that the
+ * parser found, an .inheritance property equal to either null or the result of
+ * the "ifInheritance" production found elsewhere in the grammar, and so on.
+ * After each grammatical production is a JavaScript function in curly braces
+ * that gets called with suitable arguments and returns some JavaScript value.
+ *
+ * (Note that the version of WebIDLParser.js we use might sometimes be
+ * out-of-date or forked.)
+ *
+ * The members and methods of the classes defined by this file are all at least
+ * briefly documented, hopefully.
+ */
+(function(){
+"use strict";
+/// Helpers ///
+function constValue (cnt)
+//@{
+{
+ if (cnt.type === "null") return null;
+ if (cnt.type === "NaN") return NaN;
+ if (cnt.type === "Infinity") return cnt.negative ? -Infinity : Infinity;
+ return cnt.value;
+}
+
+//@}
+function minOverloadLength(overloads)
+//@{
+{
+ if (!overloads.length) {
+ return 0;
+ }
+
+ return overloads.map(function(attr) {
+ return attr.arguments ? attr.arguments.filter(function(arg) {
+ return !arg.optional && !arg.variadic;
+ }).length : 0;
+ })
+ .reduce(function(m, n) { return Math.min(m, n); });
+}
+
+//@}
+function throwOrReject(a_test, operation, fn, obj, args, message, cb)
+//@{
+{
+ if (operation.idlType.generic !== "Promise") {
+ assert_throws(new TypeError(), function() {
+ fn.apply(obj, args);
+ }, message);
+ cb();
+ } else {
+ try {
+ promise_rejects(a_test, new TypeError(), fn.apply(obj, args)).then(cb, cb);
+ } catch (e){
+ a_test.step(function() {
+ assert_unreached("Throws \"" + e + "\" instead of rejecting promise");
+ cb();
+ });
+ }
+ }
+}
+
+//@}
+function awaitNCallbacks(n, cb, ctx)
+//@{
+{
+ var counter = 0;
+ return function() {
+ counter++;
+ if (counter >= n) {
+ cb();
+ }
+ };
+}
+
+//@}
+var fround =
+//@{
+(function(){
+ if (Math.fround) return Math.fround;
+
+ var arr = new Float32Array(1);
+ return function fround(n) {
+ arr[0] = n;
+ return arr[0];
+ };
+})();
+//@}
+
+/// IdlArray ///
+// Entry point
+self.IdlArray = function()
+//@{
+{
+ /**
+ * A map from strings to the corresponding named IdlObject, such as
+ * IdlInterface or IdlException. These are the things that test() will run
+ * tests on.
+ */
+ this.members = {};
+
+ /**
+ * A map from strings to arrays of strings. The keys are interface or
+ * exception names, and are expected to also exist as keys in this.members
+ * (otherwise they'll be ignored). This is populated by add_objects() --
+ * see documentation at the start of the file. The actual tests will be
+ * run by calling this.members[name].test_object(obj) for each obj in
+ * this.objects[name]. obj is a string that will be eval'd to produce a
+ * JavaScript value, which is supposed to be an object implementing the
+ * given IdlObject (interface, exception, etc.).
+ */
+ this.objects = {};
+
+ /**
+ * When adding multiple collections of IDLs one at a time, an earlier one
+ * might contain a partial interface or implements statement that depends
+ * on a later one. Save these up and handle them right before we run
+ * tests.
+ *
+ * .partials is simply an array of objects from WebIDLParser.js'
+ * "partialinterface" production. .implements maps strings to arrays of
+ * strings, such that
+ *
+ * A implements B;
+ * A implements C;
+ * D implements E;
+ *
+ * results in { A: ["B", "C"], D: ["E"] }.
+ */
+ this.partials = [];
+ this["implements"] = {};
+};
+
+//@}
+IdlArray.prototype.add_idls = function(raw_idls)
+//@{
+{
+ /** Entry point. See documentation at beginning of file. */
+ this.internal_add_idls(WebIDL2.parse(raw_idls));
+};
+
+//@}
+IdlArray.prototype.add_untested_idls = function(raw_idls)
+//@{
+{
+ /** Entry point. See documentation at beginning of file. */
+ var parsed_idls = WebIDL2.parse(raw_idls);
+ for (var i = 0; i < parsed_idls.length; i++)
+ {
+ parsed_idls[i].untested = true;
+ if ("members" in parsed_idls[i])
+ {
+ for (var j = 0; j < parsed_idls[i].members.length; j++)
+ {
+ parsed_idls[i].members[j].untested = true;
+ }
+ }
+ }
+ this.internal_add_idls(parsed_idls);
+};
+
+//@}
+IdlArray.prototype.internal_add_idls = function(parsed_idls)
+//@{
+{
+ /**
+ * Internal helper called by add_idls() and add_untested_idls().
+ * parsed_idls is an array of objects that come from WebIDLParser.js's
+ * "definitions" production. The add_untested_idls() entry point
+ * additionally sets an .untested property on each object (and its
+ * .members) so that they'll be skipped by test() -- they'll only be
+ * used for base interfaces of tested interfaces, return types, etc.
+ */
+ parsed_idls.forEach(function(parsed_idl)
+ {
+ if (parsed_idl.type == "interface" && parsed_idl.partial)
+ {
+ this.partials.push(parsed_idl);
+ return;
+ }
+
+ if (parsed_idl.type == "implements")
+ {
+ if (!(parsed_idl.target in this["implements"]))
+ {
+ this["implements"][parsed_idl.target] = [];
+ }
+ this["implements"][parsed_idl.target].push(parsed_idl["implements"]);
+ return;
+ }
+
+ parsed_idl.array = this;
+ if (parsed_idl.name in this.members)
+ {
+ throw "Duplicate identifier " + parsed_idl.name;
+ }
+ switch(parsed_idl.type)
+ {
+ case "interface":
+ this.members[parsed_idl.name] =
+ new IdlInterface(parsed_idl, /* is_callback = */ false);
+ break;
+
+ case "dictionary":
+ // Nothing to test, but we need the dictionary info around for type
+ // checks
+ this.members[parsed_idl.name] = new IdlDictionary(parsed_idl);
+ break;
+
+ case "typedef":
+ this.members[parsed_idl.name] = new IdlTypedef(parsed_idl);
+ break;
+
+ case "callback":
+ // TODO
+ console.log("callback not yet supported");
+ break;
+
+ case "enum":
+ this.members[parsed_idl.name] = new IdlEnum(parsed_idl);
+ break;
+
+ case "callback interface":
+ this.members[parsed_idl.name] =
+ new IdlInterface(parsed_idl, /* is_callback = */ true);
+ break;
+
+ default:
+ throw parsed_idl.name + ": " + parsed_idl.type + " not yet supported";
+ }
+ }.bind(this));
+};
+
+//@}
+IdlArray.prototype.add_objects = function(dict)
+//@{
+{
+ /** Entry point. See documentation at beginning of file. */
+ for (var k in dict)
+ {
+ if (k in this.objects)
+ {
+ this.objects[k] = this.objects[k].concat(dict[k]);
+ }
+ else
+ {
+ this.objects[k] = dict[k];
+ }
+ }
+};
+
+//@}
+IdlArray.prototype.prevent_multiple_testing = function(name)
+//@{
+{
+ /** Entry point. See documentation at beginning of file. */
+ this.members[name].prevent_multiple_testing = true;
+};
+
+//@}
+IdlArray.prototype.recursively_get_implements = function(interface_name)
+//@{
+{
+ /**
+ * Helper function for test(). Returns an array of things that implement
+ * interface_name, so if the IDL contains
+ *
+ * A implements B;
+ * B implements C;
+ * B implements D;
+ *
+ * then recursively_get_implements("A") should return ["B", "C", "D"].
+ */
+ var ret = this["implements"][interface_name];
+ if (ret === undefined)
+ {
+ return [];
+ }
+ for (var i = 0; i < this["implements"][interface_name].length; i++)
+ {
+ ret = ret.concat(this.recursively_get_implements(ret[i]));
+ if (ret.indexOf(ret[i]) != ret.lastIndexOf(ret[i]))
+ {
+ throw "Circular implements statements involving " + ret[i];
+ }
+ }
+ return ret;
+};
+
+function exposed_in(globals) {
+ if ('document' in self) {
+ return globals.indexOf("Window") >= 0;
+ }
+ if ('DedicatedWorkerGlobalScope' in self &&
+ self instanceof DedicatedWorkerGlobalScope) {
+ return globals.indexOf("Worker") >= 0 ||
+ globals.indexOf("DedicatedWorker") >= 0;
+ }
+ if ('SharedWorkerGlobalScope' in self &&
+ self instanceof SharedWorkerGlobalScope) {
+ return globals.indexOf("Worker") >= 0 ||
+ globals.indexOf("SharedWorker") >= 0;
+ }
+ if ('ServiceWorkerGlobalScope' in self &&
+ self instanceof ServiceWorkerGlobalScope) {
+ return globals.indexOf("Worker") >= 0 ||
+ globals.indexOf("ServiceWorker") >= 0;
+ }
+ throw "Unexpected global object";
+}
+
+//@}
+IdlArray.prototype.test = function()
+//@{
+{
+ /** Entry point. See documentation at beginning of file. */
+
+ // First merge in all the partial interfaces and implements statements we
+ // encountered.
+ this.partials.forEach(function(parsed_idl)
+ {
+ if (!(parsed_idl.name in this.members)
+ || !(this.members[parsed_idl.name] instanceof IdlInterface))
+ {
+ throw "Partial interface " + parsed_idl.name + " with no original interface";
+ }
+ if (parsed_idl.extAttrs)
+ {
+ parsed_idl.extAttrs.forEach(function(extAttr)
+ {
+ this.members[parsed_idl.name].extAttrs.push(extAttr);
+ }.bind(this));
+ }
+ parsed_idl.members.forEach(function(member)
+ {
+ this.members[parsed_idl.name].members.push(new IdlInterfaceMember(member));
+ }.bind(this));
+ }.bind(this));
+ this.partials = [];
+
+ for (var lhs in this["implements"])
+ {
+ this.recursively_get_implements(lhs).forEach(function(rhs)
+ {
+ var errStr = lhs + " implements " + rhs + ", but ";
+ if (!(lhs in this.members)) throw errStr + lhs + " is undefined.";
+ if (!(this.members[lhs] instanceof IdlInterface)) throw errStr + lhs + " is not an interface.";
+ if (!(rhs in this.members)) throw errStr + rhs + " is undefined.";
+ if (!(this.members[rhs] instanceof IdlInterface)) throw errStr + rhs + " is not an interface.";
+ this.members[rhs].members.forEach(function(member)
+ {
+ this.members[lhs].members.push(new IdlInterfaceMember(member));
+ }.bind(this));
+ }.bind(this));
+ }
+ this["implements"] = {};
+
+ Object.getOwnPropertyNames(this.members).forEach(function(memberName) {
+ var member = this.members[memberName];
+ if (!(member instanceof IdlInterface)) {
+ return;
+ }
+
+ var exposed = member.extAttrs.filter(function(a) { return a.name == "Exposed" });
+ if (exposed.length > 1) {
+ throw "Unexpected Exposed extended attributes on " + memberName + ": " + exposed;
+ }
+
+ var globals = exposed.length === 1
+ ? exposed[0].rhs.value
+ : ["Window"];
+ member.exposed = exposed_in(globals);
+ }.bind(this));
+
+ // Now run test() on every member, and test_object() for every object.
+ for (var name in this.members)
+ {
+ this.members[name].test();
+ if (name in this.objects)
+ {
+ this.objects[name].forEach(function(str)
+ {
+ this.members[name].test_object(str);
+ }.bind(this));
+ }
+ }
+};
+
+//@}
+IdlArray.prototype.assert_type_is = function(value, type)
+//@{
+{
+ /**
+ * Helper function that tests that value is an instance of type according
+ * to the rules of WebIDL. value is any JavaScript value, and type is an
+ * object produced by WebIDLParser.js' "type" production. That production
+ * is fairly elaborate due to the complexity of WebIDL's types, so it's
+ * best to look at the grammar to figure out what properties it might have.
+ */
+ if (type.idlType == "any")
+ {
+ // No assertions to make
+ return;
+ }
+
+ if (type.nullable && value === null)
+ {
+ // This is fine
+ return;
+ }
+
+ if (type.array)
+ {
+ // TODO: not supported yet
+ return;
+ }
+
+ if (type.sequence)
+ {
+ assert_true(Array.isArray(value), "is not array");
+ if (!value.length)
+ {
+ // Nothing we can do.
+ return;
+ }
+ this.assert_type_is(value[0], type.idlType.idlType);
+ return;
+ }
+
+ if (type.generic === "Promise") {
+ assert_true("then" in value, "Attribute with a Promise type has a then property");
+ // TODO: Ideally, we would check on project fulfillment
+ // that we get the right type
+ // but that would require making the type check async
+ return;
+ }
+
+ type = type.idlType;
+
+ switch(type)
+ {
+ case "void":
+ assert_equals(value, undefined);
+ return;
+
+ case "boolean":
+ assert_equals(typeof value, "boolean");
+ return;
+
+ case "byte":
+ assert_equals(typeof value, "number");
+ assert_equals(value, Math.floor(value), "not an integer");
+ assert_true(-128 <= value && value <= 127, "byte " + value + " not in range [-128, 127]");
+ return;
+
+ case "octet":
+ assert_equals(typeof value, "number");
+ assert_equals(value, Math.floor(value), "not an integer");
+ assert_true(0 <= value && value <= 255, "octet " + value + " not in range [0, 255]");
+ return;
+
+ case "short":
+ assert_equals(typeof value, "number");
+ assert_equals(value, Math.floor(value), "not an integer");
+ assert_true(-32768 <= value && value <= 32767, "short " + value + " not in range [-32768, 32767]");
+ return;
+
+ case "unsigned short":
+ assert_equals(typeof value, "number");
+ assert_equals(value, Math.floor(value), "not an integer");
+ assert_true(0 <= value && value <= 65535, "unsigned short " + value + " not in range [0, 65535]");
+ return;
+
+ case "long":
+ assert_equals(typeof value, "number");
+ assert_equals(value, Math.floor(value), "not an integer");
+ assert_true(-2147483648 <= value && value <= 2147483647, "long " + value + " not in range [-2147483648, 2147483647]");
+ return;
+
+ case "unsigned long":
+ assert_equals(typeof value, "number");
+ assert_equals(value, Math.floor(value), "not an integer");
+ assert_true(0 <= value && value <= 4294967295, "unsigned long " + value + " not in range [0, 4294967295]");
+ return;
+
+ case "long long":
+ assert_equals(typeof value, "number");
+ return;
+
+ case "unsigned long long":
+ case "DOMTimeStamp":
+ assert_equals(typeof value, "number");
+ assert_true(0 <= value, "unsigned long long is negative");
+ return;
+
+ case "float":
+ assert_equals(typeof value, "number");
+ assert_equals(value, fround(value), "float rounded to 32-bit float should be itself");
+ assert_not_equals(value, Infinity);
+ assert_not_equals(value, -Infinity);
+ assert_not_equals(value, NaN);
+ return;
+
+ case "DOMHighResTimeStamp":
+ case "double":
+ assert_equals(typeof value, "number");
+ assert_not_equals(value, Infinity);
+ assert_not_equals(value, -Infinity);
+ assert_not_equals(value, NaN);
+ return;
+
+ case "unrestricted float":
+ assert_equals(typeof value, "number");
+ assert_equals(value, fround(value), "unrestricted float rounded to 32-bit float should be itself");
+ return;
+
+ case "unrestricted double":
+ assert_equals(typeof value, "number");
+ return;
+
+ case "DOMString":
+ assert_equals(typeof value, "string");
+ return;
+
+ case "ByteString":
+ assert_equals(typeof value, "string");
+ assert_regexp_match(value, /^[\x00-\x7F]*$/);
+ return;
+
+ case "USVString":
+ assert_equals(typeof value, "string");
+ assert_regexp_match(value, /^([\x00-\ud7ff\ue000-\uffff]|[\ud800-\udbff][\udc00-\udfff])*$/);
+ return;
+
+ case "object":
+ assert_true(typeof value == "object" || typeof value == "function", "wrong type: not object or function");
+ return;
+ }
+
+ if (!(type in this.members))
+ {
+ throw "Unrecognized type " + type;
+ }
+
+ if (this.members[type] instanceof IdlInterface)
+ {
+ // We don't want to run the full
+ // IdlInterface.prototype.test_instance_of, because that could result
+ // in an infinite loop. TODO: This means we don't have tests for
+ // NoInterfaceObject interfaces, and we also can't test objects that
+ // come from another self.
+ assert_true(typeof value == "object" || typeof value == "function", "wrong type: not object or function");
+ if (value instanceof Object
+ && !this.members[type].has_extended_attribute("NoInterfaceObject")
+ && type in self)
+ {
+ assert_true(value instanceof self[type], "not instanceof " + type);
+ }
+ }
+ else if (this.members[type] instanceof IdlEnum)
+ {
+ assert_equals(typeof value, "string");
+ }
+ else if (this.members[type] instanceof IdlDictionary)
+ {
+ // TODO: Test when we actually have something to test this on
+ }
+ else if (this.members[type] instanceof IdlTypedef)
+ {
+ // TODO: Test when we actually have something to test this on
+ }
+ else
+ {
+ throw "Type " + type + " isn't an interface or dictionary";
+ }
+};
+//@}
+
+/// IdlObject ///
+function IdlObject() {}
+IdlObject.prototype.test = function()
+//@{
+{
+ /**
+ * By default, this does nothing, so no actual tests are run for IdlObjects
+ * that don't define any (e.g., IdlDictionary at the time of this writing).
+ */
+};
+
+//@}
+IdlObject.prototype.has_extended_attribute = function(name)
+//@{
+{
+ /**
+ * This is only meaningful for things that support extended attributes,
+ * such as interfaces, exceptions, and members.
+ */
+ return this.extAttrs.some(function(o)
+ {
+ return o.name == name;
+ });
+};
+
+//@}
+
+/// IdlDictionary ///
+// Used for IdlArray.prototype.assert_type_is
+function IdlDictionary(obj)
+//@{
+{
+ /**
+ * obj is an object produced by the WebIDLParser.js "dictionary"
+ * production.
+ */
+
+ /** Self-explanatory. */
+ this.name = obj.name;
+
+ /** An array of objects produced by the "dictionaryMember" production. */
+ this.members = obj.members;
+
+ /**
+ * The name (as a string) of the dictionary type we inherit from, or null
+ * if there is none.
+ */
+ this.base = obj.inheritance;
+}
+
+//@}
+IdlDictionary.prototype = Object.create(IdlObject.prototype);
+
+/// IdlInterface ///
+function IdlInterface(obj, is_callback)
+//@{
+{
+ /**
+ * obj is an object produced by the WebIDLParser.js "interface" production.
+ */
+
+ /** Self-explanatory. */
+ this.name = obj.name;
+
+ /** A back-reference to our IdlArray. */
+ this.array = obj.array;
+
+ /**
+ * An indicator of whether we should run tests on the interface object and
+ * interface prototype object. Tests on members are controlled by .untested
+ * on each member, not this.
+ */
+ this.untested = obj.untested;
+
+ /** An array of objects produced by the "ExtAttr" production. */
+ this.extAttrs = obj.extAttrs;
+
+ /** An array of IdlInterfaceMembers. */
+ this.members = obj.members.map(function(m){return new IdlInterfaceMember(m); });
+ if (this.has_extended_attribute("Unforgeable")) {
+ this.members
+ .filter(function(m) { return !m["static"] && (m.type == "attribute" || m.type == "operation"); })
+ .forEach(function(m) { return m.isUnforgeable = true; });
+ }
+
+ /**
+ * The name (as a string) of the type we inherit from, or null if there is
+ * none.
+ */
+ this.base = obj.inheritance;
+
+ this._is_callback = is_callback;
+}
+//@}
+IdlInterface.prototype = Object.create(IdlObject.prototype);
+IdlInterface.prototype.is_callback = function()
+//@{
+{
+ return this._is_callback;
+};
+//@}
+
+IdlInterface.prototype.has_constants = function()
+//@{
+{
+ return this.members.some(function(member) {
+ return member.type === "const";
+ });
+};
+//@}
+
+IdlInterface.prototype.is_global = function()
+//@{
+{
+ return this.extAttrs.some(function(attribute) {
+ return attribute.name === "Global" ||
+ attribute.name === "PrimaryGlobal";
+ });
+};
+//@}
+
+IdlInterface.prototype.test = function()
+//@{
+{
+ if (this.has_extended_attribute("NoInterfaceObject"))
+ {
+ // No tests to do without an instance. TODO: We should still be able
+ // to run tests on the prototype object, if we obtain one through some
+ // other means.
+ return;
+ }
+
+ if (!this.exposed) {
+ test(function() {
+ assert_false(this.name in self);
+ }.bind(this), this.name + " interface: existence and properties of interface object");
+ return;
+ }
+
+ if (!this.untested)
+ {
+ // First test things to do with the exception/interface object and
+ // exception/interface prototype object.
+ this.test_self();
+ }
+ // Then test things to do with its members (constants, fields, attributes,
+ // operations, . . .). These are run even if .untested is true, because
+ // members might themselves be marked as .untested. This might happen to
+ // interfaces if the interface itself is untested but a partial interface
+ // that extends it is tested -- then the interface itself and its initial
+ // members will be marked as untested, but the members added by the partial
+ // interface are still tested.
+ this.test_members();
+};
+//@}
+
+IdlInterface.prototype.test_self = function()
+//@{
+{
+ test(function()
+ {
+ // This function tests WebIDL as of 2015-01-13.
+
+ // "For every interface that is exposed in a given ECMAScript global
+ // environment and:
+ // * is a callback interface that has constants declared on it, or
+ // * is a non-callback interface that is not declared with the
+ // [NoInterfaceObject] extended attribute,
+ // a corresponding property MUST exist on the ECMAScript global object.
+ // The name of the property is the identifier of the interface, and its
+ // value is an object called the interface object.
+ // The property has the attributes { [[Writable]]: true,
+ // [[Enumerable]]: false, [[Configurable]]: true }."
+ if (this.is_callback() && !this.has_constants()) {
+ return;
+ }
+
+ // TODO: Should we test here that the property is actually writable
+ // etc., or trust getOwnPropertyDescriptor?
+ assert_own_property(self, this.name,
+ "self does not have own property " + format_value(this.name));
+ var desc = Object.getOwnPropertyDescriptor(self, this.name);
+ assert_false("get" in desc, "self's property " + format_value(this.name) + " has getter");
+ assert_false("set" in desc, "self's property " + format_value(this.name) + " has setter");
+ assert_true(desc.writable, "self's property " + format_value(this.name) + " is not writable");
+ assert_false(desc.enumerable, "self's property " + format_value(this.name) + " is enumerable");
+ assert_true(desc.configurable, "self's property " + format_value(this.name) + " is not configurable");
+
+ if (this.is_callback()) {
+ // "The internal [[Prototype]] property of an interface object for
+ // a callback interface must be the Function.prototype object."
+ assert_equals(Object.getPrototypeOf(self[this.name]), Function.prototype,
+ "prototype of self's property " + format_value(this.name) + " is not Object.prototype");
+
+ return;
+ }
+
+ // "The interface object for a given non-callback interface is a
+ // function object."
+ // "If an object is defined to be a function object, then it has
+ // characteristics as follows:"
+
+ // Its [[Prototype]] internal property is otherwise specified (see
+ // below).
+
+ // "* 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."
+ // Tested below if no constructor is defined. TODO: test constructors
+ // if defined.
+
+ // "* Its @@hasInstance property is set as described in ECMA-262
+ // section 19.2.3.8, unless otherwise specified."
+ // TODO
+
+ // ES6 (rev 30) 19.1.3.6:
+ // "Else, if O has a [[Call]] internal method, then let builtinTag be
+ // "Function"."
+ assert_class_string(self[this.name], "Function", "class string of " + this.name);
+
+ // "The [[Prototype]] internal property of an interface object for a
+ // non-callback interface is determined as follows:"
+ var prototype = Object.getPrototypeOf(self[this.name]);
+ if (this.base) {
+ // "* If the interface inherits from some other interface, the
+ // value of [[Prototype]] is the interface object for that other
+ // interface."
+ var has_interface_object =
+ !this.array
+ .members[this.base]
+ .has_extended_attribute("NoInterfaceObject");
+ if (has_interface_object) {
+ assert_own_property(self, this.base,
+ 'should inherit from ' + this.base +
+ ', but self has no such property');
+ assert_equals(prototype, self[this.base],
+ 'prototype of ' + this.name + ' is not ' +
+ this.base);
+ }
+ } else {
+ // "If the interface doesn't inherit from any other interface, the
+ // value of [[Prototype]] is %FunctionPrototype% ([ECMA-262],
+ // section 6.1.7.4)."
+ assert_equals(prototype, Function.prototype,
+ "prototype of self's property " + format_value(this.name) + " is not Function.prototype");
+ }
+
+ if (!this.has_extended_attribute("Constructor")) {
+ // "The internal [[Call]] method of the interface object behaves as
+ // follows . . .
+ //
+ // "If I was not declared with a [Constructor] extended attribute,
+ // then throw a TypeError."
+ assert_throws(new TypeError(), function() {
+ self[this.name]();
+ }.bind(this), "interface object didn't throw TypeError when called as a function");
+ assert_throws(new TypeError(), function() {
+ new self[this.name]();
+ }.bind(this), "interface object didn't throw TypeError when called as a constructor");
+ }
+ }.bind(this), this.name + " interface: existence and properties of interface object");
+
+ if (!this.is_callback()) {
+ test(function() {
+ // This function tests WebIDL as of 2014-10-25.
+ // https://heycam.github.io/webidl/#es-interface-call
+
+ assert_own_property(self, this.name,
+ "self does not have own property " + format_value(this.name));
+
+ // "Interface objects for non-callback interfaces MUST have a
+ // property named “length” with attributes { [[Writable]]: false,
+ // [[Enumerable]]: false, [[Configurable]]: true } whose value is
+ // a Number."
+ assert_own_property(self[this.name], "length");
+ var desc = Object.getOwnPropertyDescriptor(self[this.name], "length");
+ assert_false("get" in desc, this.name + ".length has getter");
+ assert_false("set" in desc, this.name + ".length has setter");
+ assert_false(desc.writable, this.name + ".length is writable");
+ assert_false(desc.enumerable, this.name + ".length is enumerable");
+ assert_true(desc.configurable, this.name + ".length is not configurable");
+
+ var constructors = this.extAttrs
+ .filter(function(attr) { return attr.name == "Constructor"; });
+ var expected_length = minOverloadLength(constructors);
+ assert_equals(self[this.name].length, expected_length, "wrong value for " + this.name + ".length");
+ }.bind(this), this.name + " interface object length");
+ }
+
+ if (!this.is_callback() || this.has_constants()) {
+ test(function() {
+ // This function tests WebIDL as of 2015-11-17.
+ // https://heycam.github.io/webidl/#interface-object
+
+ assert_own_property(self, this.name,
+ "self does not have own property " + format_value(this.name));
+
+ // "All interface objects must have a property named “name” with
+ // attributes { [[Writable]]: false, [[Enumerable]]: false,
+ // [[Configurable]]: true } whose value is the identifier of the
+ // corresponding interface."
+
+ assert_own_property(self[this.name], "name");
+ var desc = Object.getOwnPropertyDescriptor(self[this.name], "name");
+ assert_false("get" in desc, this.name + ".name has getter");
+ assert_false("set" in desc, this.name + ".name has setter");
+ assert_false(desc.writable, this.name + ".name is writable");
+ assert_false(desc.enumerable, this.name + ".name is enumerable");
+ assert_true(desc.configurable, this.name + ".name is not configurable");
+ assert_equals(self[this.name].name, this.name, "wrong value for " + this.name + ".name");
+ }.bind(this), this.name + " interface object name");
+ }
+
+ // TODO: Test named constructors if I find any interfaces that have them.
+
+ test(function()
+ {
+ // This function tests WebIDL as of 2015-01-21.
+ // https://heycam.github.io/webidl/#interface-object
+
+ if (this.is_callback() && !this.has_constants()) {
+ return;
+ }
+
+ assert_own_property(self, this.name,
+ "self does not have own property " + format_value(this.name));
+
+ if (this.is_callback()) {
+ assert_false("prototype" in self[this.name],
+ this.name + ' should not have a "prototype" property');
+ return;
+ }
+
+ // "An interface object for a non-callback interface must have a
+ // property named “prototype” with attributes { [[Writable]]: false,
+ // [[Enumerable]]: false, [[Configurable]]: false } whose value is an
+ // object called the interface prototype object. This object has
+ // properties that correspond to the regular attributes and regular
+ // operations defined on the interface, and is described in more detail
+ // in section 4.5.4 below."
+ assert_own_property(self[this.name], "prototype",
+ 'interface "' + this.name + '" does not have own property "prototype"');
+ var desc = Object.getOwnPropertyDescriptor(self[this.name], "prototype");
+ assert_false("get" in desc, this.name + ".prototype has getter");
+ assert_false("set" in desc, this.name + ".prototype has setter");
+ assert_false(desc.writable, this.name + ".prototype is writable");
+ assert_false(desc.enumerable, this.name + ".prototype is enumerable");
+ assert_false(desc.configurable, this.name + ".prototype is configurable");
+
+ // Next, test that the [[Prototype]] of the interface prototype object
+ // is correct. (This is made somewhat difficult by the existence of
+ // [NoInterfaceObject].)
+ // TODO: Aryeh thinks there's at least other place in this file where
+ // we try to figure out if an interface prototype object is
+ // correct. Consolidate that code.
+
+ // "The interface prototype object for a given interface A must have an
+ // internal [[Prototype]] property whose value is returned from the
+ // following steps:
+ // "If A is declared with the [Global] or [PrimaryGlobal] extended
+ // attribute, and A supports named properties, then return the named
+ // properties object for A, as defined in section 4.5.5 below.
+ // "Otherwise, if A is declared to inherit from another interface, then
+ // return the interface prototype object for the inherited interface.
+ // "Otherwise, if A is declared with the [ArrayClass] extended
+ // attribute, then return %ArrayPrototype% ([ECMA-262], section
+ // 6.1.7.4).
+ // "Otherwise, return %ObjectPrototype% ([ECMA-262], section 6.1.7.4).
+ // ([ECMA-262], section 15.2.4).
+ if (this.name === "Window") {
+ assert_class_string(Object.getPrototypeOf(self[this.name].prototype),
+ 'WindowProperties',
+ 'Class name for prototype of Window' +
+ '.prototype is not "WindowProperties"');
+ } else {
+ var inherit_interface, inherit_interface_has_interface_object;
+ if (this.base) {
+ inherit_interface = this.base;
+ inherit_interface_has_interface_object =
+ !this.array
+ .members[inherit_interface]
+ .has_extended_attribute("NoInterfaceObject");
+ } else if (this.has_extended_attribute('ArrayClass')) {
+ inherit_interface = 'Array';
+ inherit_interface_has_interface_object = true;
+ } else {
+ inherit_interface = 'Object';
+ inherit_interface_has_interface_object = true;
+ }
+ if (inherit_interface_has_interface_object) {
+ assert_own_property(self, inherit_interface,
+ 'should inherit from ' + inherit_interface + ', but self has no such property');
+ assert_own_property(self[inherit_interface], 'prototype',
+ 'should inherit from ' + inherit_interface + ', but that object has no "prototype" property');
+ assert_equals(Object.getPrototypeOf(self[this.name].prototype),
+ self[inherit_interface].prototype,
+ 'prototype of ' + this.name + '.prototype is not ' + inherit_interface + '.prototype');
+ } else {
+ // We can't test that we get the correct object, because this is the
+ // only way to get our hands on it. We only test that its class
+ // string, at least, is correct.
+ assert_class_string(Object.getPrototypeOf(self[this.name].prototype),
+ inherit_interface + 'Prototype',
+ 'Class name for prototype of ' + this.name +
+ '.prototype is not "' + inherit_interface + 'Prototype"');
+ }
+ }
+
+ // "The class string of an interface prototype object is the
+ // concatenation of the interface’s identifier and the string
+ // “Prototype”."
+ assert_class_string(self[this.name].prototype, this.name + "Prototype",
+ "class string of " + this.name + ".prototype");
+ // String() should end up calling {}.toString if nothing defines a
+ // stringifier.
+ if (!this.has_stringifier()) {
+ assert_equals(String(self[this.name].prototype), "[object " + this.name + "Prototype]",
+ "String(" + this.name + ".prototype)");
+ }
+ }.bind(this), this.name + " interface: existence and properties of interface prototype object");
+
+ test(function()
+ {
+ if (this.is_callback() && !this.has_constants()) {
+ return;
+ }
+
+ assert_own_property(self, this.name,
+ "self does not have own property " + format_value(this.name));
+
+ if (this.is_callback()) {
+ assert_false("prototype" in self[this.name],
+ this.name + ' should not have a "prototype" property');
+ return;
+ }
+
+ assert_own_property(self[this.name], "prototype",
+ 'interface "' + this.name + '" does not have own property "prototype"');
+
+ // "If the [NoInterfaceObject] extended attribute was not specified on
+ // the interface, then the interface prototype object must also have a
+ // property named “constructor” with attributes { [[Writable]]: true,
+ // [[Enumerable]]: false, [[Configurable]]: true } whose value is a
+ // reference to the interface object for the interface."
+ assert_own_property(self[this.name].prototype, "constructor",
+ this.name + '.prototype does not have own property "constructor"');
+ var desc = Object.getOwnPropertyDescriptor(self[this.name].prototype, "constructor");
+ assert_false("get" in desc, this.name + ".prototype.constructor has getter");
+ assert_false("set" in desc, this.name + ".prototype.constructor has setter");
+ assert_true(desc.writable, this.name + ".prototype.constructor is not writable");
+ assert_false(desc.enumerable, this.name + ".prototype.constructor is enumerable");
+ assert_true(desc.configurable, this.name + ".prototype.constructor in not configurable");
+ assert_equals(self[this.name].prototype.constructor, self[this.name],
+ this.name + '.prototype.constructor is not the same object as ' + this.name);
+ }.bind(this), this.name + ' interface: existence and properties of interface prototype object\'s "constructor" property');
+};
+
+//@}
+IdlInterface.prototype.test_member_const = function(member)
+//@{
+{
+ if (!this.has_constants()) {
+ throw "Internal error: test_member_const called without any constants";
+ }
+
+ test(function()
+ {
+ assert_own_property(self, this.name,
+ "self does not have own property " + format_value(this.name));
+
+ // "For each constant defined on an interface A, there must be
+ // a corresponding property on the interface object, if it
+ // exists."
+ assert_own_property(self[this.name], member.name);
+ // "The value of the property is that which is obtained by
+ // converting the constant’s IDL value to an ECMAScript
+ // value."
+ assert_equals(self[this.name][member.name], constValue(member.value),
+ "property has wrong value");
+ // "The property has attributes { [[Writable]]: false,
+ // [[Enumerable]]: true, [[Configurable]]: false }."
+ var desc = Object.getOwnPropertyDescriptor(self[this.name], member.name);
+ assert_false("get" in desc, "property has getter");
+ assert_false("set" in desc, "property has setter");
+ assert_false(desc.writable, "property is writable");
+ assert_true(desc.enumerable, "property is not enumerable");
+ assert_false(desc.configurable, "property is configurable");
+ }.bind(this), this.name + " interface: constant " + member.name + " on interface object");
+
+ // "In addition, a property with the same characteristics must
+ // exist on the interface prototype object."
+ test(function()
+ {
+ assert_own_property(self, this.name,
+ "self does not have own property " + format_value(this.name));
+
+ if (this.is_callback()) {
+ assert_false("prototype" in self[this.name],
+ this.name + ' should not have a "prototype" property');
+ return;
+ }
+
+ assert_own_property(self[this.name], "prototype",
+ 'interface "' + this.name + '" does not have own property "prototype"');
+
+ assert_own_property(self[this.name].prototype, member.name);
+ assert_equals(self[this.name].prototype[member.name], constValue(member.value),
+ "property has wrong value");
+ var desc = Object.getOwnPropertyDescriptor(self[this.name], member.name);
+ assert_false("get" in desc, "property has getter");
+ assert_false("set" in desc, "property has setter");
+ assert_false(desc.writable, "property is writable");
+ assert_true(desc.enumerable, "property is not enumerable");
+ assert_false(desc.configurable, "property is configurable");
+ }.bind(this), this.name + " interface: constant " + member.name + " on interface prototype object");
+};
+
+
+//@}
+IdlInterface.prototype.test_member_attribute = function(member)
+//@{
+ {
+ var a_test = async_test(this.name + " interface: attribute " + member.name);
+ a_test.step(function()
+ {
+ if (this.is_callback() && !this.has_constants()) {
+ a_test.done()
+ return;
+ }
+
+ assert_own_property(self, this.name,
+ "self does not have own property " + format_value(this.name));
+ assert_own_property(self[this.name], "prototype",
+ 'interface "' + this.name + '" does not have own property "prototype"');
+
+ if (member["static"]) {
+ assert_own_property(self[this.name], member.name,
+ "The interface object must have a property " +
+ format_value(member.name));
+ a_test.done();
+ } else if (this.is_global()) {
+ assert_own_property(self, member.name,
+ "The global object must have a property " +
+ format_value(member.name));
+ assert_false(member.name in self[this.name].prototype,
+ "The prototype object must not have a property " +
+ format_value(member.name));
+
+ var getter = Object.getOwnPropertyDescriptor(self, member.name).get;
+ assert_equals(typeof(getter), "function",
+ format_value(member.name) + " must have a getter");
+
+ // Try/catch around the get here, since it can legitimately throw.
+ // If it does, we obviously can't check for equality with direct
+ // invocation of the getter.
+ var gotValue;
+ var propVal;
+ try {
+ propVal = self[member.name];
+ gotValue = true;
+ } catch (e) {
+ gotValue = false;
+ }
+ if (gotValue) {
+ assert_equals(propVal, getter.call(undefined),
+ "Gets on a global should not require an explicit this");
+ }
+
+ // do_interface_attribute_asserts must be the last thing we do,
+ // since it will call done() on a_test.
+ this.do_interface_attribute_asserts(self, member, a_test);
+ } else {
+ assert_true(member.name in self[this.name].prototype,
+ "The prototype object must have a property " +
+ format_value(member.name));
+
+ if (!member.has_extended_attribute("LenientThis")) {
+ if (member.idlType.generic !== "Promise") {
+ assert_throws(new TypeError(), function() {
+ self[this.name].prototype[member.name];
+ }.bind(this), "getting property on prototype object must throw TypeError");
+ // do_interface_attribute_asserts must be the last thing we
+ // do, since it will call done() on a_test.
+ this.do_interface_attribute_asserts(self[this.name].prototype, member, a_test);
+ } else {
+ promise_rejects(a_test, new TypeError(),
+ self[this.name].prototype[member.name])
+ .then(function() {
+ // do_interface_attribute_asserts must be the last
+ // thing we do, since it will call done() on a_test.
+ this.do_interface_attribute_asserts(self[this.name].prototype,
+ member, a_test);
+ }.bind(this));
+ }
+ } else {
+ assert_equals(self[this.name].prototype[member.name], undefined,
+ "getting property on prototype object must return undefined");
+ // do_interface_attribute_asserts must be the last thing we do,
+ // since it will call done() on a_test.
+ this.do_interface_attribute_asserts(self[this.name].prototype, member, a_test);
+ }
+
+ }
+ }.bind(this));
+};
+
+//@}
+IdlInterface.prototype.test_member_operation = function(member)
+//@{
+{
+ var a_test = async_test(this.name + " interface: operation " + member.name +
+ "(" + member.arguments.map(
+ function(m) {return m.idlType.idlType; } )
+ +")");
+ a_test.step(function()
+ {
+ // This function tests WebIDL as of 2015-12-29.
+ // https://heycam.github.io/webidl/#es-operations
+
+ if (this.is_callback() && !this.has_constants()) {
+ a_test.done();
+ return;
+ }
+
+ assert_own_property(self, this.name,
+ "self does not have own property " + format_value(this.name));
+
+ if (this.is_callback()) {
+ assert_false("prototype" in self[this.name],
+ this.name + ' should not have a "prototype" property');
+ a_test.done();
+ return;
+ }
+
+ assert_own_property(self[this.name], "prototype",
+ 'interface "' + this.name + '" does not have own property "prototype"');
+
+ // "For each unique identifier of an exposed operation defined on the
+ // interface, there must exist a corresponding property, unless the
+ // effective overload set for that identifier and operation and with an
+ // argument count of 0 has no entries."
+
+ // TODO: Consider [Exposed].
+
+ // "The location of the property is determined as follows:"
+ var memberHolderObject;
+ // "* If the operation is static, then the property exists on the
+ // interface object."
+ if (member["static"]) {
+ assert_own_property(self[this.name], member.name,
+ "interface object missing static operation");
+ memberHolderObject = self[this.name];
+ // "* Otherwise, [...] if the interface was declared with the [Global]
+ // or [PrimaryGlobal] extended attribute, then the property exists
+ // on every object that implements the interface."
+ } else if (this.is_global()) {
+ assert_own_property(self, member.name,
+ "global object missing non-static operation");
+ memberHolderObject = self;
+ // "* Otherwise, the property exists solely on the interface’s
+ // interface prototype object."
+ } else {
+ assert_own_property(self[this.name].prototype, member.name,
+ "interface prototype object missing non-static operation");
+ memberHolderObject = self[this.name].prototype;
+ }
+ this.do_member_operation_asserts(memberHolderObject, member, a_test);
+ }.bind(this));
+};
+
+//@}
+IdlInterface.prototype.do_member_operation_asserts = function(memberHolderObject, member, a_test)
+//@{
+{
+ var done = a_test.done.bind(a_test);
+ var operationUnforgeable = member.isUnforgeable;
+ var desc = Object.getOwnPropertyDescriptor(memberHolderObject, member.name);
+ // "The property has attributes { [[Writable]]: B,
+ // [[Enumerable]]: true, [[Configurable]]: B }, where B is false if the
+ // operation is unforgeable on the interface, and true otherwise".
+ assert_false("get" in desc, "property has getter");
+ assert_false("set" in desc, "property has setter");
+ assert_equals(desc.writable, !operationUnforgeable,
+ "property should be writable if and only if not unforgeable");
+ assert_true(desc.enumerable, "property is not enumerable");
+ assert_equals(desc.configurable, !operationUnforgeable,
+ "property should be configurable if and only if not unforgeable");
+ // "The value of the property is a Function object whose
+ // behavior is as follows . . ."
+ assert_equals(typeof memberHolderObject[member.name], "function",
+ "property must be a function");
+ // "The value of the Function object’s “length” property is
+ // a Number determined as follows:
+ // ". . .
+ // "Return the length of the shortest argument list of the
+ // entries in S."
+ assert_equals(memberHolderObject[member.name].length,
+ minOverloadLength(this.members.filter(function(m) {
+ return m.type == "operation" && m.name == member.name;
+ })),
+ "property has wrong .length");
+
+ // Make some suitable arguments
+ var args = member.arguments.map(function(arg) {
+ return create_suitable_object(arg.idlType);
+ });
+
+ // "Let O be a value determined as follows:
+ // ". . .
+ // "Otherwise, throw a TypeError."
+ // This should be hit if the operation is not static, there is
+ // no [ImplicitThis] attribute, and the this value is null.
+ //
+ // TODO: We currently ignore the [ImplicitThis] case. Except we manually
+ // check for globals, since otherwise we'll invoke window.close(). And we
+ // have to skip this test for anything that on the proto chain of "self",
+ // since that does in fact have implicit-this behavior.
+ if (!member["static"]) {
+ var cb;
+ if (!this.is_global() &&
+ memberHolderObject[member.name] != self[member.name])
+ {
+ cb = awaitNCallbacks(2, done);
+ throwOrReject(a_test, member, memberHolderObject[member.name], null, args,
+ "calling operation with this = null didn't throw TypeError", cb);
+ } else {
+ cb = awaitNCallbacks(1, done);
+ }
+
+ // ". . . If O is not null and is also not a platform object
+ // that implements interface I, throw a TypeError."
+ //
+ // TODO: Test a platform object that implements some other
+ // interface. (Have to be sure to get inheritance right.)
+ throwOrReject(a_test, member, memberHolderObject[member.name], {}, args,
+ "calling operation with this = {} didn't throw TypeError", cb);
+ } else {
+ done();
+ }
+}
+
+//@}
+IdlInterface.prototype.add_iterable_members = function(member)
+//@{
+{
+ this.members.push({type: "operation", name: "entries", idlType: "iterator", arguments: []});
+ this.members.push({type: "operation", name: "keys", idlType: "iterator", arguments: []});
+ this.members.push({type: "operation", name: "values", idlType: "iterator", arguments: []});
+ this.members.push({type: "operation", name: "forEach", idlType: "void", arguments:
+ [{ name: "callback", idlType: {idlType: "function"}},
+ { name: "thisValue", idlType: {idlType: "any"}, optional: true}]});
+};
+
+//@}
+IdlInterface.prototype.test_member_iterable = function(member)
+//@{
+{
+ var interfaceName = this.name;
+ var isPairIterator = member.idlType instanceof Array;
+ test(function()
+ {
+ var descriptor = Object.getOwnPropertyDescriptor(self[interfaceName].prototype, Symbol.iterator);
+ assert_true(descriptor.writable, "property is not writable");
+ assert_true(descriptor.configurable, "property is not configurable");
+ assert_false(descriptor.enumerable, "property is enumerable");
+ assert_equals(self[interfaceName].prototype[Symbol.iterator].name, isPairIterator ? "entries" : "values", "@@iterator function does not have the right name");
+ }, "Testing Symbol.iterator property of iterable interface " + interfaceName);
+
+ if (isPairIterator) {
+ test(function() {
+ assert_equals(self[interfaceName].prototype[Symbol.iterator], self[interfaceName].prototype["entries"], "entries method is not the same as @@iterator");
+ }, "Testing pair iterable interface " + interfaceName);
+ } else {
+ test(function() {
+ ["entries", "keys", "values", "forEach", Symbol.Iterator].forEach(function(property) {
+ assert_equals(self[interfaceName].prototype[property], Array.prototype[property], property + " function is not the same as Array one");
+ });
+ }, "Testing value iterable interface " + interfaceName);
+ }
+};
+
+//@}
+IdlInterface.prototype.test_member_stringifier = function(member)
+//@{
+{
+ test(function()
+ {
+ if (this.is_callback() && !this.has_constants()) {
+ return;
+ }
+
+ assert_own_property(self, this.name,
+ "self does not have own property " + format_value(this.name));
+
+ if (this.is_callback()) {
+ assert_false("prototype" in self[this.name],
+ this.name + ' should not have a "prototype" property');
+ return;
+ }
+
+ assert_own_property(self[this.name], "prototype",
+ 'interface "' + this.name + '" does not have own property "prototype"');
+
+ // ". . . the property exists on the interface prototype object."
+ var interfacePrototypeObject = self[this.name].prototype;
+ assert_own_property(self[this.name].prototype, "toString",
+ "interface prototype object missing non-static operation");
+
+ var stringifierUnforgeable = member.isUnforgeable;
+ var desc = Object.getOwnPropertyDescriptor(interfacePrototypeObject, "toString");
+ // "The property has attributes { [[Writable]]: B,
+ // [[Enumerable]]: true, [[Configurable]]: B }, where B is false if the
+ // stringifier is unforgeable on the interface, and true otherwise."
+ assert_false("get" in desc, "property has getter");
+ assert_false("set" in desc, "property has setter");
+ assert_equals(desc.writable, !stringifierUnforgeable,
+ "property should be writable if and only if not unforgeable");
+ assert_true(desc.enumerable, "property is not enumerable");
+ assert_equals(desc.configurable, !stringifierUnforgeable,
+ "property should be configurable if and only if not unforgeable");
+ // "The value of the property is a Function object, which behaves as
+ // follows . . ."
+ assert_equals(typeof interfacePrototypeObject.toString, "function",
+ "property must be a function");
+ // "The value of the Function object’s “length” property is the Number
+ // value 0."
+ assert_equals(interfacePrototypeObject.toString.length, 0,
+ "property has wrong .length");
+
+ // "Let O be the result of calling ToObject on the this value."
+ assert_throws(new TypeError(), function() {
+ self[this.name].prototype.toString.apply(null, []);
+ }, "calling stringifier with this = null didn't throw TypeError");
+
+ // "If O is not an object that implements the interface on which the
+ // stringifier was declared, then throw a TypeError."
+ //
+ // TODO: Test a platform object that implements some other
+ // interface. (Have to be sure to get inheritance right.)
+ assert_throws(new TypeError(), function() {
+ self[this.name].prototype.toString.apply({}, []);
+ }, "calling stringifier with this = {} didn't throw TypeError");
+ }.bind(this), this.name + " interface: stringifier");
+};
+
+//@}
+IdlInterface.prototype.test_members = function()
+//@{
+{
+ for (var i = 0; i < this.members.length; i++)
+ {
+ var member = this.members[i];
+ switch (member.type) {
+ case "iterable":
+ this.add_iterable_members(member);
+ break;
+ // TODO: add setlike and maplike handling.
+ default:
+ break;
+ }
+ }
+
+ for (var i = 0; i < this.members.length; i++)
+ {
+ var member = this.members[i];
+ if (member.untested) {
+ continue;
+ }
+
+ switch (member.type) {
+ case "const":
+ this.test_member_const(member);
+ break;
+
+ case "attribute":
+ // For unforgeable attributes, we do the checks in
+ // test_interface_of instead.
+ if (!member.isUnforgeable)
+ {
+ this.test_member_attribute(member);
+ }
+ if (member.stringifier) {
+ this.test_member_stringifier(member);
+ }
+ break;
+
+ case "operation":
+ // TODO: Need to correctly handle multiple operations with the same
+ // identifier.
+ // For unforgeable operations, we do the checks in
+ // test_interface_of instead.
+ if (member.name) {
+ if (!member.isUnforgeable)
+ {
+ this.test_member_operation(member);
+ }
+ } else if (member.stringifier) {
+ this.test_member_stringifier(member);
+ }
+ break;
+
+ case "iterable":
+ this.test_member_iterable(member);
+ break;
+ default:
+ // TODO: check more member types.
+ break;
+ }
+ }
+};
+
+//@}
+IdlInterface.prototype.test_object = function(desc)
+//@{
+{
+ var obj, exception = null;
+ try
+ {
+ obj = eval(desc);
+ }
+ catch(e)
+ {
+ exception = e;
+ }
+
+ var expected_typeof =
+ this.members.some(function(member) { return member.legacycaller; })
+ ? "function"
+ : "object";
+
+ this.test_primary_interface_of(desc, obj, exception, expected_typeof);
+ var current_interface = this;
+ while (current_interface)
+ {
+ if (!(current_interface.name in this.array.members))
+ {
+ throw "Interface " + current_interface.name + " not found (inherited by " + this.name + ")";
+ }
+ if (current_interface.prevent_multiple_testing && current_interface.already_tested)
+ {
+ return;
+ }
+ current_interface.test_interface_of(desc, obj, exception, expected_typeof);
+ current_interface = this.array.members[current_interface.base];
+ }
+};
+
+//@}
+IdlInterface.prototype.test_primary_interface_of = function(desc, obj, exception, expected_typeof)
+//@{
+{
+ // We can't easily test that its prototype is correct if there's no
+ // interface object, or the object is from a different global environment
+ // (not instanceof Object). TODO: test in this case that its prototype at
+ // least looks correct, even if we can't test that it's actually correct.
+ if (!this.has_extended_attribute("NoInterfaceObject")
+ && (typeof obj != expected_typeof || obj instanceof Object))
+ {
+ test(function()
+ {
+ assert_equals(exception, null, "Unexpected exception when evaluating object");
+ assert_equals(typeof obj, expected_typeof, "wrong typeof object");
+ assert_own_property(self, this.name,
+ "self does not have own property " + format_value(this.name));
+ assert_own_property(self[this.name], "prototype",
+ 'interface "' + this.name + '" does not have own property "prototype"');
+
+ // "The value of the internal [[Prototype]] property of the
+ // platform object is the interface prototype object of the primary
+ // interface from the platform object’s associated global
+ // environment."
+ assert_equals(Object.getPrototypeOf(obj),
+ self[this.name].prototype,
+ desc + "'s prototype is not " + this.name + ".prototype");
+ }.bind(this), this.name + " must be primary interface of " + desc);
+ }
+
+ // "The class string of a platform object that implements one or more
+ // interfaces must be the identifier of the primary interface of the
+ // platform object."
+ test(function()
+ {
+ assert_equals(exception, null, "Unexpected exception when evaluating object");
+ assert_equals(typeof obj, expected_typeof, "wrong typeof object");
+ assert_class_string(obj, this.name, "class string of " + desc);
+ if (!this.has_stringifier())
+ {
+ assert_equals(String(obj), "[object " + this.name + "]", "String(" + desc + ")");
+ }
+ }.bind(this), "Stringification of " + desc);
+};
+
+//@}
+IdlInterface.prototype.test_interface_of = function(desc, obj, exception, expected_typeof)
+//@{
+{
+ // TODO: Indexed and named properties, more checks on interface members
+ this.already_tested = true;
+
+ for (var i = 0; i < this.members.length; i++)
+ {
+ var member = this.members[i];
+ if (member.type == "attribute" && member.isUnforgeable)
+ {
+ var a_test = async_test(this.name + " interface: " + desc + ' must have own property "' + member.name + '"');
+ a_test.step(function() {
+ assert_equals(exception, null, "Unexpected exception when evaluating object");
+ assert_equals(typeof obj, expected_typeof, "wrong typeof object");
+ // Call do_interface_attribute_asserts last, since it will call a_test.done()
+ this.do_interface_attribute_asserts(obj, member, a_test);
+ }.bind(this));
+ }
+ else if (member.type == "operation" &&
+ member.name &&
+ member.isUnforgeable)
+ {
+ var a_test = async_test(this.name + " interface: " + desc + ' must have own property "' + member.name + '"');
+ a_test.step(function()
+ {
+ assert_equals(exception, null, "Unexpected exception when evaluating object");
+ assert_equals(typeof obj, expected_typeof, "wrong typeof object");
+ assert_own_property(obj, member.name,
+ "Doesn't have the unforgeable operation property");
+ this.do_member_operation_asserts(obj, member, a_test);
+ }.bind(this));
+ }
+ else if ((member.type == "const"
+ || member.type == "attribute"
+ || member.type == "operation")
+ && member.name)
+ {
+ test(function()
+ {
+ assert_equals(exception, null, "Unexpected exception when evaluating object");
+ assert_equals(typeof obj, expected_typeof, "wrong typeof object");
+ if (!member["static"]) {
+ if (!this.is_global()) {
+ assert_inherits(obj, member.name);
+ } else {
+ assert_own_property(obj, member.name);
+ }
+
+ if (member.type == "const")
+ {
+ assert_equals(obj[member.name], constValue(member.value));
+ }
+ if (member.type == "attribute")
+ {
+ // Attributes are accessor properties, so they might
+ // legitimately throw an exception rather than returning
+ // anything.
+ var property, thrown = false;
+ try
+ {
+ property = obj[member.name];
+ }
+ catch (e)
+ {
+ thrown = true;
+ }
+ if (!thrown)
+ {
+ this.array.assert_type_is(property, member.idlType);
+ }
+ }
+ if (member.type == "operation")
+ {
+ assert_equals(typeof obj[member.name], "function");
+ }
+ }
+ }.bind(this), this.name + " interface: " + desc + ' must inherit property "' + member.name + '" with the proper type (' + i + ')');
+ }
+ // TODO: This is wrong if there are multiple operations with the same
+ // identifier.
+ // TODO: Test passing arguments of the wrong type.
+ if (member.type == "operation" && member.name && member.arguments.length)
+ {
+ var a_test = async_test( this.name + " interface: calling " + member.name +
+ "(" + member.arguments.map(function(m) { return m.idlType.idlType; }) +
+ ") on " + desc + " with too few arguments must throw TypeError");
+ a_test.step(function()
+ {
+ assert_equals(exception, null, "Unexpected exception when evaluating object");
+ assert_equals(typeof obj, expected_typeof, "wrong typeof object");
+ if (!member["static"]) {
+ if (!this.is_global() && !member.isUnforgeable) {
+ assert_inherits(obj, member.name);
+ } else {
+ assert_own_property(obj, member.name);
+ }
+ }
+ else
+ {
+ assert_false(member.name in obj);
+ }
+
+ var minLength = minOverloadLength(this.members.filter(function(m) {
+ return m.type == "operation" && m.name == member.name;
+ }));
+ var args = [];
+ var cb = awaitNCallbacks(minLength, a_test.done.bind(a_test));
+ for (var i = 0; i < minLength; i++) {
+ throwOrReject(a_test, member, obj[member.name], obj, args, "Called with " + i + " arguments", cb);
+
+ args.push(create_suitable_object(member.arguments[i].idlType));
+ }
+ if (minLength === 0) {
+ cb();
+ }
+ }.bind(this));
+ }
+ }
+};
+
+//@}
+IdlInterface.prototype.has_stringifier = function()
+//@{
+{
+ if (this.members.some(function(member) { return member.stringifier; })) {
+ return true;
+ }
+ if (this.base &&
+ this.array.members[this.base].has_stringifier()) {
+ return true;
+ }
+ return false;
+};
+
+//@}
+IdlInterface.prototype.do_interface_attribute_asserts = function(obj, member, a_test)
+//@{
+{
+ // This function tests WebIDL as of 2015-01-27.
+ // TODO: Consider [Exposed].
+
+ // This is called by test_member_attribute() with the prototype as obj if
+ // it is not a global, and the global otherwise, and by test_interface_of()
+ // with the object as obj.
+
+ var pendingPromises = [];
+
+ // "For each exposed attribute of the interface, whether it was declared on
+ // the interface itself or one of its consequential interfaces, there MUST
+ // exist a corresponding property. The characteristics of this property are
+ // as follows:"
+
+ // "The name of the property is the identifier of the attribute."
+ assert_own_property(obj, member.name);
+
+ // "The property has attributes { [[Get]]: G, [[Set]]: S, [[Enumerable]]:
+ // true, [[Configurable]]: configurable }, where:
+ // "configurable is false if the attribute was declared with the
+ // [Unforgeable] extended attribute and true otherwise;
+ // "G is the attribute getter, defined below; and
+ // "S is the attribute setter, also defined below."
+ var desc = Object.getOwnPropertyDescriptor(obj, member.name);
+ assert_false("value" in desc, 'property descriptor has value but is supposed to be accessor');
+ assert_false("writable" in desc, 'property descriptor has "writable" field but is supposed to be accessor');
+ assert_true(desc.enumerable, "property is not enumerable");
+ if (member.isUnforgeable)
+ {
+ assert_false(desc.configurable, "[Unforgeable] property must not be configurable");
+ }
+ else
+ {
+ assert_true(desc.configurable, "property must be configurable");
+ }
+
+
+ // "The attribute getter is a Function object whose behavior when invoked
+ // is as follows:"
+ assert_equals(typeof desc.get, "function", "getter must be Function");
+
+ // "If the attribute is a regular attribute, then:"
+ if (!member["static"]) {
+ // "If O is not a platform object that implements I, then:
+ // "If the attribute was specified with the [LenientThis] extended
+ // attribute, then return undefined.
+ // "Otherwise, throw a TypeError."
+ if (!member.has_extended_attribute("LenientThis")) {
+ if (member.idlType.generic !== "Promise") {
+ assert_throws(new TypeError(), function() {
+ desc.get.call({});
+ }.bind(this), "calling getter on wrong object type must throw TypeError");
+ } else {
+ pendingPromises.push(
+ promise_rejects(a_test, new TypeError(), desc.get.call({}),
+ "calling getter on wrong object type must reject the return promise with TypeError"));
+ }
+ } else {
+ assert_equals(desc.get.call({}), undefined,
+ "calling getter on wrong object type must return undefined");
+ }
+ }
+
+ // "The value of the Function object’s “length” property is the Number
+ // value 0."
+ assert_equals(desc.get.length, 0, "getter length must be 0");
+
+
+ // TODO: Test calling setter on the interface prototype (should throw
+ // TypeError in most cases).
+ if (member.readonly
+ && !member.has_extended_attribute("PutForwards")
+ && !member.has_extended_attribute("Replaceable"))
+ {
+ // "The attribute setter is undefined if the attribute is declared
+ // readonly and has neither a [PutForwards] nor a [Replaceable]
+ // extended attribute declared on it."
+ assert_equals(desc.set, undefined, "setter must be undefined for readonly attributes");
+ }
+ else
+ {
+ // "Otherwise, it is a Function object whose behavior when
+ // invoked is as follows:"
+ assert_equals(typeof desc.set, "function", "setter must be function for PutForwards, Replaceable, or non-readonly attributes");
+
+ // "If the attribute is a regular attribute, then:"
+ if (!member["static"]) {
+ // "If /validThis/ is false and the attribute was not specified
+ // with the [LenientThis] extended attribute, then throw a
+ // TypeError."
+ // "If the attribute is declared with a [Replaceable] extended
+ // attribute, then: ..."
+ // "If validThis is false, then return."
+ if (!member.has_extended_attribute("LenientThis")) {
+ assert_throws(new TypeError(), function() {
+ desc.set.call({});
+ }.bind(this), "calling setter on wrong object type must throw TypeError");
+ } else {
+ assert_equals(desc.set.call({}), undefined,
+ "calling setter on wrong object type must return undefined");
+ }
+ }
+
+ // "The value of the Function object’s “length” property is the Number
+ // value 1."
+ assert_equals(desc.set.length, 1, "setter length must be 1");
+ }
+
+ Promise.all(pendingPromises).then(a_test.done.bind(a_test));
+}
+//@}
+
+/// IdlInterfaceMember ///
+function IdlInterfaceMember(obj)
+//@{
+{
+ /**
+ * obj is an object produced by the WebIDLParser.js "ifMember" production.
+ * We just forward all properties to this object without modification,
+ * except for special extAttrs handling.
+ */
+ for (var k in obj)
+ {
+ this[k] = obj[k];
+ }
+ if (!("extAttrs" in this))
+ {
+ this.extAttrs = [];
+ }
+
+ this.isUnforgeable = this.has_extended_attribute("Unforgeable");
+}
+
+//@}
+IdlInterfaceMember.prototype = Object.create(IdlObject.prototype);
+
+/// Internal helper functions ///
+function create_suitable_object(type)
+//@{
+{
+ /**
+ * type is an object produced by the WebIDLParser.js "type" production. We
+ * return a JavaScript value that matches the type, if we can figure out
+ * how.
+ */
+ if (type.nullable)
+ {
+ return null;
+ }
+ switch (type.idlType)
+ {
+ case "any":
+ case "boolean":
+ return true;
+
+ case "byte": case "octet": case "short": case "unsigned short":
+ case "long": case "unsigned long": case "long long":
+ case "unsigned long long": case "float": case "double":
+ case "unrestricted float": case "unrestricted double":
+ return 7;
+
+ case "DOMString":
+ case "ByteString":
+ case "USVString":
+ return "foo";
+
+ case "object":
+ return {a: "b"};
+
+ case "Node":
+ return document.createTextNode("abc");
+ }
+ return null;
+}
+//@}
+
+/// IdlEnum ///
+// Used for IdlArray.prototype.assert_type_is
+function IdlEnum(obj)
+//@{
+{
+ /**
+ * obj is an object produced by the WebIDLParser.js "dictionary"
+ * production.
+ */
+
+ /** Self-explanatory. */
+ this.name = obj.name;
+
+ /** An array of values produced by the "enum" production. */
+ this.values = obj.values;
+
+}
+//@}
+
+IdlEnum.prototype = Object.create(IdlObject.prototype);
+
+/// IdlTypedef ///
+// Used for IdlArray.prototype.assert_type_is
+function IdlTypedef(obj)
+//@{
+{
+ /**
+ * obj is an object produced by the WebIDLParser.js "typedef"
+ * production.
+ */
+
+ /** Self-explanatory. */
+ this.name = obj.name;
+
+ /** An array of values produced by the "typedef" production. */
+ this.values = obj.values;
+
+}
+//@}
+
+IdlTypedef.prototype = Object.create(IdlObject.prototype);
+
+}());
+// vim: set expandtab shiftwidth=4 tabstop=4 foldmarker=@{,@} foldmethod=marker:
</ins></span></pre></div>
<a id="trunkSourceWebCoreCMakeListstxt"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/CMakeLists.txt (213080 => 213081)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/CMakeLists.txt        2017-02-27 18:22:49 UTC (rev 213080)
+++ trunk/Source/WebCore/CMakeLists.txt        2017-02-27 19:01:13 UTC (rev 213081)
</span><span class="lines">@@ -8,6 +8,7 @@
</span><span class="cx"> "${WEBCORE_DIR}"
</span><span class="cx"> "${WEBCORE_DIR}/Modules/airplay"
</span><span class="cx"> "${WEBCORE_DIR}/Modules/applepay"
</span><ins>+ "${WEBCORE_DIR}/Modules/credentials"
</ins><span class="cx"> "${WEBCORE_DIR}/Modules/encryptedmedia"
</span><span class="cx"> "${WEBCORE_DIR}/Modules/encryptedmedia/legacy"
</span><span class="cx"> "${WEBCORE_DIR}/Modules/fetch"
</span><span class="lines">@@ -137,6 +138,7 @@
</span><span class="cx"> xml
</span><span class="cx">
</span><span class="cx"> Modules/airplay
</span><ins>+ Modules/credentials
</ins><span class="cx"> Modules/encryptedmedia/legacy
</span><span class="cx"> Modules/fetch
</span><span class="cx"> Modules/geolocation
</span><span class="lines">@@ -165,6 +167,12 @@
</span><span class="cx"> set(WebCore_NON_SVG_IDL_FILES
</span><span class="cx"> Modules/airplay/WebKitPlaybackTargetAvailabilityEvent.idl
</span><span class="cx">
</span><ins>+ Modules/credentials/BasicCredential.idl
+ Modules/credentials/CredentialData.idl
+ Modules/credentials/PasswordCredential.idl
+ Modules/credentials/SiteBoundCredential.idl
+ Modules/credentials/SiteBoundCredentialData.idl
+
</ins><span class="cx"> Modules/fetch/DOMWindowFetch.idl
</span><span class="cx"> Modules/fetch/FetchBody.idl
</span><span class="cx"> Modules/fetch/FetchHeaders.idl
</span><span class="lines">@@ -800,6 +808,10 @@
</span><span class="cx"> set(WebCore_SOURCES
</span><span class="cx"> Modules/airplay/WebKitPlaybackTargetAvailabilityEvent.cpp
</span><span class="cx">
</span><ins>+ Modules/credentials/BasicCredential.cpp
+ Modules/credentials/PasswordCredential.cpp
+ Modules/credentials/SiteBoundCredential.cpp
+
</ins><span class="cx"> Modules/fetch/DOMWindowFetch.cpp
</span><span class="cx"> Modules/fetch/FetchBody.cpp
</span><span class="cx"> Modules/fetch/FetchBodyConsumer.cpp
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (213080 => 213081)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2017-02-27 18:22:49 UTC (rev 213080)
+++ trunk/Source/WebCore/ChangeLog        2017-02-27 19:01:13 UTC (rev 213081)
</span><span class="lines">@@ -1,3 +1,56 @@
</span><ins>+2017-02-27 Jiewen Tan <jiewen_tan@apple.com>
+
+ [CredentialManagement] Add IDL definitions for Credential, SiteBoundCredential, and PasswordCredential
+ https://bugs.webkit.org/show_bug.cgi?id=168616
+ <rdar://problem/30167149>
+
+ Reviewed by Daniel Bates.
+
+ This patch adds IDL definitions for:
+ 1. Credential(https://w3c.github.io/webappsec-credential-management/#interfaces-credential-types-credential),
+ 2. SiteBoundCredential(https://w3c.github.io/webappsec-credential-management/#interfaces-credential-types-siteboundcredential), and
+ 3. PasswordCredential(https://w3c.github.io/webappsec-credential-management/#interfaces-credential-types-passwordcredential).
+
+ Test: credentials/idlharness.html
+
+ * CMakeLists.txt:
+ * DerivedSources.make:
+ * Modules/credentials/BasicCredential.cpp: Added.
+ (WebCore::BasicCredential::BasicCredential):
+ (WebCore::BasicCredential::~BasicCredential):
+ (WebCore::BasicCredential::type):
+ * Modules/credentials/BasicCredential.h: Added.
+ (WebCore::BasicCredential::id):
+ * Modules/credentials/BasicCredential.idl: Added.
+ * Modules/credentials/CredentialData.h: Added.
+ * Modules/credentials/CredentialData.idl: Added.
+ * Modules/credentials/PasswordCredential.cpp: Added.
+ (WebCore::PasswordCredential::PasswordCredential):
+ (WebCore::PasswordCredential::PasswordCredential):
+ Dummy constructors for now.
+ * Modules/credentials/PasswordCredential.h: Added.
+ (WebCore::PasswordCredential::create):
+ (WebCore::PasswordCredential::create):
+ (WebCore::PasswordCredential::setIdName):
+ (WebCore::PasswordCredential::idName):
+ (WebCore::PasswordCredential::setPasswordName):
+ (WebCore::PasswordCredential::passwordName):
+ (WebCore::PasswordCredential::setAdditionalData):
+ (WebCore::PasswordCredential::additionalData):
+ * Modules/credentials/PasswordCredential.idl: Added.
+ * Modules/credentials/SiteBoundCredential.cpp: Added.
+ (WebCore::SiteBoundCredential::SiteBoundCredential):
+ (WebCore::SiteBoundCredential::~SiteBoundCredential):
+ * Modules/credentials/SiteBoundCredential.h: Added.
+ (WebCore::SiteBoundCredential::name):
+ (WebCore::SiteBoundCredential::iconURL):
+ (WebCore::SiteBoundCredential::setOrigin):
+ (WebCore::SiteBoundCredential::origin):
+ * Modules/credentials/SiteBoundCredential.idl: Added.
+ * Modules/credentials/SiteBoundCredentialData.h: Added.
+ * Modules/credentials/SiteBoundCredentialData.idl: Added.
+ * WebCore.xcodeproj/project.pbxproj:
+
</ins><span class="cx"> 2017-02-27 Jer Noble <jer.noble@apple.com>
</span><span class="cx">
</span><span class="cx"> [WebRTC] Fix remote audio rendering
</span></span></pre></div>
<a id="trunkSourceWebCoreDerivedSourcesmake"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/DerivedSources.make (213080 => 213081)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/DerivedSources.make        2017-02-27 18:22:49 UTC (rev 213080)
+++ trunk/Source/WebCore/DerivedSources.make        2017-02-27 19:01:13 UTC (rev 213081)
</span><span class="lines">@@ -30,6 +30,7 @@
</span><span class="cx"> $(WebCore) \
</span><span class="cx"> $(WebCore)/Modules/airplay \
</span><span class="cx"> $(WebCore)/Modules/applepay \
</span><ins>+ $(WebCore)/Modules/credentials \
</ins><span class="cx"> $(WebCore)/Modules/encryptedmedia \
</span><span class="cx"> $(WebCore)/Modules/encryptedmedia/legacy \
</span><span class="cx"> $(WebCore)/Modules/fetch \
</span><span class="lines">@@ -91,6 +92,11 @@
</span><span class="cx"> $(WebCore)/Modules/applepay/ApplePayShippingMethod.idl \
</span><span class="cx"> $(WebCore)/Modules/applepay/ApplePayShippingMethodSelectedEvent.idl \
</span><span class="cx"> $(WebCore)/Modules/applepay/ApplePayValidateMerchantEvent.idl \
</span><ins>+ $(WebCore)/Modules/credentials/BasicCredential.idl \
+ $(WebCore)/Modules/credentials/CredentialData.idl \
+ $(WebCore)/Modules/credentials/PasswordCredential.idl \
+ $(WebCore)/Modules/credentials/SiteBoundCredential.idl \
+ $(WebCore)/Modules/credentials/SiteBoundCredentialData.idl \
</ins><span class="cx"> $(WebCore)/Modules/encryptedmedia/MediaKeyMessageEvent.idl \
</span><span class="cx"> $(WebCore)/Modules/encryptedmedia/MediaKeySession.idl \
</span><span class="cx"> $(WebCore)/Modules/encryptedmedia/MediaKeySessionType.idl \
</span></span></pre></div>
<a id="trunkSourceWebCoreModulescredentialsBasicCredentialcpp"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/Modules/credentials/BasicCredential.cpp (0 => 213081)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/credentials/BasicCredential.cpp         (rev 0)
+++ trunk/Source/WebCore/Modules/credentials/BasicCredential.cpp        2017-02-27 19:01:13 UTC (rev 213081)
</span><span class="lines">@@ -0,0 +1,54 @@
</span><ins>+/*
+ * Copyright (C) 2017 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. AND ITS CONTRIBUTORS ``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 ITS 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 "BasicCredential.h"
+
+namespace WebCore {
+
+BasicCredential::BasicCredential(const CredentialData& data, Type type)
+ : m_id(data.id)
+ , m_type(type)
+{
+}
+
+BasicCredential::~BasicCredential()
+{
+}
+
+String BasicCredential::type() const
+{
+ switch (m_type) {
+ case Type::Password:
+ return ASCIILiteral("password");
+ case Type::Federated:
+ return ASCIILiteral("federated");
+ }
+
+ ASSERT_NOT_REACHED();
+ return emptyString();
+}
+
+} // namespace WebCore
</ins></span></pre></div>
<a id="trunkSourceWebCoreModulescredentialsBasicCredentialh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/Modules/credentials/BasicCredential.h (0 => 213081)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/credentials/BasicCredential.h         (rev 0)
+++ trunk/Source/WebCore/Modules/credentials/BasicCredential.h        2017-02-27 19:01:13 UTC (rev 213081)
</span><span class="lines">@@ -0,0 +1,54 @@
</span><ins>+/*
+ * Copyright (C) 2017 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. AND ITS CONTRIBUTORS ``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 ITS 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
+
+#include "CredentialData.h"
+#include <wtf/RefCounted.h>
+#include <wtf/text/WTFString.h>
+
+namespace WebCore {
+
+class BasicCredential : public RefCounted<BasicCredential> {
+public:
+ enum class Type {
+ Password,
+ Federated,
+ };
+
+ virtual ~BasicCredential();
+
+ const String& id() const { return m_id; }
+ String type() const;
+
+protected:
+ BasicCredential(const CredentialData&, Type);
+
+private:
+ String m_id;
+ Type m_type;
+};
+
+} // namespace WebCore
</ins></span></pre></div>
<a id="trunkSourceWebCoreModulescredentialsBasicCredentialidl"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/Modules/credentials/BasicCredential.idl (0 => 213081)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/credentials/BasicCredential.idl         (rev 0)
+++ trunk/Source/WebCore/Modules/credentials/BasicCredential.idl        2017-02-27 19:01:13 UTC (rev 213081)
</span><span class="lines">@@ -0,0 +1,31 @@
</span><ins>+/*
+ * Copyright (C) 2017 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. AND ITS CONTRIBUTORS ``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 ITS 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.
+ */
+
+[
+ InterfaceName=Credential,
+] interface BasicCredential {
+ readonly attribute USVString id;
+ readonly attribute DOMString type;
+};
</ins></span></pre></div>
<a id="trunkSourceWebCoreModulescredentialsCredentialDatah"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/Modules/credentials/CredentialData.h (0 => 213081)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/credentials/CredentialData.h         (rev 0)
+++ trunk/Source/WebCore/Modules/credentials/CredentialData.h        2017-02-27 19:01:13 UTC (rev 213081)
</span><span class="lines">@@ -0,0 +1,36 @@
</span><ins>+/*
+ * Copyright (C) 2017 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. AND ITS CONTRIBUTORS ``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 ITS 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
+
+#include <wtf/text/WTFString.h>
+
+namespace WebCore {
+
+struct CredentialData {
+ String id;
+};
+
+} // namespace WebCore
</ins></span></pre></div>
<a id="trunkSourceWebCoreModulescredentialsCredentialDataidl"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/Modules/credentials/CredentialData.idl (0 => 213081)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/credentials/CredentialData.idl         (rev 0)
+++ trunk/Source/WebCore/Modules/credentials/CredentialData.idl        2017-02-27 19:01:13 UTC (rev 213081)
</span><span class="lines">@@ -0,0 +1,28 @@
</span><ins>+/*
+ * Copyright (C) 2017 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. AND ITS CONTRIBUTORS ``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 ITS 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.
+ */
+
+dictionary CredentialData {
+ required USVString id;
+};
</ins></span></pre></div>
<a id="trunkSourceWebCoreModulescredentialsPasswordCredentialcpp"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/Modules/credentials/PasswordCredential.cpp (0 => 213081)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/credentials/PasswordCredential.cpp         (rev 0)
+++ trunk/Source/WebCore/Modules/credentials/PasswordCredential.cpp        2017-02-27 19:01:13 UTC (rev 213081)
</span><span class="lines">@@ -0,0 +1,41 @@
</span><ins>+/*
+ * Copyright (C) 2017 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. AND ITS CONTRIBUTORS ``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 ITS 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 "PasswordCredential.h"
+
+namespace WebCore {
+
+PasswordCredential::PasswordCredential(const Data& data)
+ : SiteBoundCredential(data, Type::Password)
+{
+}
+
+PasswordCredential::PasswordCredential(const HTMLFormElement&)
+ : SiteBoundCredential(Data(), Type::Password)
+{
+}
+
+} // namespace WebCore
</ins></span></pre></div>
<a id="trunkSourceWebCoreModulescredentialsPasswordCredentialh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/Modules/credentials/PasswordCredential.h (0 => 213081)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/credentials/PasswordCredential.h         (rev 0)
+++ trunk/Source/WebCore/Modules/credentials/PasswordCredential.h        2017-02-27 19:01:13 UTC (rev 213081)
</span><span class="lines">@@ -0,0 +1,65 @@
</span><ins>+/*
+ * Copyright (C) 2017 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. AND ITS CONTRIBUTORS ``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 ITS 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
+
+#include "DOMFormData.h"
+#include "SiteBoundCredential.h"
+#include "URLSearchParams.h"
+#include <wtf/Variant.h>
+
+namespace WebCore {
+
+class HTMLFormElement;
+
+class PasswordCredential : public SiteBoundCredential {
+public:
+ struct Data : public SiteBoundCredentialData {
+ String password;
+ };
+
+ static Ref<PasswordCredential> create(const Data& data) { return adoptRef(*new PasswordCredential(data)); }
+ static Ref<PasswordCredential> create(const HTMLFormElement& form) { return adoptRef(*new PasswordCredential(form)); }
+
+ void setIdName(String&& idName) { m_idName = WTFMove(idName); }
+ const String& idName() const { return m_idName; }
+
+ void setPasswordName(String&& passwordName) { m_passwordName = WTFMove(passwordName); }
+ const String& passwordName() const { return m_passwordName; }
+
+ using CredentialBodyType = std::optional<Variant<RefPtr<DOMFormData>, RefPtr<URLSearchParams>>>;
+ void setAdditionalData(CredentialBodyType&& additionalData) { m_additionalData = WTFMove(additionalData); }
+ const CredentialBodyType& additionalData() const { return m_additionalData; }
+
+private:
+ PasswordCredential(const Data&);
+ PasswordCredential(const HTMLFormElement&);
+
+ String m_idName;
+ String m_passwordName;
+ CredentialBodyType m_additionalData;
+};
+
+} // namespace WebCore
</ins></span></pre></div>
<a id="trunkSourceWebCoreModulescredentialsPasswordCredentialidl"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/Modules/credentials/PasswordCredential.idl (0 => 213081)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/credentials/PasswordCredential.idl         (rev 0)
+++ trunk/Source/WebCore/Modules/credentials/PasswordCredential.idl        2017-02-27 19:01:13 UTC (rev 213081)
</span><span class="lines">@@ -0,0 +1,41 @@
</span><ins>+/*
+ * Copyright (C) 2017 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. AND ITS CONTRIBUTORS ``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 ITS 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.
+ */
+
+typedef (DOMFormData or URLSearchParams) CredentialBodyType;
+
+[
+ Constructor(PasswordCredentialData data),
+ Constructor(HTMLFormElement form),
+ Exposed=Window,
+] interface PasswordCredential : SiteBoundCredential {
+ attribute USVString idName;
+ attribute USVString passwordName;
+
+ attribute CredentialBodyType? additionalData;
+};
+
+dictionary PasswordCredentialData : SiteBoundCredentialData {
+ required USVString password;
+};
</ins></span></pre></div>
<a id="trunkSourceWebCoreModulescredentialsSiteBoundCredentialcpp"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/Modules/credentials/SiteBoundCredential.cpp (0 => 213081)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/credentials/SiteBoundCredential.cpp         (rev 0)
+++ trunk/Source/WebCore/Modules/credentials/SiteBoundCredential.cpp        2017-02-27 19:01:13 UTC (rev 213081)
</span><span class="lines">@@ -0,0 +1,43 @@
</span><ins>+/*
+ * Copyright (C) 2017 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. AND ITS CONTRIBUTORS ``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 ITS 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 "SiteBoundCredential.h"
+
+namespace WebCore {
+
+SiteBoundCredential::SiteBoundCredential(const SiteBoundCredentialData& data, Type type)
+ : BasicCredential(data, type)
+ , m_name(data.name)
+ , m_iconURL(URL(URL(), data.iconURL))
+ , m_origin(SecurityOrigin::create(URL()))
+{
+}
+
+SiteBoundCredential::~SiteBoundCredential()
+{
+}
+
+} // namespace WebCore
</ins></span></pre></div>
<a id="trunkSourceWebCoreModulescredentialsSiteBoundCredentialh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/Modules/credentials/SiteBoundCredential.h (0 => 213081)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/credentials/SiteBoundCredential.h         (rev 0)
+++ trunk/Source/WebCore/Modules/credentials/SiteBoundCredential.h        2017-02-27 19:01:13 UTC (rev 213081)
</span><span class="lines">@@ -0,0 +1,54 @@
</span><ins>+/*
+ * Copyright (C) 2017 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. AND ITS CONTRIBUTORS ``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 ITS 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
+
+#include "BasicCredential.h"
+#include "SecurityOrigin.h"
+#include "SiteBoundCredentialData.h"
+#include "URL.h"
+
+namespace WebCore {
+
+class SiteBoundCredential : public BasicCredential {
+public:
+ virtual ~SiteBoundCredential();
+
+ const String& name() const { return m_name; }
+ const URL& iconURL() const { return m_iconURL; }
+
+ void setOrigin(const URL& origin) { m_origin = SecurityOrigin::create(origin); }
+ const SecurityOrigin& origin() const { return m_origin.get(); }
+
+protected:
+ SiteBoundCredential(const SiteBoundCredentialData&, Type);
+
+private:
+ String m_name;
+ URL m_iconURL;
+ Ref<SecurityOrigin> m_origin;
+};
+
+} // namespace WebCore
</ins></span></pre></div>
<a id="trunkSourceWebCoreModulescredentialsSiteBoundCredentialidl"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/Modules/credentials/SiteBoundCredential.idl (0 => 213081)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/credentials/SiteBoundCredential.idl         (rev 0)
+++ trunk/Source/WebCore/Modules/credentials/SiteBoundCredential.idl        2017-02-27 19:01:13 UTC (rev 213081)
</span><span class="lines">@@ -0,0 +1,29 @@
</span><ins>+/*
+ * Copyright (C) 2017 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. AND ITS CONTRIBUTORS ``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 ITS 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.
+ */
+
+interface SiteBoundCredential : BasicCredential {
+ readonly attribute USVString name;
+ readonly attribute USVString iconURL;
+};
</ins></span></pre></div>
<a id="trunkSourceWebCoreModulescredentialsSiteBoundCredentialDatah"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/Modules/credentials/SiteBoundCredentialData.h (0 => 213081)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/credentials/SiteBoundCredentialData.h         (rev 0)
+++ trunk/Source/WebCore/Modules/credentials/SiteBoundCredentialData.h        2017-02-27 19:01:13 UTC (rev 213081)
</span><span class="lines">@@ -0,0 +1,37 @@
</span><ins>+/*
+ * Copyright (C) 2017 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. AND ITS CONTRIBUTORS ``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 ITS 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
+
+#include "CredentialData.h"
+
+namespace WebCore {
+
+struct SiteBoundCredentialData : public CredentialData {
+ String name;
+ String iconURL;
+};
+
+} // namespace WebCore
</ins></span></pre></div>
<a id="trunkSourceWebCoreModulescredentialsSiteBoundCredentialDataidl"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/Modules/credentials/SiteBoundCredentialData.idl (0 => 213081)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/credentials/SiteBoundCredentialData.idl         (rev 0)
+++ trunk/Source/WebCore/Modules/credentials/SiteBoundCredentialData.idl        2017-02-27 19:01:13 UTC (rev 213081)
</span><span class="lines">@@ -0,0 +1,29 @@
</span><ins>+/*
+ * Copyright (C) 2017 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. AND ITS CONTRIBUTORS ``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 ITS 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.
+ */
+
+dictionary SiteBoundCredentialData : CredentialData {
+ USVString name;
+ USVString iconURL;
+};
</ins></span></pre></div>
<a id="trunkSourceWebCoreWebCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (213080 => 213081)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2017-02-27 18:22:49 UTC (rev 213080)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2017-02-27 19:01:13 UTC (rev 213081)
</span><span class="lines">@@ -2365,6 +2365,24 @@
</span><span class="cx">                 5778BD821DA4806C009E3009 /* SubtleCrypto.h in Headers */ = {isa = PBXBuildFile; fileRef = 5778BD811DA4802C009E3009 /* SubtleCrypto.h */; };
</span><span class="cx">                 5778BD841DA4817B009E3009 /* SubtleCrypto.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5778BD831DA4817B009E3009 /* SubtleCrypto.cpp */; };
</span><span class="cx">                 57A9C88E1DA70BF800BC7305 /* JSSubtleCryptoCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 57A9C88D1DA70BF800BC7305 /* JSSubtleCryptoCustom.cpp */; };
</span><ins>+                57B5F7D41E57CF6800F34F90 /* SiteBoundCredential.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 57B5F7D21E57CF6800F34F90 /* SiteBoundCredential.cpp */; };
+                57B5F7D51E57CF6800F34F90 /* SiteBoundCredential.h in Headers */ = {isa = PBXBuildFile; fileRef = 57B5F7D31E57CF6800F34F90 /* SiteBoundCredential.h */; };
+                57B5F7D81E57D3C900F34F90 /* CredentialData.h in Headers */ = {isa = PBXBuildFile; fileRef = 57B5F7D71E57D3C900F34F90 /* CredentialData.h */; };
+                57B5F7DB1E57D4CC00F34F90 /* SiteBoundCredentialData.h in Headers */ = {isa = PBXBuildFile; fileRef = 57B5F7DA1E57D4CC00F34F90 /* SiteBoundCredentialData.h */; };
+                57B5F7E01E57DBC800F34F90 /* JSSiteBoundCredential.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 57B5F7DC1E57DBC800F34F90 /* JSSiteBoundCredential.cpp */; };
+                57B5F7E11E57DBC800F34F90 /* JSSiteBoundCredential.h in Headers */ = {isa = PBXBuildFile; fileRef = 57B5F7DD1E57DBC800F34F90 /* JSSiteBoundCredential.h */; };
+                57B5F7E21E57DBC800F34F90 /* JSSiteBoundCredentialData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 57B5F7DE1E57DBC800F34F90 /* JSSiteBoundCredentialData.cpp */; };
+                57B5F7E31E57DBC800F34F90 /* JSSiteBoundCredentialData.h in Headers */ = {isa = PBXBuildFile; fileRef = 57B5F7DF1E57DBC800F34F90 /* JSSiteBoundCredentialData.h */; };
+                57B5F7E61E57DBE000F34F90 /* JSCredentialData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 57B5F7E41E57DBE000F34F90 /* JSCredentialData.cpp */; };
+                57B5F7E71E57DBE000F34F90 /* JSCredentialData.h in Headers */ = {isa = PBXBuildFile; fileRef = 57B5F7E51E57DBE000F34F90 /* JSCredentialData.h */; };
+                57B5F7EC1E57F1E300F34F90 /* PasswordCredential.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 57B5F7EA1E57F1E300F34F90 /* PasswordCredential.cpp */; };
+                57B5F7ED1E57F1E300F34F90 /* PasswordCredential.h in Headers */ = {isa = PBXBuildFile; fileRef = 57B5F7EB1E57F1E300F34F90 /* PasswordCredential.h */; };
+                57B5F7F01E5B8C5A00F34F90 /* JSPasswordCredential.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 57B5F7EE1E5B8C5A00F34F90 /* JSPasswordCredential.cpp */; };
+                57B5F7F11E5B8C5A00F34F90 /* JSPasswordCredential.h in Headers */ = {isa = PBXBuildFile; fileRef = 57B5F7EF1E5B8C5A00F34F90 /* JSPasswordCredential.h */; };
+                57C7A68C1E56967500C67D71 /* BasicCredential.h in Headers */ = {isa = PBXBuildFile; fileRef = 57C7A68B1E56967500C67D71 /* BasicCredential.h */; };
+                57C7A6941E578ACA00C67D71 /* BasicCredential.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 57C7A6931E578ACA00C67D71 /* BasicCredential.cpp */; };
+                57C7A69F1E57917800C67D71 /* JSBasicCredential.h in Headers */ = {isa = PBXBuildFile; fileRef = 57C7A69D1E57910D00C67D71 /* JSBasicCredential.h */; };
+                57C7A6A01E57919B00C67D71 /* JSBasicCredential.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 57C7A69C1E57910D00C67D71 /* JSBasicCredential.cpp */; };
</ins><span class="cx">                 57D0018D1DD5413200ED19D9 /* JSCryptoKeyUsage.h in Headers */ = {isa = PBXBuildFile; fileRef = 57D0018C1DD5413200ED19D9 /* JSCryptoKeyUsage.h */; };
</span><span class="cx">                 57D0018F1DD5415300ED19D9 /* JSCryptoKeyUsage.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 57D0018E1DD5415300ED19D9 /* JSCryptoKeyUsage.cpp */; };
</span><span class="cx">                 57E2335B1DC7D5E500F28D01 /* JSJsonWebKey.h in Headers */ = {isa = PBXBuildFile; fileRef = 57E2335A1DC7D5E500F28D01 /* JSJsonWebKey.h */; };
</span><span class="lines">@@ -9744,6 +9762,29 @@
</span><span class="cx">                 5778BD811DA4802C009E3009 /* SubtleCrypto.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SubtleCrypto.h; sourceTree = "<group>"; };
</span><span class="cx">                 5778BD831DA4817B009E3009 /* SubtleCrypto.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SubtleCrypto.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 57A9C88D1DA70BF800BC7305 /* JSSubtleCryptoCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSSubtleCryptoCustom.cpp; sourceTree = "<group>"; };
</span><ins>+                57B5F7D11E57CF0E00F34F90 /* SiteBoundCredential.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = SiteBoundCredential.idl; sourceTree = "<group>"; };
+                57B5F7D21E57CF6800F34F90 /* SiteBoundCredential.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SiteBoundCredential.cpp; sourceTree = "<group>"; };
+                57B5F7D31E57CF6800F34F90 /* SiteBoundCredential.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SiteBoundCredential.h; sourceTree = "<group>"; };
+                57B5F7D61E57D36A00F34F90 /* CredentialData.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = CredentialData.idl; sourceTree = "<group>"; };
+                57B5F7D71E57D3C900F34F90 /* CredentialData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CredentialData.h; sourceTree = "<group>"; };
+                57B5F7D91E57D44E00F34F90 /* SiteBoundCredentialData.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = SiteBoundCredentialData.idl; sourceTree = "<group>"; };
+                57B5F7DA1E57D4CC00F34F90 /* SiteBoundCredentialData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SiteBoundCredentialData.h; sourceTree = "<group>"; };
+                57B5F7DC1E57DBC800F34F90 /* JSSiteBoundCredential.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSSiteBoundCredential.cpp; sourceTree = "<group>"; };
+                57B5F7DD1E57DBC800F34F90 /* JSSiteBoundCredential.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSSiteBoundCredential.h; sourceTree = "<group>"; };
+                57B5F7DE1E57DBC800F34F90 /* JSSiteBoundCredentialData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSSiteBoundCredentialData.cpp; sourceTree = "<group>"; };
+                57B5F7DF1E57DBC800F34F90 /* JSSiteBoundCredentialData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSSiteBoundCredentialData.h; sourceTree = "<group>"; };
+                57B5F7E41E57DBE000F34F90 /* JSCredentialData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSCredentialData.cpp; sourceTree = "<group>"; };
+                57B5F7E51E57DBE000F34F90 /* JSCredentialData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCredentialData.h; sourceTree = "<group>"; };
+                57B5F7E91E57E00000F34F90 /* PasswordCredential.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = PasswordCredential.idl; sourceTree = "<group>"; };
+                57B5F7EA1E57F1E300F34F90 /* PasswordCredential.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PasswordCredential.cpp; sourceTree = "<group>"; };
+                57B5F7EB1E57F1E300F34F90 /* PasswordCredential.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PasswordCredential.h; sourceTree = "<group>"; };
+                57B5F7EE1E5B8C5A00F34F90 /* JSPasswordCredential.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSPasswordCredential.cpp; sourceTree = "<group>"; };
+                57B5F7EF1E5B8C5A00F34F90 /* JSPasswordCredential.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSPasswordCredential.h; sourceTree = "<group>"; };
+                57C7A6891E56946D00C67D71 /* BasicCredential.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = BasicCredential.idl; sourceTree = "<group>"; };
+                57C7A68B1E56967500C67D71 /* BasicCredential.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BasicCredential.h; sourceTree = "<group>"; };
+                57C7A6931E578ACA00C67D71 /* BasicCredential.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = BasicCredential.cpp; sourceTree = "<group>"; };
+                57C7A69C1E57910D00C67D71 /* JSBasicCredential.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSBasicCredential.cpp; sourceTree = "<group>"; };
+                57C7A69D1E57910D00C67D71 /* JSBasicCredential.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSBasicCredential.h; sourceTree = "<group>"; };
</ins><span class="cx">                 57D0018B1DD3DBA400ED19D9 /* CryptoKeyUsage.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = CryptoKeyUsage.idl; sourceTree = "<group>"; };
</span><span class="cx">                 57D0018C1DD5413200ED19D9 /* JSCryptoKeyUsage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCryptoKeyUsage.h; sourceTree = "<group>"; };
</span><span class="cx">                 57D0018E1DD5415300ED19D9 /* JSCryptoKeyUsage.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSCryptoKeyUsage.cpp; sourceTree = "<group>"; };
</span><span class="lines">@@ -15962,6 +16003,7 @@
</span><span class="cx">                                 1221E0581C02B409006A1A00 /* Animation */,
</span><span class="cx">                                 1AE96A791D1A0A5C00B86768 /* ApplePay */,
</span><span class="cx">                                 A83B79100CCB001B000B0825 /* Core */,
</span><ins>+                                57C7A68D1E569A8400C67D71 /* Credentials */,
</ins><span class="cx">                                 E1FF8F61180745C600132674 /* Crypto */,
</span><span class="cx">                                 A83B790E0CCAFF97000B0825 /* CSS */,
</span><span class="cx">                                 5CE5D9A61DB899A800CE7A8D /* Encoding */,
</span><span class="lines">@@ -17691,6 +17733,43 @@
</span><span class="cx">                         path = mac;
</span><span class="cx">                         sourceTree = "<group>";
</span><span class="cx">                 };
</span><ins>+                57C7A6881E56946D00C67D71 /* credentials */ = {
+                        isa = PBXGroup;
+                        children = (
+                                57C7A6931E578ACA00C67D71 /* BasicCredential.cpp */,
+                                57C7A68B1E56967500C67D71 /* BasicCredential.h */,
+                                57C7A6891E56946D00C67D71 /* BasicCredential.idl */,
+                                57B5F7D71E57D3C900F34F90 /* CredentialData.h */,
+                                57B5F7D61E57D36A00F34F90 /* CredentialData.idl */,
+                                57B5F7EA1E57F1E300F34F90 /* PasswordCredential.cpp */,
+                                57B5F7EB1E57F1E300F34F90 /* PasswordCredential.h */,
+                                57B5F7E91E57E00000F34F90 /* PasswordCredential.idl */,
+                                57B5F7D21E57CF6800F34F90 /* SiteBoundCredential.cpp */,
+                                57B5F7D31E57CF6800F34F90 /* SiteBoundCredential.h */,
+                                57B5F7D11E57CF0E00F34F90 /* SiteBoundCredential.idl */,
+                                57B5F7DA1E57D4CC00F34F90 /* SiteBoundCredentialData.h */,
+                                57B5F7D91E57D44E00F34F90 /* SiteBoundCredentialData.idl */,
+                        );
+                        path = credentials;
+                        sourceTree = "<group>";
+                };
+                57C7A68D1E569A8400C67D71 /* Credentials */ = {
+                        isa = PBXGroup;
+                        children = (
+                                57C7A69C1E57910D00C67D71 /* JSBasicCredential.cpp */,
+                                57C7A69D1E57910D00C67D71 /* JSBasicCredential.h */,
+                                57B5F7E41E57DBE000F34F90 /* JSCredentialData.cpp */,
+                                57B5F7E51E57DBE000F34F90 /* JSCredentialData.h */,
+                                57B5F7EE1E5B8C5A00F34F90 /* JSPasswordCredential.cpp */,
+                                57B5F7EF1E5B8C5A00F34F90 /* JSPasswordCredential.h */,
+                                57B5F7DC1E57DBC800F34F90 /* JSSiteBoundCredential.cpp */,
+                                57B5F7DD1E57DBC800F34F90 /* JSSiteBoundCredential.h */,
+                                57B5F7DE1E57DBC800F34F90 /* JSSiteBoundCredentialData.cpp */,
+                                57B5F7DF1E57DBC800F34F90 /* JSSiteBoundCredentialData.h */,
+                        );
+                        name = Credentials;
+                        sourceTree = "<group>";
+                };
</ins><span class="cx">                 59B5977111086556007159E8 /* jsc */ = {
</span><span class="cx">                         isa = PBXGroup;
</span><span class="cx">                         children = (
</span><span class="lines">@@ -19633,6 +19712,7 @@
</span><span class="cx">                         children = (
</span><span class="cx">                                 CE26169D187E6554007955F3 /* airplay */,
</span><span class="cx">                                 1A58E8611D19D37300C0EA73 /* applepay */,
</span><ins>+                                57C7A6881E56946D00C67D71 /* credentials */,
</ins><span class="cx">                                 CDA98DBD16014E0800FEA3B1 /* encryptedmedia */,
</span><span class="cx">                                 41F54F7C1C50C4F600338488 /* fetch */,
</span><span class="cx">                                 518F4FE9194CA4B60081BAAE /* gamepad */,
</span><span class="lines">@@ -25332,11 +25412,13 @@
</span><span class="cx">                                 49E912AB0EFAC906009D0CAF /* Animation.h in Headers */,
</span><span class="cx">                                 316FE1120E6E1DA700BF6088 /* AnimationBase.h in Headers */,
</span><span class="cx">                                 319848011A1D817B00A13318 /* AnimationEvent.h in Headers */,
</span><ins>+                                57B5F7D81E57D3C900F34F90 /* CredentialData.h in Headers */,
</ins><span class="cx">                                 49E912AD0EFAC906009D0CAF /* AnimationList.h in Headers */,
</span><span class="cx">                                 31DCD29D1AB4FBDE0072E817 /* AnimationTrigger.h in Headers */,
</span><span class="cx">                                 0F580FAF149800D400FB5BD8 /* AnimationUtilities.h in Headers */,
</span><span class="cx">                                 93309DD7099E64920056E581 /* AppendNodeCommand.h in Headers */,
</span><span class="cx">                                 7C6579E31E00827000E3A27A /* ApplePayLineItem.h in Headers */,
</span><ins>+                                57C7A68C1E56967500C67D71 /* BasicCredential.h in Headers */,
</ins><span class="cx">                                 7C6523011E00D03400677F22 /* ApplePayPayment.h in Headers */,
</span><span class="cx">                                 1A8A64521D19FCFB00D0E00F /* ApplePayPaymentAuthorizedEvent.h in Headers */,
</span><span class="cx">                                 7C6522FB1E00C90900677F22 /* ApplePayPaymentContact.h in Headers */,
</span><span class="lines">@@ -25689,6 +25771,7 @@
</span><span class="cx">                                 E1BD331C182D8EE900C05D9F /* CryptoAlgorithmRsaSsaParamsDeprecated.h in Headers */,
</span><span class="cx">                                 E125F82C1822CFEC00D84CD9 /* CryptoAlgorithmSHA1.h in Headers */,
</span><span class="cx">                                 E19AC3EF1824DC7900349426 /* CryptoAlgorithmSHA224.h in Headers */,
</span><ins>+                                57B5F7F11E5B8C5A00F34F90 /* JSPasswordCredential.h in Headers */,
</ins><span class="cx">                                 E19AC3F11824DC7900349426 /* CryptoAlgorithmSHA256.h in Headers */,
</span><span class="cx">                                 E19AC3F31824DC7900349426 /* CryptoAlgorithmSHA384.h in Headers */,
</span><span class="cx">                                 E19AC3F51824DC7900349426 /* CryptoAlgorithmSHA512.h in Headers */,
</span><span class="lines">@@ -25977,6 +26060,7 @@
</span><span class="cx">                                 A7CA59630B27C1F200FA021D /* DragClient.h in Headers */,
</span><span class="cx">                                 A7CA595D0B27BD9E00FA021D /* DragController.h in Headers */,
</span><span class="cx">                                 A7B6E69F0B291A9600D0529F /* DragData.h in Headers */,
</span><ins>+                                57B5F7D51E57CF6800F34F90 /* SiteBoundCredential.h in Headers */,
</ins><span class="cx">                                 A7CFB3D20B7ED10A0070C32D /* DragImage.h in Headers */,
</span><span class="cx">                                 81F65FF613788FAA00FF6F2D /* DragState.h in Headers */,
</span><span class="cx">                                 E1BA66F11742BD8600C20251 /* DynamicLinkerInterposing.h in Headers */,
</span><span class="lines">@@ -26461,6 +26545,7 @@
</span><span class="cx">                                 AA4C3A770B2B1679002334A2 /* InlineStyleSheetOwner.h in Headers */,
</span><span class="cx">                                 BCEA485A097D93020094C9E4 /* InlineTextBox.h in Headers */,
</span><span class="cx">                                 1C010701192594DF008A4201 /* InlineTextBoxStyle.h in Headers */,
</span><ins>+                                57B5F7E31E57DBC800F34F90 /* JSSiteBoundCredentialData.h in Headers */,
</ins><span class="cx">                                 510A58E51BAA40B100C19282 /* InProcessIDBServer.h in Headers */,
</span><span class="cx">                                 2EB767571DA19BDF003E23B5 /* InputEvent.h in Headers */,
</span><span class="cx">                                 37E3524D12450C6600BAF5D9 /* InputType.h in Headers */,
</span><span class="lines">@@ -26666,6 +26751,7 @@
</span><span class="cx">                                 65DF31F809D1CC60000BE325 /* JSDOMImplementation.h in Headers */,
</span><span class="cx">                                 4138F8581D253F0E001CB61E /* JSDOMIterator.h in Headers */,
</span><span class="cx">                                 A9D248070D757E7D00FDF959 /* JSDOMMimeType.h in Headers */,
</span><ins>+                                57B5F7E11E57DBC800F34F90 /* JSSiteBoundCredential.h in Headers */,
</ins><span class="cx">                                 A9D248090D757E7D00FDF959 /* JSDOMMimeTypeArray.h in Headers */,
</span><span class="cx">                                 52CCA9E315E3F62C0053C77F /* JSDOMNamedFlowCollection.h in Headers */,
</span><span class="cx">                                 1ACE53E00A8D18810022947D /* JSDOMParser.h in Headers */,
</span><span class="lines">@@ -26773,6 +26859,7 @@
</span><span class="cx">                                 A80E7B0D0A19D606007FB8C5 /* JSHTMLLinkElement.h in Headers */,
</span><span class="cx">                                 1AE2AB280A1CE63B00B42B25 /* JSHTMLMapElement.h in Headers */,
</span><span class="cx">                                 BC491B790C023EFD009D6316 /* JSHTMLMarqueeElement.h in Headers */,
</span><ins>+                                57C7A69F1E57917800C67D71 /* JSBasicCredential.h in Headers */,
</ins><span class="cx">                                 E446143A0CD689C800FADA75 /* JSHTMLMediaElement.h in Headers */,
</span><span class="cx">                                 1AE2AE5C0A1D26F200B42B25 /* JSHTMLMenuElement.h in Headers */,
</span><span class="cx">                                 A80E7A180A19C3D6007FB8C5 /* JSHTMLMetaElement.h in Headers */,
</span><span class="lines">@@ -27471,6 +27558,7 @@
</span><span class="cx">                                 979F43D41075E44A0000F83B /* NavigationScheduler.h in Headers */,
</span><span class="cx">                                 A9C6E5A60D746458006442E9 /* Navigator.h in Headers */,
</span><span class="cx">                                 E12719C70EEEC16800F61213 /* NavigatorBase.h in Headers */,
</span><ins>+                                57B5F7ED1E57F1E300F34F90 /* PasswordCredential.h in Headers */,
</ins><span class="cx">                                 9711460414EF009A00674FD9 /* NavigatorGeolocation.h in Headers */,
</span><span class="cx">                                 5EA725D61ACABD5700EAD17B /* NavigatorMediaDevices.h in Headers */,
</span><span class="cx">                                 996E59DF1DF0128D006612B9 /* NavigatorWebDriver.h in Headers */,
</span><span class="lines">@@ -27778,6 +27866,7 @@
</span><span class="cx">                                 836DAA061CEAB80D00A2B707 /* RenderDescendantIterator.h in Headers */,
</span><span class="cx">                                 D302754A12A5FE84004BD828 /* RenderDetailsMarker.h in Headers */,
</span><span class="cx">                                 A76E5F7F135E0DCF00A69837 /* RenderedDocumentMarker.h in Headers */,
</span><ins>+                                57B5F7E71E57DBE000F34F90 /* JSCredentialData.h in Headers */,
</ins><span class="cx">                                 9B32CDA913DF7FA900F34D13 /* RenderedPosition.h in Headers */,
</span><span class="cx">                                 E43A023B17EB370A004CDD25 /* RenderElement.h in Headers */,
</span><span class="cx">                                 0F5B7A5510F65D7A00376302 /* RenderEmbeddedObject.h in Headers */,
</span><span class="lines">@@ -27983,6 +28072,7 @@
</span><span class="cx">                                 078E094317D16E1C00420AA1 /* RTCSessionDescriptionDescriptor.h in Headers */,
</span><span class="cx">                                 078E094417D16E1C00420AA1 /* RTCSessionDescriptionRequest.h in Headers */,
</span><span class="cx">                                 078E092A17D14D1C00420AA1 /* RTCStatsReport.h in Headers */,
</span><ins>+                                57B5F7DB1E57D4CC00F34F90 /* SiteBoundCredentialData.h in Headers */,
</ins><span class="cx">                                 5E2C43681BCEE3770001E2BC /* RTCTrackEvent.h in Headers */,
</span><span class="cx">                                 078E094717D16E1C00420AA1 /* RTCVoidRequest.h in Headers */,
</span><span class="cx">                                 5824ABA31AE81116009074B7 /* RubyElement.h in Headers */,
</span><span class="lines">@@ -29283,6 +29373,7 @@
</span><span class="cx">                         buildActionMask = 2147483647;
</span><span class="cx">                         files = (
</span><span class="cx">                                 570440531E5278B200356601 /* CryptoAlgorithmAES_CFB.cpp in Sources */,
</span><ins>+                                57C7A6A01E57919B00C67D71 /* JSBasicCredential.cpp in Sources */,
</ins><span class="cx">                                 41E1B1D00FF5986900576B3B /* AbstractWorker.cpp in Sources */,
</span><span class="cx">                                 37F57AB91A50726900876F98 /* AccessibilityARIAGrid.cpp in Sources */,
</span><span class="cx">                                 37F57ABA1A50726F00876F98 /* AccessibilityARIAGridCell.cpp in Sources */,
</span><span class="lines">@@ -29357,6 +29448,7 @@
</span><span class="cx">                                 A8C4A80E09D563270003AC8D /* Attr.cpp in Sources */,
</span><span class="cx">                                 E4A814D81C70E10500BF85AC /* AttributeChangeInvalidation.cpp in Sources */,
</span><span class="cx">                                 FD629EA4154B47160006D026 /* AudioBasicInspectorNode.cpp in Sources */,
</span><ins>+                                57B5F7E61E57DBE000F34F90 /* JSCredentialData.cpp in Sources */,
</ins><span class="cx">                                 FD315FF612B0267600C1A359 /* AudioBasicProcessorNode.cpp in Sources */,
</span><span class="cx">                                 FD315FF812B0267600C1A359 /* AudioBuffer.cpp in Sources */,
</span><span class="cx">                                 FD315FFB12B0267600C1A359 /* AudioBufferSourceNode.cpp in Sources */,
</span><span class="lines">@@ -30329,6 +30421,7 @@
</span><span class="cx">                                 120DE3FE1C87E18800B6D4DD /* JSAnimationEffect.cpp in Sources */,
</span><span class="cx">                                 3198480B1A1E6CE400A13318 /* JSAnimationEvent.cpp in Sources */,
</span><span class="cx">                                 1221E06C1C03D224006A1A00 /* JSAnimationTimeline.cpp in Sources */,
</span><ins>+                                57B5F7E21E57DBC800F34F90 /* JSSiteBoundCredentialData.cpp in Sources */,
</ins><span class="cx">                                 1221E0731C03E4C2006A1A00 /* JSAnimationTimelineCustom.cpp in Sources */,
</span><span class="cx">                                 7C6579EF1E00856600E3A27A /* JSApplePayLineItem.cpp in Sources */,
</span><span class="cx">                                 7C65231E1E018B5A00677F22 /* JSApplePayPayment.cpp in Sources */,
</span><span class="lines">@@ -30369,6 +30462,7 @@
</span><span class="cx">                                 7C77C3D41DEF178E00A50BFA /* JSBlobPropertyBag.cpp in Sources */,
</span><span class="cx">                                 14DCF3B21B6BE2080062D4C3 /* JSByteLengthQueuingStrategy.cpp in Sources */,
</span><span class="cx">                                 1449E287107D4DB400B5793F /* JSCallbackData.cpp in Sources */,
</span><ins>+                                57B5F7D41E57CF6800F34F90 /* SiteBoundCredential.cpp in Sources */,
</ins><span class="cx">                                 65DF323909D1DE65000BE325 /* JSCanvasGradient.cpp in Sources */,
</span><span class="cx">                                 65DF323B09D1DE65000BE325 /* JSCanvasPattern.cpp in Sources */,
</span><span class="cx">                                 49EED1441051969400099FAB /* JSCanvasRenderingContext2D.cpp in Sources */,
</span><span class="lines">@@ -31298,6 +31392,7 @@
</span><span class="cx">                                 D6E276AF14637455001D280A /* MutationObserverRegistration.cpp in Sources */,
</span><span class="cx">                                 C6F08FBC1430FE8F00685849 /* MutationRecord.cpp in Sources */,
</span><span class="cx">                                 52B6C9C515E3F4DF00690B05 /* NamedFlowCollection.cpp in Sources */,
</span><ins>+                                57B5F7EC1E57F1E300F34F90 /* PasswordCredential.cpp in Sources */,
</ins><span class="cx">                                 314BE3A61B3103FB00141982 /* NamedImageGeneratedImage.cpp in Sources */,
</span><span class="cx">                                 BCF34A3711A231CD00C71804 /* NamedNodeMap.cpp in Sources */,
</span><span class="cx">                                 A81872240977D3C0005826D9 /* NameNodeList.cpp in Sources */,
</span><span class="lines">@@ -31687,6 +31782,7 @@
</span><span class="cx">                                 5824ABA21AE81116009074B7 /* RubyElement.cpp in Sources */,
</span><span class="cx">                                 5824ABA61AE81384009074B7 /* RubyTextElement.cpp in Sources */,
</span><span class="cx">                                 A79BADA1161E7F3F00C2E652 /* RuleFeature.cpp in Sources */,
</span><ins>+                                57B5F7E01E57DBC800F34F90 /* JSSiteBoundCredential.cpp in Sources */,
</ins><span class="cx">                                 A79BADA3161E7F3F00C2E652 /* RuleSet.cpp in Sources */,
</span><span class="cx">                                 2D76BB8419456F8100CFD29A /* RunLoopObserver.cpp in Sources */,
</span><span class="cx">                                 1A569D1E0D7E2B82007C3983 /* runtime_array.cpp in Sources */,
</span><span class="lines">@@ -31822,6 +31918,7 @@
</span><span class="cx">                                 5C688AA31D3814BF000B54FA /* SocketProvider.cpp in Sources */,
</span><span class="cx">                                 510D4A36103165EE0049EA54 /* SocketStreamHandle.cpp in Sources */,
</span><span class="cx">                                 51ABAE1F103C1913008C5260 /* SocketStreamHandleImplCFNet.cpp in Sources */,
</span><ins>+                                57C7A6941E578ACA00C67D71 /* BasicCredential.cpp in Sources */,
</ins><span class="cx">                                 E45390470EAFD637003695C8 /* SoundIOS.mm in Sources */,
</span><span class="cx">                                 4B3043C90AE0371D00A82647 /* SoundMac.mm in Sources */,
</span><span class="cx">                                 84A81F3D0FC7DFF000955300 /* SourceAlpha.cpp in Sources */,
</span><span class="lines">@@ -32191,6 +32288,7 @@
</span><span class="cx">                                 E17B491516A9B094001C8839 /* TransitionEvent.cpp in Sources */,
</span><span class="cx">                                 49E911D10EF86D47009D0CAF /* TranslateTransformOperation.cpp in Sources */,
</span><span class="cx">                                 854FE7360A2297BE0058D7AD /* Traversal.cpp in Sources */,
</span><ins>+                                57B5F7F01E5B8C5A00F34F90 /* JSPasswordCredential.cpp in Sources */,
</ins><span class="cx">                                 14D64B5C134A5B6B00E58FDA /* TreeScope.cpp in Sources */,
</span><span class="cx">                                 A77E1FEF14AACB6E005B7CB6 /* TreeScopeAdopter.cpp in Sources */,
</span><span class="cx">                                 854FE7380A2297BE0058D7AD /* TreeWalker.cpp in Sources */,
</span></span></pre>
</div>
</div>
</body>
</html>