Update web-platform-tests to revision 7ed49cff4d031720f829c01df837ed7a09ad5c60

This commit is contained in:
Ms2ger 2016-02-24 09:25:47 +01:00
parent 33f0040496
commit 62a9bebeef
220 changed files with 8623 additions and 559 deletions

View file

@ -10,6 +10,8 @@
<script src="/resources/testharnessreport.js"></script>
<div id=log></div>
<iframe name="bar"></iframe>
<iframe name="baz"></iframe>
<iframe name="baz"></iframe>
<iframe name="constructor"></iframe>
<script>
function assert_data_propdesc(pd, Writable, Enumerable, Configurable) {
@ -31,7 +33,7 @@ test(function() {
assert_true("bar" in gsp, "bar in gsp");
assert_true(gsp.hasOwnProperty("bar"), "gsp.hasOwnProperty(\"bar\")");
assert_data_propdesc(Object.getOwnPropertyDescriptor(gsp, "bar"),
false, true, true);
true, false, true);
}, "Static name on the prototype");
test(function() {
assert_equals(window.constructor, Window);
@ -45,10 +47,15 @@ test(function() {
var gsp = Object.getPrototypeOf(proto);
assert_true("constructor" in gsp, "constructor in gsp");
assert_true(gsp.hasOwnProperty("constructor"), "gsp.hasOwnProperty(\"constructor\")");
assert_data_propdesc(Object.getOwnPropertyDescriptor(gsp, "constructor"),
false, true, true);
assert_false(gsp.hasOwnProperty("constructor"), "gsp.hasOwnProperty(\"constructor\")");
assert_equals(Object.getOwnPropertyDescriptor(gsp, "constructor"), undefined);
}, "constructor");
test(function() {
var gsp = Object.getPrototypeOf(Object.getPrototypeOf(window));
var names = Object.getOwnPropertyNames(gsp);
assert_equals(names.filter((name) => name == "baz").length, 1);
}, "duplicate property names")
var t = async_test("Dynamic name")
var t2 = async_test("Ghost name")
t.step(function() {

View file

@ -5,7 +5,7 @@ var embeddedElements = {
alt: "string",
src: "url",
srcset: "string",
crossOrigin: {type: "enum", keywords: ["", "anonymous", "use-credentials"]},
crossOrigin: {type: "enum", keywords: ["anonymous", "use-credentials"], nonCanon:{"": "anonymous"}, isNullable: true, defaultVal: null, invalidVal: "anonymous"},
useMap: "string",
isMap: "boolean",
width: {type: "unsigned long", customGetter: true},
@ -84,7 +84,7 @@ var embeddedElements = {
video: {
// HTMLMediaElement
src: "url",
crossOrigin: {type: "enum", keywords: ["anonymous", "use-credentials"], nonCanon:{"": "anonymous"}},
crossOrigin: {type: "enum", keywords: ["anonymous", "use-credentials"], nonCanon:{"": "anonymous"}, isNullable: true, defaultVal: null, invalidVal: "anonymous"},
// As with "keytype", we have no missing value default defined here.
preload: {type: "enum", keywords: ["none", "metadata", "auto"], nonCanon: {"": "auto"}, defaultVal: null},
autoplay: "boolean",
@ -100,7 +100,7 @@ var embeddedElements = {
audio: {
// HTMLMediaElement
src: "url",
crossOrigin: {type: "enum", keywords: ["anonymous", "use-credentials"], nonCanon:{"": "anonymous"}},
crossOrigin: {type: "enum", keywords: ["anonymous", "use-credentials"], nonCanon:{"": "anonymous"}, isNullable: true, defaultVal: null, invalidVal: "anonymous"},
// As with "keytype", we have no missing value default defined here.
preload: {type: "enum", keywords: ["none", "metadata", "auto"], nonCanon: {"": "auto"}, defaultVal: null},
autoplay: "boolean",

View file

@ -13,7 +13,7 @@ var miscElements = {
charset: "string",
// TODO: async attribute (complicated).
defer: "boolean",
crossOrigin: {type: "enum", keywords: ["anonymous", "use-credentials"], nonCanon:{"": "anonymous"}},
crossOrigin: {type: "enum", keywords: ["anonymous", "use-credentials"], nonCanon:{"": "anonymous"}, isNullable: true, defaultVal: null, invalidVal: "anonymous"},
},
noscript: {},

View file

@ -859,7 +859,7 @@ typedef (Int8Array or Uint8Array or Uint8ClampedArray or
[NoInterfaceObject, Exposed=Window]
interface HTMLHyperlinkElementUtils {
stringifier attribute USVString href;
attribute USVString origin;
readonly attribute USVString origin;
attribute USVString protocol;
attribute USVString username;
attribute USVString password;
@ -871,11 +871,11 @@ interface HTMLHyperlinkElementUtils {
attribute USVString hash;
};
interface HTMLAllCollection : HTMLCollection {
// inherits length and 'getter'
Element? item(unsigned long index);
interface HTMLAllCollection {
readonly attribute unsigned long length;
getter Element? item(unsigned long index);
(HTMLCollection or Element)? item(DOMString name);
legacycaller getter (HTMLCollection or Element)? namedItem(DOMString name); // shadows inherited namedItem()
legacycaller getter (HTMLCollection or Element)? namedItem(DOMString name);
};
interface HTMLFormControlsCollection : HTMLCollection {
@ -1048,7 +1048,7 @@ interface HTMLBaseElement : HTMLElement {
interface HTMLLinkElement : HTMLElement {
attribute DOMString href;
attribute DOMString crossOrigin;
attribute DOMString? crossOrigin;
attribute DOMString rel;
[PutForwards=value] readonly attribute DOMTokenList relList;
attribute DOMString media;
@ -1173,7 +1173,7 @@ interface HTMLImageElement : HTMLElement {
attribute DOMString src;
attribute DOMString srcset;
attribute DOMString sizes;
attribute DOMString crossOrigin;
attribute DOMString? crossOrigin;
attribute DOMString useMap;
attribute boolean isMap;
attribute unsigned long width;
@ -1286,7 +1286,7 @@ interface HTMLMediaElement : HTMLElement {
// network state
attribute DOMString src;
readonly attribute DOMString currentSrc;
attribute DOMString crossOrigin;
attribute DOMString? crossOrigin;
const unsigned short NETWORK_EMPTY = 0;
const unsigned short NETWORK_IDLE = 1;
const unsigned short NETWORK_LOADING = 2;
@ -1949,7 +1949,7 @@ interface HTMLScriptElement : HTMLElement {
attribute DOMString charset;
attribute boolean async;
attribute boolean defer;
attribute DOMString crossOrigin;
attribute DOMString? crossOrigin;
attribute DOMString text;
// also has obsolete members
@ -2304,7 +2304,7 @@ Window implements GlobalEventHandlers;
Window implements WindowEventHandlers;
interface BarProp {
attribute boolean visible;
readonly attribute boolean visible;
};
enum ScrollRestoration { "auto", "manual" };
@ -2322,7 +2322,7 @@ interface History {
[Unforgeable] interface Location {
stringifier attribute USVString href;
attribute USVString origin;
readonly attribute USVString origin;
attribute USVString protocol;
attribute USVString host;
attribute USVString hostname;

View file

@ -271,6 +271,7 @@ ReflectionTests.typeMap = {
* "keywords": array of keywords as given by the spec (required)
* "nonCanon": dictionary mapping non-canonical values to their
* canonical equivalents (defaults to {})
* "isNullable": Indicates if attribute is nullable (defaults to false)
*
* Tests are mostly hardcoded into reflects(), since they depend on the
* keywords. All expected values are computed in reflects() using a helper
@ -592,9 +593,14 @@ ReflectionTests.doReflects = function(data, idlName, idlObj, domName, domObj) {
var typeInfo = this.typeMap[data.type];
if (typeof data.isNullable == "undefined") {
data.isNullable = false;
}
// Test that typeof idlObj[idlName] is correct. If not, further tests are
// probably pointless, so bail out.
if (!ReflectionHarness.test(typeof idlObj[idlName], typeInfo.jsType, "typeof IDL attribute")) {
var isDefaultValueNull = data.isNullable && data.defaultVal === null;
if (!ReflectionHarness.test(typeof idlObj[idlName], isDefaultValueNull ? "object" : typeInfo.jsType, "typeof IDL attribute")) {
return;
}
@ -603,7 +609,7 @@ ReflectionTests.doReflects = function(data, idlName, idlObj, domName, domObj) {
if (defaultVal === undefined) {
defaultVal = typeInfo.defaultVal;
}
if (defaultVal !== null) {
if (defaultVal !== null || data.isNullable) {
ReflectionHarness.test(idlObj[idlName], defaultVal, "IDL get with DOM attribute unset");
}
@ -650,7 +656,14 @@ ReflectionTests.doReflects = function(data, idlName, idlObj, domName, domObj) {
// Per spec, the expected DOM values are the same as the value we set
// it to.
idlDomExpected = idlTests.slice(0);
if (!data.isNullable) {
idlDomExpected = idlTests.slice(0);
} else {
idlDomExpected = [];
for (var i = 0; i < idlTests.length; i++) {
idlDomExpected.push((idlTests[i] === null || idlTests[i] === undefined) ? null : idlTests[i]);
}
}
// Now we have the fun of calculating what the expected IDL values are.
domExpected = [];
@ -659,7 +672,11 @@ ReflectionTests.doReflects = function(data, idlName, idlObj, domName, domObj) {
domExpected.push(this.enumExpected(data.keywords, data.nonCanon, data.invalidVal, domTests[i]));
}
for (var i = 0; i < idlTests.length; i++) {
idlIdlExpected.push(this.enumExpected(data.keywords, data.nonCanon, data.invalidVal, idlTests[i]));
if (data.isNullable && (idlTests[i] === null || idlTests[i] === undefined)) {
idlIdlExpected.push(null);
} else {
idlIdlExpected.push(this.enumExpected(data.keywords, data.nonCanon, data.invalidVal, idlTests[i]));
}
}
break;
@ -687,7 +704,7 @@ ReflectionTests.doReflects = function(data, idlName, idlObj, domName, domObj) {
if (!data.customGetter) {
for (var i = 0; i < domTests.length; i++) {
if (domExpected[i] === null) {
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
@ -723,10 +740,14 @@ ReflectionTests.doReflects = function(data, idlName, idlObj, domName, domObj) {
if (data.type == "boolean") {
// Special case yay
ReflectionHarness.test(domObj.hasAttribute(domName), Boolean(idlTests[i]), "IDL set to " + ReflectionHarness.stringRep(idlTests[i]) + " followed by hasAttribute()");
} else if (idlDomExpected[i] !== null) {
ReflectionHarness.test(domObj.getAttribute(domName), idlDomExpected[i] + "", "IDL set to " + ReflectionHarness.stringRep(idlTests[i]) + " followed by getAttribute()");
} else if (idlDomExpected[i] !== null || data.isNullable) {
var expected = idlDomExpected[i] + "";
if (data.isNullable && idlDomExpected[i] === null) {
expected = null;
}
ReflectionHarness.test(domObj.getAttribute(domName), expected, "IDL set to " + ReflectionHarness.stringRep(idlTests[i]) + " followed by getAttribute()");
}
if (idlIdlExpected[i] !== null) {
if (idlIdlExpected[i] !== null || data.isNullable) {
ReflectionHarness.test(idlObj[idlName], idlIdlExpected[i], "IDL set to " + ReflectionHarness.stringRep(idlTests[i]) + " followed by IDL get");
}
if (ReflectionHarness.catchUnexpectedExceptions) {

View file

@ -0,0 +1,32 @@
<!doctype html>
<meta charset=utf-8>
<title>img update media</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
var t = async_test('set media after src updates selected image');
var img;
onload = t.step_func(function() {
img = document.querySelector('img');
img.addEventListener('load', t.step_func_done(onImgLoad));
var source = document.querySelector('source[data-media]');
source.setAttribute('media', source.getAttribute('data-media'));
});
function onImgLoad() {
img.removeEventListener('load', onImgLoad);
assert_true(img.currentSrc.indexOf(img.getAttribute('data-expect')) > -1);
}
</script>
<div id="log"></div>
<picture>
<source srcset="/images/fail.gif" data-media="(max-width: 1px)" />
<source srcset="/images/smiley.png" />
<img data-expect="/images/smiley.png">
</picture>

View file

@ -42,6 +42,10 @@
input.value = " foo\rbar ";
});
assert_equals(input.value, "");
} else if (types[j].type === "file") {
input.value = " foo\rbar ";
input.type = types[j].type; // change state
assert_equals(input.value, "");
} else {
input.value = " foo\rbar ";
input.type = types[j].type; // change state

View file

@ -0,0 +1,18 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
<html>
<head>
<title>CSS Selectors (:checked)</title>
<link rel="author" title="Ian Hickson" href="mailto:ian@hixie.ch"/>
<link rel="alternate" href="http://www.hixie.ch/tests/adhoc/css/selectors/checked/001.html"/>
<style type="text/css">
:checked, :checked + span { border: solid blue; color: blue; background: navy; }
</style>
</head>
<body>
<p>Anything that is checked below should be blue.</p>
<p><input checked type="checkbox"> <span>X</span></p>
<p><input checked type="radio" name="x"> <span>X</span> <input checked type="radio" name="x"> <span>X</span></p>
<p><select><option selected>X</option></select></p>
<p><select size="2"><option selected>X</option></select></p>
</body>
</html>

View file

@ -0,0 +1,26 @@
<!DOCTYPE HTML>
<meta charset="utf-8">
<title>:indeterminate and input type=radio</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<style type="text/css">
#test {
color: green;
}
input:indeterminate + #test {
color: red;
}
</style>
<input type="radio" name="radios">
<div id="test"></div>
<input type="radio" name="radios" checked>
<script type="text/javascript">
test(function() {
document.getElementsByTagName("input")[0].indeterminate = true;
var target = document.getElementById("test");
var val = getComputedStyle(target, null).getPropertyValue("color");
assert_equals(val, "rgb(0, 128, 0)",
"The indeterminate IDL attribute should not cause the " +
":indeterminate pseudo-class to match on input type=radio");
})
</script>