Update web-platform-tests and CSS tests.

- Update CSS tests to revision e05bfd5e30ed662c2f8a353577003f8eed230180.
- Update web-platform-tests to revision a052787dd5c069a340031011196b73affbd68cd9.
This commit is contained in:
Ms2ger 2017-02-06 11:06:12 +01:00
parent fb4f421c8b
commit 296fa2512b
21852 changed files with 2080936 additions and 892894 deletions

View file

@ -0,0 +1,35 @@
<iframe id="test"></iframe>
<script>
var opener = window.opener;
var t = opener.t;
var f = document.getElementById("test");
var l = opener.document.getElementById("step_log");
log = function(t) {l.textContent += ("\n" + t)}
var navigated = false;
var steps = [
() => f.src = "browsing_context_name-1.html",
() => {
navigated = true;
opener.assert_equals(f.contentWindow.name, "test", "Initial load");
f.src = "browsing_context_name-2.html"
},
() => {
opener.assert_equals(f.contentWindow.name, "test1");
opener.assert_equals(history.length, 2);
history.back()
},
() => {
opener.assert_equals(f.contentWindow.name, "test1", "After navigation");
t.done();
}
].map((x, i) => t.step_func(() => {log("Step " + (i+1)); x()}));
next = () => steps.shift()();
onload = () => {
log("page load");
f.onload = () => {log("iframe onload"); next()};
setTimeout(next, 0);
};
</script>

View file

@ -2,41 +2,12 @@
<title>Retaining window.name on history traversal</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<pre id="step_log"></pre>
<iframe id="test"></iframe>
<script>
var t = async_test(undefined, {timeout:10000});
var f = document.getElementById("test");
var l = document.getElementById("step_log");
var navigated = false;
log = function(t) {l.textContent += ("\n" + t)}
var steps = [
function() {f.src = "browsing_context_name-1.html"},
function() {
navigated = true;
assert_equals(f.contentWindow.name, "test", "Initial load");
setTimeout(next, 0);
},
function() {f.src = "browsing_context_name-2.html"; setTimeout(next, 500)},
function() {
assert_equals(f.contentWindow.name, "test1");
setTimeout(next, 0);
},
function() {history.back(); setTimeout(next, 500)},
function() {
assert_equals(f.contentWindow.name, "test1", "After navigation");
t.done();
}
].map(function(x) {return t.step_func(function() {log("Step " + step); x()})});
var step = 0;
next = t.step_func(function() {steps[step++]()});
f.onload=next;
onload = setTimeout(next, 0);
var t = async_test();
t.step(() => {
win = window.open("browsing_context_name-0.html");
t.add_cleanup(() => win.close());
});
</script>

View file

@ -17,7 +17,7 @@ log = function(t) {l.textContent += ("\n" + t)}
var steps = [
function() {f.src = "browsing_context_name-1.html"},
function() {
var navigated = true;
navigated = true;
assert_equals(f.contentWindow.name, "test", "Initial load");
setTimeout(next, 0);
},
@ -37,5 +37,5 @@ next = t.step_func(function() {steps[step++]()});
f.onload=next;
onload = setTimeout(next, 0);
onload = function() { setTimeout(next, 0); };
</script>

View file

@ -17,7 +17,7 @@ log = function(t) {l.textContent += ("\n" + t)}
var steps = [
function() {f.src = "browsing_context_name-1.html"},
function() {
var navigated = true;
navigated = true;
assert_equals(f.contentWindow.name, "test", "Initial load");
setTimeout(next, 0);
},
@ -43,5 +43,5 @@ next = t.step_func(function() {steps[step++]()});
f.onload=next;
onload = setTimeout(next, 0);
onload = function() { setTimeout(next, 0); };
</script>

View file

@ -16,7 +16,7 @@ log = function(t) {l.textContent += ("\n" + t)}
var steps = [
function() {f.src = "browsing_context_name-1.html"},
function() {
var navigated = true;
navigated = true;
assert_equals(f.contentWindow.name, "test", "Initial load");
setTimeout(next, 0);
},
@ -43,5 +43,5 @@ next = t.step_func(function() {steps[step++]()});
f.onload=next;
onload = setTimeout(next, 0);
onload = function() { setTimeout(next, 0); };
</script>

View file

@ -0,0 +1,7 @@
<!doctype html>
<script>
addEventListener('load', _ => {
let params = new URLSearchParams(window.location.search);
window.opener.postMessage(params.get('name'), '*');
});
</script>

View file

@ -0,0 +1,145 @@
<!doctype html>
<title>Verify history.back() on a persisted page resumes timers</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script type="text/javascript">
function make_post_back_url(name) {
return new URL('resources/post_name_on_load.html?name=' + name,
window.location).href;
}
function wait_for_message(name) {
return new Promise(resolve => {
addEventListener('message', function onMsg(evt) {
if (evt.data !== name) {
return;
}
removeEventListener('message', onMsg);
resolve();
});
});
}
function with_window_by_name(name) {
let win = window.open(make_post_back_url(name));
return wait_for_message(name).then(_ => {
return win;
});
}
function with_nested_frame(win, url) {
return new Promise(resolve => {
let frame = win.document.createElement('iframe');
frame.addEventListener('load', function onLoad(evt) {
removeEventListener('load', onLoad);
resolve(frame);
});
frame.src = url;
win.document.body.appendChild(frame);
});
}
function delay(win, delay) {
return new Promise(resolve => {
win.setTimeout(_ => {
resolve(win);
}, delay);
});
}
function navigate_by_name(win, name) {
win.location = make_post_back_url(name);
return wait_for_message(name).then(_ => {
return win;
});
}
function go_back(win) {
return new Promise(resolve => {
win.onpagehide = e => resolve(win);
win.history.back();
});
}
let DELAY = 500;
promise_test(t => {
// Create a new window so we can navigate it later.
return with_window_by_name('foo').then(win => {
// Schedule a timer within the new window. Our intent is
// to navigate the window before the timer fires.
let delayFired = false;
let innerDelay = delay(win, DELAY);
innerDelay.then(_ => {
delayFired = true;
});
return navigate_by_name(win, 'bar').then(_ => {
// Since the window has navigated the timer should not
// fire. We set a timer on our current test window
// to verify the other timer is not received.
assert_false(delayFired);
return delay(window, DELAY * 2);
}).then(_ => {
// The navigated window's timer should not have fired.
assert_false(delayFired);
// Now go back to the document that set the timer.
return go_back(win);
}).then(_ => {
// We wait for one of two conditions here. For browsers
// with a bfcache the original suspended timer will fire.
// Alternatively, if the browser reloads the page the original
// message will be sent again. Wait for either of these
// two events.
return Promise.race([wait_for_message('foo'), innerDelay]);
}).then(_ => {
win.close();
});
});
}, 'history.back() handles top level page timer correctly');
promise_test(t => {
let win;
// Create a new window so we can navigate it later.
return with_window_by_name('foo').then(w => {
win = w;
// Create a nested frame so we check if navigation and history.back()
// properly handle child window state.
return with_nested_frame(win, 'about:blank');
}).then(frame => {
// Schedule a timer within the nested frame contained by the new window.
// Our intent is to navigate the window before the timer fires.
let delayFired = false;
let innerDelay = delay(frame.contentWindow, DELAY);
innerDelay.then(_ => {
delayFired = true;
});
return navigate_by_name(win, 'bar').then(_ => {
// Since the window has navigated the timer should not
// fire. We set a timer on our current test window
// to verify the other timer is not received.
assert_false(delayFired);
return delay(window, DELAY * 2);
}).then(_ => {
// The navigated window's timer should not have fired.
assert_false(delayFired);
// Now go back to the document containing the frame that set the timer.
return go_back(win);
}).then(_ => {
// We wait for one of two conditions here. For browsers
// with a bfcache the original suspended timer will fire.
// Alternatively, if the browser reloads the page the original
// message will be sent again. Wait for either of these
// two events.
return Promise.race([wait_for_message('foo'), innerDelay]);
}).then(_ => {
win.close();
});
});
}, 'history.back() handles nested iframe timer correctly');
</script>

View file

@ -0,0 +1,16 @@
<!doctype html>
<title>Set location.pathname to ?</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<div id=log></div>
<iframe src=/common/blank.html></iframe>
<script>
async_test((t) => {
onload = t.step_func(() => {
self[0].frameElement.onload = t.step_func_done(() => {
assert_equals(self[0].location.pathname, "/%3F")
})
self[0].location.pathname = "?"
})
})
</script>

View file

@ -0,0 +1,34 @@
<!doctype html>
<title>Set location.protocol from an HTTP URL</title>
<!-- In particular, valid non-broken schemes that are nevertheless not going to work -->
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<div id=log></div>
<iframe src=/common/blank.html></iframe>
<iframe src=/common/blank.html></iframe>
<iframe src=/common/blank.html></iframe>
<iframe src=/common/blank.html></iframe>
<iframe src=/common/blank.html></iframe>
<iframe src=/common/blank.html></iframe>
<script>
self.onload = () => {
[
'x',
'data',
'file',
'ftp',
'gopher',
'http+x'
].forEach((val, index) => {
async_test((t) => {
self[index].location.protocol = val
t.step_timeout(() => {
assert_equals(self[index].location.protocol, location.protocol)
assert_equals(self[index].location.host, location.host)
assert_equals(self[index].location.port, location.port)
t.done()
}, 500)
}, "Set location.protocol to " + val)
})
}
</script>

View file

@ -0,0 +1,60 @@
<!doctype html>
<title>Set location.protocol to a non-broken-non-functioning scheme</title>
<!-- In particular, valid non-broken schemes that are nevertheless not going to work -->
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<div id=log></div>
<script>
self.onload = () => {
[
'x',
'data',
// 'mailto' opens an email client in Firefox...
'file',
'ftp',
'gopher',
'http+x'
].forEach((val) => {
async_test((t) => {
// HTTP URL <iframe>
const frame = document.createElement("iframe")
frame.src = "/common/blank.html"
frame.onload = t.step_func(() => {
frame.contentWindow.location.protocol = val
t.step_timeout(() => {
assert_equals(frame.contentWindow.location.protocol, location.protocol)
assert_equals(frame.contentWindow.location.host, location.host)
assert_equals(frame.contentWindow.location.port, location.port)
t.done()
}, 500)
})
document.body.appendChild(frame)
}, "Set HTTP URL frame location.protocol to " + val)
async_test((t) => {
// data URL <iframe>
const dataFrame = document.createElement("iframe")
const channel = new MessageChannel()
dataFrame.src = `data:text/html,<script>
onmessage = (e) => {
let result = false;
try {
location.protocol = e.data
} catch(e) {
result = true
}
setTimeout(() => e.ports[0].postMessage([result, location.protocol]), 100)
}
<\/script>`
dataFrame.onload = t.step_func(() => {
dataFrame.contentWindow.postMessage(val, "*", [channel.port2])
})
channel.port1.onmessage = t.step_func_done((e) => {
assert_false(e.data[0])
assert_equals(e.data[1], "data:")
})
document.body.appendChild(dataFrame)
}, "Set data URL frame location.protocol to " + val)
})
}
</script>

View file

@ -0,0 +1,106 @@
<!doctype html>
<title>Set location.protocol to broken schemes</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<div id=log></div>
<iframe src="data:text/html,<script>
onmessage = (e) => {
let results = [];
e.data.forEach((val) => {
try {
location.protocol = val;
results.push('failure')
} catch(e) {
results.push(e.name)
}
});
parent.postMessage(results, '*')
}
</script>"></iframe>
<iframe srcdoc="<script>
onmessage = (e) => {
let results = [];
e.data.forEach((val) => {
try {
location.protocol = val;
results.push('failure')
} catch(e) {
results.push(e.name)
}
});
parent.postMessage(results, '*')
}
</script>"></iframe>
<script>
let broken = [
'\x00',
'\x01',
'\x0A',
'\x20',
'\x21',
'\x7F',
'\x80',
'\xFF',
':',
'†',
'\x00x',
'\x01x',
'\x0Ax',
'\x20x',
'\x21x',
'\x7Fx',
'\x80x',
'\xFFx',
':x',
'†x',
'\x00X',
'\x01X',
'\x0AX',
'\x20X',
'\x21X',
'\x7FX',
'\x80X',
'\xFFX',
':X',
'†X',
'x\x00',
'x\x01',
'x\x0A',
'x\x20',
'x\x21',
'x\x7F',
'x\x80',
'x\xFF',
'x†',
'X\x00',
'X\x01',
'X\x0A',
'X\x20',
'X\x21',
'X\x7F',
'X\x80',
'X\xFF',
'X†',
'a\x0A',
'a+-.\x0A'
]
;broken.forEach((val) => {
test(() => {
assert_throws("SyntaxError", () => { location.protocol = val })
}, encodeURI(val) + " (percent-encoded) is not a scheme")
})
let c = 0
async_test((t) => {
self.onload = t.step_func(() => {
self.onmessage = t.step_func((e) => {
assert_array_equals(e.data, ("SyntaxError ".repeat(49) + "SyntaxError").split(" "))
c++
if(c === 2) {
t.done()
}
})
self[0].postMessage(broken, "*")
self[1].postMessage(broken, "*")
})
}, "Equivalent tests for data URL and srcdoc <iframe>s")
</script>

View file

@ -1,329 +0,0 @@
<!-- Once most browsers pass this test it can replace cross-origin-objects.html. It is meant to be
identical (please verify), except for also checking that the exceptions are correct. -->
<!doctype html>
<meta charset=utf-8>
<meta name="timeout" content="long">
<title>Cross-origin behavior of Window and Location</title>
<link rel="author" title="Bobby Holley (:bholley)" href="bobbyholley@gmail.com">
<link rel="help" href="https://html.spec.whatwg.org/multipage/#security-window">
<link rel="help" href="https://html.spec.whatwg.org/multipage/#security-location">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/get-host-info.sub.js"></script>
<div id=log></div>
<iframe id="B"></iframe>
<iframe id="C"></iframe>
<script>
/*
* Setup boilerplate. This gives us a same-origin window "B" and a cross-origin
* window "C".
*/
var host_info = get_host_info();
setup({explicit_done: true});
path = location.pathname.substring(0, location.pathname.lastIndexOf('/')) + '/frame.html';
var B = document.getElementById('B').contentWindow;
var C = document.getElementById('C').contentWindow;
B.frameElement.uriToLoad = path;
C.frameElement.uriToLoad = get_host_info().HTTP_REMOTE_ORIGIN + path;
function reloadSubframes(cb) {
var iframes = document.getElementsByTagName('iframe');
iframes.forEach = Array.prototype.forEach;
var count = 0;
function frameLoaded() {
this.onload = null;
if (++count == iframes.length)
cb();
}
iframes.forEach(function(ifr) { ifr.onload = frameLoaded; ifr.setAttribute('src', ifr.uriToLoad); });
}
function isObject(x) { return Object(x) === x; }
/*
* Note: we eschew assert_equals in a lot of these tests, since the harness ends
* up throwing when it tries to format a message involving a cross-origin object.
*/
var testList = [];
function addTest(fun, desc) { testList.push([fun, desc]); }
/*
* Basic sanity testing.
*/
addTest(function() {
// Note: we do not check location.host as its default port semantics are hard to reflect statically
assert_equals(location.hostname, host_info.ORIGINAL_HOST, 'Need to run the top-level test from domain ' + host_info.ORIGINAL_HOST);
assert_equals(get_port(location), host_info.HTTP_PORT, 'Need to run the top-level test from port ' + host_info.HTTP_PORT);
assert_equals(B.parent, window, "window.parent works same-origin");
assert_equals(C.parent, window, "window.parent works cross-origin");
assert_equals(B.location.pathname, path, "location.href works same-origin");
assert_throws("SecurityError", function() { C.location.pathname; }, "location.pathname throws cross-origin");
assert_equals(B.frames, 'override', "Overrides visible in the same-origin case");
assert_equals(C.frames, C, "Overrides invisible in the cross-origin case");
}, "Basic sanity-checking");
/*
* Whitelist behavior.
*
* Also tests for [[GetOwnProperty]] and [[HasOwnProperty]] behavior.
*/
var whitelistedWindowProps = ['location', 'postMessage', 'window', 'frames', 'self', 'top', 'parent',
'opener', 'closed', 'close', 'blur', 'focus', 'length'];
addTest(function() {
for (var prop in window) {
if (whitelistedWindowProps.indexOf(prop) != -1) {
C[prop]; // Shouldn't throw.
Object.getOwnPropertyDescriptor(C, prop); // Shouldn't throw.
assert_true(Object.prototype.hasOwnProperty.call(C, prop), "hasOwnProperty for " + prop);
} else {
assert_throws("SecurityError", function() { C[prop]; }, "Should throw when accessing " + prop + " on Window");
assert_throws("SecurityError", function() { Object.getOwnPropertyDescriptor(C, prop); },
"Should throw when accessing property descriptor for " + prop + " on Window");
assert_throws("SecurityError", function() { Object.prototype.hasOwnProperty.call(C, prop); },
"Should throw when invoking hasOwnProperty for " + prop + " on Window");
}
if (prop != 'location')
assert_throws("SecurityError", function() { C[prop] = undefined; }, "Should throw when writing to " + prop + " on Window");
}
for (var prop in location) {
if (prop == 'replace') {
C.location[prop]; // Shouldn't throw.
Object.getOwnPropertyDescriptor(C.location, prop); // Shouldn't throw.
assert_true(Object.prototype.hasOwnProperty.call(C.location, prop), "hasOwnProperty for " + prop);
}
else {
assert_throws("SecurityError", function() { C[prop]; }, "Should throw when accessing " + prop + " on Location");
assert_throws("SecurityError", function() { Object.getOwnPropertyDescriptor(C, prop); },
"Should throw when accessing property descriptor for " + prop + " on Location");
assert_throws("SecurityError", function() { Object.prototype.hasOwnProperty.call(C, prop); },
"Should throw when invoking hasOwnProperty for " + prop + " on Location");
}
if (prop != 'href')
assert_throws("SecurityError", function() { C[prop] = undefined; }, "Should throw when writing to " + prop + " on Location");
}
}, "Only whitelisted properties are accessible cross-origin");
/*
* ES Internal Methods.
*/
/*
* [[GetPrototypeOf]]
*/
addTest(function() {
assert_true(Object.getPrototypeOf(C) === null, "cross-origin Window proto is null");
assert_true(Object.getPrototypeOf(C.location) === null, "cross-origin Location proto is null (__proto__)");
var protoGetter = Object.getOwnPropertyDescriptor(Object.prototype, '__proto__').get;
assert_true(protoGetter.call(C) === null, "cross-origin Window proto is null");
assert_true(protoGetter.call(C.location) === null, "cross-origin Location proto is null (__proto__)");
assert_throws("SecurityError", function() { C.__proto__; }, "__proto__ property not available cross-origin");
assert_throws("SecurityError", function() { C.location.__proto__; }, "__proto__ property not available cross-origin");
}, "[[GetPrototypeOf]] should return null");
/*
* [[SetPrototypeOf]]
*/
addTest(function() {
assert_throws("SecurityError", function() { C.__proto__ = new Object(); }, "proto set on cross-origin Window");
assert_throws("SecurityError", function() { C.location.__proto__ = new Object(); }, "proto set on cross-origin Location");
var setters = [Object.getOwnPropertyDescriptor(Object.prototype, '__proto__').set];
if (Object.setPrototypeOf)
setters.push(function(p) { Object.setPrototypeOf(this, p); });
setters.forEach(function(protoSetter) {
assert_throws(new TypeError, function() { protoSetter.call(C, new Object()); }, "proto setter |call| on cross-origin Window");
assert_throws(new TypeError, function() { protoSetter.call(C.location, new Object()); }, "proto setter |call| on cross-origin Location");
});
}, "[[SetPrototypeOf]] should throw");
/*
* [[IsExtensible]]
*/
addTest(function() {
assert_true(Object.isExtensible(C), "cross-origin Window should be extensible");
assert_true(Object.isExtensible(C.location), "cross-origin Location should be extensible");
}, "[[IsExtensible]] should return true for cross-origin objects");
/*
* [[PreventExtensions]]
*/
addTest(function() {
assert_throws(new TypeError, function() { Object.preventExtensions(C) },
"preventExtensions on cross-origin Window should throw");
assert_throws(new TypeError, function() { Object.preventExtensions(C.location) },
"preventExtensions on cross-origin Location should throw");
}, "[[PreventExtensions]] should throw for cross-origin objects");
/*
* [[GetOwnProperty]]
*/
addTest(function() {
assert_true(isObject(Object.getOwnPropertyDescriptor(C, 'close')), "C.close is |own|");
assert_true(isObject(Object.getOwnPropertyDescriptor(C, 'top')), "C.top is |own|");
assert_true(isObject(Object.getOwnPropertyDescriptor(C.location, 'href')), "C.location.href is |own|");
assert_true(isObject(Object.getOwnPropertyDescriptor(C.location, 'replace')), "C.location.replace is |own|");
}, "[[GetOwnProperty]] - Properties on cross-origin objects should be reported |own|");
function checkPropertyDescriptor(desc, propName, expectWritable) {
assert_true(isObject(desc), "property descriptor for " + propName + " should exist");
assert_equals(desc.enumerable, false, "property descriptor for " + propName + " should be non-enumerable");
assert_equals(desc.configurable, true, "property descriptor for " + propName + " should be configurable");
if ('value' in desc)
assert_equals(desc.writable, expectWritable, "property descriptor for " + propName + " should have writable: " + expectWritable);
else
assert_equals(typeof desc.set != 'undefined', expectWritable,
"property descriptor for " + propName + " should " + (expectWritable ? "" : "not ") + "have setter");
}
addTest(function() {
whitelistedWindowProps.forEach(function(prop) {
var desc = Object.getOwnPropertyDescriptor(C, prop);
checkPropertyDescriptor(desc, prop, prop == 'location');
});
checkPropertyDescriptor(Object.getOwnPropertyDescriptor(C.location, 'replace'), 'replace', false);
checkPropertyDescriptor(Object.getOwnPropertyDescriptor(C.location, 'href'), 'href', true);
assert_equals(typeof Object.getOwnPropertyDescriptor(C.location, 'href').get, 'undefined', "Cross-origin location should have no href getter");
}, "[[GetOwnProperty]] - Property descriptors for cross-origin properties should be set up correctly");
/*
* [[Delete]]
*/
addTest(function() {
assert_throws("SecurityError", function() { delete C[0]; }, "Can't delete cross-origin indexed property");
assert_throws("SecurityError", function() { delete C[100]; }, "Can't delete cross-origin indexed property");
assert_throws("SecurityError", function() { delete C.location; }, "Can't delete cross-origin property");
assert_throws("SecurityError", function() { delete C.parent; }, "Can't delete cross-origin property");
assert_throws("SecurityError", function() { delete C.length; }, "Can't delete cross-origin property");
assert_throws("SecurityError", function() { delete C.document; }, "Can't delete cross-origin property");
assert_throws("SecurityError", function() { delete C.foopy; }, "Can't delete cross-origin property");
assert_throws("SecurityError", function() { delete C.location.href; }, "Can't delete cross-origin property");
assert_throws("SecurityError", function() { delete C.location.replace; }, "Can't delete cross-origin property");
assert_throws("SecurityError", function() { delete C.location.port; }, "Can't delete cross-origin property");
assert_throws("SecurityError", function() { delete C.location.foopy; }, "Can't delete cross-origin property");
}, "[[Delete]] Should throw on cross-origin objects");
/*
* [[DefineOwnProperty]]
*/
function checkDefine(obj, prop) {
var valueDesc = { configurable: true, enumerable: false, writable: false, value: 2 };
var accessorDesc = { configurable: true, enumerable: false, get: function() {} };
assert_throws("SecurityError", function() { Object.defineProperty(obj, prop, valueDesc); }, "Can't define cross-origin value property " + prop);
assert_throws("SecurityError", function() { Object.defineProperty(obj, prop, accessorDesc); }, "Can't define cross-origin accessor property " + prop);
}
addTest(function() {
checkDefine(C, 'length');
checkDefine(C, 'parent');
checkDefine(C, 'location');
checkDefine(C, 'document');
checkDefine(C, 'foopy');
checkDefine(C.location, 'href');
checkDefine(C.location, 'replace');
checkDefine(C.location, 'port');
checkDefine(C.location, 'foopy');
}, "[[DefineOwnProperty]] Should throw for cross-origin objects");
/*
* [[Enumerate]]
*/
addTest(function() {
for (var prop in C)
assert_unreached("Shouldn't have been able to enumerate " + prop + " on cross-origin Window");
for (var prop in C.location)
assert_unreached("Shouldn't have been able to enumerate " + prop + " on cross-origin Location");
}, "[[Enumerate]] should return an empty iterator");
/*
* [[OwnPropertyKeys]]
*/
addTest(function() {
assert_array_equals(whitelistedWindowProps.sort(), Object.getOwnPropertyNames(C).sort(),
"Object.getOwnPropertyNames() gives the right answer for cross-origin Window");
assert_array_equals(Object.getOwnPropertyNames(C.location).sort(), ['href', 'replace'],
"Object.getOwnPropertyNames() gives the right answer for cross-origin Location");
}, "[[OwnPropertyKeys]] should return all properties from cross-origin objects");
addTest(function() {
assert_true(B.eval('parent.C') === C, "A and B observe the same identity for C's Window");
assert_true(B.eval('parent.C.location') === C.location, "A and B observe the same identity for C's Location");
}, "A and B jointly observe the same identity for cross-origin Window and Location");
function checkFunction(f, proto) {
var name = f.name || '<missing name>';
assert_equals(typeof f, 'function', name + " is a function");
assert_equals(Object.getPrototypeOf(f), proto, f.name + " has the right prototype");
}
addTest(function() {
checkFunction(C.close, Function.prototype);
checkFunction(C.location.replace, Function.prototype);
}, "Cross-origin functions get local Function.prototype");
addTest(function() {
assert_true(isObject(Object.getOwnPropertyDescriptor(C, 'parent')),
"Need to be able to use Object.getOwnPropertyDescriptor do this test");
checkFunction(Object.getOwnPropertyDescriptor(C, 'parent').get, Function.prototype);
checkFunction(Object.getOwnPropertyDescriptor(C.location, 'href').set, Function.prototype);
}, "Cross-origin Window accessors get local Function.prototype");
addTest(function() {
checkFunction(close, Function.prototype);
assert_true(close != B.close, 'same-origin Window functions get their own object');
assert_true(close != C.close, 'cross-origin Window functions get their own object');
var close_B = B.eval('parent.C.close');
assert_true(close != close_B, 'close_B is unique when viewed by the parent');
assert_true(close_B != C.close, 'different Window functions per-incumbent script settings object');
checkFunction(close_B, B.Function.prototype);
checkFunction(location.replace, Function.prototype);
assert_true(location.replace != C.location.replace, "cross-origin Location functions get their own object");
var replace_B = B.eval('parent.C.location.replace');
assert_true(replace_B != C.location.replace, 'different Location functions per-incumbent script settings object');
checkFunction(replace_B, B.Function.prototype);
}, "Same-origin observers get different functions for cross-origin objects");
addTest(function() {
assert_true(isObject(Object.getOwnPropertyDescriptor(C, 'parent')),
"Need to be able to use Object.getOwnPropertyDescriptor do this test");
var get_self_parent = Object.getOwnPropertyDescriptor(window, 'parent').get;
var get_parent_A = Object.getOwnPropertyDescriptor(C, 'parent').get;
var get_parent_B = B.eval('Object.getOwnPropertyDescriptor(parent.C, "parent").get');
assert_true(get_self_parent != get_parent_A, 'different Window accessors per-incumbent script settings object');
assert_true(get_parent_A != get_parent_B, 'different Window accessors per-incumbent script settings object');
checkFunction(get_self_parent, Function.prototype);
checkFunction(get_parent_A, Function.prototype);
checkFunction(get_parent_B, B.Function.prototype);
}, "Same-origin observers get different accessors for cross-origin Window");
addTest(function() {
var set_self_href = Object.getOwnPropertyDescriptor(window.location, 'href').set;
var set_href_A = Object.getOwnPropertyDescriptor(C.location, 'href').set;
var set_href_B = B.eval('Object.getOwnPropertyDescriptor(parent.C.location, "href").set');
assert_true(set_self_href != set_href_A, 'different Location accessors per-incumbent script settings object');
assert_true(set_href_A != set_href_B, 'different Location accessors per-incumbent script settings object');
checkFunction(set_self_href, Function.prototype);
checkFunction(set_href_A, Function.prototype);
checkFunction(set_href_B, B.Function.prototype);
}, "Same-origin observers get different accessors for cross-origin Location");
// We do a fresh load of the subframes for each test to minimize side-effects.
// It would be nice to reload ourselves as well, but we can't do that without
// disrupting the test harness.
function runNextTest() {
var entry = testList.shift();
test(entry[0], entry[1]);
if (testList.length != 0)
reloadSubframes(runNextTest);
else
done();
}
reloadSubframes(runNextTest);
</script>

View file

@ -52,14 +52,14 @@ function addTest(fun, desc) { testList.push([fun, desc]); }
* Basic sanity testing.
*/
addTest(function() {
addTest(function(exception_t) {
// Note: we do not check location.host as its default port semantics are hard to reflect statically
assert_equals(location.hostname, host_info.ORIGINAL_HOST, 'Need to run the top-level test from domain ' + host_info.ORIGINAL_HOST);
assert_equals(get_port(location), host_info.HTTP_PORT, 'Need to run the top-level test from port ' + host_info.HTTP_PORT);
assert_equals(B.parent, window, "window.parent works same-origin");
assert_equals(C.parent, window, "window.parent works cross-origin");
assert_equals(B.location.pathname, path, "location.href works same-origin");
assert_throws(null, function() { C.location.pathname; }, "location.pathname throws cross-origin");
test_throws(exception_t, "SecurityError", function() { C.location.pathname; }, "location.pathname throws cross-origin");
assert_equals(B.frames, 'override', "Overrides visible in the same-origin case");
assert_equals(C.frames, C, "Overrides invisible in the cross-origin case");
}, "Basic sanity-checking");
@ -70,23 +70,32 @@ addTest(function() {
* Also tests for [[GetOwnProperty]] and [[HasOwnProperty]] behavior.
*/
var whitelistedWindowProps = ['location', 'postMessage', 'window', 'frames', 'self', 'top', 'parent',
'opener', 'closed', 'close', 'blur', 'focus', 'length'];
addTest(function() {
var whitelistedWindowIndices = ['0', '1'];
var whitelistedWindowPropNames = ['location', 'postMessage', 'window', 'frames', 'self', 'top', 'parent',
'opener', 'closed', 'close', 'blur', 'focus', 'length'];
whitelistedWindowPropNames = whitelistedWindowPropNames.concat(whitelistedWindowIndices);
whitelistedWindowPropNames.sort();
var whitelistedLocationPropNames = ['href', 'replace'];
whitelistedLocationPropNames.sort();
var whitelistedSymbols = [Symbol.toStringTag, Symbol.hasInstance,
Symbol.isConcatSpreadable];
var whitelistedWindowProps = whitelistedWindowPropNames.concat(whitelistedSymbols);
addTest(function(exception_t) {
for (var prop in window) {
if (whitelistedWindowProps.indexOf(prop) != -1) {
C[prop]; // Shouldn't throw.
Object.getOwnPropertyDescriptor(C, prop); // Shouldn't throw.
assert_true(Object.prototype.hasOwnProperty.call(C, prop), "hasOwnProperty for " + prop);
assert_true(Object.prototype.hasOwnProperty.call(C, prop), "hasOwnProperty for " + String(prop));
} else {
assert_throws(null, function() { C[prop]; }, "Should throw when accessing " + prop + " on Window");
assert_throws(null, function() { Object.getOwnPropertyDescriptor(C, prop); },
test_throws(exception_t, "SecurityError", function() { C[prop]; }, "Should throw when accessing " + String(prop) + " on Window");
test_throws(exception_t, "SecurityError", function() { Object.getOwnPropertyDescriptor(C, prop); },
"Should throw when accessing property descriptor for " + prop + " on Window");
assert_throws(null, function() { Object.prototype.hasOwnProperty.call(C, prop); },
test_throws(exception_t, "SecurityError", function() { Object.prototype.hasOwnProperty.call(C, prop); },
"Should throw when invoking hasOwnProperty for " + prop + " on Window");
}
if (prop != 'location')
assert_throws(null, function() { C[prop] = undefined; }, "Should throw when writing to " + prop + " on Window");
test_throws(exception_t, "SecurityError", function() { C[prop] = undefined; }, "Should throw when writing to " + prop + " on Window");
}
for (var prop in location) {
if (prop == 'replace') {
@ -95,14 +104,14 @@ addTest(function() {
assert_true(Object.prototype.hasOwnProperty.call(C.location, prop), "hasOwnProperty for " + prop);
}
else {
assert_throws(null, function() { C[prop]; }, "Should throw when accessing " + prop + " on Location");
assert_throws(null, function() { Object.getOwnPropertyDescriptor(C, prop); },
test_throws(exception_t, "SecurityError", function() { C[prop]; }, "Should throw when accessing " + prop + " on Location");
test_throws(exception_t, "SecurityError", function() { Object.getOwnPropertyDescriptor(C, prop); },
"Should throw when accessing property descriptor for " + prop + " on Location");
assert_throws(null, function() { Object.prototype.hasOwnProperty.call(C, prop); },
test_throws(exception_t, "SecurityError", function() { Object.prototype.hasOwnProperty.call(C, prop); },
"Should throw when invoking hasOwnProperty for " + prop + " on Location");
}
if (prop != 'href')
assert_throws(null, function() { C[prop] = undefined; }, "Should throw when writing to " + prop + " on Location");
test_throws(exception_t, "SecurityError", function() { C[prop] = undefined; }, "Should throw when writing to " + prop + " on Location");
}
}, "Only whitelisted properties are accessible cross-origin");
@ -113,36 +122,36 @@ addTest(function() {
/*
* [[GetPrototypeOf]]
*/
addTest(function() {
addTest(function(exception_t) {
assert_true(Object.getPrototypeOf(C) === null, "cross-origin Window proto is null");
assert_true(Object.getPrototypeOf(C.location) === null, "cross-origin Location proto is null (__proto__)");
var protoGetter = Object.getOwnPropertyDescriptor(Object.prototype, '__proto__').get;
assert_true(protoGetter.call(C) === null, "cross-origin Window proto is null");
assert_true(protoGetter.call(C.location) === null, "cross-origin Location proto is null (__proto__)");
assert_throws(null, function() { C.__proto__; }, "__proto__ property not available cross-origin");
assert_throws(null, function() { C.location.__proto__; }, "__proto__ property not available cross-origin");
test_throws(exception_t, "SecurityError", function() { C.__proto__; }, "__proto__ property not available cross-origin");
test_throws(exception_t, "SecurityError", function() { C.location.__proto__; }, "__proto__ property not available cross-origin");
}, "[[GetPrototypeOf]] should return null");
/*
* [[SetPrototypeOf]]
*/
addTest(function() {
assert_throws(null, function() { C.__proto__ = new Object(); }, "proto set on cross-origin Window");
assert_throws(null, function() { C.location.__proto__ = new Object(); }, "proto set on cross-origin Location");
addTest(function(exception_t) {
test_throws(exception_t, "SecurityError", function() { C.__proto__ = new Object(); }, "proto set on cross-origin Window");
test_throws(exception_t, "SecurityError", function() { C.location.__proto__ = new Object(); }, "proto set on cross-origin Location");
var setters = [Object.getOwnPropertyDescriptor(Object.prototype, '__proto__').set];
if (Object.setPrototypeOf)
setters.push(function(p) { Object.setPrototypeOf(this, p); });
setters.forEach(function(protoSetter) {
assert_throws(null, function() { protoSetter.call(C, new Object()); }, "proto setter |call| on cross-origin Window");
assert_throws(null, function() { protoSetter.call(C.location, new Object()); }, "proto setter |call| on cross-origin Location");
test_throws(exception_t, new TypeError, function() { protoSetter.call(C, new Object()); }, "proto setter |call| on cross-origin Window");
test_throws(exception_t, new TypeError, function() { protoSetter.call(C.location, new Object()); }, "proto setter |call| on cross-origin Location");
});
}, "[[SetPrototypeOf]] should throw");
/*
* [[IsExtensible]]
*/
addTest(function() {
addTest(function(exception_t) {
assert_true(Object.isExtensible(C), "cross-origin Window should be extensible");
assert_true(Object.isExtensible(C.location), "cross-origin Location should be extensible");
}, "[[IsExtensible]] should return true for cross-origin objects");
@ -150,10 +159,10 @@ addTest(function() {
/*
* [[PreventExtensions]]
*/
addTest(function() {
assert_throws(null, function() { Object.preventExtensions(C) },
addTest(function(exception_t) {
test_throws(exception_t, new TypeError, function() { Object.preventExtensions(C) },
"preventExtensions on cross-origin Window should throw");
assert_throws(null, function() { Object.preventExtensions(C.location) },
test_throws(exception_t, new TypeError, function() { Object.preventExtensions(C.location) },
"preventExtensions on cross-origin Location should throw");
}, "[[PreventExtensions]] should throw for cross-origin objects");
@ -161,7 +170,7 @@ addTest(function() {
* [[GetOwnProperty]]
*/
addTest(function() {
addTest(function(exception_t) {
assert_true(isObject(Object.getOwnPropertyDescriptor(C, 'close')), "C.close is |own|");
assert_true(isObject(Object.getOwnPropertyDescriptor(C, 'top')), "C.top is |own|");
assert_true(isObject(Object.getOwnPropertyDescriptor(C.location, 'href')), "C.location.href is |own|");
@ -169,9 +178,18 @@ addTest(function() {
}, "[[GetOwnProperty]] - Properties on cross-origin objects should be reported |own|");
function checkPropertyDescriptor(desc, propName, expectWritable) {
var isSymbol = (typeof(propName) == "symbol");
propName = String(propName);
assert_true(isObject(desc), "property descriptor for " + propName + " should exist");
assert_equals(desc.enumerable, false, "property descriptor for " + propName + " should be non-enumerable");
assert_equals(desc.configurable, true, "property descriptor for " + propName + " should be configurable");
if (isSymbol) {
assert_true("value" in desc,
"property descriptor for " + propName + " should be a value descriptor");
assert_equals(desc.value, undefined,
"symbol-named cross-origin visible prop " + propName +
" should come back as undefined");
}
if ('value' in desc)
assert_equals(desc.writable, expectWritable, "property descriptor for " + propName + " should have writable: " + expectWritable);
else
@ -179,7 +197,7 @@ function checkPropertyDescriptor(desc, propName, expectWritable) {
"property descriptor for " + propName + " should " + (expectWritable ? "" : "not ") + "have setter");
}
addTest(function() {
addTest(function(exception_t) {
whitelistedWindowProps.forEach(function(prop) {
var desc = Object.getOwnPropertyDescriptor(C, prop);
checkPropertyDescriptor(desc, prop, prop == 'location');
@ -187,51 +205,55 @@ addTest(function() {
checkPropertyDescriptor(Object.getOwnPropertyDescriptor(C.location, 'replace'), 'replace', false);
checkPropertyDescriptor(Object.getOwnPropertyDescriptor(C.location, 'href'), 'href', true);
assert_equals(typeof Object.getOwnPropertyDescriptor(C.location, 'href').get, 'undefined', "Cross-origin location should have no href getter");
whitelistedSymbols.forEach(function(prop) {
var desc = Object.getOwnPropertyDescriptor(C.location, prop);
checkPropertyDescriptor(desc, prop, false);
});
}, "[[GetOwnProperty]] - Property descriptors for cross-origin properties should be set up correctly");
/*
* [[Delete]]
*/
addTest(function() {
assert_throws(null, function() { delete C[0]; }, "Can't delete cross-origin indexed property");
assert_throws(null, function() { delete C[100]; }, "Can't delete cross-origin indexed property");
assert_throws(null, function() { delete C.location; }, "Can't delete cross-origin property");
assert_throws(null, function() { delete C.parent; }, "Can't delete cross-origin property");
assert_throws(null, function() { delete C.length; }, "Can't delete cross-origin property");
assert_throws(null, function() { delete C.document; }, "Can't delete cross-origin property");
assert_throws(null, function() { delete C.foopy; }, "Can't delete cross-origin property");
assert_throws(null, function() { delete C.location.href; }, "Can't delete cross-origin property");
assert_throws(null, function() { delete C.location.replace; }, "Can't delete cross-origin property");
assert_throws(null, function() { delete C.location.port; }, "Can't delete cross-origin property");
assert_throws(null, function() { delete C.location.foopy; }, "Can't delete cross-origin property");
addTest(function(exception_t) {
test_throws(exception_t, "SecurityError", function() { delete C[0]; }, "Can't delete cross-origin indexed property");
test_throws(exception_t, "SecurityError", function() { delete C[100]; }, "Can't delete cross-origin indexed property");
test_throws(exception_t, "SecurityError", function() { delete C.location; }, "Can't delete cross-origin property");
test_throws(exception_t, "SecurityError", function() { delete C.parent; }, "Can't delete cross-origin property");
test_throws(exception_t, "SecurityError", function() { delete C.length; }, "Can't delete cross-origin property");
test_throws(exception_t, "SecurityError", function() { delete C.document; }, "Can't delete cross-origin property");
test_throws(exception_t, "SecurityError", function() { delete C.foopy; }, "Can't delete cross-origin property");
test_throws(exception_t, "SecurityError", function() { delete C.location.href; }, "Can't delete cross-origin property");
test_throws(exception_t, "SecurityError", function() { delete C.location.replace; }, "Can't delete cross-origin property");
test_throws(exception_t, "SecurityError", function() { delete C.location.port; }, "Can't delete cross-origin property");
test_throws(exception_t, "SecurityError", function() { delete C.location.foopy; }, "Can't delete cross-origin property");
}, "[[Delete]] Should throw on cross-origin objects");
/*
* [[DefineOwnProperty]]
*/
function checkDefine(obj, prop) {
function checkDefine(exception_t, obj, prop) {
var valueDesc = { configurable: true, enumerable: false, writable: false, value: 2 };
var accessorDesc = { configurable: true, enumerable: false, get: function() {} };
assert_throws(null, function() { Object.defineProperty(obj, prop, valueDesc); }, "Can't define cross-origin value property " + prop);
assert_throws(null, function() { Object.defineProperty(obj, prop, accessorDesc); }, "Can't define cross-origin accessor property " + prop);
test_throws(exception_t, "SecurityError", function() { Object.defineProperty(obj, prop, valueDesc); }, "Can't define cross-origin value property " + prop);
test_throws(exception_t, "SecurityError", function() { Object.defineProperty(obj, prop, accessorDesc); }, "Can't define cross-origin accessor property " + prop);
}
addTest(function() {
checkDefine(C, 'length');
checkDefine(C, 'parent');
checkDefine(C, 'location');
checkDefine(C, 'document');
checkDefine(C, 'foopy');
checkDefine(C.location, 'href');
checkDefine(C.location, 'replace');
checkDefine(C.location, 'port');
checkDefine(C.location, 'foopy');
addTest(function(exception_t) {
checkDefine(exception_t, C, 'length');
checkDefine(exception_t, C, 'parent');
checkDefine(exception_t, C, 'location');
checkDefine(exception_t, C, 'document');
checkDefine(exception_t, C, 'foopy');
checkDefine(exception_t, C.location, 'href');
checkDefine(exception_t, C.location, 'replace');
checkDefine(exception_t, C.location, 'port');
checkDefine(exception_t, C.location, 'foopy');
}, "[[DefineOwnProperty]] Should throw for cross-origin objects");
/*
* [[Enumerate]]
*/
addTest(function() {
addTest(function(exception_t) {
for (var prop in C)
assert_unreached("Shouldn't have been able to enumerate " + prop + " on cross-origin Window");
for (var prop in C.location)
@ -242,14 +264,45 @@ addTest(function() {
* [[OwnPropertyKeys]]
*/
addTest(function() {
assert_array_equals(whitelistedWindowProps.sort(), Object.getOwnPropertyNames(C).sort(),
addTest(function(exception_t) {
assert_array_equals(Object.getOwnPropertyNames(C).sort(),
whitelistedWindowPropNames,
"Object.getOwnPropertyNames() gives the right answer for cross-origin Window");
assert_array_equals(Object.getOwnPropertyNames(C.location).sort(), ['href', 'replace'],
assert_array_equals(Object.getOwnPropertyNames(C.location).sort(),
whitelistedLocationPropNames,
"Object.getOwnPropertyNames() gives the right answer for cross-origin Location");
}, "[[OwnPropertyKeys]] should return all properties from cross-origin objects");
addTest(function() {
addTest(function(exception_t) {
assert_array_equals(Object.getOwnPropertySymbols(C), whitelistedSymbols,
"Object.getOwnPropertySymbols() should return the three symbol-named properties that are exposed on a cross-origin Window");
assert_array_equals(Object.getOwnPropertySymbols(C.location),
whitelistedSymbols,
"Object.getOwnPropertySymbols() should return the three symbol-named properties that are exposed on a cross-origin Location");
}, "[[OwnPropertyKeys]] should return the right symbol-named properties for cross-origin objects");
addTest(function(exception_t) {
var allWindowProps = Reflect.ownKeys(C);
indexedWindowProps = allWindowProps.slice(0, whitelistedWindowIndices.length);
stringWindowProps = allWindowProps.slice(0, -1 * whitelistedSymbols.length);
symbolWindowProps = allWindowProps.slice(-1 * whitelistedSymbols.length);
assert_array_equals(indexedWindowProps, whitelistedWindowIndices,
"Reflect.ownKeys should start with the indices exposed on the cross-origin window.");
assert_array_equals(stringWindowProps.sort(), whitelistedWindowPropNames,
"Reflect.ownKeys should continue with the cross-origin window properties for a cross-origin Window.");
assert_array_equals(symbolWindowProps, whitelistedSymbols,
"Reflect.ownKeys should end with the cross-origin symbols for a cross-origin Window.");
var allLocationProps = Reflect.ownKeys(C.location);
stringLocationProps = allLocationProps.slice(0, -1 * whitelistedSymbols.length);
symbolLocationProps = allLocationProps.slice(-1 * whitelistedSymbols.length);
assert_array_equals(stringLocationProps.sort(), whitelistedLocationPropNames,
"Reflect.ownKeys should start with the cross-origin window properties for a cross-origin Location.")
assert_array_equals(symbolLocationProps, whitelistedSymbols,
"Reflect.ownKeys should end with the cross-origin symbols for a cross-origin Location.")
}, "[[OwnPropertyKeys]] should place the symbols after the property names after the subframe indices");
addTest(function(exception_t) {
assert_true(B.eval('parent.C') === C, "A and B observe the same identity for C's Window");
assert_true(B.eval('parent.C.location') === C.location, "A and B observe the same identity for C's Location");
}, "A and B jointly observe the same identity for cross-origin Window and Location");
@ -260,19 +313,19 @@ function checkFunction(f, proto) {
assert_equals(Object.getPrototypeOf(f), proto, f.name + " has the right prototype");
}
addTest(function() {
addTest(function(exception_t) {
checkFunction(C.close, Function.prototype);
checkFunction(C.location.replace, Function.prototype);
}, "Cross-origin functions get local Function.prototype");
addTest(function() {
addTest(function(exception_t) {
assert_true(isObject(Object.getOwnPropertyDescriptor(C, 'parent')),
"Need to be able to use Object.getOwnPropertyDescriptor do this test");
checkFunction(Object.getOwnPropertyDescriptor(C, 'parent').get, Function.prototype);
checkFunction(Object.getOwnPropertyDescriptor(C.location, 'href').set, Function.prototype);
}, "Cross-origin Window accessors get local Function.prototype");
addTest(function() {
addTest(function(exception_t) {
checkFunction(close, Function.prototype);
assert_true(close != B.close, 'same-origin Window functions get their own object');
assert_true(close != C.close, 'cross-origin Window functions get their own object');
@ -288,7 +341,7 @@ addTest(function() {
checkFunction(replace_B, B.Function.prototype);
}, "Same-origin observers get different functions for cross-origin objects");
addTest(function() {
addTest(function(exception_t) {
assert_true(isObject(Object.getOwnPropertyDescriptor(C, 'parent')),
"Need to be able to use Object.getOwnPropertyDescriptor do this test");
var get_self_parent = Object.getOwnPropertyDescriptor(window, 'parent').get;
@ -301,7 +354,7 @@ addTest(function() {
checkFunction(get_parent_B, B.Function.prototype);
}, "Same-origin observers get different accessors for cross-origin Window");
addTest(function() {
addTest(function(exception_t) {
var set_self_href = Object.getOwnPropertyDescriptor(window.location, 'href').set;
var set_href_A = Object.getOwnPropertyDescriptor(C.location, 'href').set;
var set_href_B = B.eval('Object.getOwnPropertyDescriptor(parent.C.location, "href").set');
@ -312,12 +365,39 @@ addTest(function() {
checkFunction(set_href_B, B.Function.prototype);
}, "Same-origin observers get different accessors for cross-origin Location");
addTest(function(exception_t) {
assert_equals({}.toString.call(C), "[object Object]");
assert_equals({}.toString.call(C.location), "[object Object]");
}, "{}.toString.call() does the right thing on cross-origin objects");
// Separate test for throwing at all and throwing the right exception type
// so that we can test that all implementations could pass while implementing
// the observables that are actually important for security and interop, so
// they would notice if they ever regressed them.
function test_throws(exception_t, code, func, description) {
assert_throws(null, func, description);
exception_t.step(function() {
assert_throws(code, func, description);
});
}
// We do a fresh load of the subframes for each test to minimize side-effects.
// It would be nice to reload ourselves as well, but we can't do that without
// disrupting the test harness.
function runNextTest() {
var entry = testList.shift();
test(entry[0], entry[1]);
var fun = entry[0];
var desc = entry[1];
var main_t = async_test(desc);
var exception_t = async_test(desc + ' (exception type)');
main_t.add_cleanup(function() {
exception_t.unreached_func('Main test failed')();
});
main_t.step(function() {
fun(exception_t);
});
exception_t.done();
main_t.done();
if (testList.length != 0)
reloadSubframes(runNextTest);
else

View file

@ -35,5 +35,8 @@
</script>
</head>
<body>
<!-- Two subframes to give us some indexed properties -->
<iframe></iframe>
<iframe></iframe>
</body>
</html>

View file

@ -1,6 +1,7 @@
<!DOCTYPE html>
<html>
<head>
<script src="/common/get-host-info.sub.js"></script>
<script>
function loadFrames() {
window.A = document.getElementById('A').contentWindow;

View file

@ -10,12 +10,17 @@ var miscElements = {
script: {
src: "url",
type: "string",
noModule: "boolean",
charset: "string",
// TODO: async attribute (complicated).
defer: "boolean",
crossOrigin: {type: "enum", keywords: ["anonymous", "use-credentials"], nonCanon:{"": "anonymous"}, isNullable: true, defaultVal: null, invalidVal: "anonymous"},
nonce: "string",
integrity: "string",
// Obsolete
event: "string",
htmlFor: {type: "string", domAttrName: "for"},
},
noscript: {},

View file

@ -0,0 +1,24 @@
<!doctype html>
<title>Historical HTMLElement features</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<body>
<script>
[
// https://github.com/whatwg/html/commit/389ec2620d89e9480ef8847bf016abdfa92427bc
"commandType",
"commandLabel",
"commandIcon",
"commandHidden",
"commandDisabled",
"commandChecked",
"commandTriggers",
// https://github.com/whatwg/html/commit/5ddfc78b1f82e86cc202d72ccc752a0e15f1e4ad
"inert",
].forEach(function(member) {
test(function() {
assert_false(member in document.body);
assert_false(member in document.createElement('div'));
}, 'HTMLElement member must be nuked: ' + member);
});
</script>

View file

@ -577,12 +577,7 @@ interface CSSStyleSheet : StyleSheet {
typedef sequence<StyleSheet> StyleSheetList;
partial interface Document {
readonly attribute StyleSheetList styleSheets;
attribute DOMString? selectedStyleSheetSet;
readonly attribute DOMString? lastStyleSheetSet;
readonly attribute DOMString? preferredStyleSheetSet;
readonly attribute DOMStringList styleSheetSets;
void enableStyleSheetsForSet(DOMString? name);
[SameObject] readonly attribute StyleSheetList styleSheets;
};
[NoInterfaceObject] interface LinkStyle {
@ -1322,6 +1317,7 @@ interface MediaError {
const unsigned short MEDIA_ERR_DECODE = 3;
const unsigned short MEDIA_ERR_SRC_NOT_SUPPORTED = 4;
readonly attribute unsigned short code;
readonly attribute DOMString message;
};
interface AudioTrackList : EventTarget {
@ -1718,26 +1714,6 @@ interface HTMLTextAreaElement : HTMLElement {
void setSelectionRange(unsigned long start, unsigned long end, optional DOMString direction);
};
interface HTMLKeygenElement : HTMLElement {
attribute boolean autofocus;
attribute DOMString challenge;
attribute boolean disabled;
readonly attribute HTMLFormElement? form;
attribute DOMString keytype;
attribute DOMString name;
readonly attribute DOMString type;
readonly attribute boolean willValidate;
readonly attribute ValidityState validity;
readonly attribute DOMString validationMessage;
boolean checkValidity();
boolean reportValidity();
void setCustomValidity(DOMString error);
readonly attribute NodeList labels;
};
interface HTMLOutputElement : HTMLElement {
[PutForwards=value] readonly attribute DOMTokenList htmlFor;
readonly attribute HTMLFormElement? form;
@ -1857,14 +1833,19 @@ interface HTMLDialogElement : HTMLElement {
void close(optional DOMString returnValue);
};
[HTMLConstructor]
interface HTMLScriptElement : HTMLElement {
attribute DOMString src;
attribute DOMString type;
attribute DOMString charset;
attribute boolean async;
attribute boolean defer;
attribute DOMString? crossOrigin;
attribute DOMString text;
[CEReactions] attribute USVString src;
[CEReactions] attribute DOMString type;
[CEReactions] attribute boolean noModule;
[CEReactions] attribute DOMString charset;
[CEReactions] attribute boolean async;
[CEReactions] attribute boolean defer;
[CEReactions] attribute DOMString? crossOrigin;
[CEReactions] attribute DOMString text;
[CEReactions] attribute DOMString nonce;
[CEReactions] attribute DOMString integrity;
// also has obsolete members
};
@ -3301,7 +3282,6 @@ window.onload = function() {
HTMLOptGroupElement: ['document.createElement("optgroup")'],
HTMLOptionElement: ['document.createElement("option")', 'new Option()'],
HTMLTextAreaElement: ['document.createElement("textarea")'],
HTMLKeygenElement: ['document.createElement("keygen")'],
HTMLOutputElement: ['document.createElement("output")'],
HTMLProgressElement: ['document.createElement("progress")'],
HTMLMeterElement: ['document.createElement("meter")'],

View file

@ -0,0 +1,32 @@
<!doctype html>
<meta charset=utf-8>
<title>DOMStringList IDL tests</title>
<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>DOMStringList IDL tests</h1>
<div id=log></div>
<script>
"use strict";
async_test(function(t) {
var request = new XMLHttpRequest();
request.open("GET", "domstringlist.idl");
request.send();
request.onload = t.step_func(function() {
var idlArray = new IdlArray();
var idls = request.responseText;
idlArray.add_idls(idls);
idlArray.add_objects({
DOMStringList: ['location.ancestorOrigins'],
});
idlArray.test();
t.done();
});
});
</script>

View file

@ -0,0 +1,24 @@
"use strict";
importScripts("/resources/testharness.js");
importScripts("/resources/WebIDLParser.js", "/resources/idlharness.js");
async_test(function(t) {
var request = new XMLHttpRequest();
request.open("GET", "domstringlist.idl");
request.send();
request.onload = t.step_func(function() {
var idlArray = new IdlArray();
var idls = request.responseText;
idlArray.add_idls(idls);
idlArray.add_objects({
DOMStringList: [],
});
idlArray.test();
t.done();
});
});
done();

View file

@ -0,0 +1,61 @@
<!doctype html>
<title>DOMStringList</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
// Returns a promise that resolves to a DOMStringList with
// the requested entries. Relies on Indexed DB.
function createDOMStringList(entries) {
return new Promise((resolve, reject) => {
const dbname = String(self.location + Math.random());
const request = indexedDB.open(dbname);
request.onerror = () => reject(request.error);
request.onupgradeneeded = () => {
const db = request.result;
entries.forEach(entry => db.createObjectStore(entry));
const dsl = db.objectStoreNames;
resolve(dsl);
request.transaction.abort();
}
});
}
function dsl_test(entries, func, description) {
promise_test(t => createDOMStringList(entries).then(dsl => func(t, dsl)),
description);
}
dsl_test(['a', 'b', 'c'], (t, dsl) => {
assert_equals(dsl.length, 3, 'length attribute');
}, 'DOMStringList: length attribute');
dsl_test(['a', 'b', 'c'], (t, dsl) => {
assert_equals(dsl.item(0), 'a', 'item method');
assert_equals(dsl.item(1), 'b', 'item method');
assert_equals(dsl.item(2), 'c', 'item method');
assert_equals(dsl.item(3), null, 'item method out of range');
assert_equals(dsl.item(-1), null, 'item method out of range');
assert_throws(TypeError(), () => dsl.item(),
'item method should throw if called without enough args');
}, 'DOMStringList: item() method');
dsl_test(['a', 'b', 'c'], (t, dsl) => {
assert_equals(dsl[0], 'a', 'indexed getter');
assert_equals(dsl[1], 'b', 'indexed getter');
assert_equals(dsl[2], 'c', 'indexed getter');
assert_equals(dsl[3], undefined, 'indexed getter out of range');
assert_equals(dsl[-1], undefined, 'indexed getter out of range');
}, 'DOMStringList: indexed getter');
dsl_test(['a', 'b', 'c'], (t, dsl) => {
assert_true(dsl.contains('a'), 'contains method matched');
assert_true(dsl.contains('b'), 'contains method matched');
assert_true(dsl.contains('c'), 'contains method matched');
assert_false(dsl.contains(''), 'contains method unmatched');
assert_false(dsl.contains('d'), 'contains method unmatched');
assert_throws(TypeError(), () => dsl.contains(),
'contains method should throw if called without enough args');
}, 'DOMStringList: contains() method');
</script>

View file

@ -0,0 +1,6 @@
[Exposed=(Window,Worker)]
interface DOMStringList {
readonly attribute unsigned long length;
getter DOMString? item(unsigned long index);
boolean contains(DOMString string);
};

View file

@ -7,8 +7,8 @@
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<form id="f1">
<input type="radio" id="r1">
<keygen id="kg" name="key"></keygen>
<input type="radio" id="r1" name="ra">
<keygen id="kg" name="key"></keygen> <!-- we test that it does *not* appear in form.elements -->
</form>
<form id="f2">
<table>
@ -39,7 +39,7 @@ setup(function () {
//length
test(function () {
assert_equals(coll1.length, 2, "The length attribute is incorrect.");
assert_equals(coll1.length, 1, "The length attribute is incorrect.");
assert_equals(coll2.length, 4, "The length attribute is incorrect.");
}, "The length attribute must return the number of elements in the form");
@ -83,17 +83,22 @@ test(function () {
}, "The namedItem(name) must return null if there is no matched element");
test(function () {
assert_equals(coll1.namedItem("kg"), document.getElementById("kg"), "Controls can be named by 'id' attribute.");
assert_equals(coll1.namedItem("key"), document.getElementById("kg"), "Controls can be named by 'name' attribute.");
assert_equals(coll1.namedItem("r1"), document.getElementById("r1"), "Controls can be named by 'id' attribute.");
assert_equals(coll1.namedItem("ra"), document.getElementById("r1"), "Controls can be named by 'name' attribute.");
}, "Controls can be indexed by id or name attribute");
test(function () {
assert_equals(coll1.namedItem("kg"), null, "Keygen does not show up when queried by id.");
assert_equals(coll1.namedItem("key"), null, "Keygen does not show up when queried by name.");
}, "Keygen controls do not show up at all");
test(function () {
assert_equals(coll2.namedItem("btn").length, 2, "The length attribute should be 2.");
}, "The namedItem(name) must return the items with id or name attribute");
//various controls in fieldset and form
var containers = ["form", "fieldset"],
controls = ["button", "fieldset", "input", "keygen", "object", "output", "select", "textarea"];
controls = ["button", "fieldset", "input", "object", "output", "select", "textarea"];
for (var m = 0; m < containers.length; m++) {
test(function () {
var container = document.createElement(containers[m]);

View file

@ -14,7 +14,7 @@ onload = function() {
'utf-16be':'%C3%A5',
'utf-16le':'%C3%A5',
'windows-1252':'%E5',
'windows-1251':'%3F'
'windows-1251':'&%23229;'
};
var expected_current = expected_obj[encoding];
var expected_utf8 = expected_obj['utf-8'];
@ -48,7 +48,7 @@ onload = function() {
// background attribute, check with getComputedStyle
function test_background(tag) {
var spec_url = 'https://html.spec.whatwg.org/multipage/multipage/rendering.html';
var spec_url = 'https://html.spec.whatwg.org/multipage/rendering.html';
spec_url += tag == 'body' ? '#the-page' : '#tables';
test(function() {
var elm = document.createElement(tag);
@ -81,7 +81,7 @@ onload = function() {
var got = elm[idlAttr];
assert_true(got.indexOf(expected_current) > -1, msg(expected_current, got));
}, 'Getting <'+tag+'>.'+idlAttr + (multiple ? ' (multiple URLs)' : ''),
{help:'https://html.spec.whatwg.org/multipage/multipage/common-dom-interfaces.html#reflecting-content-attributes-in-idl-attributes'});
{help:'https://html.spec.whatwg.org/multipage/#reflecting-content-attributes-in-idl-attributes'});
}
('iframe src, a href, base href, link href, img src, embed src, object data, track src, video src, audio src, input src, form action, ' +
@ -120,7 +120,7 @@ onload = function() {
elm.click();
// check that navigation succeeded by ...??? XXX
}, 'follow hyperlink <'+tag+' href>',
{help:'https://html.spec.whatwg.org/multipage/multipage/links.html#following-hyperlinks'});
{help:'https://html.spec.whatwg.org/multipage/#following-hyperlinks'});
}
'a, area, link'.split(', ').forEach(function(str) {
@ -143,7 +143,7 @@ onload = function() {
// check that the right URL was requested for the ping
poll_for_stash(this, uuid, expected_current);
}, 'hyperlink auditing <'+tag+' ping>',
{help:'https://html.spec.whatwg.org/multipage/multipage/links.html#hyperlink-auditing'});
{help:'https://html.spec.whatwg.org/multipage/#hyperlink-auditing'});
}
'a, area'.split(', ').forEach(function(str) {
@ -169,7 +169,7 @@ onload = function() {
assert_equals(got, expected_current);
});
}, 'meta refresh',
{help:'https://html.spec.whatwg.org/multipage/multipage/semantics.html#attr-meta-http-equiv-refresh'});
{help:'https://html.spec.whatwg.org/multipage/#attr-meta-http-equiv-refresh'});
// loading html (or actually svg to support <embed>)
function test_load_nested_browsing_context(tag, attr, spec_url) {
@ -191,10 +191,10 @@ onload = function() {
}
spec_url_load_nested_browsing_context = {
frame:'https://html.spec.whatwg.org/multipage/multipage/obsolete.html#process-the-frame-attributes',
iframe:'https://html.spec.whatwg.org/multipage/multipage/the-iframe-element.html#process-the-iframe-attributes',
object:'https://html.spec.whatwg.org/multipage/multipage/the-iframe-element.html#the-object-element',
embed:'https://html.spec.whatwg.org/multipage/multipage/the-iframe-element.html#the-embed-element-setup-steps'
frame:'https://html.spec.whatwg.org/multipage/#process-the-frame-attributes',
iframe:'https://html.spec.whatwg.org/multipage/#process-the-iframe-attributes',
object:'https://html.spec.whatwg.org/multipage/#the-object-element',
embed:'https://html.spec.whatwg.org/multipage/#the-embed-element-setup-steps'
};
'frame src, iframe src, object data, embed src'.split(', ').forEach(function(str) {
@ -217,8 +217,8 @@ onload = function() {
assert_equals(elm.sheet.cssRules[0].style.content, '"'+expected_current+'"', 'sheet.cssRules[0].style.content');
});
}, 'loading css <link>',
{help:['https://html.spec.whatwg.org/multipage/multipage/semantics.html#the-link-element',
'https://html.spec.whatwg.org/multipage/multipage/semantics.html#styling']});
{help:['https://html.spec.whatwg.org/multipage/#the-link-element',
'https://html.spec.whatwg.org/multipage/#styling']});
// loading js
async_test(function() {
@ -229,7 +229,7 @@ onload = function() {
assert_equals(window.test_load_js_got, expected_current);
});
}, 'loading js <script>',
{help:'https://html.spec.whatwg.org/multipage/multipage/scripting-1.html#prepare-a-script'});
{help:'https://html.spec.whatwg.org/multipage/#prepare-a-script'});
// loading image
function test_load_image(tag, attr, spec_url) {
@ -279,11 +279,11 @@ onload = function() {
})();
var spec_url_load_image = {
img:'https://html.spec.whatwg.org/multipage/multipage/embedded-content-1.html#update-the-image-data',
embed:'https://html.spec.whatwg.org/multipage/multipage/the-iframe-element.html#the-embed-element-setup-steps',
object:'https://html.spec.whatwg.org/multipage/multipage/the-iframe-element.html#the-object-element',
input:'https://html.spec.whatwg.org/multipage/multipage/states-of-the-type-attribute.html#image-button-state-(type=image)',
video:'https://html.spec.whatwg.org/multipage/multipage/the-video-element.html#poster-frame'
img:'https://html.spec.whatwg.org/multipage/#update-the-image-data',
embed:'https://html.spec.whatwg.org/multipage/#the-embed-element-setup-steps',
object:'https://html.spec.whatwg.org/multipage/#the-object-element',
input:'https://html.spec.whatwg.org/multipage/#image-button-state-(type=image)',
video:'https://html.spec.whatwg.org/multipage/#poster-frame'
};
'img src, embed src, object data, input src, video poster'.split(', ').forEach(function(str) {
@ -327,7 +327,7 @@ onload = function() {
assert_equals(got, query_to_video_duration[expected_current], msg(expected_current, video_duration_to_query[got]));
});
}, 'loading video <'+tag+'>' + (use_source_element ? '<source>' : ''),
{help:'https://html.spec.whatwg.org/multipage/multipage/the-video-element.html#concept-media-load-algorithm'});
{help:'https://html.spec.whatwg.org/multipage/#concept-media-load-algorithm'});
}
var query_to_video_duration = {
@ -363,7 +363,7 @@ onload = function() {
assert_equals(got, expected_current);
});
}, 'loading webvtt <track>',
{help:'https://html.spec.whatwg.org/multipage/multipage/the-video-element.html#track-url'});
{help:'https://html.spec.whatwg.org/multipage/#track-url'});
// XXX downloading seems hard to automate
// <a href download>
@ -405,7 +405,7 @@ onload = function() {
assert_equals(got, expected_current);
});
}, 'submit form <'+tag+' '+attr+'>',
{help:'https://html.spec.whatwg.org/multipage/multipage/association-of-controls-and-forms.html#concept-form-submit'});
{help:'https://html.spec.whatwg.org/multipage/#concept-form-submit'});
}
'form action, input formaction, button formaction'.split(', ').forEach(function(str) {
@ -431,9 +431,9 @@ onload = function() {
assert_true(got_a_href.indexOf(expected_current) > -1, msg(expected_current, got_a_href), 'a.href');
});
}, '<base href>',
{help:['https://html.spec.whatwg.org/multipage/multipage/semantics.html#set-the-frozen-base-url',
{help:['https://html.spec.whatwg.org/multipage/#set-the-frozen-base-url',
'https://dom.spec.whatwg.org/#dom-node-baseuri',
'https://html.spec.whatwg.org/multipage/multipage/text-level-semantics.html#the-a-element']});
'https://html.spec.whatwg.org/multipage/#the-a-element']});
// XXX drag and drop (<a href> or <img src>) seems hard to automate
@ -444,7 +444,7 @@ onload = function() {
assert_equals(e.data, expected_current);
});
}, 'Worker constructor',
{help:'https://html.spec.whatwg.org/multipage/multipage/workers.html#dom-worker'});
{help:'https://html.spec.whatwg.org/multipage/#dom-worker'});
// SharedWorker()
async_test(function() {
@ -453,7 +453,7 @@ onload = function() {
assert_equals(e.data, expected_current);
});
}, 'SharedWorker constructor',
{help:'https://html.spec.whatwg.org/multipage/multipage/workers.html#dom-sharedworker'});
{help:'https://html.spec.whatwg.org/multipage/#dom-sharedworker'});
// EventSource()
async_test(function() {
@ -465,7 +465,7 @@ onload = function() {
assert_equals(e.data, expected_current);
});
}, 'EventSource constructor',
{help:'https://html.spec.whatwg.org/multipage/multipage/comms.html#dom-eventsource'});
{help:'https://html.spec.whatwg.org/multipage/#dom-eventsource'});
// EventSource#url
test(function() {
@ -474,7 +474,7 @@ onload = function() {
var got = source.url;
assert_true(source.url.indexOf(expected_current) > -1, msg(expected_current, got));
}, 'EventSource#url',
{help:'https://html.spec.whatwg.org/multipage/multipage/comms.html#dom-eventsource'});
{help:'https://html.spec.whatwg.org/multipage/#dom-eventsource'});
// XMLDocument#load()
async_test(function() {
@ -484,7 +484,7 @@ onload = function() {
assert_equals(doc.documentElement.textContent, expected_current);
});
}, 'XMLDocument#load()',
{help:'https://html.spec.whatwg.org/multipage/multipage/dom.html#dom-xmldocument-load'});
{help:'https://html.spec.whatwg.org/multipage/#dom-xmldocument-load'});
// window.open
async_test(function() {
@ -504,7 +504,7 @@ onload = function() {
}
});
}, 'window.open()',
{help:'https://html.spec.whatwg.org/multipage/multipage/browsers.html#dom-open'});
{help:'https://html.spec.whatwg.org/multipage/#dom-open'});
// location
function test_location(func, desc) {
@ -523,7 +523,7 @@ onload = function() {
}
});
}, desc,
{help:'https://html.spec.whatwg.org/multipage/multipage/history.html#the-location-interface'});
{help:'https://html.spec.whatwg.org/multipage/#the-location-interface'});
}
[[function(win, input) { win.location = input; }, "location [PutForwards]"],
[function(win, input) { win.location.assign(input); }, "location.assign()"],
@ -552,7 +552,7 @@ onload = function() {
}
});
}, 'location.search',
{help:['https://html.spec.whatwg.org/multipage/multipage/history.html#the-location-interface',
{help:['https://html.spec.whatwg.org/multipage/#the-location-interface',
'http://url.spec.whatwg.org/#dom-url-search']});
// a.search, area.search
@ -567,7 +567,7 @@ onload = function() {
var got_search = elm.search;
assert_true(got_search.indexOf(expected_current) > -1, 'getting .search '+msg(expected_current, got_search));
}, '<'+tag+'>.search',
{help:['https://html.spec.whatwg.org/multipage/multipage/text-level-semantics.html#the-'+tag+'-element',
{help:['https://html.spec.whatwg.org/multipage/#the-'+tag+'-element',
'http://url.spec.whatwg.org/#dom-url-search']});
}
'a, area'.split(', ').forEach(function(str) {
@ -591,7 +591,7 @@ onload = function() {
assert_equals(got.indexOf('/resources/resources/'), -1, 'url was resolved against the iframe\'s URL instead of the settings object\'s API base URL');
});
}, 'history.'+prop,
{help:'https://html.spec.whatwg.org/multipage/multipage/history.html#dom-history-'+prop.toLowerCase()});
{help:'https://html.spec.whatwg.org/multipage/#dom-history-'+prop.toLowerCase()});
}
'pushState, replaceState'.split(', ').forEach(function(str) {
@ -681,8 +681,8 @@ onload = function() {
assert_equals(e.data, expected_utf8);
});
}, 'importScripts() in a dedicated worker',
{help:['https://html.spec.whatwg.org/multipage/multipage/workers.html#set-up-a-worker-script-settings-object',
'https://html.spec.whatwg.org/multipage/multipage/workers.html#dom-workerglobalscope-importscripts']});
{help:['https://html.spec.whatwg.org/multipage/#set-up-a-worker-script-settings-object',
'https://html.spec.whatwg.org/multipage/#dom-workerglobalscope-importscripts']});
async_test(function() {
var worker = new Worker(input_url_worker_worker);
@ -690,8 +690,8 @@ onload = function() {
assert_equals(e.data, expected_utf8);
});
}, 'Worker() in a dedicated worker',
{help:['https://html.spec.whatwg.org/multipage/multipage/workers.html#set-up-a-worker-script-settings-object',
'https://html.spec.whatwg.org/multipage/multipage/workers.html#dom-worker']});
{help:['https://html.spec.whatwg.org/multipage/#set-up-a-worker-script-settings-object',
'https://html.spec.whatwg.org/multipage/#dom-worker']});
async_test(function() {
var worker = new Worker(input_url_worker_sharedworker);
@ -699,8 +699,8 @@ onload = function() {
assert_equals(e.data, expected_utf8);
});
}, 'SharedWorker() in a dedicated worker',
{help:['https://html.spec.whatwg.org/multipage/multipage/workers.html#set-up-a-worker-script-settings-object',
'https://html.spec.whatwg.org/multipage/multipage/workers.html#dom-sharedworker']});
{help:['https://html.spec.whatwg.org/multipage/#set-up-a-worker-script-settings-object',
'https://html.spec.whatwg.org/multipage/#dom-sharedworker']});
async_test(function() {
var worker = new SharedWorker(input_url_sharedworker_importScripts);
@ -708,8 +708,8 @@ onload = function() {
assert_equals(e.data, expected_utf8);
});
}, 'importScripts() in a shared worker',
{help:['https://html.spec.whatwg.org/multipage/multipage/workers.html#set-up-a-worker-script-settings-object',
'https://html.spec.whatwg.org/multipage/multipage/workers.html#dom-workerglobalscope-importscripts']});
{help:['https://html.spec.whatwg.org/multipage/#set-up-a-worker-script-settings-object',
'https://html.spec.whatwg.org/multipage/#dom-workerglobalscope-importscripts']});
async_test(function() {
var worker = new SharedWorker(input_url_sharedworker_worker);
@ -717,8 +717,8 @@ onload = function() {
assert_equals(e.data, expected_utf8);
});
}, 'Worker() in a shared worker',
{help:['https://html.spec.whatwg.org/multipage/multipage/workers.html#set-up-a-worker-script-settings-object',
'https://html.spec.whatwg.org/multipage/multipage/workers.html#dom-worker']});
{help:['https://html.spec.whatwg.org/multipage/#set-up-a-worker-script-settings-object',
'https://html.spec.whatwg.org/multipage/#dom-worker']});
async_test(function() {
var worker = new SharedWorker(input_url_sharedworker_sharedworker);
@ -726,8 +726,8 @@ onload = function() {
assert_equals(e.data, expected_utf8);
});
}, 'SharedWorker() in a shared worker',
{help:['https://html.spec.whatwg.org/multipage/multipage/workers.html#set-up-a-worker-script-settings-object',
'https://html.spec.whatwg.org/multipage/multipage/workers.html#dom-sharedworker']});
{help:['https://html.spec.whatwg.org/multipage/#set-up-a-worker-script-settings-object',
'https://html.spec.whatwg.org/multipage/#dom-sharedworker']});
// WebSocket()
async_test(function(){
@ -739,7 +739,7 @@ onload = function() {
assert_equals(e.data, expected_utf8);
});
}, 'WebSocket constructor',
{help:'https://html.spec.whatwg.org/multipage/multipage/network.html#parse-a-websocket-url\'s-components'});
{help:'https://html.spec.whatwg.org/multipage/#parse-a-websocket-url\'s-components'});
// WebSocket#url
test(function(){
@ -748,7 +748,7 @@ onload = function() {
var got = ws.url;
assert_true(ws.url.indexOf(expected_utf8) > -1, msg(expected_utf8, got));
}, 'WebSocket#url',
{help:'https://html.spec.whatwg.org/multipage/multipage/network.html#dom-websocket-url'});
{help:'https://html.spec.whatwg.org/multipage/#dom-websocket-url'});
// Parsing cache manifest
function test_cache_manifest(mode) {
@ -762,7 +762,7 @@ onload = function() {
});
poll_for_stash(this, uuid, expected_utf8);
}, 'Parsing cache manifest (' + mode + ')',
{help:'https://html.spec.whatwg.org/multipage/multipage/offline.html#parse-a-manifest'});
{help:'https://html.spec.whatwg.org/multipage/#parse-a-manifest'});
}
'CACHE, FALLBACK, NETWORK'.split(', ').forEach(function(str) {

View file

@ -0,0 +1,15 @@
<!doctype html>
<meta charset=utf-8>
<title>table vspace hspace (standards mode)</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<div>x</div>
<table vspace=25 hspace=25><tr><td>x</table>
<div>x</div>
<script>
var style = getComputedStyle(document.querySelector('table'));
['marginTop', 'marginRight', 'marginBottom', 'marginLeft'].forEach(function(m) {
assert_equals(style[m], '0px', m);
});
done();
</script>

View file

@ -0,0 +1,15 @@
<!-- quirks -->
<meta charset=utf-8>
<title>table vspace hspace (quirks mode)</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<div>x</div> <!-- prevent margin collapsing quirks -->
<table vspace=25 hspace=25><tr><td>x</table>
<div>x</div> <!-- prevent margin collapsing quirks -->
<script>
var style = getComputedStyle(document.querySelector('table'));
['marginTop', 'marginRight', 'marginBottom', 'marginLeft'].forEach(function(m) {
assert_equals(style[m], '0px', m);
});
done();
</script>

View file

@ -31,7 +31,7 @@ var HTML5_VOID_ELEMENTS = [ 'area', 'base', 'br', 'col', 'command', 'embed',
'track', 'wbr' ];
// https://html.spec.whatwg.org/multipage/multipage/forms.html#form-associated-element
var HTML5_FORM_ASSOCIATED_ELEMENTS = [ 'button', 'fieldset', 'input', 'keygen',
var HTML5_FORM_ASSOCIATED_ELEMENTS = [ 'button', 'fieldset', 'input',
'object', 'output', 'select', 'textarea' ];
function newDocument() {

View file

@ -4,7 +4,7 @@
"original_id": "authoring"
},
{
"id": "processing-model-0",
"original_id": "processing-model-0"
"id": "image-map-processing-model",
"original_id": "image-map-processing-model"
}
]
]

View file

@ -0,0 +1,254 @@
<!DOCTYPE {{GET[doctype]}}>
<!-- This file should be polyglot -->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8"/>
<title>Test data for hash name reference</title>
<style>
body { margin: 0 }
img, object { height: 1px; display:block }
</style>
</head>
<body>
<div data-expect="no match">
<img src="/images/threecolors.png" usemap="no-hash-name"/>
<object data="/images/threecolors.png" usemap="no-hash-name"></object>
<map name="no-hash-name">
<area shape="rect" coords="0,0,99,50" href="#area-no-hash-name"/>
</map>
</div>
<div data-expect="no match">
<img src="/images/threecolors.png" usemap="no-hash-id"/>
<object data="/images/threecolors.png" usemap="no-hash-id"></object>
<map id="no-hash-id">
<area shape="rect" coords="0,0,99,50" href="#area-no-hash-id"/>
</map>
</div>
<div data-expect="area-hash-name">
<img src="/images/threecolors.png" usemap="#hash-name"/>
<object data="/images/threecolors.png" usemap="#hash-name"></object>
<map name="hash-name">
<area shape="rect" coords="0,0,99,50" href="#area-hash-name"/>
</map>
</div>
<div data-expect="area-hash-id">
<img src="/images/threecolors.png" usemap="#hash-id"/>
<object data="/images/threecolors.png" usemap="#hash-id"></object>
<map id="hash-id">
<area shape="rect" coords="0,0,99,50" href="#area-hash-id"/>
</map>
</div>
<div data-expect="area-non-map-with-this-name">
<img src="/images/threecolors.png" usemap="#non-map-with-this-name" name="non-map-with-this-name"/>
<object data="/images/threecolors.png" usemap="#non-map-with-this-name"></object>
<map name="non-map-with-this-name">
<area shape="rect" coords="0,0,99,50" href="#area-non-map-with-this-name"/>
</map>
</div>
<div data-expect="area-non-map-with-this-id">
<img src="/images/threecolors.png" usemap="#non-map-with-this-id" id="non-map-with-this-id"/>
<object data="/images/threecolors.png" usemap="#non-map-with-this-id"></object>
<map id="non-map-with-this-name">
<area shape="rect" coords="0,0,99,50" href="#area-non-map-with-this-id"/>
</map>
</div>
<div data-expect="area-two-maps-with-this-name-1">
<img src="/images/threecolors.png" usemap="#two-maps-with-this-name"/>
<object data="/images/threecolors.png" usemap="#two-maps-with-this-name"></object>
<map name="two-maps-with-this-name">
<area shape="rect" coords="0,0,99,50" href="#area-two-maps-with-this-name-1"/>
</map>
<map name="two-maps-with-this-name">
<area shape="rect" coords="0,0,99,50" href="#area-two-maps-with-this-name-2"/>
</map>
</div>
<div data-expect="area-two-maps-with-this-id-1">
<img src="/images/threecolors.png" usemap="#two-maps-with-this-id"/>
<object data="/images/threecolors.png" usemap="#two-maps-with-this-id"></object>
<map id="two-maps-with-this-id">
<area shape="rect" coords="0,0,99,50" href="#area-two-maps-with-this-id-1"/>
</map>
<map id="two-maps-with-this-id">
<area shape="rect" coords="0,0,99,50" href="#area-two-maps-with-this-id-2"/>
</map>
</div>
<div data-expect="area-two-maps-with-this-name-or-id-1">
<img src="/images/threecolors.png" usemap="#two-maps-with-this-name-or-id"/>
<object data="/images/threecolors.png" usemap="#two-maps-with-this-name-or-id"></object>
<map name="two-maps-with-this-name-or-id">
<area shape="rect" coords="0,0,99,50" href="#area-two-maps-with-this-name-or-id-1"/>
</map>
<map id="two-maps-with-this-name-or-id">
<area shape="rect" coords="0,0,99,50" href="#area-two-maps-with-this-name-or-id-2"/>
</map>
</div>
<div data-expect="area-two-maps-with-this-id-or-name-1">
<img src="/images/threecolors.png" usemap="#two-maps-with-this-id-or-name"/>
<object data="/images/threecolors.png" usemap="#two-maps-with-this-id-or-name"></object>
<map id="two-maps-with-this-id-or-name">
<area shape="rect" coords="0,0,99,50" href="#area-two-maps-with-this-id-or-name-1"/>
</map>
<map name="two-maps-with-this-id-or-name">
<area shape="rect" coords="0,0,99,50" href="#area-two-maps-with-this-id-or-name-2"/>
</map>
</div>
<div data-expect="no match">
<img src="/images/threecolors.png" usemap="hash-last#"/>
<object data="/images/threecolors.png" usemap="hash-last#"></object>
<map name="hash-last" id="hash-last">
<area shape="rect" coords="0,0,99,50" href="#area-hash-last-no-hash-in-map-name-and-id"/>
</map>
<map name="hash-last#" id="hash-last#">
<area shape="rect" coords="0,0,99,50" href="#area-hash-last-with-hash-in-map-name-and-id"/>
</map>
</div>
<div data-expect="no match">
<img src="/images/threecolors.png" usemap=""/>
<object data="/images/threecolors.png" usemap=""></object>
<map name="" id="">
<area shape="rect" coords="0,0,99,50" href="#area-empty-usemap-empty-map-name-and-id"/>
</map>
</div>
<div data-expect="no match">
<img src="/images/threecolors.png" usemap="#"/>
<object data="/images/threecolors.png" usemap="#"></object>
<map name="" id="">
<area shape="rect" coords="0,0,99,50" href="#area-hash-usemap-empty-name-and-id"/>
</map>
</div>
<div data-expect="area-hash-space-usemap-space-map-name">
<img src="/images/threecolors.png" usemap="# "/>
<object data="/images/threecolors.png" usemap="# "></object>
<map name=" ">
<area shape="rect" coords="0,0,99,50" href="#area-hash-space-usemap-space-map-name"/>
</map>
</div>
<div data-expect="area-hash-LF-usemap-LF-map-id">
<img src="/images/threecolors.png" usemap="#&#x0A;"/>
<object data="/images/threecolors.png" usemap="#&#x0A;"></object>
<map id="&#x0A;">
<area shape="rect" coords="0,0,99,50" href="#area-hash-LF-usemap-LF-map-id"/>
</map>
</div>
<div data-expect="no match">
<img src="/images/threecolors.png" usemap="#percent-escape-name-%41"/>
<object data="/images/threecolors.png" usemap="#percent-escape-name-%41"></object>
<map name="percent-escape-name-A">
<area shape="rect" coords="0,0,99,50" href="#area-percent-escape-name-A"/>
</map>
</div>
<div data-expect="no match">
<img src="/images/threecolors.png" usemap="#percent-escape-id-%41"/>
<object data="/images/threecolors.png" usemap="#percent-escape-id-%41"></object>
<map id="percent-escape-id-A">
<area shape="rect" coords="0,0,99,50" href="#area-percent-escape-id-A"/>
</map>
</div>
<div data-expect="area-percent-escape-name-B">
<img src="/images/threecolors.png" usemap="#percent-escape-name-%42"/>
<object data="/images/threecolors.png" usemap="#percent-escape-name-%42"></object>
<map name="percent-escape-name-%42">
<area shape="rect" coords="0,0,99,50" href="#area-percent-escape-name-B"/>
</map>
</div>
<div data-expect="area-percent-escape-id-B">
<img src="/images/threecolors.png" usemap="#percent-escape-id-%42"/>
<object data="/images/threecolors.png" usemap="#percent-escape-id-%42"></object>
<map id="percent-escape-id-%42">
<area shape="rect" coords="0,0,99,50" href="#area-percent-escape-id-B"/>
</map>
</div>
<div data-expect="area-hash-space-name">
<img src="/images/threecolors.png" usemap="# hash-space-name"/>
<object data="/images/threecolors.png" usemap="# hash-space-name"></object>
<map name=" hash-space-name">
<area shape="rect" coords="0,0,99,50" href="#area-hash-space-name"/>
</map>
</div>
<div data-expect="area-hash-space-id">
<img src="/images/threecolors.png" usemap="# hash-space-id"/>
<object data="/images/threecolors.png" usemap="# hash-space-id"></object>
<map id=" hash-space-id">
<area shape="rect" coords="0,0,99,50" href="#area-hash-space-id"/>
</map>
</div>
<div data-expect="area-space-before-hash-name">
<img src="/images/threecolors.png" usemap=" #space-before-hash-name"/>
<object data="/images/threecolors.png" usemap=" #space-before-hash-name"></object>
<map name="space-before-hash-name">
<area shape="rect" coords="0,0,99,50" href="#area-space-before-hash-name"/>
</map>
</div>
<div data-expect="area-space-before-hash-id">
<img src="/images/threecolors.png" usemap=" #space-before-hash-id"/>
<object data="/images/threecolors.png" usemap=" #space-before-hash-id"></object>
<map id="space-before-hash-id">
<area shape="rect" coords="0,0,99,50" href="#area-space-before-hash-id"/>
</map>
</div>
<div data-expect="area-garbage-before-hash-name">
<img src="/images/threecolors.png" usemap="http://example.org/#garbage-before-hash-name"/>
<object data="/images/threecolors.png" usemap="http://example.org/#garbage-before-hash-name"></object>
<map name="garbage-before-hash-name">
<area shape="rect" coords="0,0,99,50" href="#area-garbage-before-hash-name"/>
</map>
</div>
<div data-expect="area-garbage-before-hash-id">
<img src="/images/threecolors.png" usemap="http://example.org/#garbage-before-hash-id"/>
<object data="/images/threecolors.png" usemap="http://example.org/#garbage-before-hash-id"></object>
<map id="garbage-before-hash-id">
<area shape="rect" coords="0,0,99,50" href="#area-garbage-before-hash-id"/>
</map>
</div>
<div data-expect="no match">
<img src="/images/threecolors.png" usemap="#no-such-map"/>
<object data="/images/threecolors.png" usemap="#no-such-map"></object>
<map>
<area shape="rect" coords="0,0,99,50" href="#area-no-such-map"/>
</map>
</div>
<div data-expect="no match">
<img src="/images/threecolors.png" usemap="#different-CASE-name"/>
<object data="/images/threecolors.png" usemap="#different-CASE-name"></object>
<map name="different-case-name">
<area shape="rect" coords="0,0,99,50" href="#area-different-case-name"/>
</map>
</div>
<div data-expect="no match">
<img src="/images/threecolors.png" usemap="#different-CASE-id"/>
<object data="/images/threecolors.png" usemap="#different-CASE-id"></object>
<map id="different-case-id">
<area shape="rect" coords="0,0,99,50" href="#area-different-case-id"/>
</map>
</div>
</body>
</html>

View file

@ -0,0 +1,45 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>parsing a hash-name reference for img and object</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<style>
body { margin-top: 0 }
iframe { height: 600px; width:50px; border-top: none }
</style>
<div id="log"></div>
<iframe data-name="HTML (standards)" src="hash-name-reference-test-data.html?pipe=sub&amp;doctype=html"></iframe>
<iframe data-name="HTML (quirks)" src="hash-name-reference-test-data.html?pipe=sub&amp;doctype=quirks"></iframe>
<iframe data-name="XHTML" src="hash-name-reference-test-data.html?pipe=sub|header(Content-Type, application/xhtml%2Bxml)&amp;doctype=html"></iframe>
<script>
setup({explicit_done: true});
onload = function() {
var iframes = document.querySelectorAll('iframe');
iframes.forEach(function(iframe) {
var iframeName = iframe.getAttribute('data-name');
var doc = iframe.contentDocument;
var divs = doc.querySelectorAll('div[data-expect]');
var div, img, object;
for (var i = 0; i < divs.length; ++i) {
div = divs[i];
img = div.querySelector('img');
object = div.querySelector('object');
[img, object].forEach(function(elm) {
test(function(t) {
var expected = div.getAttribute('data-expect');
var expected_elm = expected === 'no match' ? elm : div.querySelector('area[href="#' + expected + '"]');
var got_elm = doc.elementFromPoint(elm.offsetLeft, elm.offsetTop);
assert_not_equals(expected_elm, null, 'sanity check (data-expect value wrong?)');
assert_not_equals(got_elm, null, 'sanity check (too many tests to fit in viewport?)');
assert_equals(got_elm, expected_elm);
}, iframeName + ' ' + elm.tagName + ' usemap=' + format_value(elm.useMap));
});
}
});
done();
};
</script>

View file

@ -28,6 +28,7 @@ function error_test(tagName, src) {
assert_true(e.error instanceof MediaError);
assert_equals(e.error.code, 4);
assert_equals(e.error.code, e.error.MEDIA_ERR_SRC_NOT_SUPPORTED);
assert_equals(typeof e.error.message, 'string', 'error.message type');
t.done();
});
}, tagName + '.error after setting src to the empty string');

View file

@ -12,8 +12,8 @@
<p class="output">Actual output:</p>
<canvas id="c" class="output" width="
100" height="
<canvas id="c" class="output" width="
100" height="
100"><p class="fallback">FAIL (fallback content)</p></canvas>
<p class="output expectedtext">Expected output:<p><img src="size.attributes.parse.whitespace.png" class="output expected" id="expected" alt="">
<ul id="d"></ul>

View file

@ -19,13 +19,13 @@
var t = async_test("Parsing of non-negative integers in setAttribute");
_addTest(function(canvas, ctx) {
canvas.setAttribute('width', '\r\n\t\x0c100');
canvas.setAttribute('height', '\r\n\t\x0c100');
canvas.setAttribute('width', '\n\t\x0c100');
canvas.setAttribute('height', '\n\t\x0c100');
_assertSame(canvas.width, 100, "canvas.width", "100");
_assertSame(canvas.height, 100, "canvas.height", "100");
_assertSame(window.getComputedStyle(canvas, null).getPropertyValue("width"), "100px", "window.getComputedStyle(canvas, null).getPropertyValue(\"width\")", "\"100px\"");
_assertSame(canvas.getAttribute('width'), '\r\n\t\x0c100', "canvas.getAttribute('width')", "'\\r\\n\\t\\x0c100'");
_assertSame(canvas.getAttribute('height'), '\r\n\t\x0c100', "canvas.getAttribute('height')", "'\\r\\n\\t\\x0c100'");
_assertSame(canvas.getAttribute('width'), '\n\t\x0c100', "canvas.getAttribute('width')", "'\\n\\t\\x0c100'");
_assertSame(canvas.getAttribute('height'), '\n\t\x0c100', "canvas.getAttribute('height')", "'\\n\\t\\x0c100'");
});

View file

@ -18,13 +18,16 @@
<script>
var t = async_test("toDataURL works before any context has been got");
_addTest(function(canvas, ctx) {
var no_context_data = canvas.toDataURL();
var ctx = canvas.getContext('2d');
ctx.rect(0, 0, 100, 50);
ctx.fillStyle = "rgba(0, 0, 0, 0)";
ctx.fill();
var data = canvas.toDataURL();
assert_equals(no_context_data, data);
var no_context_data = canvas.toDataURL();
var ctx = canvas.getContext('2d');
ctx.rect(0, 0, 100, 50);
ctx.fillStyle = "rgba(0, 0, 0, 0)";
ctx.fill();
var data = canvas.toDataURL();
assert_equals(no_context_data, data);
});
</script>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 242 B

After

Width:  |  Height:  |  Size: 242 B

Before After
Before After

Binary file not shown.

After

Width:  |  Height:  |  Size: 268 B

View file

@ -0,0 +1,23 @@
<!doctype html>
<meta charset="utf-8">
<title>Changing the img src should retain the 'complete' property</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<p id="display"><img src="image.png"></p>
<script>
function check() {
var img = document.querySelector("img");
assert_true(img.complete, "By onload, image should have loaded");
img.src = `image.png?${Math.random()}`;
assert_false(img.complete, "Now that we're loading we should no longer be complete");
img.onload = function () {
assert_true(img.complete, "The new thing should have loaded.");
done();
}
}
onload = function () {
check();
};
</script>

View file

@ -62,7 +62,8 @@
testData: [
{conditions: {max: "2000-01", value: "2001-01"}, expected: false, name: "[target] validity.valid must be false if validity.rangeOverflow is true"},
{conditions: {min: "2001-01", value: "2000-01"}, expected: false, name: "[target] validity.valid must be false if validity.rangeUnderflow is true"},
{conditions: {step: 2 * 1 * 1, value: "2001-03"}, expected: false, name: "[target] validity.valid must be false if validity.stepMismatch is true"},
// Step checks that "months since Jan 1970" is evenly divisible by `step`
{conditions: {step: 3, value: "2001-02"}, expected: false, name: "[target] validity.valid must be false if validity.stepMismatch is true"},
{conditions: {required: true, value: ""}, expected: false, name: "[target] validity.valid must be false if validity.valueMissing is true"}
]
},

View file

@ -22,16 +22,16 @@
types: ["button", "reset"],
testData: [{conditions: {}, expected: false, name: "[target] Must be barred from the constraint validation"}]
},
//FIELDSET, OUTPUT elements should not be barred from the constraint validation
// FIELDSET and OUTPUT elements are not "submittable elements" and therefore never validate.
{
tag: "fieldset",
types: [],
testData: [{conditions: {}, expected: true, name: "[target] Must not be barred from the constraint validation"}]
testData: [{conditions: {}, expected: false, name: "[target] The willValidate attribute must be false since FIELDSET is not a submittable element"}]
},
{
tag: "output",
types: [],
testData: [{conditions: {}, expected: true, name: "[target] Must not be barred from the constraint validation"}]
testData: [{conditions: {}, expected: false, name: "[target] The willValidate attribute must be false since OUTPUT is not a submittable element"}]
},
//OBJECT, KEYGEN, elements must be barred from the constraint validation
{
@ -39,11 +39,6 @@
types: [],
testData: [{conditions: {}, expected: false, name: "[target] Must be barred from the constraint validation"}]
},
{
tag: "keygen",
types: [],
testData: [{conditions: {}, expected: false, name: "[target] Must be barred from the constraint validation"}]
},
//If an element is disabled, it is barred from constraint validation.
//The willValidate attribute must be true if an element is mutable
//If the readonly attribute is specified on an INPUT element, the element is barred from constraint validation.

View file

@ -0,0 +1,30 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>input[type="email"], ValidityState.tooShort and user editing</title>
<link rel="author" title="Chris Rebert" href="http://chrisrebert.com">
<link rel="help" href="https://html.spec.whatwg.org/multipage/#setting-minimum-input-length-requirements:-the-minlength-attribute">
<meta name="flags" content="interact">
<meta name="assert" content="Per the 'Constraint validation' definition in the referenced section, an input whose value was edited by the user but still falls below the input's minlength should suffer from being too short.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<p>Type one additional character into the following text input:</p>
<input type="email" value="jane.doe@example.com" minlength="25" autocomplete="off" id="testinput">
<div id="log"></div>
<script>
var input = document.getElementById('testinput');
setup({explicit_timeout: true, explicit_done: true});
on_event(input, "input", function () {
test(function() {
assert_class_string(input.validity, 'ValidityState', 'HTMLInputElement.validity must be a ValidityState instance');
assert_true(input.validity.tooShort, "tooShort must be true since the user just changed the input's value and the value falls below the minlength");
});
done();
});
</script>
</body>
</html>

View file

@ -0,0 +1,30 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>input[type="password"], ValidityState.tooShort and user editing</title>
<link rel="author" title="Chris Rebert" href="http://chrisrebert.com">
<link rel="help" href="https://html.spec.whatwg.org/multipage/#setting-minimum-input-length-requirements:-the-minlength-attribute">
<meta name="flags" content="interact">
<meta name="assert" content="Per the 'Constraint validation' definition in the referenced section, an input whose value was edited by the user but still falls below the input's minlength should suffer from being too short.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<p>Type one additional character into the following text input:</p>
<input type="password" value="swordfish" minlength="15" autocomplete="off" id="testinput">
<div id="log"></div>
<script>
var input = document.getElementById('testinput');
setup({explicit_timeout: true, explicit_done: true});
on_event(input, "input", function () {
test(function() {
assert_class_string(input.validity, 'ValidityState', 'HTMLInputElement.validity must be a ValidityState instance');
assert_true(input.validity.tooShort, "tooShort must be true since the user just changed the input's value and the value falls below the minlength");
});
done();
});
</script>
</body>
</html>

View file

@ -0,0 +1,30 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>input[type="search"], ValidityState.tooShort and user editing</title>
<link rel="author" title="Chris Rebert" href="http://chrisrebert.com">
<link rel="help" href="https://html.spec.whatwg.org/multipage/#setting-minimum-input-length-requirements:-the-minlength-attribute">
<meta name="flags" content="interact">
<meta name="assert" content="Per the 'Constraint validation' definition in the referenced section, an input whose value was edited by the user but still falls below the input's minlength should suffer from being too short.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<p>Type one additional character into the following text input:</p>
<input type="search" value="abcdefghi" minlength="15" autocomplete="off" id="testinput">
<div id="log"></div>
<script>
var input = document.getElementById('testinput');
setup({explicit_timeout: true, explicit_done: true});
on_event(input, "input", function () {
test(function() {
assert_class_string(input.validity, 'ValidityState', 'HTMLInputElement.validity must be a ValidityState instance');
assert_true(input.validity.tooShort, "tooShort must be true since the user just changed the input's value and the value falls below the minlength");
});
done();
});
</script>
</body>
</html>

View file

@ -0,0 +1,30 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>input[type="tel"], ValidityState.tooShort and user editing</title>
<link rel="author" title="Chris Rebert" href="http://chrisrebert.com">
<link rel="help" href="https://html.spec.whatwg.org/multipage/#setting-minimum-input-length-requirements:-the-minlength-attribute">
<meta name="flags" content="interact">
<meta name="assert" content="Per the 'Constraint validation' definition in the referenced section, an input whose value was edited by the user but still falls below the input's minlength should suffer from being too short.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<p>Type one additional character into the following text input:</p>
<input type="tel" value="123-456-7890" minlength="20" autocomplete="off" id="testinput">
<div id="log"></div>
<script>
var input = document.getElementById('testinput');
setup({explicit_timeout: true, explicit_done: true});
on_event(input, "input", function () {
test(function() {
assert_class_string(input.validity, 'ValidityState', 'HTMLInputElement.validity must be a ValidityState instance');
assert_true(input.validity.tooShort, "tooShort must be true since the user just changed the input's value and the value falls below the minlength");
});
done();
});
</script>
</body>
</html>

View file

@ -0,0 +1,30 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>input[type="text"], ValidityState.tooShort and user editing</title>
<link rel="author" title="Chris Rebert" href="http://chrisrebert.com">
<link rel="help" href="https://html.spec.whatwg.org/multipage/#setting-minimum-input-length-requirements:-the-minlength-attribute">
<meta name="flags" content="interact">
<meta name="assert" content="Per the 'Constraint validation' definition in the referenced section, an input whose value was edited by the user but still falls below the input's minlength should suffer from being too short.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<p>Type one additional character into the following text input:</p>
<input type="text" value="1234" minlength="10" autocomplete="off" id="testinput">
<div id="log"></div>
<script>
var input = document.getElementById('testinput');
setup({explicit_timeout: true, explicit_done: true});
on_event(input, "input", function () {
test(function() {
assert_class_string(input.validity, 'ValidityState', 'HTMLInputElement.validity must be a ValidityState instance');
assert_true(input.validity.tooShort, "tooShort must be true since the user just changed the input's value and the value falls below the minlength");
});
done();
});
</script>
</body>
</html>

View file

@ -0,0 +1,30 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>input[type="url"], ValidityState.tooShort and user editing</title>
<link rel="author" title="Chris Rebert" href="http://chrisrebert.com">
<link rel="help" href="https://html.spec.whatwg.org/multipage/#setting-minimum-input-length-requirements:-the-minlength-attribute">
<meta name="flags" content="interact">
<meta name="assert" content="Per the 'Constraint validation' definition in the referenced section, an input whose value was edited by the user but still falls below the input's minlength should suffer from being too short.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<p>Type one additional character into the following text input:</p>
<input type="url" value="http://example.com" minlength="25" autocomplete="off" id="testinput">
<div id="log"></div>
<script>
var input = document.getElementById('testinput');
setup({explicit_timeout: true, explicit_done: true});
on_event(input, "input", function () {
test(function() {
assert_class_string(input.validity, 'ValidityState', 'HTMLInputElement.validity must be a ValidityState instance');
assert_true(input.validity.tooShort, "tooShort must be true since the user just changed the input's value and the value falls below the minlength");
});
done();
});
</script>
</body>
</html>

View file

@ -0,0 +1,30 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>textarea, ValidityState.tooShort and user editing</title>
<link rel="author" title="Chris Rebert" href="http://chrisrebert.com">
<link rel="help" href="https://html.spec.whatwg.org/multipage/#setting-minimum-input-length-requirements:-the-minlength-attribute">
<meta name="flags" content="interact">
<meta name="assert" content="Per the 'Constraint validation' definition in the referenced section, a textarea whose value was edited by the user but still falls below the textarea's minlength should suffer from being too short.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<p>Type one additional character into the following text area:</p>
<textarea minlength="15" autocomplete="off" id="testinput">123456789</textarea>
<div id="log"></div>
<script>
var input = document.getElementById('testinput');
setup({explicit_timeout: true, explicit_done: true});
on_event(input, "input", function () {
test(function() {
assert_class_string(input.validity, 'ValidityState', 'HTMLTextAreaElement.validity must be a ValidityState instance');
assert_true(input.validity.tooShort, "tooShort must be true since the user just changed the input's value and the value falls below the minlength");
});
done();
});
</script>
</body>
</html>

View file

@ -9,7 +9,6 @@
<p><button id="button">button</button>
<p><fieldset id="fieldset">fieldset</fieldset>
<p><input id="input">
<p><keygen id="keygen">
<p><object id="object">object</object>
<p><output id="output">output</output>
<p><select id="select"><option>select</option></select>
@ -21,8 +20,6 @@
<p><label id="label-form-form2" form="form2">label-form-form2</label>
<p><label id="label-with-control">label-with-control <input></label>
<p><label id="label-for" for="control-for-label">label-for</label> <input id="control-for-label">
<p><label id="label-with-progress">label-with-progress <progress></progress></label>
<p><label id="label-with-meter">label-with-meter <meter></meter></label>
<p>
<input id="input-with-form-attr-in-form" form="form2">
<label id="label-for-control-form-in-form" for="input-with-form-attr-in-form">label-for-control-form-in-form</label>
@ -59,7 +56,6 @@ var listedElements = [
"button",
"fieldset",
"input",
"keygen",
"object",
"output",
"select",
@ -87,8 +83,6 @@ testLabel("label-form", null);
testLabel("label-form-form2", null);
testLabel("label-with-control", form);
testLabel("label-for", form);
testLabel("label-with-progress", null);
testLabel("label-with-meter", null);
testLabel("label-for-control-form-in-form", form2);
testLabel("label-for-control-form", form2);
testLabel("label-in-table", null);

View file

@ -15,6 +15,11 @@ var simple_tests = [
input: "<textarea name=foo>bar</textarea>",
output: "foo=bar"
},
{
name: "nokeygen.simple",
input: "<input name=foo value=barb><keygen>",
output: "foo=barb"
}
];
simple_tests.forEach(function(test_obj) {
test_obj.test = async_test(test_obj.name);

View file

@ -0,0 +1,3 @@
<!DOCTYPE html>
<form></form>

View file

@ -0,0 +1,38 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>reset() event firing realm</title>
<link rel="help" href="https://html.spec.whatwg.org/#resetting-a-form">
<link rel="help" href="https://dom.spec.whatwg.org/#concept-event-fire">
<link rel="author" title="Domenic Denicola" href="mailto:d@domenic.me">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<iframe src="reset-form-event-realm-support.html"></iframe>
<iframe></iframe>
<script>
"use strict";
async_test(t => {
window.onload = t.step_func_done(() => {
const frame0Form = frames[0].document.forms[0];
const frame1Body = frames[1].document.body;
frame1Body.appendChild(frame0Form);
let resetCalled = false;
frame0Form.onreset = t.step_func(ev => {
resetCalled = true;
const functionConstructorInEvRealm = ev.constructor.constructor;
const functionConstructorInFormRealm = frame0Form.constructor.constructor;
assert_equals(functionConstructorInEvRealm, functionConstructorInFormRealm,
"the event must be created in the realm of the target");
});
frame0Form.reset();
assert_true(resetCalled, "The reset event handler must have been called");
});
}, "reset()'s event must be fired in the Realm of the target")
</script>

View file

@ -15,7 +15,6 @@
<input type="checkbox" id="cb1" checked="checked" />
<input type="checkbox" id="cb2" />
<textarea id="ta">abc</textarea>
<!--<keygen id="kg"></keygen>-->
<output id="opt">5</output>
<select id="slt1">
<option value="1">ITEM1</option>
@ -114,7 +113,6 @@ function runTest(reset, description) {
assert_true(document.getElementById("slt3").options[1].selected, "The second option in the select element with multiple attribute should be selected.");
assert_true(document.getElementById("slt3").options[2].selected, "The third option in the select element with multiple attribute should be selected.");
}, "Resetting <select> " + description);
//TODO: The keygen reset algorithm
}
</script>

View file

@ -9,12 +9,21 @@
<script>
test(function() {
var el = document.createElement("textarea");
assert_equals(el.selectionStart, 0);
assert_equals(el.selectionEnd, 0);
assert_equals(el.selectionStart, 0, "initial selectionStart");
assert_equals(el.selectionEnd, 0, "initial selectionEnd");
assert_equals(el.selectionDirection, "none", "initial selectionDirection");
el.selectionStart = 1;
el.selectionEnd = 1;
el.selectionDirection = "forward";
assert_equals(el.selectionStart, 1, "updated selectionStart");
assert_equals(el.selectionEnd, 1, "updated selectionEnd");
assert_equals(el.selectionDirection, "forward", "updated selectionDirection");
el.setRangeText("foobar");
el.setSelectionRange(0, 1);
assert_equals(el.selectionStart, 0, "final selectionStart");
assert_equals(el.selectionEnd, 1, "final selectionEnd");
assert_equals(el.selectionDirection, "forward", "final selectionDirection");
}, "text field selection for the input textarea");
</script>

View file

@ -110,7 +110,7 @@
element.onselect = this.step_func_done(function(e) {
assert_true(q, "event should be queued");
assert_true(e.isTrusted, "event is trusted");
assert_false(e.bubbles, "event bubbles");
assert_true(e.bubbles, "event bubbles");
assert_false(e.cancelable, "event is not cancelable");
});
element.setRangeText("foobar2", 0, 6);

View file

@ -41,7 +41,7 @@ test(function() {
input.setSelectionRange(input.value.length+1,1)
assert_equals(input.selectionStart, 1, "If end is less than or equal to start then the start of the selection and the end of the selection must both be placed immediately before the character with offset end");
assert_equals(input.selectionEnd, 1, "element.selectionEnd should be 1");
},'input setSelectionRange(input.value.length+1,input.value.length+1)');
},'input setSelectionRange(input.value.length+1,1)');
test(function() {
input.setSelectionRange(2,2)

View file

@ -52,20 +52,20 @@
assert_true(document.getElementById('fs2').disabled, "The fieldset is disabled");
assert_false(document.getElementById('clubname2').willValidate, "fieldset is disabled so is input 'clubname2'");
assert_false(document.getElementById('clubnum2').willValidate, "fieldset is disabled so is input 'clubnum2'");
assert_false(document.getElementById('club2').willValidate, "the first legend is not a child of the disbled fieldset: input 'club2' is disabled");
assert_false(document.getElementById('club2').willValidate, "the first legend is not a child of the disabled fieldset: input 'club2' is disabled");
}, "The first 'legend' element is not a child of the disabled fieldset: Its descendants should be disabled.");
test(function () {
assert_true(document.getElementById('fs3').disabled, "The fieldset is disabled");
assert_false(document.getElementById('clubname3').willValidate, "fieldset is disabled so is input 'clubname3'");
assert_false(document.getElementById('clubnum3').willValidate, "fieldset is disabled so is input 'clubnum3'");
assert_false(document.getElementById('club3').willValidate, "the first legend is not a child of the disbled fieldset: input 'club3' is disabled");
assert_false(document.getElementById('club3').willValidate, "the first legend is not a child of the disabled fieldset: input 'club3' is disabled");
}, "The <legend> element is not a child of the disabled fieldset: Its descendants should be disabled.");
test(function () {
assert_true(document.getElementById('fs4').disabled, "The fieldset is disabled");
assert_false(document.getElementById('clubname4').willValidate, "fieldset is disabled so is input 'clubname4'");
assert_false(document.getElementById('clubnum4').willValidate, "fieldset is disabled so is input 'clubnum4'");
assert_true(document.getElementById('club4').willValidate, "the first legend a child of the disbled fieldset: input 'club4' is disabled");
assert_true(document.getElementById('club4').willValidate, "the first legend a child of the disabled fieldset: input 'club4' is disabled");
}, "The <legend> element is child of the disabled fieldset: Its descendants should be disabled.");
</script>

View file

@ -5,7 +5,6 @@
<script src="/resources/testharnessreport.js"></script>
<div id=log></div>
<!-- XXX Nothing tests id attributes yet. -->
<!-- XXX Keygen. -->
<!-- XXX We also need tests for moving inputs and forms in the DOM. -->
<form>
<input type=button name=button>
@ -327,4 +326,93 @@ test(function() {
assert_equals(form["new-name2"], 5);
}, 'Trying to set a non-configurable expando that shadows a named property that gets added later');
test(function() {
var form = document.getElementsByTagName("form")[1];
var i1 = document.createElement("input");
i1.name = "past-name1";
i1.id = "past-id1"
assert_equals(form["past-name1"], undefined);
assert_equals(form["past-id1"], undefined);
form.appendChild(i1);
assert_equals(form["past-name1"], i1);
assert_equals(form["past-id1"], i1);
i1.name = "twiddled-name1";
i1.id = "twiddled-id1";
assert_equals(form["past-name1"], i1);
assert_equals(form["twiddled-name1"], i1);
assert_equals(form["past-id1"], i1);
assert_equals(form["twiddled-id1"], i1);
i1.name = "twiddled-name2";
i1.id = "twiddled-id2";
assert_equals(form["past-name1"], i1);
assert_equals(form["twiddled-name1"], i1);
assert_equals(form["twiddled-name2"], i1);
assert_equals(form["past-id1"], i1);
assert_equals(form["twiddled-id1"], i1);
assert_equals(form["twiddled-id2"], i1);
i1.removeAttribute("id");
i1.removeAttribute("name");
assert_equals(form["past-name1"], i1);
assert_equals(form["twiddled-name1"], i1);
assert_equals(form["twiddled-name2"], i1);
assert_equals(form["past-id1"], i1);
assert_equals(form["twiddled-id1"], i1);
assert_equals(form["twiddled-id2"], i1);
i1.remove();
assert_equals(form["past-name1"], undefined);
assert_equals(form["twiddled-name1"], undefined);
assert_equals(form["twiddled-name2"], undefined);
assert_equals(form["past-id1"], undefined);
assert_equals(form["twiddled-id1"], undefined);
assert_equals(form["twiddled-id2"], undefined);
var i2 = document.createElement("input");
i2.name = "past-name2";
i2.id = "past-id2";
assert_equals(form["past-name2"], undefined);
assert_equals(form["past-id2"], undefined);
form.appendChild(i2);
assert_equals(form["past-name2"], i2);
assert_equals(form["past-id2"], i2);
i2.name = "twiddled-name3";
i2.id = "twiddled-id3";
assert_equals(form["past-name2"], i2);
assert_equals(form["twiddled-name3"], i2);
assert_equals(form["past-id2"], i2);
assert_equals(form["twiddled-id3"], i2);
i2.name = "twiddled-name4";
i2.id = "twiddled-id4";
assert_equals(form["past-name2"], i2);
assert_equals(form["twiddled-name3"], i2);
assert_equals(form["twiddled-name4"], i2);
assert_equals(form["past-id2"], i2);
assert_equals(form["twiddled-id3"], i2);
assert_equals(form["twiddled-id4"], i2);
i2.removeAttribute("id");
i2.removeAttribute("name");
assert_equals(form["past-name2"], i2);
assert_equals(form["twiddled-name3"], i2);
assert_equals(form["twiddled-name4"], i2);
assert_equals(form["past-id2"], i2);
assert_equals(form["twiddled-id3"], i2);
assert_equals(form["twiddled-id4"], i2);
i2.setAttribute("form", "c");
assert_equals(form["past-name2"], undefined);
assert_equals(form["twiddled-name3"], undefined);
assert_equals(form["twiddled-name4"], undefined);
assert_equals(form["past-id2"], undefined);
assert_equals(form["twiddled-id3"], undefined);
assert_equals(form["twiddled-id4"], undefined);
}, "Past names map should work correctly");
</script>

View file

@ -0,0 +1,150 @@
<!doctype html>
<meta charset=utf-8>
<title>Test input value retention upon clone</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<style>form {display: none;} </style>
<form>
<p><input type=checkbox> This checkbox is initially unchecked.</p>
<p><input type=checkbox checked="checked"> This checkbox is initially checked.</p>
<p><input type=radio name=radio> This radiobutton is initially unchecked.</p>
<p><input type=radio checked="checked" name=radio> This radiobutton is initially checked.</p>
<p><input type=hidden value="DEFAULT
DEFAULT"> This hidden field has the initial value "DEFAULT\nDEFAULT".</p>
<p><input type=text value=DEFAULT> This text field has the initial value "DEFAULT".</p>
<p><input type=search value=DEFAULT> This search field has the initial value "DEFAULT".</p>
<p><input type=tel value=DEFAULT> This phone number field has the initial value "DEFAULT".</p>
<p><input type=url value=https://default.invalid/> This URL field has the initial value "https://default.invalid/".</p>
<p><input type=email value=default@default.invalid> This email field has the initial value "default@default.invalid".</p>
<p><input type=password value=DEFAULT> This password field has the initial value "DEFAULT".</p>
<p><input type=date value=2015-01-01> This date field has the initial value "2015-01-01".</p>
<p><input type=month value=2015-01> This month field has the initial value "2015-01".</p>
<p><input type=week value=2015-W01> This week field has the initial value "2015-W01".</p>
<p><input type=time value=12:00> This time field has the initial value "12:00".</p>
<p><input type=datetime-local value=2015-01-01T12:00> This datetime (local) field has the initial value "2015-01-01T12:00".</p>
<p><input type=number value=1> This number field has the initial value "1".</p>
<p><input type=range value=1> This range control has the initial value "1".</p>
<p><input type=color value=#ff0000> This color picker has the initial value "#FF0000".</p>
<p><input type="button" value="Clone" onclick="clone();"></p>
</form>
<script>
setup(function() {
let form = document.getElementsByTagName("form")[0];
let inputs = form.getElementsByTagName("input");
inputs[0].checked = true;
inputs[1].checked = false;
inputs[2].checked = true;
inputs[4].value = "CHANGED\nCHANGED";
inputs[5].value = "CHANGED";
inputs[6].value = "CHANGED";
inputs[7].value = "CHANGED";
inputs[8].value = "https://changed.invalid/";
inputs[9].value = "changed@changed.invalid";
inputs[10].value = "CHANGED";
inputs[11].value = "2016-01-01";
inputs[12].value = "2016-01";
inputs[13].value = "2016-W01";
inputs[14].value = "12:30";
inputs[15].value = "2016-01-01T12:30";
inputs[16].value = "2";
inputs[17].value = "2";
inputs[18].value = "#00ff00";
let clone = form.cloneNode(true);
document.body.appendChild(clone);
});
test(function() {
let clone = document.getElementsByTagName("form")[1];
let inputs = clone.getElementsByTagName("input");
assert_true(inputs[0].checked, "Should have retained checked state");
}, "Checkbox must retain checked state.");
test(function() {
let clone = document.getElementsByTagName("form")[1];
let inputs = clone.getElementsByTagName("input");
assert_false(inputs[1].checked, "Should have retained unchecked state");
}, "Checkbox must retain unchecked state.");
test(function() {
let clone = document.getElementsByTagName("form")[1];
let inputs = clone.getElementsByTagName("input");
assert_true(inputs[2].checked, "Should have retained checked state");
}, "Radiobutton must retain checked state.");
test(function() {
let clone = document.getElementsByTagName("form")[1];
let inputs = clone.getElementsByTagName("input");
assert_false(inputs[3].checked, "Should have retained unchecked state");
}, "Radiobutton must retain unchecked state.");
test(function() {
let clone = document.getElementsByTagName("form")[1];
let inputs = clone.getElementsByTagName("input");
assert_equals(inputs[4].value, "CHANGED\nCHANGED", "Should have retained the changed value.");
}, "Hidden field must retain changed value.");
test(function() {
let clone = document.getElementsByTagName("form")[1];
let inputs = clone.getElementsByTagName("input");
assert_equals(inputs[5].value, "CHANGED", "Should have retained the changed value.");
}, "Text field must retain changed value.");
test(function() {
let clone = document.getElementsByTagName("form")[1];
let inputs = clone.getElementsByTagName("input");
assert_equals(inputs[6].value, "CHANGED", "Should have retained the changed value.");
}, "Search field must retain changed value.");
test(function() {
let clone = document.getElementsByTagName("form")[1];
let inputs = clone.getElementsByTagName("input");
assert_equals(inputs[7].value, "CHANGED", "Should have retained the changed value.");
}, "Phone number field must retain changed value.");
test(function() {
let clone = document.getElementsByTagName("form")[1];
let inputs = clone.getElementsByTagName("input");
assert_equals(inputs[8].value, "https://changed.invalid/", "Should have retained the changed value.");
}, "URL field must retain changed value.");
test(function() {
let clone = document.getElementsByTagName("form")[1];
let inputs = clone.getElementsByTagName("input");
assert_equals(inputs[9].value, "changed@changed.invalid", "Should have retained the changed value.");
}, "Email field must retain changed value.");
test(function() {
let clone = document.getElementsByTagName("form")[1];
let inputs = clone.getElementsByTagName("input");
assert_equals(inputs[10].value, "CHANGED", "Should have retained the changed value.");
}, "Password field must retain changed value.");
test(function() {
let clone = document.getElementsByTagName("form")[1];
let inputs = clone.getElementsByTagName("input");
assert_equals(inputs[11].value, "2016-01-01", "Should have retained the changed value.");
}, "Date field must retain changed value.");
test(function() {
let clone = document.getElementsByTagName("form")[1];
let inputs = clone.getElementsByTagName("input");
assert_equals(inputs[12].value, "2016-01", "Should have retained the changed value.");
}, "Month field must retain changed value.");
test(function() {
let clone = document.getElementsByTagName("form")[1];
let inputs = clone.getElementsByTagName("input");
assert_equals(inputs[13].value, "2016-W01", "Should have retained the changed value.");
}, "Week field must retain changed value.");
test(function() {
let clone = document.getElementsByTagName("form")[1];
let inputs = clone.getElementsByTagName("input");
assert_equals(inputs[14].value, "12:30", "Should have retained the changed value.");
}, "Time field must retain changed value.");
test(function() {
let clone = document.getElementsByTagName("form")[1];
let inputs = clone.getElementsByTagName("input");
assert_equals(inputs[15].value, "2016-01-01T12:30", "Should have retained the changed value.");
}, "Datetime (local) field must retain changed value.");
test(function() {
let clone = document.getElementsByTagName("form")[1];
let inputs = clone.getElementsByTagName("input");
assert_equals(inputs[16].value, "2", "Should have retained the changed value.");
}, "Number field must retain changed value.");
test(function() {
let clone = document.getElementsByTagName("form")[1];
let inputs = clone.getElementsByTagName("input");
assert_equals(inputs[17].value, "2", "Should have retained the changed value.");
}, "Range control must retain changed value.");
test(function() {
let clone = document.getElementsByTagName("form")[1];
let inputs = clone.getElementsByTagName("input");
assert_equals(inputs[18].value, "#00ff00", "Should have retained the changed value.");
}, "Color picker must retain changed value.");
</script>

View file

@ -16,7 +16,7 @@
<input id="too_large_value" type="date" value="2099-01-31" min="2011-01-01" max="2011-12-31"/>
<input id="invalid_min" type="date" value="2011-01-01" min="1999-1" max="2011-12-31"/>
<input id="invalid_max" type="date" value="2011-01-01" min="2011-01-01" max="2011-13-162-777"/>
<input id="min_larger_than_max" type="date" value="2011-01-01" min="2099-01" max="2011-12-31"/>
<input id="min_larger_than_max" type="date" value="2011-01-01" min="2099-01-01" max="2011-12-31"/>
<input id="invalid_value" type="date" value="invalid-date" min="2011-01-01" max="2011-12-31"/>
</div>
@ -29,20 +29,20 @@
test(function() {
assert_equals(document.getElementById("valid").value, "2011-11-01");
assert_equals(document.getElementById("too_small_value").value, "2011-01-01");
assert_equals(document.getElementById("too_large_value").value, "2011-12-31");
assert_equals(document.getElementById("too_small_value").value, "1999-01-31");
assert_equals(document.getElementById("too_large_value").value, "2099-01-31");
}, "The value attribute, if specified and not empty, must have a value that is a valid date string.");
test(function() {
assert_equals(document.getElementById("valid").min, "2011-01-01"),
assert_equals(document.getElementById("invalid_min").min, "")
}, "The min attribute, if specified, must have a value that is a valid date string.");
assert_equals(document.getElementById("valid").min, "2011-01-01");
assert_equals(document.getElementById("invalid_min").min, "1999-1");
}, "The min attribute must be reflected verbatim by the min property.");
test(function() {
assert_equals(document.getElementById("valid").max, "2011-12-31"),
assert_equals(document.getElementById("min_larger_than_max").max, "2099-01"),
assert_equals(document.getElementById("invalid_max").max, "")
},"The max attribute, if specified, must have a value that is a valid date string.");
assert_equals(document.getElementById("valid").max, "2011-12-31");
assert_equals(document.getElementById("min_larger_than_max").max, "2011-12-31");
assert_equals(document.getElementById("invalid_max").max, "2011-13-162-777");
}, "The max attribute must be reflected verbatim by the max property.");
test(function() {
assert_equals(document.getElementById("invalid_value").value, "");

View file

@ -1,7 +1,7 @@
<!DOCTYPE html>
<html>
<head>
<title>Date & Time Inputs</title>
<title>Date and Time Inputs</title>
<meta name=viewport content="width=device-width, maximum-scale=1.0, user-scalable=no" />
<link rel="author" title="Fabrice Clari" href="mailto:f.clari@inno-group.com">
<link rel="author" title="Dimitri Bocquet" href="mailto:Dimitri.Bocquet@mosquito-fp7.eu">
@ -11,11 +11,11 @@
</head>
<body>
<h1>Date & Time Inputs</h1>
<h1>Date and Time Inputs</h1>
<div style="display: none">
<input type="date" value="2011-12-01" min="2011-12-01" max="2011-12-31" step="5" />
<input type="time" value= "12:00" min="11:30" max="14:00" step="600" />
<input type="datetime" value="2011-12-01T12:00Z" min="2011-12-01T12:00Z" max="2011-12-31T22:00Z" step="7200" />
<input type="datetime-local" value="2011-12-01T12:00" min="2011-12-01T12:00" max="2011-12-31T22:00" step="7200" />
<input type="month" value="2011-01" min="2011-01" max="2011-12" step="2" />
<input type="week" value="2011-W40" min="2011-W20" max="2011-W50" step="2" />
</div>
@ -54,19 +54,19 @@
test(function() {assert_true(typeof(document.getElementsByTagName("input")[1].stepDown) == "function")}, "[time] stepDown method support on input 'time' element", {
"help" : "https://html.spec.whatwg.org/multipage/#dom-input-stepdown" });
test(function() {assert_equals(document.getElementsByTagName("input")[2].type, "datetime")}, "datetime type support on input element", {
test(function() {assert_equals(document.getElementsByTagName("input")[2].type, "datetime-local")}, "datetime-local type support on input element", {
"help" : "https://html.spec.whatwg.org/multipage/#dom-input-type" });
test(function() {assert_equals(document.getElementsByTagName("input")[2].value, "2011-12-01T12:00Z")}, "[datetime] The must be a valid global date and time string", {
test(function() {assert_equals(document.getElementsByTagName("input")[2].value, "2011-12-01T12:00")}, "[datetime-local] The must be a valid local date and time string", {
"help" : "https://html.spec.whatwg.org/multipage/#dom-input-value" });
test(function() {assert_equals(document.getElementsByTagName("input")[2].min, "2011-12-01T12:00Z")}, "[datetime] The min attribute must have a value that is a valid global date and time string", {
test(function() {assert_equals(document.getElementsByTagName("input")[2].min, "2011-12-01T12:00")}, "[datetime-local] The min attribute must have a value that is a valid local date and time string", {
"help" : "https://html.spec.whatwg.org/multipage/#dom-input-min" });
test(function() {assert_equals(document.getElementsByTagName("input")[2].max, "2011-12-31T22:00Z")}, "[datetime] The max attribute must have a value that is a valid global date and time string", {
test(function() {assert_equals(document.getElementsByTagName("input")[2].max, "2011-12-31T22:00")}, "[datetime-local] The max attribute must have a value that is a valid local date and time string", {
"help" : "https://html.spec.whatwg.org/multipage/#dom-input-max" });
test(function() {assert_equals(document.getElementsByTagName("input")[2].step, "7200")}, "[datetime] The step attribute must be expressed in seconds", {
test(function() {assert_equals(document.getElementsByTagName("input")[2].step, "7200")}, "[datetime-local] The step attribute must be expressed in seconds", {
"help" : "https://html.spec.whatwg.org/multipage/#dom-input-step" });
test(function() {assert_true(typeof(document.getElementsByTagName("input")[2].stepUp) == "function")}, "[datetime] stepUp method support on input 'datetime' element", {
test(function() {assert_true(typeof(document.getElementsByTagName("input")[2].stepUp) == "function")}, "[datetime-local] stepUp method support on input 'datetime-local' element", {
"help" : "https://html.spec.whatwg.org/multipage/#dom-input-stepup" });
test(function() {assert_true(typeof(document.getElementsByTagName("input")[2].stepDown) == "function")}, "[datetime] stepDown method support on input 'datetime' element", {
test(function() {assert_true(typeof(document.getElementsByTagName("input")[2].stepDown) == "function")}, "[datetime-local] stepDown method support on input 'datetime-local' element", {
"help" : "https://html.spec.whatwg.org/multipage/#dom-input-stepdown" });
test(function() {assert_equals(document.getElementsByTagName("input")[3].type, "month")}, "month type support on input element", {

View file

@ -2,7 +2,7 @@
<meta charset=utf-8>
<title>Form input type=number</title>
<link rel="author" title="Denis Ah-Kang" href="mailto:denis@w3.org">
<link rel=help href="https://html.spec.whatwg.org/multipage/#password-state-(type=number)">
<link rel=help href="https://html.spec.whatwg.org/multipage/#number-state-(type=number)">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
@ -29,14 +29,14 @@
{value: "Infinity", expected: "", testname: " value = Infinity"},
{value: "-Infinity", expected: "", testname: "value = -Infinity"},
{value: "NaN", expected: "", testname: "value = NaN"},
{value: "9007199254740993", expected: "9007199254740992", testname: "value = 2^53+1"},
{value: "9007199254740993", expected: "9007199254740993", testname: "value = 2^53+1"},
{value: "2e308", expected: "", testname: "value >= Number.MAX_VALUE"},
{value: "1e", expected: "", testname: "value = 1e"},
{value: "+1", expected: "1", testname: "value = +1"},
{value: "+1", expected: "", testname: "value = +1"},
{value: "+", expected: "", testname: "value = '+'"},
{value: "-", expected: "", testname: "value = '-'"},
{value: " 1", expected: "1", testname: "value with a leading whitespace"},
{value: "1trailing junk", expected: "1", testname: "value = 1trailing junk"}
{value: " 1", expected: "", testname: "value with a leading whitespace"},
{value: "1trailing junk", expected: "", testname: "value = 1trailing junk"}
];
for (var i = 0; i < numbers.length; i++) {
var w = numbers[i];

View file

@ -71,24 +71,30 @@
}
);
// HTML5 spec says the default vaules of min and max attributes are 0 and 100 respectively,
// however, Chrome, Opera and Firefox would not give any default value at all...
test(
function() {
assert_equals(document.getElementById('illegal_min_and_max').min, "0")
assert_equals(document.getElementById('illegal_min_and_max').min, "ab")
},
"Illegal value of min attribute",
{
"help" : "https://html.spec.whatwg.org/multipage/#range-state-(type=range)"
"help" : [
"https://html.spec.whatwg.org/multipage/#dom-input-min",
"https://html.spec.whatwg.org/multipage/#range-state-(type=range)"
]
}
);
test(
function() {
assert_equals(document.getElementById('illegal_min_and_max').max, "100")
assert_equals(document.getElementById('illegal_min_and_max').max, "f")
},
"Illegal value of max attribute",
{ "help" : "https://html.spec.whatwg.org/multipage/#range-state-(type=range)" }
{
"help" : [
"https://html.spec.whatwg.org/multipage/#dom-input-max",
"https://html.spec.whatwg.org/multipage/#range-state-(type=range)"
]
}
);
test(
@ -103,10 +109,15 @@
test(
function() {
assert_equals(document.getElementById('illegal_value_and_step').step, "1")
assert_equals(document.getElementById('illegal_value_and_step').step, "xyz")
},
"Converting an illegal string to the default step",
{ "help" : "https://html.spec.whatwg.org/multipage/#range-state-(type=range)" }
"Illegal value of step attribute",
{
"help" : [
"https://html.spec.whatwg.org/multipage/#dom-input-step",
"https://html.spec.whatwg.org/multipage/#range-state-(type=range)"
]
}
);
test(
@ -131,7 +142,7 @@
test(
function() {
assert_equals(document.getElementById('empty_attributes').min, "0")
assert_equals(document.getElementById('empty_attributes').min, "")
},
"default value of min attribute in input type=range",
{ "help" : "https://html.spec.whatwg.org/multipage/#dom-input-min" }
@ -139,7 +150,7 @@
test(
function() {
assert_equals(document.getElementById('empty_attributes').max, "100")
assert_equals(document.getElementById('empty_attributes').max, "")
},
"default value of max attribute in input type=range",
{

View file

@ -2,8 +2,8 @@
<meta charset=utf-8>
<title>Form input type=time</title>
<link rel="author" title="Denis Ah-Kang" href="mailto:denis@w3.org">
<link rel=help href="https://html.spec.whatwg.org/multipage/multipage/common-microsyntaxes.html#times">
<link rel=help href="https://html.spec.whatwg.org/multipage/multipage/states-of-the-type-attribute.html#time-state-(type=time)">
<link rel=help href="https://html.spec.whatwg.org/multipage/#times">
<link rel=help href="https://html.spec.whatwg.org/multipage/#time-state-(type=time)">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
@ -23,9 +23,9 @@
{value: "00:60:00.000", expected: "", testname: "Invalid value: minute > 59. Value should be empty"},
{value: "00:00:60.000", expected: "", testname: "Invalid value: second > 59. Value should be empty"},
{value: "12:00:00.001", attributes: { min: "12:00:00.000" }, expected: "12:00:00.001", testname: "Value >= min attribute"},
{value: "12:00:00.000", attributes: { min: "12:00:00.001" }, expected: "12:00:00.001", testname: "Value < min attribute"},
{value: "12:00:00.000", attributes: { min: "12:00:00.001" }, expected: "12:00:00.000", testname: "Value < min attribute"},
{value: "12:00:00.000", attributes: { max: "12:00:00.001" }, expected: "12:00:00.000", testname: "Value <= max attribute"},
{value: "12:00:00.001", attributes: { max: "12:00:00.000" }, expected: "12:00:00.000", testname: "Value > max attribute"}
{value: "12:00:00.001", attributes: { max: "12:00:00.000" }, expected: "12:00:00.001", testname: "Value > max attribute"}
];
for (var i = 0; i < times.length; i++) {
var w = times[i];

View file

@ -51,79 +51,172 @@ test(function(){
_StepTest.value = "12:00";
_StepTest.step = "";
_StepTest.stepUp();
assert_equals(_StepTest.value,"12:01");
assert_in_array(
_StepTest.value,
[
"12:01",
"12:01:00",
"12:01:00.0",
"12:01:00.00",
"12:01:00.000"],
"a valid time string representing 1 minute after noon");
} , "stepUp step value empty on default step value ");
test(function(){
_StepTest.value = "12:00";
_StepTest.step = "";
_StepTest.stepDown();
assert_equals(_StepTest.value,"11:59");
assert_in_array(
_StepTest.value,
[
"11:59",
"11:59:00",
"11:59:00.0",
"11:59:00.00",
"11:59:00.000"],
"a valid time string representing 1 minute before noon");
}, "stepDown step value empty default step value");
test(function(){
_StepTest.value = "12:00";
_StepTest.step = "-600";
_StepTest.stepUp();
assert_equals(_StepTest.value, "12:01");
assert_in_array(
_StepTest.value,
[
"12:01",
"12:01:00",
"12:01:00.0",
"12:01:00.00",
"12:01:00.000"],
"a valid time string representing 1 minute after noon");
},"stepUp on step value minus");
test(function(){
_StepTest.value = "12:00";
_StepTest.step = "-600";
_StepTest.stepDown();
assert_equals(_StepTest.value, "11:59");
assert_in_array(
_StepTest.value,
[
"11:59",
"11:59:00",
"11:59:00.0",
"11:59:00.00",
"11:59:00.000"],
"a valid time string representing 1 minute before noon");
},"stepDown on step value minus");
test(function(){
_StepTest.value = "12:00";
_StepTest.step = "0";
_StepTest.stepUp();
assert_equals(_StepTest.value, "12:01");
assert_in_array(
_StepTest.value,
[
"12:01",
"12:01:00",
"12:01:00.0",
"12:01:00.00",
"12:01:00.000"],
"a valid time string representing 1 minute after noon");
} , "stepUp on step value zero ");
test(function(){
_StepTest.value = "12:00";
_StepTest.step = "0";
_StepTest.stepDown();
assert_equals(_StepTest.value, "11:59");
assert_in_array(
_StepTest.value,
[
"11:59",
"11:59:00",
"11:59:00.0",
"11:59:00.00",
"11:59:00.000"],
"a valid time string representing 1 minute before noon");
} , "stepDown on step value zero ");
test(function(){
_StepTest.value = "00:00";
_StepTest.step = "86399";
_StepTest.stepUp();
assert_equals(_StepTest.value, "23:59:59");
assert_in_array(
_StepTest.value,
[
"23:59:59",
"23:59:59.0",
"23:59:59.00",
"23:59:59.000"],
"a valid time string representing 1 second before midnight");
} , "stepUp on step value 24 hour");
test(function(){
_StepTest.value = "23:59:59";
_StepTest.step = "86399";
_StepTest.stepDown();
assert_equals(_StepTest.value, "00:00:00");
assert_in_array(
_StepTest.value,
[
"00:00",
"00:00:00",
"00:00:00.0",
"00:00:00.00",
"00:00:00.000"],
"a valid time string representing midnight");
} , "stepDown on step value 24 hour ");
test(function(){
_StepTest.value = "12:00";
_StepTest.step = "3600";
_StepTest.stepUp();
assert_equals(_StepTest.value, "13:00");
assert_in_array(
_StepTest.value,
[
"13:00",
"13:00:00",
"13:00:00.0",
"13:00:00.00",
"13:00:00.000"],
"a valid time string representing 1pm");
} , "stepUp on step value hour ");
test(function(){
_StepTest.value = "12:00";
_StepTest.step = "3600";
_StepTest.stepDown();
assert_equals(_StepTest.value, "11:00");
assert_in_array(
_StepTest.value,
[
"11:00",
"11:00:00",
"11:00:00.0",
"11:00:00.00",
"11:00:00.000"],
"a valid time string representing 11am");
} , "stepDown on step value hour ");
test(function(){
_StepTest.value = "12:00";
_StepTest.step = "1";
_StepTest.stepUp();
assert_equals(_StepTest.value, "12:00:01");
assert_in_array(
_StepTest.value,
[
"12:00:01",
"12:00:01.0",
"12:00:01.00",
"12:00:01.000"],
"a valid time string representing 1 second after noon");
} , "stepUp on step value second ");
test(function(){
_StepTest.value = "12:00";
_StepTest.step = "1";
_StepTest.stepDown();
assert_equals(_StepTest.value, "11:59:59");
assert_in_array(
_StepTest.value,
[
"11:59:59",
"11:59:59.0",
"11:59:59.00",
"11:59:59.000"],
"a valid time string representing 1 second before noon");
} , "stepDown on step value second ");
test(function(){
@ -131,64 +224,118 @@ test(function(){
_StepTest.step = "0.001";
_StepTest.stepUp();
assert_equals(_StepTest.value, "12:00:00.001");
} , "stepUp on step value miri second ");
} , "stepUp on step value with fractional seconds");
test(function(){
_StepTest.value = "12:00";
_StepTest.step = "0.001";
_StepTest.stepDown();
assert_equals(_StepTest.value, "11:59:59.999");
} , "stepDown on step value miri second ");
} , "stepDown on step value with fractional seconds");
test(function(){
_StepTest.value = "13:00:00";
_StepTest.step = "1";
_StepTest.stepUp(2);
assert_equals(_StepTest.value, "13:00:02");
}, "stepUp argment 2 times");
assert_in_array(
_StepTest.value,
[
"13:00:02",
"13:00:02.0",
"13:00:02.00",
"13:00:02.000"],
"a valid time string representing 2 seconds after 1pm");
}, "stepUp argument 2 times");
test(function(){
_StepTest.value = "13:00:00";
_StepTest.step = "1";
_StepTest.stepDown(2);
assert_equals(_StepTest.value, "12:59:58");
}, "stepDown argment 2 times");
assert_in_array(
_StepTest.value,
[
"12:59:58",
"12:59:58.0",
"12:59:58.00",
"12:59:58.000"],
"a valid time string representing 2 seconds before 1pm");
}, "stepDown argument 2 times");
test(function(){
_StepTest.max = "15:00";
this.add_cleanup(function() { _StepTest.max = ""; });
_StepTest.value = "15:00";
_StepTest.stepUp();
assert_equals(_StepTest.value, "15:00");
_StepTest.max = "";
assert_in_array(
_StepTest.value,
[
"15:00",
"15:00:00",
"15:00:00.0",
"15:00:00.00",
"15:00:00.000"],
"a valid time string representing 3pm");
} , "stepUp stop because it exceeds the maximum value");
test(function(){
_StepTest.min = "13:00";
this.add_cleanup(function() { _StepTest.min = ""; });
_StepTest.value = "13:00";
_StepTest.stepDown();
assert_equals(_StepTest.value, "13:00");
_StepTest.min="";
} , "stepDown Stop so lower than the minimum value");
assert_in_array(
_StepTest.value,
[
"13:00",
"13:00:00",
"13:00:00.0",
"13:00:00.00",
"13:00:00.000"],
"a valid time string representing 1pm");
} , "stepDown stop so lower than the minimum value");
test(function(){
_StepTest.max = "15:01";
this.add_cleanup(function() { _StepTest.max = ""; });
_StepTest.value = "15:00";
_StepTest.step = "120";
_StepTest.stepUp();
assert_equals(_StepTest.value, "15:01");
_StepTest.max = "";
assert_in_array(
_StepTest.value,
[
"15:01",
"15:01:00",
"15:01:00.0",
"15:01:00.00",
"15:01:00.000"],
"a valid time string representing 1 minute after 3pm");
} , "stop at border on stepUp");
test(function(){
_StepTest.min = "12:59";
this.add_cleanup(function() { _StepTest.min = ""; });
_StepTest.value = "13:00";
_StepTest.step = "120";
_StepTest.stepDown();
assert_equals(_StepTest.value, "12:59");
_StepTest.min="";
assert_in_array(
_StepTest.value,
[
"12:59",
"12:59:00",
"12:59:00.0",
"12:59:00.00",
"12:59:00.000"],
"a valid time string representing 1 minute before 2pm");
} , "stop at border on stepDown");
test(function(){
_StepTest.value = "";
_StepTest.step = "60";
_StepTest.stepUp();
assert_equals(_StepTest.value, "00:01");
assert_in_array(
_StepTest.value,
[
"00:01",
"00:01:00",
"00:01:00.0",
"00:01:00.00",
"00:01:00.000"],
"a valid time string representing 1 minute after midnight");
} , " empty value of stepUp");

View file

@ -19,9 +19,9 @@
{value: "-W52", expected: "", testname: "Invalid value: yearless week"},
{value: "W52", expected: "", testname: "Invalid value: yearless week and no '-' (U+002D)"},
{value: "2014-W03", attributes: { min: "2014-W02" }, expected: "2014-W03", testname: "Value >= min attribute"},
{value: "2014-W01", attributes: { min: "2014-W02" }, expected: "2014-W02", testname: "Value < min attribute"},
{value: "2014-W01", attributes: { min: "2014-W02" }, expected: "2014-W01", testname: "Value < min attribute"},
{value: "2014-W10", attributes: { max: "2014-W11" }, expected: "2014-W10", testname: "Value <= max attribute"},
{value: "2014-W12", attributes: { max: "2014-W11" }, expected: "2014-W11", testname: "Value > max attribute"}
{value: "2014-W12", attributes: { max: "2014-W11" }, expected: "2014-W12", testname: "Value > max attribute"}
];
for (var i = 0; i < weeks.length; i++) {
var w = weeks[i];

View file

@ -103,11 +103,12 @@ test(function() {
}, "Check if the input element in radio state can access 'labels'");
test(function() {
assert_equals(document.getElementById("lbl7").control.id, "testkeygen", "A keygen element should be labelable.");
}, "Check if the keygen element is a labelable element");
assert_not_equals(document.getElementById("lbl7").control, document.getElementById("testkeygen"));
assert_equals(document.getElementById("lbl7").control, null, "A keygen element should not be labelable.");
}, "Check if the keygen element is not a labelable element");
test(function() {
testLabelsAttr("testkeygen", "lbl7");
assert_equals(document.getElementById("testkeygen").labels, undefined);
}, "Check if the keygen element can access 'labels'");
test(function() {

View file

@ -0,0 +1,95 @@
<!doctype html>
<meta charset=utf-8>
<title>HTMLSelectElement.checkValidity</title>
<link rel="help" href="https://html.spec.whatwg.org/multipage/forms.html#the-select-element:attr-select-required-4">
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<div id=log></div>
<script>
test(function() {
var select = document.createElement('select');
assert_true(select.willValidate, "A select element is a submittable element that is a candidate for constraint validation.");
var placeholder = document.createElement('option');
select.appendChild(placeholder);
assert_true(select.checkValidity(), "Always valid when the select isn't a required value.");
select.required = true;
assert_true(placeholder.selected, "If display size is 1, multiple is absent and no options have selectedness true, the first option is selected.");
assert_equals(select.value, "", "The placeholder's value should be the select's value right now");
assert_false(select.checkValidity(), "A selected placeholder option should invalidate the select.");
var emptyOption = document.createElement('option');
select.appendChild(emptyOption);
emptyOption.selected = true;
assert_equals(select.value, "", "The empty value should be set.");
assert_true(select.checkValidity(), "An empty non-placeholder option should be a valid choice.");
var filledOption = document.createElement('option');
filledOption.value = "test";
select.appendChild(filledOption);
filledOption.selected = true;
assert_equals(select.value, "test", "The non-empty value should be set.");
assert_true(select.checkValidity(), "A non-empty non-placeholder option should be a valid choice.");
select.removeChild(placeholder);
select.appendChild(emptyOption); // move emptyOption to second place
emptyOption.selected = true;
assert_equals(select.value, "", "The empty value should be set.");
assert_true(select.checkValidity(), "Only the first option can be seen as a placeholder.");
placeholder.disabled = true;
select.insertBefore(placeholder, filledOption);
placeholder.selected = true;
assert_equals(select.value, "", "A disabled first placeholder option should result in an empty value.");
assert_false(select.checkValidity(), "A disabled first placeholder option should invalidate the select.");
}, "Placeholder label options within a select");
test(function() {
var select = document.createElement('select');
select.required = true;
var optgroup = document.createElement('optgroup');
var emptyOption = document.createElement('option');
optgroup.appendChild(emptyOption);
select.appendChild(optgroup);
emptyOption.selected = true;
assert_equals(select.value, "", "The empty value should be set.");
assert_true(select.checkValidity(), "The first option is not considered a placeholder if it is located within an optgroup.");
var otherEmptyOption = document.createElement('option');
otherEmptyOption.value = "";
select.appendChild(otherEmptyOption);
otherEmptyOption.selected = true;
assert_equals(select.value, "", "The empty value should be set.");
assert_true(select.checkValidity(), "The empty option should be accepted as it is not the first option in the tree ordered list.");
}, "Placeholder label-like options within optgroup");
test(function() {
var select = document.createElement('select');
select.required = true;
select.size = 2;
var emptyOption = document.createElement('option');
select.appendChild(emptyOption);
assert_false(emptyOption.selected, "Display size is not 1, so the first option should not be selected.");
assert_false(select.checkValidity(), "If no options are selected the select must be seen as invalid.");
emptyOption.selected = true;
assert_true(select.checkValidity(), "If one option is selected, the select should be considered valid.");
var otherEmptyOption = document.createElement('option');
otherEmptyOption.value = "";
select.appendChild(otherEmptyOption);
otherEmptyOption.selected = true;
assert_false(emptyOption.selected, "Whenever an option has its selectiveness set to true, the other options must be set to false.");
otherEmptyOption.selected = false;
assert_false(otherEmptyOption.selected, "It should be possible to set the selectiveness to false with a display size more than one.");
assert_false(select.checkValidity(), "If no options are selected the select must be seen as invalid.");
}, "Validation on selects with display size set as more than one");
test(function() {
var select = document.createElement('select');
select.required = true;
select.multiple = true;
var emptyOption = document.createElement('option');
select.appendChild(emptyOption);
assert_false(select.checkValidity(), "If no options are selected the select must be seen as invalid.");
emptyOption.selected = true;
assert_true(select.checkValidity(), "If one option is selected, the select should be considered valid.");
var optgroup = document.createElement('optgroup');
optgroup.appendChild(emptyOption); // Move option to optgroup
select.appendChild(optgroup);
assert_true(select.checkValidity(), "If one option within an optgroup or not is selected, the select should be considered valid.");
}, "Validation on selects with multiple set");
</script>

View file

@ -55,11 +55,9 @@
test(function(){
assert_false(d1.open);
assert_false(b0.commandDisabled);
d1.showModal();
this.add_cleanup(function() { d1.close(); });
assert_true(d1.open);
assert_true(b0.commandDisabled);
assert_equals(document.activeElement, b1);
});
@ -80,11 +78,8 @@
test(function(){
assert_false(d3.open);
assert_false(b3.commandDisabled);
assert_false(d4.open);
assert_false(b4.commandDisabled);
assert_false(d5.open);
assert_false(b5.commandDisabled);
d3.showModal();
this.add_cleanup(function() { d3.close(); });
d4.showModal();
@ -92,11 +87,8 @@
d5.showModal();
this.add_cleanup(function() { d5.close(); });
assert_true(d3.open);
assert_true(b3.commandDisabled);
assert_true(d4.open);
assert_true(b4.commandDisabled);
assert_true(d5.open);
assert_false(b5.commandDisabled);
}, "when opening multiple dialogs, only the newest one is non-inert");
test(function(){

View file

@ -0,0 +1,134 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>summary element: activation behavior</title>
<link rel="author" title="Domenic Denicola" href="mailto:d@domenic.me">
<link rel="help" href="https://html.spec.whatwg.org/multipage/#the-summary-element">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<details id="happy-path-starts-closed">
<summary id="happy-path-starts-closed-summary">Summary</summary>
<p>Contents</p>
</details>
<details id="happy-path-starts-open" open>
<summary id="happy-path-starts-open-summary">Summary</summary>
<p>Contents</p>
</details>
<details id="details-not-being-rendered" style="display: none">
<summary id="details-not-being-rendered-summary">Summary</summary>
<p>Contents</p>
</details>
<details id="summary-not-being-rendered">
<summary id="summary-not-being-rendered-summary" style="display: none">Summary</summary>
<p>Contents</p>
</details>
<details id="has-preceding-element">
<span></span>
<summary id="has-preceding-element-summary">Summary</summary>
<p>Contents</p>
</details>
<details id="has-preceding-summary">
<summary>Summary 1</summary>
<summary id="has-preceding-summary-summary">Summary 2</summary>
<p>Contents</p>
</details>
<details id="has-preceding-summary-descendant">
<span><summary>Summary 1</summary></span>
<summary id="has-preceding-summary-descendant-summary">Summary 2</summary>
<p>Contents</p>
</details>
<details id="summary-nested">
<span><summary id="summary-nested-summary">Summary</summary></span>
<p>Contents</p>
</details>
<details id="toggle-tester">
<summary>Summary</summary>
<p>Contents</p>
</details>
<script>
"use strict";
testSummary(
"happy-path-starts-closed", false, true,
"Should open a closed details if all conditions are met"
);
testSummary(
"happy-path-starts-open", true, false,
"Should close an open details if all conditions are met"
);
testSummary(
"details-not-being-rendered", false, true,
"Should open a closed details even if the details is not being rendered"
);
testSummary(
"summary-not-being-rendered", false, true,
"Should open a closed details even if the summary is not being rendered"
);
testSummary(
"has-preceding-element", false, true,
"Should open a closed details if a span element precedes the summary"
);
testSummary(
"has-preceding-summary", false, false,
"Should stay closed if another summary element precedes the summary"
);
testSummary(
"has-preceding-summary-descendant", false, true,
"Should open a closed details if another summary element *nested inside a span* precedes the summary"
);
testSummary(
"summary-nested", false, false,
"Should stay closed if the summary element is nested inside a span element"
);
async_test(t => {
const details = document.getElementById("toggle-tester");
const summary = details.firstElementChild;
let timesToggleFired = 0;
details.addEventListener("toggle", t.step_func(() => {
++timesToggleFired;
}));
t.step_timeout(() => {
assert_equals(timesToggleFired, 1, "Expected toggle to fire exactly once");
t.done();
}, 200);
summary.click();
summary.click();
summary.click();
summary.click();
Promise.resolve().then(() => summary.click());
}, "toggle events should be coalesced even when using the activation behavior of a summary");
function testSummary(detailsId, expectedBefore, expectedAfter, name) {
test(() => {
const details = document.getElementById(detailsId);
const summary = document.getElementById(detailsId + "-summary");
assert_equals(details.open, expectedBefore, "Before activation: expected open to be " + expectedBefore);
summary.click();
assert_equals(details.open, expectedAfter, "After activation: expected open to be " + expectedAfter);
}, name);
}
</script>

View file

@ -72,7 +72,7 @@ var elements = [
["ins", "Mod"],
["isindex", "Unknown"],
["kbd", ""],
["keygen", "Keygen"],
["keygen", "Unknown"],
["label", "Label"],
["legend", "Legend"],
["li", "LI"],

View file

@ -0,0 +1,75 @@
<!DOCTYPE html>
<html>
<head>
<title>noModule IDL attribute must reflect nomodule content attribute</title>
<link rel="author" title="Yusuke Suzuki" href="mailto:utatane.tea@gmail.com">
<link rel="author" title="Ryosuke Niwa" href="mailto:rniwa@webkit.org">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<script id="classicWithoutNomodule"></script>
<script id="classicWithNomodule" nomodule></script>
<script id="moduleWithoutNomodule" type=module></script>
<script id="moduleWithNomodule" type=module nomodule></script>
<script>
test(() => {
assert_false(document.getElementById('classicWithoutNomodule').noModule);
}, 'noModule IDL attribute on a parser created classic script element without nomodule content attribute');
test(() => {
assert_true(document.getElementById('classicWithNomodule').noModule);
}, 'noModule IDL attribute on a parser created classic script element with nomodule content attribute');
test(() => {
assert_false(document.getElementById('moduleWithoutNomodule').noModule);
}, 'noModule IDL attribute on a parser created module script element without nomodule content attribute');
test(() => {
assert_true(document.getElementById('moduleWithNomodule').noModule);
}, 'noModule IDL attribute on a parser created module script element with nomodule content attribute');
test(() => {
const script = document.createElement('script');
assert_false(script.noModule);
}, 'noModule IDL attribute on a dynamically created script element without nomodule content attribute');
test(() => {
const script = document.createElement('script');
script.setAttribute('nomodule', 'nomodule');
assert_true(script.noModule);
}, 'noModule IDL attribute on a dynamically created script element after nomodule content attribute is set to "nomodule"');
test(() => {
const script = document.createElement('script');
script.setAttribute('nomodule', '');
assert_true(script.noModule);
}, 'noModule IDL attribute on a dynamically created script element after nomodule content attribute is set to ""');
test(() => {
const script = document.createElement('script');
script.setAttribute('nomodule', 'nomodule');
assert_true(script.noModule);
script.removeAttribute('nomodule');
assert_false(script.noModule);
}, 'noModule IDL attribute on a dynamically created script element after nomodule content attribute had been removed');
test(() => {
const script = document.createElement('script');
assert_false(script.hasAttribute('nomodule'));
script.noModule = true;
assert_true(script.hasAttribute('nomodule'));
}, 'noModule IDL attribute must add nomodule content attribute on setting to true');
test(() => {
const script = document.createElement('script');
script.setAttribute('nomodule', 'nomodule');
script.noModule = false;
assert_false(script.hasAttribute('nomodule'));
}, 'noModule IDL attribute must remove nomodule content attribute on setting to false');
</script>
</body>
</html>

View file

@ -0,0 +1,66 @@
<!DOCTYPE html>
<html>
<head>
<title>External classic scripts with nomodule content attribute must not run</title>
<link rel="author" title="Yusuke Suzuki" href="mailto:utatane.tea@gmail.com">
<link rel="author" title="Ryosuke Niwa" href="mailto:rniwa@webkit.org">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<!-- Load this script synchronously to ensure test cases below can load it in 200ms -->
<script src="resources/set-script-executed.js"></script>
</head>
<body>
<script>
waitForLoadEvent = new Promise((resolve) => {
window.onload = resolve;
});
waitForAsyncScript = () => {
return new Promise((resolve) => {
waitForLoadEvent.then(() => setTimeout(resolve, 200));
});
}
let readyForSecondTest;
promise_test(() => {
window.executed = false;
let loaded = false;
let errored = false;
let script = document.createElement('script');
script.src = './resources/set-script-executed.js';
script.onload = () => loaded = true;
script.onerror = () => errored = true;
script.noModule = false;
document.body.appendChild(script);
return waitForAsyncScript().then(() => {
assert_true(executed);
assert_true(loaded);
assert_false(errored);
});
}, 'An asynchronously loaded classic script with noModule set to false must run');
promise_test(() => {
window.executed = false;
let loaded = false;
let errored = false;
let script = document.createElement('script');
script.src = './resources/set-script-executed.js';
script.onload = () => loaded = true;
script.onerror = () => errored = true;
script.noModule = true;
document.body.appendChild(script);
return waitForAsyncScript().then(() => {
assert_false(executed);
assert_false(loaded);
assert_false(errored);
});
}, 'An asynchronously loaded classic script with noModule set to true must not run');
</script>
</body>
</html>

View file

@ -0,0 +1,28 @@
<!DOCTYPE html>
<html>
<head>
<title>An external module script with nomodule must run</title>
<link rel="author" title="Yusuke Suzuki" href="mailto:utatane.tea@gmail.com">
<link rel="author" title="Ryosuke Niwa" href="mailto:rniwa@webkit.org">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<script nomodule type="module" src="./resources/exports-cocoa.js"></script>
<script>
waitForLoadEvent = new Promise((resolve) => {
window.onload = resolve;
});
promise_test(() => {
return waitForLoadEvent.then(() => {
assert_equals(typeof cocoa, 'undefined');
assert_equals(typeof exportedCocoa, 'object');
assert_equals(exportedCocoa.taste(), 'awesome');
});
}, 'An external module script with nomodule content attribute must run');
</script>
</body>
</html>

View file

@ -0,0 +1,56 @@
<!DOCTYPE html>
<html>
<head>
<title>Inline classic scripts with nomodule content attribute must not run</title>
<link rel="author" title="Yusuke Suzuki" href="mailto:utatane.tea@gmail.com">
<link rel="author" title="Ryosuke Niwa" href="mailto:rniwa@webkit.org">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<script>
window.executed = true;
</script>
<script>
test(() => {
assert_true(executed);
}, 'An inline classic script without nomodule content attribute must run');
window.executed = false;
</script>
<script nomodule>
window.executed = true;
</script>
<script>
test(() => {
assert_false(executed);
}, 'An inline classic script with nomodule content attribute must not run');
</script>
<script>
test(() => {
window.executed = false;
const element = document.createElement("script");
element.noModule = false;
element.textContent = `window.executed = true`;
document.body.appendChild(element);
assert_true(window.executed);
}, 'An inline classic script element dynamically inserted after noModule was set to false must run.');
test(() => {
window.executed = false;
const element = document.createElement("script");
element.noModule = true;
element.textContent = `window.executed = true`;
document.body.appendChild(element);
assert_false(window.executed);
}, 'An inline classic script element dynamically inserted after noModule was set to true must not run.');
window.executed = false;
</script>
</body>
</html>

View file

@ -0,0 +1,32 @@
<!DOCTYPE html>
<html>
<head>
<title>An inline module script with nomodule must run</title>
<link rel="author" title="Yusuke Suzuki" href="mailto:utatane.tea@gmail.com">
<link rel="author" title="Ryosuke Niwa" href="mailto:rniwa@webkit.org">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<script nomodule type="module">
import Cocoa from "./resources/cocoa-module.js";
var cocoa = new Cocoa();
window.exportedCocoa = cocoa;
</script>
<script>
waitForLoadEvent = new Promise((resolve) => {
window.onload = resolve;
});
promise_test(() => {
return waitForLoadEvent.then(() => {
assert_equals(typeof cocoa, 'undefined');
assert_equals(typeof exportedCocoa, 'object');
assert_equals(exportedCocoa.taste(), 'awesome');
});
}, 'An inline module script with nomodule content attribute must run');
</script>
</body>
</html>

View file

@ -0,0 +1,46 @@
<!DOCTYPE html>
<html>
<head>
<title>External classic scripts with nomodule content attribute must not run</title>
<link rel="author" title="Yusuke Suzuki" href="mailto:utatane.tea@gmail.com">
<link rel="author" title="Ryosuke Niwa" href="mailto:rniwa@webkit.org">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<script>
window.executed = false;
window.loaded = false;
window.errored = false;
</script>
<script src="./resources/set-script-executed.js" onload="loaded = true" onerror="errored = false"></script>
<script>
test(() => {
assert_true(executed);
assert_true(loaded);
assert_false(errored);
}, 'A synchronously loaded external classic script without nomodule content attribute must run');
window.executed = false;
window.loaded = false;
window.errored = false;
</script>
<script nomodule src="./resources/set-script-executed.js" onload="loaded = true" onerror="errored = false"></script>
<script>
test(() => {
assert_false(executed);
assert_false(loaded);
assert_false(errored);
}, 'A synchronously loaded external classic script with nomodule content attribute must not run');
waitForLoadEvent = new Promise((resolve) => {
window.onload = resolve;
});
</script>
</body>
</html>

View file

@ -0,0 +1,5 @@
export default class Cocoa {
taste() {
return "awesome";
}
};

View file

@ -0,0 +1,3 @@
import Cocoa from "./cocoa-module.js";
var cocoa = new Cocoa();
window.exportedCocoa = cocoa;

View file

@ -5,7 +5,7 @@
<meta name="author" title="Sergey G. Grekhov" href="mailto:sgrekhov@unipro.ru">
<meta name="author" title="Aleksei Yu. Semenov" href="mailto:a.semenov@unipro.ru">
<meta name="assert" content="Template element can be a descendant of the body element">
<link rel="help" href="http://www.w3.org/TR/2013/WD-html-templates-20130214/#template-element">
<link rel="help" href="https://html.spec.whatwg.org/multipage/#the-template-element">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src='/html/resources/common.js'></script>
@ -93,7 +93,7 @@ parameters = [['Template element as an indirect descendant of the BODY element.
generate_tests(templateIsAnIndirectChild, parameters,
'Template element as an indirect descendant of the HEAD, BODY and FRAMESET elements');
parameters = [['Template element as a descendant of the FRAMESET element. ' +
parameters = [['Template element as an indirect descendant of the FRAMESET element. ' +
'Template element is created by innerHTML',
frameset],
];

View file

@ -1,6 +1,7 @@
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>Creating and deleting captions</title>
<link rel="author" title="Erika Navara" href="mailto:edoyle@microsoft.com">
<link rel="help" href="https://html.spec.whatwg.org/multipage/#the-table-element" />
@ -38,6 +39,22 @@
</table>
<table id="table5" style="display:none">
</table>
<table id="table6" style="display:none">
<caption id="caption6">caption 6</caption>
<tr>
<td>cell</td>
<td>cell</td>
</tr>
</table>
<table id="table7" style="display:none">
<caption id="caption7">caption 7</caption>
<tbody id="tbody7">
<tr>
<td>cell</td>
<td>cell</td>
</tr>
</tbody>
</table>
<script>
test(function () {
var table0 = document.getElementById('table0');
@ -48,34 +65,40 @@
assert_not_equals(testCaption, table0FirstNode);
assert_equals(testCaption, table0.firstChild);
}, "createCaption method creates new caption if existing caption is not in html namespace")
test(function () {
var table1 = document.getElementById('table1');
var testCaption = table1.createCaption();
var table1FirstCaption = table1.caption;
assert_equals(testCaption, table1FirstCaption);
}, "createCaption method returns the first caption element child of the table")
test(function () {
var table2 = document.getElementById('table2');
var test2Caption = table2.createCaption();
var table2FirstNode = table2.firstChild;
assert_true(test2Caption instanceof HTMLTableCaptionElement);
assert_true(test2Caption instanceof HTMLTableCaptionElement);
assert_equals(table2FirstNode, test2Caption);
}, "createCaption method creates a new caption and inserts it as the first node of the table element")
test(function () {
var table = document.createElement('table');
assert_equals(table.createCaption(), table.createCaption());
}, "createCaption will not create new caption if one exists")
test(function () {
var table = document.createElementNS("http://www.w3.org/1999/xhtml", "foo:table")
var caption = table.createCaption();
assert_equals(caption.prefix, null);
}, "createCaption will not copy table's prefix")
test(function () {
var table3 = document.getElementById('table3');
assert_equals(table3.caption.textContent, "caption 3");
table3.deleteCaption();
assert_equals(table3.caption, null);
}, "deleteCaption method removes the first caption element child of the table element")
test(function () {
var table4 = document.getElementById('table4');
var caption = document.createElementNS("foo", "caption");
@ -83,6 +106,7 @@
table4.deleteCaption();
assert_equals(caption.parentNode, table4);
}, "deleteCaption method not remove caption that is not in html namespace")
test(function() {
var table5 = document.getElementById('table5');
var caption = document.createElement('caption');
@ -95,6 +119,45 @@
assert_not_equals(table5.caption, caption);
}, "Setting caption rethrows exception");
test(function() {
var table6 = document.getElementById("table6");
var caption = document.getElementById("caption6");
assert_equals(table6.caption, caption);
var newCaption = document.createElement("caption");
table6.caption = newCaption;
assert_equals(newCaption.parentNode, table6);
assert_equals(table6.firstChild, newCaption);
assert_equals(table6.caption, newCaption);
}, "Assigning a caption to table.caption")
test(function() {
var table7 = document.getElementById("table7");
var caption = document.getElementById("caption7");
assert_equals(table7.caption, caption);
table7.caption = null;
assert_equals(caption.parentNode, null);
assert_equals(table7.firstElementChild, document.getElementById("tbody7"));
assert_equals(table7.caption, null);
}, "Assigning null to table.caption")
test(function() {
var table8 = document.createElement("table");
var caption = document.createElement("captİon");
assert_throws(new TypeError(), function() {
table8.caption = caption;
});
}, "Assigning a non-caption to table.caption")
test(function() {
var table9 = document.createElement("table");
var caption = document.createElementNS("http://www.example.com", "caption");
assert_throws(new TypeError(), function() {
table9.caption = caption;
});
}, "Assigning a foreign caption to table.caption")
</script>
</body>
</html>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,24 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf8">
<title>HTML 5 Parser tests html5lib_innerHTML_adoption01.html</title>
<meta name="timeout" content="long">
</head>
<body>
<h1>html5lib Parser Test</h1>
<div id="log"></div>
<script src="common.js"></script>
<script src="test.js"></script>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
var num_iframes = 8;
var order = ['0bf80e1546d4c221354aa9734f61713b7d64ee6d',];
var tests = {
"0bf80e1546d4c221354aa9734f61713b7d64ee6d":[async_test('html5lib_innerHTML_adoption01.html 0bf80e1546d4c221354aa9734f61713b7d64ee6d'), "%3Cb%3E%3Cem%3E%3Cfoo%3E%3Cfoob%3E%3Cfooc%3E%3Caside%3E%3C/b%3E%3C/em%3E", "%23document%0A%7C%20%3Cb%3E%0A%7C%20%20%20%3Cem%3E%0A%7C%20%20%20%20%20%3Cfoo%3E%0A%7C%20%20%20%20%20%20%20%3Cfoob%3E%0A%7C%20%20%20%20%20%20%20%20%20%3Cfooc%3E%0A%7C%20%3Caside%3E%0A%7C%20%20%20%3Cb%3E", 'div'],
}
init_tests("innerHTML");
</script>
</body>
</html>

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,24 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf8">
<title>HTML 5 Parser tests html5lib_innerHTML_math.html</title>
<meta name="timeout" content="long">
</head>
<body>
<h1>html5lib Parser Test</h1>
<div id="log"></div>
<script src="common.js"></script>
<script src="test.js"></script>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
var num_iframes = 8;
var order = ['0e7e70d0dcf0c26593203b36cac4fa7f6325613e','fa7d4a31838dbcc16bf73672f2f4486cca185673','d9d2e4c0e926a91f5e704846cdbc855e3cb21949','c04b203803f6b3bec3db65db16854e7e624d13ef','4f95d47164955a6b163935fd8ac89ea200767330','e942ee6666e1dc938aab10fc2374a2240806b439','3537413f7f8166cb0c3a324fef8261be5628611d','c0186fb0fe26b48bcd82d58ebe0c90a423f26c28',];
var tests = {
"0e7e70d0dcf0c26593203b36cac4fa7f6325613e":[async_test('html5lib_innerHTML_math.html 0e7e70d0dcf0c26593203b36cac4fa7f6325613e'), "%3Cmath%3E%3Ctr%3E%3Ctd%3E%3Cmo%3E%3Ctr%3E", "%23document%0A%7C%20%3Cmath%20math%3E%0A%7C%20%20%20%3Cmath%20tr%3E%0A%7C%20%20%20%20%20%3Cmath%20td%3E%0A%7C%20%20%20%20%20%20%20%3Cmath%20mo%3E", 'td'],"fa7d4a31838dbcc16bf73672f2f4486cca185673":[async_test('html5lib_innerHTML_math.html fa7d4a31838dbcc16bf73672f2f4486cca185673'), "%3Cmath%3E%3Ctr%3E%3Ctd%3E%3Cmo%3E%3Ctr%3E", "%23document%0A%7C%20%3Cmath%20math%3E%0A%7C%20%20%20%3Cmath%20tr%3E%0A%7C%20%20%20%20%20%3Cmath%20td%3E%0A%7C%20%20%20%20%20%20%20%3Cmath%20mo%3E", 'tr'],"d9d2e4c0e926a91f5e704846cdbc855e3cb21949":[async_test('html5lib_innerHTML_math.html d9d2e4c0e926a91f5e704846cdbc855e3cb21949'), "%3Cmath%3E%3Cthead%3E%3Cmo%3E%3Ctbody%3E", "%23document%0A%7C%20%3Cmath%20math%3E%0A%7C%20%20%20%3Cmath%20thead%3E%0A%7C%20%20%20%20%20%3Cmath%20mo%3E", 'thead'],"c04b203803f6b3bec3db65db16854e7e624d13ef":[async_test('html5lib_innerHTML_math.html c04b203803f6b3bec3db65db16854e7e624d13ef'), "%3Cmath%3E%3Ctfoot%3E%3Cmo%3E%3Ctbody%3E", "%23document%0A%7C%20%3Cmath%20math%3E%0A%7C%20%20%20%3Cmath%20tfoot%3E%0A%7C%20%20%20%20%20%3Cmath%20mo%3E", 'tfoot'],"4f95d47164955a6b163935fd8ac89ea200767330":[async_test('html5lib_innerHTML_math.html 4f95d47164955a6b163935fd8ac89ea200767330'), "%3Cmath%3E%3Ctbody%3E%3Cmo%3E%3Ctfoot%3E", "%23document%0A%7C%20%3Cmath%20math%3E%0A%7C%20%20%20%3Cmath%20tbody%3E%0A%7C%20%20%20%20%20%3Cmath%20mo%3E", 'tbody'],"e942ee6666e1dc938aab10fc2374a2240806b439":[async_test('html5lib_innerHTML_math.html e942ee6666e1dc938aab10fc2374a2240806b439'), "%3Cmath%3E%3Ctbody%3E%3Cmo%3E%3C/table%3E", "%23document%0A%7C%20%3Cmath%20math%3E%0A%7C%20%20%20%3Cmath%20tbody%3E%0A%7C%20%20%20%20%20%3Cmath%20mo%3E", 'tbody'],"3537413f7f8166cb0c3a324fef8261be5628611d":[async_test('html5lib_innerHTML_math.html 3537413f7f8166cb0c3a324fef8261be5628611d'), "%3Cmath%3E%3Cthead%3E%3Cmo%3E%3C/table%3E", "%23document%0A%7C%20%3Cmath%20math%3E%0A%7C%20%20%20%3Cmath%20thead%3E%0A%7C%20%20%20%20%20%3Cmath%20mo%3E", 'tbody'],"c0186fb0fe26b48bcd82d58ebe0c90a423f26c28":[async_test('html5lib_innerHTML_math.html c0186fb0fe26b48bcd82d58ebe0c90a423f26c28'), "%3Cmath%3E%3Ctfoot%3E%3Cmo%3E%3C/table%3E", "%23document%0A%7C%20%3Cmath%20math%3E%0A%7C%20%20%20%3Cmath%20tfoot%3E%0A%7C%20%20%20%20%20%3Cmath%20mo%3E", 'tbody'],
}
init_tests("innerHTML");
</script>
</body>
</html>

View file

@ -0,0 +1,24 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf8">
<title>HTML 5 Parser tests html5lib_innerHTML_webkit02.html</title>
<meta name="timeout" content="long">
</head>
<body>
<h1>html5lib Parser Test</h1>
<div id="log"></div>
<script src="common.js"></script>
<script src="test.js"></script>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
var num_iframes = 8;
var order = ['bafeef55f21b568ab89a91082464614e4ebe7c2f','9461cfc6d9d4f08b05b3a95bbe5baa264f868a44','c2c4647447354abc154f1917a7fbefa4a679d5fb',];
var tests = {
"bafeef55f21b568ab89a91082464614e4ebe7c2f":[async_test('html5lib_innerHTML_webkit02.html bafeef55f21b568ab89a91082464614e4ebe7c2f'), "%3Cb%3E%3Cem%3E%3Cfoo%3E%3Cfoo%3E%3Cfoo%3E%3Cfoo%3E%3Cfoo%3E%3Cfoo%3E%3Cfoo%3E%3Cfoo%3E%3Cfoo%3E%3Cfoo%3E%3Caside%3E%3C/b%3E%3C/em%3E", "%23document%0A%7C%20%3Cb%3E%0A%7C%20%20%20%3Cem%3E%0A%7C%20%20%20%20%20%3Cfoo%3E%0A%7C%20%20%20%20%20%20%20%3Cfoo%3E%0A%7C%20%20%20%20%20%20%20%20%20%3Cfoo%3E%0A%7C%20%20%20%20%20%20%20%20%20%20%20%3Cfoo%3E%0A%7C%20%20%20%20%20%20%20%20%20%20%20%20%20%3Cfoo%3E%0A%7C%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3Cfoo%3E%0A%7C%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3Cfoo%3E%0A%7C%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3Cfoo%3E%0A%7C%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3Cfoo%3E%0A%7C%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3Cfoo%3E%0A%7C%20%3Caside%3E%0A%7C%20%20%20%3Cb%3E", 'div'],"9461cfc6d9d4f08b05b3a95bbe5baa264f868a44":[async_test('html5lib_innerHTML_webkit02.html 9461cfc6d9d4f08b05b3a95bbe5baa264f868a44'), "%3Cb%3E%3Cem%3E%3Cfoo%3E%3Cfoob%3E%3Cfoob%3E%3Cfoob%3E%3Cfoob%3E%3Cfooc%3E%3Cfooc%3E%3Cfooc%3E%3Cfooc%3E%3Cfood%3E%3Caside%3E%3C/b%3E%3C/em%3E", "%23document%0A%7C%20%3Cb%3E%0A%7C%20%20%20%3Cem%3E%0A%7C%20%20%20%20%20%3Cfoo%3E%0A%7C%20%20%20%20%20%20%20%3Cfoob%3E%0A%7C%20%20%20%20%20%20%20%20%20%3Cfoob%3E%0A%7C%20%20%20%20%20%20%20%20%20%20%20%3Cfoob%3E%0A%7C%20%20%20%20%20%20%20%20%20%20%20%20%20%3Cfoob%3E%0A%7C%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3Cfooc%3E%0A%7C%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3Cfooc%3E%0A%7C%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3Cfooc%3E%0A%7C%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3Cfooc%3E%0A%7C%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3Cfood%3E%0A%7C%20%3Caside%3E%0A%7C%20%20%20%3Cb%3E", 'div'],"c2c4647447354abc154f1917a7fbefa4a679d5fb":[async_test('html5lib_innerHTML_webkit02.html c2c4647447354abc154f1917a7fbefa4a679d5fb'), "%3Coption%3E%3CXH%3Coptgroup%3E%3C/optgroup%3E", "%23document%0A%7C%20%3Coption%3E", 'select'],
}
init_tests("innerHTML");
</script>
</body>
</html>

View file

@ -18,9 +18,9 @@
<script src="/resources/testharnessreport.js"></script>
<script>
var num_iframes = 8;
var order = ['579ca96e69c47b3d2ac83f1aa79a450b745d21f3','cb91f67071d81dd18d7ba9990de8f0f845c375f0','bd8ac64cc8f1422fac94bbe1c8828c0b51dca3f2',];
var order = ['579ca96e69c47b3d2ac83f1aa79a450b745d21f3','cb91f67071d81dd18d7ba9990de8f0f845c375f0','bd8ac64cc8f1422fac94bbe1c8828c0b51dca3f2','4303a393c6933743460836cb5e7dd29ca7fd6f43',];
var tests = {
"579ca96e69c47b3d2ac83f1aa79a450b745d21f3":[async_test('html5lib_isindex.html 579ca96e69c47b3d2ac83f1aa79a450b745d21f3'), "%3Cisindex%3E", "%23document%0A%7C%20%3Chtml%3E%0A%7C%20%20%20%3Chead%3E%0A%7C%20%20%20%3Cbody%3E%0A%7C%20%20%20%20%20%3Cform%3E%0A%7C%20%20%20%20%20%20%20%3Chr%3E%0A%7C%20%20%20%20%20%20%20%3Clabel%3E%0A%7C%20%20%20%20%20%20%20%20%20%22This%20is%20a%20searchable%20index.%20Enter%20search%20keywords%3A%20%22%0A%7C%20%20%20%20%20%20%20%20%20%3Cinput%3E%0A%7C%20%20%20%20%20%20%20%20%20%20%20name%3D%22isindex%22%0A%7C%20%20%20%20%20%20%20%3Chr%3E"],"cb91f67071d81dd18d7ba9990de8f0f845c375f0":[async_test('html5lib_isindex.html cb91f67071d81dd18d7ba9990de8f0f845c375f0'), "%3Cisindex%20name%3D%22A%22%20action%3D%22B%22%20prompt%3D%22C%22%20foo%3D%22D%22%3E", "%23document%0A%7C%20%3Chtml%3E%0A%7C%20%20%20%3Chead%3E%0A%7C%20%20%20%3Cbody%3E%0A%7C%20%20%20%20%20%3Cform%3E%0A%7C%20%20%20%20%20%20%20action%3D%22B%22%0A%7C%20%20%20%20%20%20%20%3Chr%3E%0A%7C%20%20%20%20%20%20%20%3Clabel%3E%0A%7C%20%20%20%20%20%20%20%20%20%22C%22%0A%7C%20%20%20%20%20%20%20%20%20%3Cinput%3E%0A%7C%20%20%20%20%20%20%20%20%20%20%20foo%3D%22D%22%0A%7C%20%20%20%20%20%20%20%20%20%20%20name%3D%22isindex%22%0A%7C%20%20%20%20%20%20%20%3Chr%3E"],"bd8ac64cc8f1422fac94bbe1c8828c0b51dca3f2":[async_test('html5lib_isindex.html bd8ac64cc8f1422fac94bbe1c8828c0b51dca3f2'), "%3Cform%3E%3Cisindex%3E", "%23document%0A%7C%20%3Chtml%3E%0A%7C%20%20%20%3Chead%3E%0A%7C%20%20%20%3Cbody%3E%0A%7C%20%20%20%20%20%3Cform%3E"],
"579ca96e69c47b3d2ac83f1aa79a450b745d21f3":[async_test('html5lib_isindex.html 579ca96e69c47b3d2ac83f1aa79a450b745d21f3'), "%3Cisindex%3E", "%23document%0A%7C%20%3Chtml%3E%0A%7C%20%20%20%3Chead%3E%0A%7C%20%20%20%3Cbody%3E%0A%7C%20%20%20%20%20%3Cisindex%3E"],"cb91f67071d81dd18d7ba9990de8f0f845c375f0":[async_test('html5lib_isindex.html cb91f67071d81dd18d7ba9990de8f0f845c375f0'), "%3Cisindex%20name%3D%22A%22%20action%3D%22B%22%20prompt%3D%22C%22%20foo%3D%22D%22%3E", "%23document%0A%7C%20%3Chtml%3E%0A%7C%20%20%20%3Chead%3E%0A%7C%20%20%20%3Cbody%3E%0A%7C%20%20%20%20%20%3Cisindex%3E%0A%7C%20%20%20%20%20%20%20action%3D%22B%22%0A%7C%20%20%20%20%20%20%20foo%3D%22D%22%0A%7C%20%20%20%20%20%20%20name%3D%22A%22%0A%7C%20%20%20%20%20%20%20prompt%3D%22C%22"],"bd8ac64cc8f1422fac94bbe1c8828c0b51dca3f2":[async_test('html5lib_isindex.html bd8ac64cc8f1422fac94bbe1c8828c0b51dca3f2'), "%3Cform%3E%3Cisindex%3E", "%23document%0A%7C%20%3Chtml%3E%0A%7C%20%20%20%3Chead%3E%0A%7C%20%20%20%3Cbody%3E%0A%7C%20%20%20%20%20%3Cform%3E%0A%7C%20%20%20%20%20%20%20%3Cisindex%3E"],"4303a393c6933743460836cb5e7dd29ca7fd6f43":[async_test('html5lib_isindex.html 4303a393c6933743460836cb5e7dd29ca7fd6f43'), "%3C%21doctype%20html%3E%3Cisindex%3Ex%3C/isindex%3Ex", "%23document%0A%7C%20%3C%21DOCTYPE%20html%3E%0A%7C%20%3Chtml%3E%0A%7C%20%20%20%3Chead%3E%0A%7C%20%20%20%3Cbody%3E%0A%7C%20%20%20%20%20%3Cisindex%3E%0A%7C%20%20%20%20%20%20%20%22x%22%0A%7C%20%20%20%20%20%22x%22"],
}
init_tests(get_type());
</script>

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,28 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf8">
<title>HTML 5 Parser tests html5lib_namespace-sensitivity.html</title>
<meta name="timeout" content="long">
<meta name="variant" content="?run_type=uri">
<meta name="variant" content="?run_type=write">
<meta name="variant" content="?run_type=write_single">
</head>
<body>
<h1>html5lib Parser Test</h1>
<div id="log"></div>
<script src="common.js"></script>
<script src="test.js"></script>
<script src="template.js"></script>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
var num_iframes = 8;
var order = ['de0a2051123e97a540e3aeb58375103bda021122',];
var tests = {
"de0a2051123e97a540e3aeb58375103bda021122":[async_test('html5lib_namespace-sensitivity.html de0a2051123e97a540e3aeb58375103bda021122'), "%3Cbody%3E%3Ctable%3E%3Ctr%3E%3Ctd%3E%3Csvg%3E%3Ctd%3E%3CforeignObject%3E%3Cspan%3E%3C/td%3EFoo", "%23document%0A%7C%20%3Chtml%3E%0A%7C%20%20%20%3Chead%3E%0A%7C%20%20%20%3Cbody%3E%0A%7C%20%20%20%20%20%22Foo%22%0A%7C%20%20%20%20%20%3Ctable%3E%0A%7C%20%20%20%20%20%20%20%3Ctbody%3E%0A%7C%20%20%20%20%20%20%20%20%20%3Ctr%3E%0A%7C%20%20%20%20%20%20%20%20%20%20%20%3Ctd%3E%0A%7C%20%20%20%20%20%20%20%20%20%20%20%20%20%3Csvg%20svg%3E%0A%7C%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3Csvg%20td%3E%0A%7C%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3Csvg%20foreignObject%3E%0A%7C%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3Cspan%3E"],
}
init_tests(get_type());
</script>
</body>
</html>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

Some files were not shown because too many files have changed in this diff Show more