Update web-platform-tests to revision 8a2ceb5f18911302b7a5c1cd2791f4ab50ad4326

This commit is contained in:
Josh Matthews 2017-10-12 09:25:50 -04:00
parent 462c272380
commit 1f531f66ea
5377 changed files with 174916 additions and 84369 deletions

View file

@ -14,7 +14,6 @@ var data = {
"dom-inline" : [],
"dom-ext" : [],
"nested" : ["nested-outer","nested-inner","nested-outer"],
"script-exec" : ["script-exec-before-after","script-exec-before-after"],
"script-load-error" : [null],
"script-window-error" : ["script-error-compile","script-error-runtime"],
"timeout" : [null],

View file

@ -6,105 +6,13 @@
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<div id="test">
<applet name=test1></applet>
<applet name=test2></applet>
<applet name=test2></applet>
<applet id=test3></applet>
<applet id=test4></applet>
<applet id=test4></applet>
<applet name=test5></applet>
<applet id=test5></applet>
<applet id=test6></applet>
<applet name=test6></applet>
<applet id=test7 name=fail></applet>
<applet name=test8 id=fail></applet>
</div>
<script>
test(function() {
var applet = document.getElementsByTagName("applet")[0];
assert_equals(applet.name, "test1");
assert_equals(applet.name, undefined);
assert_true("test1" in document, '"test1" in document should be true');
assert_equals(document.test1, applet);
}, "If there is one applet, it should be returned (name)");
test(function() {
var applet1 = document.getElementsByTagName("applet")[1];
assert_equals(applet1.name, "test2");
var applet2 = document.getElementsByTagName("applet")[2];
assert_equals(applet2.name, "test2");
assert_true("test2" in document, '"test2" in document should be true');
var collection = document.test2;
assert_class_string(collection, "HTMLCollection", "collection should be an HTMLCollection");
assert_array_equals(collection, [applet1, applet2]);
}, "If there are two applets, a collection should be returned. (name)");
test(function() {
var applet = document.getElementsByTagName("applet")[3];
assert_equals(applet.id, "test3");
assert_true("test3" in document, '"test3" in document should be true');
assert_equals(document.test3, applet);
}, "If there is one applet, it should be returned (id)");
test(function() {
var applet1 = document.getElementsByTagName("applet")[4];
assert_equals(applet1.id, "test4");
var applet2 = document.getElementsByTagName("applet")[5];
assert_equals(applet2.id, "test4");
assert_true("test4" in document, '"test4" in document should be true');
var collection = document.test4;
assert_class_string(collection, "HTMLCollection", "collection should be an HTMLCollection");
assert_array_equals(collection, [applet1, applet2]);
}, "If there are two applets, a collection should be returned. (id)");
test(function() {
var applet1 = document.getElementsByTagName("applet")[6];
assert_equals(applet1.name, "test5");
var applet2 = document.getElementsByTagName("applet")[7];
assert_equals(applet2.id, "test5");
assert_true("test5" in document, '"test5" in document should be true');
var collection = document.test5;
assert_class_string(collection, "HTMLCollection", "collection should be an HTMLCollection");
assert_array_equals(collection, [applet1, applet2]);
}, "If there are two applets, a collection should be returned. (name and id)");
test(function() {
var applet1 = document.getElementsByTagName("applet")[8];
assert_equals(applet1.id, "test6");
var applet2 = document.getElementsByTagName("applet")[9];
assert_equals(applet2.name, "test6");
assert_true("test6" in document, '"test6" in document should be true');
var collection = document.test6;
assert_class_string(collection, "HTMLCollection", "collection should be an HTMLCollection");
assert_array_equals(collection, [applet1, applet2]);
}, "If there are two applets, a collection should be returned. (id and name)");
test(function() {
var applet = document.getElementsByTagName("applet")[10];
assert_equals(applet.id, "test7");
assert_true("test7" in document, '"test7" in document should be true');
assert_equals(document.test7, applet);
}, "A name shouldn't affect getting an applet by id");
test(function() {
var applet = document.getElementsByTagName("applet")[11];
assert_equals(applet.name, "test8");
assert_true("test8" in document, '"test8" in document should be true');
assert_equals(document.test8, applet);
}, "An id shouldn't affect getting an applet by name");
assert_false("test1" in document, '"test1" in document should be false');
assert_equals(document.test1, undefined);
}, "applet elements are (mostly) gone");
</script>

View file

@ -1,14 +1,11 @@
<!DOCTYPE html>
<meta charset=utf-8>
<title>Named items: duplicate id attributes for applet, object and img</title>
<title>Named items: duplicate id attributes for object and img</title>
<link rel="help" href="https://html.spec.whatwg.org/multipage/dom.html#dom-document-nameditem">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<div id="test">
<div id=test1></div>
<applet id=test1></applet>
<div id=test2></div>
<object id=test2></object>
@ -16,14 +13,6 @@
<img id=test3 name=non-empty>
</div>
<script>
test(function() {
var applet = document.querySelector("applet");
assert_equals(applet.id, "test1");
assert_true("test1" in document);
assert_equals(document.test1, applet);
}, "If there is a div and applet with same id, the applet should be returned");
test(function() {
var object = document.querySelector("object");
assert_equals(object.id, "test2");

View file

@ -1,5 +1,5 @@
// Up-to-date as of 2013-04-06.
var embeddedElements = {
picture: {},
img: {
// Conforming
alt: "string",
@ -92,7 +92,6 @@ var embeddedElements = {
preload: {type: "enum", keywords: ["none", "metadata", "auto"], nonCanon: {"": "auto"}, defaultVal: null},
autoplay: "boolean",
loop: "boolean",
mediaGroup: "string",
controls: "boolean",
defaultMuted: {type: "boolean", domAttrName: "muted"},
@ -108,13 +107,14 @@ var embeddedElements = {
preload: {type: "enum", keywords: ["none", "metadata", "auto"], nonCanon: {"": "auto"}, defaultVal: null},
autoplay: "boolean",
loop: "boolean",
mediaGroup: "string",
controls: "boolean",
defaultMuted: {type: "boolean", domAttrName: "muted"}
},
source: {
src: "url",
type: "string",
srcset: "string",
sizes: "string",
media: "string"
},
track: {

View file

@ -1,9 +1,22 @@
// Up-to-date as of 2013-04-07.
var inputModeKeywords = [
"verbatim",
"latin",
"latin-name",
"latin-prose",
"full-width-latin",
"kana",
"kana-name",
"katakana",
"numeric",
"tel",
"email",
"url",
];
var formElements = {
form: {
acceptCharset: {type: "string", domAttrName: "accept-charset"},
// TODO: action is special
// action: "url",
// "action" has magic hard-coded in reflection.js
action: "url",
autocomplete: {type: "enum", keywords: ["on", "off"], defaultVal: "on"},
enctype: {type: "enum", keywords: ["application/x-www-form-urlencoded", "multipart/form-data", "text/plain"], defaultVal: "application/x-www-form-urlencoded"},
encoding: {type: "enum", keywords: ["application/x-www-form-urlencoded", "multipart/form-data", "text/plain"], defaultVal: "application/x-www-form-urlencoded", domAttrName: "enctype"},
@ -27,41 +40,39 @@ var formElements = {
// Conforming
accept: "string",
alt: "string",
// TODO: autocomplete is special.
// autocomplete: {type: "enum", keywords: ["on", "off"], defaultVal: "on"},
autocomplete: {type: "string", customGetter: true},
autofocus: "boolean",
defaultChecked: {type: "boolean", domAttrName: "checked"},
dirName: "string",
disabled: "boolean",
// TODO: formAction is special
// formAction: "url",
// "formAction" has magic hard-coded in reflection.js
formAction: "url",
formEnctype: {type: "enum", keywords: ["application/x-www-form-urlencoded", "multipart/form-data", "text/plain"], invalidVal: "application/x-www-form-urlencoded"},
formMethod: {type: "enum", keywords: ["get", "post"], invalidVal: "get"},
formNoValidate: "boolean",
formTarget: "string",
//TODO: only reflected on setting
//height: "unsigned long",
inputMode: {type: "enum", keywords: ["verbatim", "latin", "latin-name", "latin-prose", "full-width-latin", "kana", "katakana", "numeric", "tel", "email", "url"]},
height: {type: "unsigned long", customGetter: true},
inputMode: {type: "enum", keywords: inputModeKeywords},
max: "string",
maxLength: "limited long",
min: "string",
minLength: "limited long",
multiple: "boolean",
name: "string",
pattern: "string",
placeholder: "string",
readOnly: "boolean",
required: "boolean",
// https://html.spec.whatwg.org/multipage/#attr-input-size
// https://html.spec.whatwg.org/#attr-input-size
size: {type: "limited unsigned long", defaultVal: 20},
src: "url",
step: "string",
type: {type: "enum", keywords: ["hidden", "text", "search", "tel",
"url", "email", "password", "datetime", "date", "month", "week",
"url", "email", "password", "date", "month", "week",
"time", "datetime-local", "number", "range", "color", "checkbox",
"radio", "file", "submit", "image", "reset", "button"], defaultVal:
"text"},
//TODO: only reflected on setting
//width: "unsigned long",
width: {type: "unsigned long", customGetter: true},
defaultValue: {type: "string", domAttrName: "value"},
// Obsolete
@ -71,8 +82,8 @@ var formElements = {
button: {
autofocus: "boolean",
disabled: "boolean",
// TODO: formAction is special
// formAction: "url",
// "formAction" has magic hard-coded in reflection.js
formAction: "url",
formEnctype: {type: "enum", keywords: ["application/x-www-form-urlencoded", "multipart/form-data", "text/plain"], invalidVal: "application/x-www-form-urlencoded"},
formMethod: {type: "enum", keywords: ["get", "post", "dialog"], invalidVal: "get"},
formNoValidate: "boolean",
@ -82,6 +93,7 @@ var formElements = {
value: "string"
},
select: {
autocomplete: {type: "string", customGetter: true},
autofocus: "boolean",
disabled: "boolean",
multiple: "boolean",
@ -101,14 +113,14 @@ var formElements = {
value: {type: "string", customGetter: true},
},
textarea: {
// TODO: autocomplete is special.
// autocomplete: {type: "enum", keywords: ["on", "off"], defaultVal: "on"},
autocomplete: {type: "string", customGetter: true},
autofocus: "boolean",
cols: {type: "limited unsigned long with fallback", defaultVal: 20},
dirName: "string",
disabled: "boolean",
inputMode: {type: "enum", keywords: ["verbatim", "latin", "latin-name", "latin-prose", "full-width-latin", "kana", "katakana", "numeric", "tel", "email", "url"]},
inputMode: {type: "enum", keywords: inputModeKeywords},
maxLength: "limited long",
minLength: "limited long",
name: "string",
placeholder: "string",
readOnly: "boolean",
@ -116,19 +128,6 @@ var formElements = {
rows: {type: "limited unsigned long with fallback", defaultVal: 2},
wrap: "string",
},
keygen: {
autofocus: "boolean",
challenge: "string",
disabled: "boolean",
// The invalid value default is the "unknown" state, which for our
// purposes seems to be the same as having no invalid value default.
// The missing value default depends on whether "rsa" is implemented,
// so we use null, which is magically reserved for "don't try testing
// this", since no one default is required. (TODO: we could test that
// it's either the RSA state or the unknown state.)
keytype: {type: "enum", keywords: ["rsa"], defaultVal: null},
name: "string",
},
output: {
htmlFor: {type: "settable tokenlist", domAttrName: "for" },
name: "string",
@ -136,7 +135,14 @@ var formElements = {
progress: {
max: {type: "limited double", defaultVal: 1.0},
},
meter: {},
meter: {
value: {type: "double", customGetter: true},
min: {type: "double", customGetter: true},
max: {type: "double", customGetter: true},
low: {type: "double", customGetter: true},
high: {type: "double", customGetter: true},
optimum: {type: "double", customGetter: true},
},
};
mergeElements(formElements);

View file

@ -1,4 +1,3 @@
// Up-to-date as of 2013-04-08.
var groupingElements = {
p: {
// Obsolete
@ -22,8 +21,6 @@ var groupingElements = {
ol: {
// Conforming
reversed: "boolean",
// TODO: This should have a default value of the list's length if the
// reversed attribute is set.
start: {type: "long", defaultVal: 1},
type: "string",

View file

@ -1,9 +1,8 @@
// Up-to-date as of 2013-04-08.
var metadataElements = {
head: {},
title: {},
base: {
// XXX href is weird. href: "url",
href: {type: "url", customGetter: true},
target: "string",
},
link: {
@ -11,13 +10,13 @@ var metadataElements = {
href: "url",
crossOrigin: {type: "enum", keywords: ["anonymous", "use-credentials"], nonCanon:{"": "anonymous"}, isNullable: true, defaultVal: null, invalidVal: "anonymous"},
rel: "string",
relList: {type: "tokenlist", domAttrName: "rel"},
as: {
type: "enum",
keywords: ["fetch", "audio", "document", "embed", "font", "image", "manifest", "object", "report", "script", "serviceworker", "sharedworker", "style", "track", "video", "worker", "xslt"],
defaultVal: "",
invalidVal: ""
},
relList: {type: "tokenlist", domAttrName: "rel"},
media: "string",
nonce: "string",
integrity: "string",
@ -25,6 +24,19 @@ var metadataElements = {
type: "string",
sizes: "settable tokenlist",
referrerPolicy: {type: "enum", keywords: ["", "no-referrer", "no-referrer-when-downgrade", "same-origin", "origin", "strict-origin", "origin-when-cross-origin", "strict-origin-when-cross-origin", "unsafe-url"]},
scope: "string",
workerType: {
type: "enum",
keywords: ["classic", "module"],
defaultVal: "classic",
invalidVal: "",
},
updateViaCache: {
type: "enum",
keywords: ["imports", "all", "none"],
defaultVal: "imports",
invalidVal: "imports"
},
// Obsolete
charset: "string",
@ -42,6 +54,7 @@ var metadataElements = {
},
style: {
media: "string",
nonce: "string",
type: "string",
},
};

View file

@ -1,4 +1,3 @@
// Up-to-date as of 2013-04-09.
var miscElements = {
// "The root element" section
html: {
@ -24,6 +23,11 @@ var miscElements = {
},
noscript: {},
template: {},
slot: {
name: "string",
},
// "Edits" section
ins: {
cite: "url",

View file

@ -1,6 +1,4 @@
// Up-to-date as of 2013-04-13.
var obsoleteElements = {
// https://html.spec.whatwg.org/multipage/#the-applet-element
applet: {
align: "string",
alt: "string",
@ -14,7 +12,6 @@ var obsoleteElements = {
vspace: "unsigned long",
width: "string",
},
// https://html.spec.whatwg.org/multipage/#the-marquee-element-2
marquee: {
behavior: "string",
bgColor: "string",
@ -27,12 +24,10 @@ var obsoleteElements = {
vspace: "unsigned long",
width: "string",
},
// https://html.spec.whatwg.org/multipage/#frameset
frameset: {
cols: "string",
rows: "string",
},
// https://html.spec.whatwg.org/multipage/#frame
frame: {
name: "string",
scrolling: "string",
@ -43,11 +38,9 @@ var obsoleteElements = {
marginHeight: {type: "string", treatNullAsEmptyString: true},
marginWidth: {type: "string", treatNullAsEmptyString: true},
},
// https://html.spec.whatwg.org/multipage/#htmldirectoryelement
dir: {
compact: "boolean",
},
// https://html.spec.whatwg.org/multipage/#htmlfontelement
font: {
color: {type: "string", treatNullAsEmptyString: true},
face: "string",

View file

@ -1,4 +1,3 @@
// Up-to-date as of 2013-04-12.
var sectionElements = {
body: {
// Obsolete
@ -54,6 +53,8 @@ extraTests.push(function() {
ReflectionTests.reflects({type: "string", treatNullAsEmptyString: true}, "vlinkColor", document, "vlink", document.body);
ReflectionTests.reflects({type: "string", treatNullAsEmptyString: true}, "alinkColor", document, "alink", document.body);
ReflectionTests.reflects({type: "string", treatNullAsEmptyString: true}, "bgColor", document, "bgcolor", document.body);
// Edge remains RTL if we don't do this, despite removing the attribute
document.dir = "ltr";
// Don't mess up the colors :)
document.documentElement.removeAttribute("dir");
var attrs = ["text", "bgcolor", "link", "alink", "vlink"];

View file

@ -70,7 +70,7 @@ var tabularElements = {
// HTMLTableCellElement (Conforming)
colSpan: {type: "clamped unsigned long", defaultVal: 1, min: 1, max: 1000},
rowSpan: {type: "clamped unsigned long", defaultVal: 1, min: 0, max: 65534},
headers: "settable tokenlist",
headers: "string",
scope: {type: "enum", keywords: ["row", "col", "rowgroup", "colgroup"]},
abbr: "string",
@ -89,7 +89,7 @@ var tabularElements = {
// HTMLTableCellElement (Conforming)
colSpan: {type: "clamped unsigned long", defaultVal: 1, min: 1, max: 1000},
rowSpan: {type: "clamped unsigned long", defaultVal: 1, min: 0, max: 65534},
headers: "settable tokenlist",
headers: "string",
scope: {type: "enum", keywords: ["row", "col", "rowgroup", "colgroup"]},
abbr: "string",

View file

@ -31,6 +31,9 @@ var textElements = {
},
dfn: {},
abbr: {},
ruby: {},
rt: {},
rp: {},
data: {
value: "string",
},
@ -38,9 +41,7 @@ var textElements = {
dateTime: "string",
},
code: {},
// Opera 11.50 doesn't allow unquoted "var" here, although ES5 does and
// other browsers support it.
"var": {},
var: {},
samp: {},
kbd: {},
sub: {},
@ -49,9 +50,6 @@ var textElements = {
b: {},
u: {},
mark: {},
ruby: {},
rt: {},
rp: {},
bdi: {},
bdo: {},
span: {},

View file

@ -0,0 +1,33 @@
<!doctype html>
<title>Historical HTML APIs</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<div id=log></div>
<applet name=war align=left></applet>
<script>
test(() => {
assert_array_equals(document.applets, []);
}, "document.applets is always empty");
test(() => {
const ap = document.getElementsByTagName("applet")[0];
assert_equals(self.HTMLAppletElement, undefined);
assert_true(ap instanceof window.HTMLUnknownElement);
}, "HTMLAppletElement is no more")
test(() => {
assert_equals(document.all.war, undefined);
}, "document.all cannot find applet")
test(() => {
assert_equals(document.war, undefined);
}, "document cannot find applet")
test(() => {
assert_equals(self.war, undefined);
}, "window cannot find applet")
test(() => {
assert_equals(self.getComputedStyle(document.getElementsByTagName("applet")[0], "").cssFloat, "none");
}, "applet is not styled")
</script>

View file

@ -32,7 +32,8 @@ function createInput(type) {
function doTest([html, dom, cssom, uievents, touchevents]) {
var idlArray = new IdlArray();
idlArray.add_untested_idls(dom + cssom + uievents + touchevents);
var svg = "interface SVGElement : Element {};";
idlArray.add_untested_idls(dom + svg + cssom + uievents + touchevents);
idlArray.add_idls(html);
idlArray.add_objects({
@ -204,7 +205,6 @@ function doTest([html, dom, cssom, uievents, touchevents]) {
MessageEvent: ['new MessageEvent("message", { data: 5 })'],
MessageChannel: [],
MessagePort: [],
HTMLAppletElement: ['document.createElement("applet")'],
HTMLMarqueeElement: ['document.createElement("marquee")'],
HTMLFrameSetElement: ['document.createElement("frameset")'],
HTMLFrameElement: ['document.createElement("frame")'],

View file

@ -3,10 +3,10 @@
importScripts("/resources/testharness.js");
importScripts("/resources/WebIDLParser.js", "/resources/idlharness.js");
function doTest([untested, tested]) {
function doTest([html, dom, cssom, touchevents, uievents]) {
var idlArray = new IdlArray();
idlArray.add_untested_idls(untested);
idlArray.add_idls(tested);
idlArray.add_untested_idls(dom + cssom + touchevents + uievents);
idlArray.add_idls(html);
idlArray.add_objects({
WorkerNavigator: ['self.navigator'],
@ -25,8 +25,11 @@ function fetchData(url) {
}
promise_test(function() {
return Promise.all([fetchData("resources/untested-interfaces.idl"),
fetchData("resources/interfaces.idl")])
return Promise.all([fetchData("/interfaces/html.idl"),
fetchData("/interfaces/dom.idl"),
fetchData("/interfaces/cssom.idl"),
fetchData("/interfaces/touchevents.idl"),
fetchData("/interfaces/uievents.idl")])
.then(doTest);
}, "Test driver");

View file

@ -141,7 +141,8 @@ ReflectionHarness.assertThrows = function(exceptionName, fn) {
try {
fn();
} catch (e) {
if (e instanceof DOMException && e.code == DOMException[exceptionName]) {
if (e instanceof DOMException && (e.code == DOMException[exceptionName] ||
e.name == exceptionName)) {
this.increment(this.passed);
return true;
}

View file

@ -630,6 +630,12 @@ ReflectionTests.reflects = function(data, idlName, idlObj, domName, domObj) {
if (defaultVal === undefined) {
defaultVal = typeInfo.defaultVal;
}
if ((domObj.localName === "form" && domName === "action") ||
(["button", "input"].includes(domObj.localName) &&
domName === "formAction")) {
// Hard-coded special case
defaultVal = domObj.ownerDocument.URL;
}
if (defaultVal !== null || data.isNullable) {
ReflectionHarness.test(function() {
ReflectionHarness.assertEquals(idlObj[idlName], defaultVal);
@ -776,24 +782,43 @@ ReflectionTests.reflects = function(data, idlName, idlObj, domName, domObj) {
idlDomExpected = idlDomExpected.filter(function(element, index, array) { return idlIdlExpected[index] < 1000; });
idlIdlExpected = idlIdlExpected.filter(function(element, index, array) { return idlIdlExpected[index] < 1000; });
}
if (!data.customGetter) {
if ((domObj.localName === "form" && domName === "action") ||
(["button", "input"].includes(domObj.localName) &&
domName === "formAction")) {
// Hard-coded special case
for (var i = 0; i < domTests.length; i++) {
if (domExpected[i] === null && !data.isNullable) {
// If you follow all the complicated logic here, you'll find that
// this will only happen if there's no expected value at all (like
// for tabIndex, where the default is too complicated). So skip
// the test.
continue;
if (domTests[i] === "") {
domExpected[i] = domObj.ownerDocument.URL;
}
ReflectionHarness.test(function() {
domObj.setAttribute(domName, domTests[i]);
ReflectionHarness.assertEquals(domObj.getAttribute(domName),
String(domTests[i]), "getAttribute()");
ReflectionHarness.assertEquals(idlObj[idlName], domExpected[i],
"IDL get");
}, "setAttribute() to " + ReflectionHarness.stringRep(domTests[i]));
}
for (var i = 0; i < idlTests.length; i++) {
if (idlTests[i] === "") {
idlIdlExpected[i] = domObj.ownerDocument.URL;
}
}
}
if (data.customGetter) {
// These are reflected only on setting, not getting
domTests = [];
domExpected = [];
idlIdlExpected = idlIdlExpected.map(() => null);
}
for (var i = 0; i < domTests.length; i++) {
if (domExpected[i] === null && !data.isNullable) {
// If you follow all the complicated logic here, you'll find that
// this will only happen if there's no expected value at all (like
// for tabIndex, where the default is too complicated). So skip
// the test.
continue;
}
ReflectionHarness.test(function() {
domObj.setAttribute(domName, domTests[i]);
ReflectionHarness.assertEquals(domObj.getAttribute(domName),
String(domTests[i]), "getAttribute()");
ReflectionHarness.assertEquals(idlObj[idlName], domExpected[i],
"IDL get");
}, "setAttribute() to " + ReflectionHarness.stringRep(domTests[i]));
}
for (var i = 0; i < idlTests.length; i++) {