mirror of
https://github.com/servo/servo.git
synced 2025-08-29 17:18:23 +01:00
Update web-platform-tests to revision 10168e9a5d44efbc6e7d416d1d454eb9c9f1396c
This commit is contained in:
parent
c88dc51d03
commit
0e1caebaf4
791 changed files with 23381 additions and 5501 deletions
|
@ -0,0 +1,43 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Media documents: image</title>
|
||||
<link rel="author" title="Takayoshi Kochi" href="mailto:kochi@chromium.org">
|
||||
<link rel="author" title="Michael Ventnor" href="mailto:mventnor@mozilla.com">
|
||||
<link rel="author" title="Ms2ger" href="mailto:ms2ger@gmail.com">
|
||||
<link rel="help" href="https://html.spec.whatwg.org/multipage/#read-media">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
|
||||
<script>
|
||||
var t = async_test("The document for a standalone media file should have one child in the body.");
|
||||
|
||||
var imgwin = window.open('/images/blue.png');
|
||||
// imgwin.onload doesn't work, check popup's URL to see if the loading of
|
||||
// the image and creation of image document is finished.
|
||||
function checkURL() {
|
||||
if (imgwin.location.href.indexOf('blue.png') == -1) {
|
||||
step_timeout(checkURL, 100);
|
||||
return;
|
||||
}
|
||||
t.step(frameLoaded);
|
||||
}
|
||||
checkURL();
|
||||
|
||||
function frameLoaded() {
|
||||
assert_equals(imgwin.opener, window);
|
||||
assert_equals(imgwin.document.contentType, "image/png");
|
||||
var imgwinChildren = imgwin.document.body.childNodes;
|
||||
assert_equals(imgwinChildren.length, 1, "Body of image document has 1 child");
|
||||
assert_equals(imgwinChildren[0].nodeName, "IMG", "Only child of body must be an <img> element");
|
||||
assert_equals(imgwinChildren[0].namespaceURI, "http://www.w3.org/1999/xhtml",
|
||||
"Only child of body must be an HTML element");
|
||||
imgwin.close();
|
||||
t.done();
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="log"></div>
|
||||
</body>
|
||||
</html>
|
|
@ -10,14 +10,14 @@
|
|||
<div id="test1">scroll 2</div>
|
||||
<script>
|
||||
test(function() {
|
||||
assert_equals(document.body.scrollTop, 0);
|
||||
assert_equals(document.scrollingElement.scrollTop, 0);
|
||||
location.hash = "test";
|
||||
|
||||
var scroll1 = document.body.scrollTop;
|
||||
var scroll1 = document.scrollingElement.scrollTop;
|
||||
assert_true(scroll1 > 0);
|
||||
|
||||
location.hash = "test1";
|
||||
var scroll2 = document.body.scrollTop;
|
||||
var scroll2 = document.scrollingElement.scrollTop;
|
||||
assert_true(scroll2 > scroll1);
|
||||
|
||||
location.hash = ""
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
<a name="anchor1" style="position:absolute; top:200px;"></a>
|
||||
<div id="id-equals-anchor" style="position:absolute; top:300px;"></div>
|
||||
<a name="id-equals-anchor" style="position:absolute; top:400px;"></a>
|
||||
<a name="§1" style="position:absolute; top:400px;"></a>
|
||||
<div style="height:200em;"></div>
|
||||
<script>
|
||||
var steps = [{
|
||||
|
@ -21,6 +22,11 @@ var steps = [{
|
|||
// id still takes precedence over anchor name
|
||||
assert_equals( scrollPosition(), 300 );
|
||||
}
|
||||
},{
|
||||
fragid:'§1',
|
||||
handler: function(){
|
||||
assert_equals( scrollPosition(), 400 );
|
||||
}
|
||||
}];
|
||||
|
||||
function scrollPosition(){
|
||||
|
|
|
@ -166,4 +166,54 @@ test(function() {
|
|||
doc.body = new_frameset;
|
||||
assert_equals(doc.body, new_frameset, "test6-3, append frameset to a new document");
|
||||
}, "Setting document.body to a new frameset element.");
|
||||
|
||||
test(function() {
|
||||
var doc = createDocument();
|
||||
var html = doc.appendChild(doc.createElement("html"));
|
||||
var f =
|
||||
html.appendChild(doc.createElement("frameset"));
|
||||
assert_equals(doc.body, f);
|
||||
|
||||
var b = doc.createElement("body");
|
||||
doc.body = b;
|
||||
|
||||
assert_equals(f.parentNode, null,
|
||||
"Frameset should have been removed from the tree");
|
||||
assert_equals(doc.body, b, "Body should be the new doc.body");
|
||||
}, "Setting document.body to a body will replace an existing frameset if there is one.");
|
||||
|
||||
test(function() {
|
||||
var doc = createDocument();
|
||||
var html = doc.appendChild(doc.createElement("html"));
|
||||
var b =
|
||||
html.appendChild(doc.createElement("body"));
|
||||
assert_equals(doc.body, b);
|
||||
|
||||
var f = doc.createElement("frameset");
|
||||
doc.body = f;
|
||||
|
||||
assert_equals(b.parentNode, null,
|
||||
"Body should have been removed from the tree");
|
||||
assert_equals(doc.body, f, "Frameset should be the new doc.body");
|
||||
}, "Setting document.body to a frameset will replace an existing body if there is one.");
|
||||
|
||||
test(function() {
|
||||
var doc = createDocument();
|
||||
var html = doc.appendChild(doc.createElement("html"));
|
||||
var b =
|
||||
html.appendChild(doc.createElement("body"));
|
||||
var f1 = html.appendChild(doc.createElement("frameset"));
|
||||
assert_equals(doc.body, b);
|
||||
|
||||
var f2 = doc.createElement("frameset");
|
||||
doc.body = f2;
|
||||
|
||||
assert_equals(b.parentNode, null,
|
||||
"Body should have been removed from the tree");
|
||||
assert_equals(f1.parentNode, html,
|
||||
"Frameset following body should still be in the tree.");
|
||||
assert_equals(doc.body, f2, "New frameset should be the new doc.body");
|
||||
assert_equals(f2.nextSibling, f1, "New frameset should have replaced the body");
|
||||
}, "Setting document.body to a frameset will replace the first existing body/frameset.");
|
||||
|
||||
</script>
|
||||
|
|
|
@ -94,9 +94,19 @@ test(() => {
|
|||
assert_true(wsocket.url.endsWith('ws://www.example.com/socketserve%EF%BF%BD/'));
|
||||
}, "websocket url : unpaired surrogate codepoint should be replaced with U+FFFD")
|
||||
|
||||
test(() => {
|
||||
try {
|
||||
navigator.sendBeacon("resources/\uD800blank.txt");
|
||||
assert_true(true);
|
||||
} catch (e) {
|
||||
assert_true(false);
|
||||
}
|
||||
}, "sendBeacon URL: unpaired surrogate codepoint should not make any exceptions.")
|
||||
|
||||
test(() => {
|
||||
var w = window.open("about:blank#\uD800");
|
||||
assert_equals(w.document.URL, 'about:blank#%EF%BF%BD');
|
||||
assert_equals(w.document.documentURI, 'about:blank#%EF%BF%BD');
|
||||
}, "Document URLs: unpaired surrogate codepoint should be replaced with U+FFFD")
|
||||
|
||||
</script>
|
||||
|
|
|
@ -0,0 +1,688 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<link rel="help" href="https://html.spec.whatwg.org/multipage/interaction.html#autocapitalization">
|
||||
<body>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script>
|
||||
|
||||
test(function() {
|
||||
assert_true('autocapitalize' in document.createElement('input'));
|
||||
}, "Test that the autocapitalize is avaible on HTMLInputElement.")
|
||||
|
||||
test(function() {
|
||||
assert_true('autocapitalize' in document.createElement('textarea'));
|
||||
}, "Test that the autocapitalize is avaible on HTMLTextAreaElement.")
|
||||
|
||||
test(function() {
|
||||
assert_true('autocapitalize' in document.createElement('div'));
|
||||
}, "Test that the autocapitalize is avaible on div.")
|
||||
|
||||
test(function() {
|
||||
var elements = [ document.createElement('input'),
|
||||
document.createElement('textarea'),
|
||||
document.createElement('div') ];
|
||||
|
||||
elements.forEach(function(e) {
|
||||
e.autocapitalize = 'on';
|
||||
assert_equals(e.autocapitalize, 'sentences');
|
||||
|
||||
e.autocapitalize = 'off';
|
||||
assert_equals(e.autocapitalize, 'none');
|
||||
});
|
||||
}, "Test deprecated values of autocapitalize.");
|
||||
|
||||
test(function() {
|
||||
var elements = [ document.createElement('input'),
|
||||
document.createElement('textarea'),
|
||||
document.createElement('div') ];
|
||||
var knownValues = [ 'none', 'characters', 'words', 'sentences' ];
|
||||
|
||||
elements.forEach(function(e) {
|
||||
// Default value.
|
||||
assert_equals(e.autocapitalize, '');
|
||||
|
||||
// Empty value.
|
||||
e.autocapitalize = '';
|
||||
assert_equals(e.autocapitalize, '');
|
||||
assert_equals(e.getAttribute('autocapitalize'), '');
|
||||
e.setAttribute('autocapitalize', '');
|
||||
assert_equals(e.autocapitalize, '');
|
||||
assert_equals(e.getAttribute('autocapitalize'), '');
|
||||
assert_equals(e.autocapitalize, '');
|
||||
|
||||
// Invalid value.
|
||||
e.autocapitalize = 'foo';
|
||||
assert_equals(e.autocapitalize, 'sentences');
|
||||
assert_equals(e.getAttribute('autocapitalize'), 'foo');
|
||||
e.setAttribute('autocapitalize', 'bar');
|
||||
assert_equals(e.autocapitalize, 'sentences');
|
||||
assert_equals(e.getAttribute('autocapitalize'), 'bar');
|
||||
|
||||
// Default value.
|
||||
e.removeAttribute('autocapitalize');
|
||||
assert_equals(e.autocapitalize, '');
|
||||
assert_equals(e.getAttribute('autocapitalize'), null);
|
||||
|
||||
// Case insensitive.
|
||||
e.setAttribute('autocapitalize', 'NoNe');
|
||||
assert_equals(e.autocapitalize, 'none');
|
||||
assert_equals(e.getAttribute('autocapitalize'), 'NoNe');
|
||||
e.autocapitalize = 'WORDS';
|
||||
assert_equals(e.autocapitalize, 'words');
|
||||
assert_equals(e.getAttribute('autocapitalize'), 'WORDS');
|
||||
|
||||
knownValues.forEach(function(value) {
|
||||
e.setAttribute('autocapitalize', value);
|
||||
assert_equals(e.autocapitalize, value);
|
||||
assert_equals(e.getAttribute('autocapitalize'), value);
|
||||
|
||||
e.removeAttribute('autocapitalize');
|
||||
|
||||
e.autocapitalize = value;
|
||||
assert_equals(e.autocapitalize, value);
|
||||
assert_equals(e.getAttribute('autocapitalize'), value);
|
||||
|
||||
e.removeAttribute('autocapitalize');
|
||||
});
|
||||
});
|
||||
}, "Test reflection of autocapitalize.");
|
||||
|
||||
test(function() {
|
||||
var testData = [ 'text',
|
||||
'search',
|
||||
'email',
|
||||
'url',
|
||||
'tel',
|
||||
'number',
|
||||
'date',
|
||||
'color',
|
||||
'password' ];
|
||||
|
||||
testData.forEach(function(data) {
|
||||
const input = document.createElement('input');
|
||||
input.type = data;
|
||||
assert_equals(input.autocapitalize, '');
|
||||
|
||||
// Verify that wrapping the input element in a form doesn't change the
|
||||
// defaults.
|
||||
const form = document.createElement('form');
|
||||
form.appendChild(input);
|
||||
assert_equals(input.autocapitalize, '');
|
||||
});
|
||||
}, "Test that the IDL attribute returns the empty string if the content "
|
||||
+ "attribute is not set.")
|
||||
|
||||
test(function() {
|
||||
const testData = [
|
||||
{
|
||||
formValue: null,
|
||||
formElementValue: null,
|
||||
inheritedResult: '',
|
||||
uninheritedResult: '',
|
||||
},
|
||||
{
|
||||
formValue: null,
|
||||
formElementValue: '',
|
||||
inheritedResult: '',
|
||||
uninheritedResult: '',
|
||||
},
|
||||
{
|
||||
formValue: null,
|
||||
formElementValue: 'on',
|
||||
inheritedResult: 'sentences',
|
||||
uninheritedResult: 'sentences',
|
||||
},
|
||||
{
|
||||
formValue: null,
|
||||
formElementValue: 'off',
|
||||
inheritedResult: 'none',
|
||||
uninheritedResult: 'none',
|
||||
},
|
||||
{
|
||||
formValue: null,
|
||||
formElementValue: 'none',
|
||||
inheritedResult: 'none',
|
||||
uninheritedResult: 'none',
|
||||
},
|
||||
{
|
||||
formValue: null,
|
||||
formElementValue: 'characters',
|
||||
inheritedResult: 'characters',
|
||||
uninheritedResult: 'characters',
|
||||
},
|
||||
{
|
||||
formValue: null,
|
||||
formElementValue: 'words',
|
||||
inheritedResult: 'words',
|
||||
uninheritedResult: 'words',
|
||||
},
|
||||
{
|
||||
formValue: null,
|
||||
formElementValue: 'sentences',
|
||||
inheritedResult: 'sentences',
|
||||
uninheritedResult: 'sentences',
|
||||
},
|
||||
{
|
||||
formValue: null,
|
||||
formElementValue: 'foo',
|
||||
inheritedResult: 'sentences',
|
||||
uninheritedResult: 'sentences',
|
||||
},
|
||||
{
|
||||
formValue: '',
|
||||
formElementValue: null,
|
||||
inheritedResult: '',
|
||||
uninheritedResult: '',
|
||||
},
|
||||
{
|
||||
formValue: '',
|
||||
formElementValue: '',
|
||||
inheritedResult: '',
|
||||
uninheritedResult: '',
|
||||
},
|
||||
{
|
||||
formValue: '',
|
||||
formElementValue: 'on',
|
||||
inheritedResult: 'sentences',
|
||||
uninheritedResult: 'sentences',
|
||||
},
|
||||
{
|
||||
formValue: '',
|
||||
formElementValue: 'off',
|
||||
inheritedResult: 'none',
|
||||
uninheritedResult: 'none',
|
||||
},
|
||||
{
|
||||
formValue: '',
|
||||
formElementValue: 'none',
|
||||
inheritedResult: 'none',
|
||||
uninheritedResult: 'none',
|
||||
},
|
||||
{
|
||||
formValue: '',
|
||||
formElementValue: 'characters',
|
||||
inheritedResult: 'characters',
|
||||
uninheritedResult: 'characters',
|
||||
},
|
||||
{
|
||||
formValue: '',
|
||||
formElementValue: 'words',
|
||||
inheritedResult: 'words',
|
||||
uninheritedResult: 'words',
|
||||
},
|
||||
{
|
||||
formValue: '',
|
||||
formElementValue: 'sentences',
|
||||
inheritedResult: 'sentences',
|
||||
uninheritedResult: 'sentences',
|
||||
},
|
||||
{
|
||||
formValue: '',
|
||||
formElementValue: 'foo',
|
||||
inheritedResult: 'sentences',
|
||||
uninheritedResult: 'sentences',
|
||||
},
|
||||
{
|
||||
formValue: 'on',
|
||||
formElementValue: null,
|
||||
inheritedResult: 'sentences',
|
||||
uninheritedResult: '',
|
||||
},
|
||||
{
|
||||
formValue: 'on',
|
||||
formElementValue: '',
|
||||
inheritedResult: 'sentences',
|
||||
uninheritedResult: '',
|
||||
},
|
||||
{
|
||||
formValue: 'on',
|
||||
formElementValue: 'on',
|
||||
inheritedResult: 'sentences',
|
||||
uninheritedResult: 'sentences',
|
||||
},
|
||||
{
|
||||
formValue: 'on',
|
||||
formElementValue: 'off',
|
||||
inheritedResult: 'none',
|
||||
uninheritedResult: 'none',
|
||||
},
|
||||
{
|
||||
formValue: 'on',
|
||||
formElementValue: 'none',
|
||||
inheritedResult: 'none',
|
||||
uninheritedResult: 'none',
|
||||
},
|
||||
{
|
||||
formValue: 'on',
|
||||
formElementValue: 'characters',
|
||||
inheritedResult: 'characters',
|
||||
uninheritedResult: 'characters',
|
||||
},
|
||||
{
|
||||
formValue: 'on',
|
||||
formElementValue: 'words',
|
||||
inheritedResult: 'words',
|
||||
uninheritedResult: 'words',
|
||||
},
|
||||
{
|
||||
formValue: 'on',
|
||||
formElementValue: 'sentences',
|
||||
inheritedResult: 'sentences',
|
||||
uninheritedResult: 'sentences',
|
||||
},
|
||||
{
|
||||
formValue: 'on',
|
||||
formElementValue: 'foo',
|
||||
inheritedResult: 'sentences',
|
||||
uninheritedResult: 'sentences',
|
||||
},
|
||||
{
|
||||
formValue: 'off',
|
||||
formElementValue: null,
|
||||
inheritedResult: 'none',
|
||||
uninheritedResult: '',
|
||||
},
|
||||
{
|
||||
formValue: 'off',
|
||||
formElementValue: '',
|
||||
inheritedResult: 'none',
|
||||
uninheritedResult: '',
|
||||
},
|
||||
{
|
||||
formValue: 'off',
|
||||
formElementValue: 'on',
|
||||
inheritedResult: 'sentences',
|
||||
uninheritedResult: 'sentences',
|
||||
},
|
||||
{
|
||||
formValue: 'off',
|
||||
formElementValue: 'off',
|
||||
inheritedResult: 'none',
|
||||
uninheritedResult: 'none',
|
||||
},
|
||||
{
|
||||
formValue: 'off',
|
||||
formElementValue: 'none',
|
||||
inheritedResult: 'none',
|
||||
uninheritedResult: 'none',
|
||||
},
|
||||
{
|
||||
formValue: 'off',
|
||||
formElementValue: 'characters',
|
||||
inheritedResult: 'characters',
|
||||
uninheritedResult: 'characters',
|
||||
},
|
||||
{
|
||||
formValue: 'off',
|
||||
formElementValue: 'words',
|
||||
inheritedResult: 'words',
|
||||
uninheritedResult: 'words',
|
||||
},
|
||||
{
|
||||
formValue: 'off',
|
||||
formElementValue: 'sentences',
|
||||
inheritedResult: 'sentences',
|
||||
uninheritedResult: 'sentences',
|
||||
},
|
||||
{
|
||||
formValue: 'off',
|
||||
formElementValue: 'foo',
|
||||
inheritedResult: 'sentences',
|
||||
uninheritedResult: 'sentences',
|
||||
},
|
||||
{
|
||||
formValue: 'none',
|
||||
formElementValue: null,
|
||||
inheritedResult: 'none',
|
||||
uninheritedResult: '',
|
||||
},
|
||||
{
|
||||
formValue: 'none',
|
||||
formElementValue: '',
|
||||
inheritedResult: 'none',
|
||||
uninheritedResult: '',
|
||||
},
|
||||
{
|
||||
formValue: 'none',
|
||||
formElementValue: 'on',
|
||||
inheritedResult: 'sentences',
|
||||
uninheritedResult: 'sentences',
|
||||
},
|
||||
{
|
||||
formValue: 'none',
|
||||
formElementValue: 'off',
|
||||
inheritedResult: 'none',
|
||||
uninheritedResult: 'none',
|
||||
},
|
||||
{
|
||||
formValue: 'none',
|
||||
formElementValue: 'none',
|
||||
inheritedResult: 'none',
|
||||
uninheritedResult: 'none',
|
||||
},
|
||||
{
|
||||
formValue: 'none',
|
||||
formElementValue: 'characters',
|
||||
inheritedResult: 'characters',
|
||||
uninheritedResult: 'characters',
|
||||
},
|
||||
{
|
||||
formValue: 'none',
|
||||
formElementValue: 'words',
|
||||
inheritedResult: 'words',
|
||||
uninheritedResult: 'words',
|
||||
},
|
||||
{
|
||||
formValue: 'none',
|
||||
formElementValue: 'sentences',
|
||||
inheritedResult: 'sentences',
|
||||
uninheritedResult: 'sentences',
|
||||
},
|
||||
{
|
||||
formValue: 'none',
|
||||
formElementValue: 'foo',
|
||||
inheritedResult: 'sentences',
|
||||
uninheritedResult: 'sentences',
|
||||
},
|
||||
{
|
||||
formValue: 'characters',
|
||||
formElementValue: null,
|
||||
inheritedResult: 'characters',
|
||||
uninheritedResult: '',
|
||||
},
|
||||
{
|
||||
formValue: 'characters',
|
||||
formElementValue: '',
|
||||
inheritedResult: 'characters',
|
||||
uninheritedResult: '',
|
||||
},
|
||||
{
|
||||
formValue: 'characters',
|
||||
formElementValue: 'on',
|
||||
inheritedResult: 'sentences',
|
||||
uninheritedResult: 'sentences',
|
||||
},
|
||||
{
|
||||
formValue: 'characters',
|
||||
formElementValue: 'off',
|
||||
inheritedResult: 'none',
|
||||
uninheritedResult: 'none',
|
||||
},
|
||||
{
|
||||
formValue: 'characters',
|
||||
formElementValue: 'none',
|
||||
inheritedResult: 'none',
|
||||
uninheritedResult: 'none',
|
||||
},
|
||||
{
|
||||
formValue: 'characters',
|
||||
formElementValue: 'characters',
|
||||
inheritedResult: 'characters',
|
||||
uninheritedResult: 'characters',
|
||||
},
|
||||
{
|
||||
formValue: 'characters',
|
||||
formElementValue: 'words',
|
||||
inheritedResult: 'words',
|
||||
uninheritedResult: 'words',
|
||||
},
|
||||
{
|
||||
formValue: 'characters',
|
||||
formElementValue: 'sentences',
|
||||
inheritedResult: 'sentences',
|
||||
uninheritedResult: 'sentences',
|
||||
},
|
||||
{
|
||||
formValue: 'characters',
|
||||
formElementValue: 'foo',
|
||||
inheritedResult: 'sentences',
|
||||
uninheritedResult: 'sentences',
|
||||
},
|
||||
{
|
||||
formValue: 'words',
|
||||
formElementValue: null,
|
||||
inheritedResult: 'words',
|
||||
uninheritedResult: '',
|
||||
},
|
||||
{
|
||||
formValue: 'words',
|
||||
formElementValue: '',
|
||||
inheritedResult: 'words',
|
||||
uninheritedResult: '',
|
||||
},
|
||||
{
|
||||
formValue: 'words',
|
||||
formElementValue: 'on',
|
||||
inheritedResult: 'sentences',
|
||||
uninheritedResult: 'sentences',
|
||||
},
|
||||
{
|
||||
formValue: 'words',
|
||||
formElementValue: 'off',
|
||||
inheritedResult: 'none',
|
||||
uninheritedResult: 'none',
|
||||
},
|
||||
{
|
||||
formValue: 'words',
|
||||
formElementValue: 'none',
|
||||
inheritedResult: 'none',
|
||||
uninheritedResult: 'none',
|
||||
},
|
||||
{
|
||||
formValue: 'words',
|
||||
formElementValue: 'characters',
|
||||
inheritedResult: 'characters',
|
||||
uninheritedResult: 'characters',
|
||||
},
|
||||
{
|
||||
formValue: 'words',
|
||||
formElementValue: 'words',
|
||||
inheritedResult: 'words',
|
||||
uninheritedResult: 'words',
|
||||
},
|
||||
{
|
||||
formValue: 'words',
|
||||
formElementValue: 'sentences',
|
||||
inheritedResult: 'sentences',
|
||||
uninheritedResult: 'sentences',
|
||||
},
|
||||
{
|
||||
formValue: 'words',
|
||||
formElementValue: 'foo',
|
||||
inheritedResult: 'sentences',
|
||||
uninheritedResult: 'sentences',
|
||||
},
|
||||
{
|
||||
formValue: 'sentences',
|
||||
formElementValue: null,
|
||||
inheritedResult: 'sentences',
|
||||
uninheritedResult: '',
|
||||
},
|
||||
{
|
||||
formValue: 'sentences',
|
||||
formElementValue: '',
|
||||
inheritedResult: 'sentences',
|
||||
uninheritedResult: '',
|
||||
},
|
||||
{
|
||||
formValue: 'sentences',
|
||||
formElementValue: 'on',
|
||||
inheritedResult: 'sentences',
|
||||
uninheritedResult: 'sentences',
|
||||
},
|
||||
{
|
||||
formValue: 'sentences',
|
||||
formElementValue: 'off',
|
||||
inheritedResult: 'none',
|
||||
uninheritedResult: 'none',
|
||||
},
|
||||
{
|
||||
formValue: 'sentences',
|
||||
formElementValue: 'none',
|
||||
inheritedResult: 'none',
|
||||
uninheritedResult: 'none',
|
||||
},
|
||||
{
|
||||
formValue: 'sentences',
|
||||
formElementValue: 'characters',
|
||||
inheritedResult: 'characters',
|
||||
uninheritedResult: 'characters',
|
||||
},
|
||||
{
|
||||
formValue: 'sentences',
|
||||
formElementValue: 'words',
|
||||
inheritedResult: 'words',
|
||||
uninheritedResult: 'words',
|
||||
},
|
||||
{
|
||||
formValue: 'sentences',
|
||||
formElementValue: 'sentences',
|
||||
inheritedResult: 'sentences',
|
||||
uninheritedResult: 'sentences',
|
||||
},
|
||||
{
|
||||
formValue: 'sentences',
|
||||
formElementValue: 'foo',
|
||||
inheritedResult: 'sentences',
|
||||
uninheritedResult: 'sentences',
|
||||
},
|
||||
{
|
||||
formValue: 'foo',
|
||||
formElementValue: null,
|
||||
inheritedResult: 'sentences',
|
||||
uninheritedResult: '',
|
||||
},
|
||||
{
|
||||
formValue: 'foo',
|
||||
formElementValue: '',
|
||||
inheritedResult: 'sentences',
|
||||
uninheritedResult: '',
|
||||
},
|
||||
{
|
||||
formValue: 'foo',
|
||||
formElementValue: 'on',
|
||||
inheritedResult: 'sentences',
|
||||
uninheritedResult: 'sentences',
|
||||
},
|
||||
{
|
||||
formValue: 'foo',
|
||||
formElementValue: 'off',
|
||||
inheritedResult: 'none',
|
||||
uninheritedResult: 'none',
|
||||
},
|
||||
{
|
||||
formValue: 'foo',
|
||||
formElementValue: 'none',
|
||||
inheritedResult: 'none',
|
||||
uninheritedResult: 'none',
|
||||
},
|
||||
{
|
||||
formValue: 'foo',
|
||||
formElementValue: 'characters',
|
||||
inheritedResult: 'characters',
|
||||
uninheritedResult: 'characters',
|
||||
},
|
||||
{
|
||||
formValue: 'foo',
|
||||
formElementValue: 'words',
|
||||
inheritedResult: 'words',
|
||||
uninheritedResult: 'words',
|
||||
},
|
||||
{
|
||||
formValue: 'foo',
|
||||
formElementValue: 'sentences',
|
||||
inheritedResult: 'sentences',
|
||||
uninheritedResult: 'sentences',
|
||||
},
|
||||
{
|
||||
formValue: 'foo',
|
||||
formElementValue: 'foo',
|
||||
inheritedResult: 'sentences',
|
||||
uninheritedResult: 'sentences',
|
||||
},
|
||||
];
|
||||
|
||||
const formElements = [
|
||||
{element: 'button', inherits: true},
|
||||
{element: 'fieldset', inherits: true},
|
||||
{element: 'img', inherits: false},
|
||||
{element: 'input', inherits: true},
|
||||
{element: 'object', inherits: false},
|
||||
{element: 'output', inherits: true},
|
||||
{element: 'select', inherits: true},
|
||||
{element: 'textarea', inherits: true},
|
||||
];
|
||||
|
||||
const form = document.createElement('form');
|
||||
form.id = 'form';
|
||||
document.body.appendChild(form);
|
||||
|
||||
testData.forEach(data => {
|
||||
form.removeAttribute('autocapitalize');
|
||||
|
||||
if (data.formValue !== null) {
|
||||
form.setAttribute('autocapitalize', data.formValue);
|
||||
}
|
||||
|
||||
formElements.forEach(elementData => {
|
||||
const element = document.createElement(elementData.element);
|
||||
form.appendChild(element);
|
||||
|
||||
const element2 = document.createElement(elementData.element);
|
||||
element2.setAttribute('form', 'form');
|
||||
document.body.appendChild(element2);
|
||||
|
||||
if (data.formElementValue !== null) {
|
||||
element.setAttribute('autocapitalize', data.formElementValue);
|
||||
element2.setAttribute('autocapitalize', data.formElementValue);
|
||||
}
|
||||
|
||||
const descriptionSuffix = 'with "' + data.formValue
|
||||
+ '" and form element with "'+ data.formElementValue + '"';
|
||||
|
||||
if (elementData.inherits) {
|
||||
assert_equals(element.autocapitalize, data.inheritedResult,
|
||||
`${elementData.element} element with form parent `
|
||||
+ `${descriptionSuffix}`);
|
||||
assert_equals(element2.autocapitalize, data.inheritedResult,
|
||||
`${elementData.element} element with form owner attribute`
|
||||
+ ` set ${descriptionSuffix}`);
|
||||
} else {
|
||||
assert_equals(element.autocapitalize, data.uninheritedResult,
|
||||
`${elementData.element} element with form parent `
|
||||
+ `${descriptionSuffix}`);
|
||||
assert_equals(element2.autocapitalize, data.uninheritedResult,
|
||||
`${elementData.element} element with form owner attribute`
|
||||
+ `set ${descriptionSuffix}`);
|
||||
}
|
||||
});
|
||||
});
|
||||
}, "Test inheriting values from a form.")
|
||||
|
||||
test(function() {
|
||||
const testData = [ 'text',
|
||||
'search',
|
||||
'email',
|
||||
'url',
|
||||
'tel',
|
||||
'number',
|
||||
'date',
|
||||
'color',
|
||||
'password' ];
|
||||
|
||||
testData.forEach(function(data) {
|
||||
const form = document.createElement('form');
|
||||
form.setAttribute('autocapitalize', 'sentences');
|
||||
const input = document.createElement('input');
|
||||
input.setAttribute('type', data);
|
||||
form.appendChild(input);
|
||||
|
||||
assert_equals(input.autocapitalize, 'sentences');
|
||||
});
|
||||
}, "Verify that even input types that are never autocapitalized support the "
|
||||
+ "IDL interface.")
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -2,8 +2,13 @@
|
|||
<title>canPlayType</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<audio id="audio"></audio>
|
||||
<video id="video"></video>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
let VIDEO_ELEM = document.getElementById('video');
|
||||
let AUDIO_ELEM = document.getElementById('audio');
|
||||
|
||||
function t(type, expected) {
|
||||
assert_equals(canPlayType(type), expected, type);
|
||||
}
|
||||
|
@ -22,12 +27,13 @@ test(function() {
|
|||
}, 'utility code');
|
||||
|
||||
function canPlayType(type) {
|
||||
var canPlay = document.createElement('audio').canPlayType(type);
|
||||
assert_equals(canPlay, document.createElement('video').canPlayType(type),
|
||||
let audioCanPlay = AUDIO_ELEM.canPlayType(type);
|
||||
let videoCanPlay = VIDEO_ELEM.canPlayType(type);
|
||||
assert_equals(audioCanPlay, videoCanPlay,
|
||||
'audio.canPlayType() and video.canPlayType() agree');
|
||||
assert_in_array(canPlay, ['', 'maybe', 'probably'],
|
||||
assert_in_array(audioCanPlay, ['', 'maybe', 'probably'],
|
||||
'return value is one of "", "maybe" and "probably"');
|
||||
return canPlay;
|
||||
return audioCanPlay;
|
||||
}
|
||||
|
||||
test(function() {
|
||||
|
@ -37,20 +43,22 @@ test(function() {
|
|||
t('application/octet-stream; codecs="mp4a.40.2"', '');
|
||||
t('application/octet-stream; codecs="theora, vorbis"', '');
|
||||
t('application/octet-stream; codecs="avc1.42E01E, mp4a.40.2"', '');
|
||||
}, 'application/octet-stream');
|
||||
}, 'application/octet-stream not supported');
|
||||
|
||||
test(function() {
|
||||
t('application/marks-fantasmagorical-format', '');
|
||||
t('video/x-new-fictional-format', '');
|
||||
t('video/x-new-fictional-format;codecs="kittens,bunnies"', '');
|
||||
}, 'video/x-new-fictional-format');
|
||||
}, 'fictional formats and codecs not supported');
|
||||
|
||||
function type_codecs_test(type, audioCodecs, videoCodecs) {
|
||||
var typeSupported = false;
|
||||
var codecSupported = false;
|
||||
|
||||
// Test 'type' without codecs.
|
||||
// Spec: Generally, a user agent should never return "probably" for a type
|
||||
// that allows the codecs parameter if that parameter is not present.
|
||||
test(function() {
|
||||
// Spec: Generally, a user agent should never return "probably" for a type
|
||||
// that allows the codecs parameter if that parameter is not present.
|
||||
t(type, 'maybe');
|
||||
t(type + ';', 'maybe');
|
||||
t(type + ';codecs', 'maybe');
|
||||
|
@ -66,9 +74,11 @@ function type_codecs_test(type, audioCodecs, videoCodecs) {
|
|||
}, typeWithCodec + ' (optional)');
|
||||
}
|
||||
|
||||
// Test each audio and video codec separately.
|
||||
audioCodecs.forEach(test_codec);
|
||||
videoCodecs.forEach(test_codec);
|
||||
|
||||
// Test different pairings and orderings of audio+video codecs.
|
||||
if (audioCodecs.length > 0 && videoCodecs.length > 0) {
|
||||
test(function() {
|
||||
audioCodecs.forEach(function(ac) {
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
<!DOCTYPE html>
|
||||
<html class="reftest-wait">
|
||||
<script src="/common/reftest-wait.js"></script>
|
||||
<title>Text track cue layout after controls are added (reference)</title>
|
||||
<style>
|
||||
::cue {
|
||||
font-size: 50px;
|
||||
}
|
||||
|
||||
/* Video width should be large enough to display all of the media controls. */
|
||||
video {
|
||||
border: 1px solid gray;
|
||||
width: 500px;
|
||||
}
|
||||
</style>
|
||||
<video controls onloadeddata="this.onloadeddata = null; takeScreenshot();">
|
||||
<source src="/media/white.webm" type="video/webm">
|
||||
<source src="/media/white.mp4" type="video/mp4">
|
||||
</video>
|
||||
<script>
|
||||
// Add a single cue at line -2, where it would be if there were controls visible
|
||||
// at the bottom. (This assumes that those controls are less than 50px high.)
|
||||
// cue at line -1.
|
||||
var video = document.querySelector("video");
|
||||
var track = video.addTextTrack("captions");
|
||||
var cue = new VTTCue(0, 1, "text");
|
||||
cue.line = -2;
|
||||
track.addCue(cue);
|
||||
track.mode = "showing";
|
||||
</script>
|
||||
</html>
|
|
@ -0,0 +1,37 @@
|
|||
<!DOCTYPE html>
|
||||
<html class="reftest-wait">
|
||||
<script src="/common/reftest-wait.js"></script>
|
||||
<link rel="match" href="track-cue-rendering-after-controls-added-ref.html">
|
||||
<title>Text track cue layout after controls are added</title>
|
||||
<style>
|
||||
::cue {
|
||||
font-size: 50px;
|
||||
}
|
||||
</style>
|
||||
<!-- Width should be large enough to display all of the media controls. -->
|
||||
<video style="border:1px solid gray; width: 500px;">
|
||||
<source src="/media/white.webm" type="video/webm">
|
||||
<source src="/media/white.mp4" type="video/mp4">
|
||||
</video>
|
||||
<script>
|
||||
// Add a cue that will overlap with the video controls.
|
||||
var video = document.querySelector("video");
|
||||
var track = video.addTextTrack("captions");
|
||||
track.addCue(new VTTCue(0, 1, "text"));
|
||||
track.mode = "showing";
|
||||
|
||||
video.onloadeddata = function() {
|
||||
// Double nesting of requestAnimationFrame to
|
||||
// make sure cue layout and paint happens.
|
||||
window.requestAnimationFrame(function() {
|
||||
window.requestAnimationFrame(function() {
|
||||
video.controls = true;
|
||||
// Wait for the relayout before screenshot.
|
||||
window.requestAnimationFrame(function() {
|
||||
takeScreenshot();
|
||||
});
|
||||
});
|
||||
});
|
||||
};
|
||||
</script>
|
||||
</html>
|
|
@ -0,0 +1,29 @@
|
|||
<!DOCTYPE html>
|
||||
<html class="reftest-wait">
|
||||
<script src="/common/reftest-wait.js"></script>
|
||||
<title>Text track cue layout after controls are removed (reference)</title>
|
||||
<style>
|
||||
::cue {
|
||||
font-size: 50px;
|
||||
}
|
||||
|
||||
video {
|
||||
border: 1px solid gray;
|
||||
}
|
||||
</style>
|
||||
<video onloadeddata="this.onloadeddata = null; takeScreenshot();">
|
||||
<source src="/media/white.webm" type="video/webm">
|
||||
<source src="/media/white.mp4" type="video/mp4">
|
||||
</video>
|
||||
<script>
|
||||
// Add a single cue at line -2, where it would be if there were controls visible
|
||||
// at the bottom. (This assumes that those controls are less than 50px high.)
|
||||
// cue at line -1.
|
||||
var video = document.querySelector("video");
|
||||
var track = video.addTextTrack("captions");
|
||||
var cue = new VTTCue(0, 1, "text");
|
||||
cue.line = -2;
|
||||
track.addCue(cue);
|
||||
track.mode = "showing";
|
||||
</script>
|
||||
</html>
|
|
@ -0,0 +1,34 @@
|
|||
<!DOCTYPE html>
|
||||
<html class="reftest-wait">
|
||||
<script src="/common/reftest-wait.js"></script>
|
||||
<link rel="match" href="track-cue-rendering-after-controls-removed-ref.html">
|
||||
<title>Text track cue layout after controls are removed</title>
|
||||
<style>
|
||||
::cue {
|
||||
font-size: 50px;
|
||||
}
|
||||
</style>
|
||||
<video controls style="border:1px solid gray">
|
||||
<source src="/media/white.webm" type="video/webm">
|
||||
<source src="/media/white.mp4" type="video/mp4">
|
||||
</video>
|
||||
<script>
|
||||
// Add a cue that will overlap with the video controls.
|
||||
var video = document.querySelector("video");
|
||||
var track = video.addTextTrack("captions");
|
||||
track.addCue(new VTTCue(0, 1, "text"));
|
||||
track.mode = "showing";
|
||||
|
||||
video.onloadeddata = function() {
|
||||
// Double nesting of requestAnimationFrame to
|
||||
// make sure cue layout and paint happens.
|
||||
window.requestAnimationFrame(function() {
|
||||
window.requestAnimationFrame(function() {
|
||||
// Remove the controls. The cue should not move.
|
||||
video.controls = false;
|
||||
takeScreenshot();
|
||||
});
|
||||
});
|
||||
};
|
||||
</script>
|
||||
</html>
|
|
@ -0,0 +1,29 @@
|
|||
<!DOCTYPE html>
|
||||
<html class="reftest-wait">
|
||||
<title>Reference test for track-webvtt-non-snap-to-lines.html</title>
|
||||
<script src="/common/reftest-wait.js"></script>
|
||||
<script src="/common/media.js"></script>
|
||||
<style>
|
||||
.container {
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
}
|
||||
.cue {
|
||||
position: absolute;
|
||||
top: 48px;
|
||||
font-family: sans-serif;
|
||||
background: green;
|
||||
color: rgba(255, 255, 255, 1);
|
||||
font-size: 12px;
|
||||
padding: 0px 2px;
|
||||
}
|
||||
</style>
|
||||
<div class="container">
|
||||
<video autoplay onplaying="this.onplaying = null; this.pause(); takeScreenshot();">
|
||||
<script>
|
||||
document.currentScript.parentNode.src = getVideoURI("/media/test");
|
||||
</script>
|
||||
</video>
|
||||
<span class="cue">Bear is Coming!!!!!</span>
|
||||
</div>
|
||||
</html>
|
|
@ -0,0 +1,24 @@
|
|||
<!DOCTYPE html>
|
||||
<html class="reftest-wait">
|
||||
<title>Position is not adjusted for non snap-to-lines cues</title>
|
||||
<link rel="match" href="track-webvtt-non-snap-to-lines-ref.html">
|
||||
<script src="/common/reftest-wait.js"></script>
|
||||
<script src="/common/media.js"></script>
|
||||
<style>
|
||||
::cue {
|
||||
background: green;
|
||||
}
|
||||
</style>
|
||||
<video autoplay onplaying="this.onplaying = null; this.pause(); takeScreenshot();"></video>
|
||||
<script>
|
||||
var video = document.querySelector("video");
|
||||
var track = video.addTextTrack("captions");
|
||||
var cue = new VTTCue(0, 1, "Bear is Coming!!!!!");
|
||||
cue.snapToLines = false;
|
||||
cue.line = 20;
|
||||
cue.align = "left";
|
||||
track.addCue(cue);
|
||||
track.mode = "showing";
|
||||
video.src = getVideoURI("/media/test");
|
||||
</script>
|
||||
</html>
|
|
@ -0,0 +1,23 @@
|
|||
<!DOCTYPE html>
|
||||
<html class="reftest-wait">
|
||||
<title>WebVTT two-cue layout after the first cue has ended (reference)</title>
|
||||
<script src="/common/reftest-wait.js"></script>
|
||||
<video style="border:1px solid gray">
|
||||
<source src="/media/white.webm" type="video/webm">
|
||||
<source src="/media/white.mp4" type="video/mp4">
|
||||
</video>
|
||||
<script>
|
||||
// Add a single cue at line -2, where it would be if there was a first
|
||||
// cue at line -1.
|
||||
var video = document.querySelector("video");
|
||||
var track = video.addTextTrack("captions");
|
||||
var cue = new VTTCue(0, 3, "cue 2");
|
||||
cue.line = -2;
|
||||
track.addCue(cue);
|
||||
track.mode = "showing";
|
||||
|
||||
video.onloadeddata = function() {
|
||||
takeScreenshot();
|
||||
};
|
||||
</script>
|
||||
</html>
|
|
@ -0,0 +1,30 @@
|
|||
<!DOCTYPE html>
|
||||
<html class="reftest-wait">
|
||||
<title>WebVTT two-cue layout after the first cue has ended</title>
|
||||
<link rel="match" href="track-webvtt-two-cue-layout-after-first-end-ref.html">
|
||||
<script src="/common/reftest-wait.js"></script>
|
||||
<video style="border:1px solid gray">
|
||||
<source src="/media/white.webm" type="video/webm">
|
||||
<source src="/media/white.mp4" type="video/mp4">
|
||||
</video>
|
||||
<script>
|
||||
// Add two cues, where the first cue ends before the second.
|
||||
var video = document.querySelector("video");
|
||||
var track = video.addTextTrack("captions");
|
||||
track.addCue(new VTTCue(0, 1, "cue 1"));
|
||||
track.addCue(new VTTCue(0, 3, "cue 2"));
|
||||
track.mode = "showing";
|
||||
|
||||
video.onloadeddata = function() {
|
||||
// Double nesting of requestAnimationFrame to
|
||||
// make sure cue layout and paint happens.
|
||||
window.requestAnimationFrame(function() {
|
||||
window.requestAnimationFrame(function() {
|
||||
// Seek past the end of the first cue. The second cue should not move.
|
||||
video.currentTime = 2;
|
||||
video.onseeked = function() { takeScreenshot(); };
|
||||
});
|
||||
});
|
||||
};
|
||||
</script>
|
||||
</html>
|
|
@ -0,0 +1,80 @@
|
|||
<!DOCTYPE html>
|
||||
<title>Test relList attribute</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script>
|
||||
let link_support_table = {};
|
||||
// https://html.spec.whatwg.org/multipage/links.html#linkTypes
|
||||
link_support_table['link'] = {
|
||||
supported : ['modulepreload', 'preload', 'preconnect', 'dns-prefetch',
|
||||
'stylesheet', 'import', 'icon', 'alternate', 'prefetch',
|
||||
'prerender', 'next', 'manifest', 'apple-touch-icon',
|
||||
'apple-touch-icon-precomposed', 'canonical'],
|
||||
unsupported : ['author', 'bookmark', 'external', 'help', 'license',
|
||||
'nofollow', 'pingback', 'prev', 'search', 'tag',
|
||||
'noreferrer', 'noopener']
|
||||
};
|
||||
link_support_table['a'] = {
|
||||
supported : ['noreferrer', 'noopener'],
|
||||
unsupported : ['author', 'bookmark', 'external', 'help', 'license',
|
||||
'nofollow', 'pingback', 'prev', 'search', 'tag',
|
||||
'modulepreload', 'preload', 'preconnect', 'dns-prefetch',
|
||||
'stylesheet', 'import', 'icon', 'alternate', 'prefetch',
|
||||
'prerender', 'next', 'manifest', 'apple-touch-icon',
|
||||
'apple-touch-icon-precomposed', 'canonical']
|
||||
};
|
||||
link_support_table['area'] = link_support_table['a'];
|
||||
|
||||
function test_rellist(tag_name, rel_table) {
|
||||
let element = document.createElement(tag_name);
|
||||
let tag = element.tagName;
|
||||
// Test that setting rel is also setting relList, for both
|
||||
// valid and invalid values.
|
||||
element.rel = 'whatever';
|
||||
assert_true(element.relList.contains('whatever'), 'tag = ' + tag + ', setting rel must work');
|
||||
element.rel = 'prefetch';
|
||||
assert_true(element.relList.contains('prefetch'), 'tag = ' + tag + ', setting rel must work');
|
||||
// Test that add() works.
|
||||
element.relList.add('preloadwhatever');
|
||||
assert_equals(element.rel, 'prefetch preloadwhatever', 'tag = ' + tag + ', add must work');
|
||||
assert_true(element.relList.contains('preloadwhatever'), 'tag = ' + tag + ', add must work');
|
||||
// Test that remove() works.
|
||||
element.relList.remove('preloadwhatever');
|
||||
assert_equals(element.rel, 'prefetch', 'tag = ' + tag + ', remove must work');
|
||||
assert_false(element.relList.contains('preloadwhatever'), 'tag = ' + tag + ', remove must work');
|
||||
// Test that toggle() works.
|
||||
element.relList.toggle('prefetch', false);
|
||||
assert_equals(element.rel, '', 'tag = ' + tag + ', toggle must work');
|
||||
element.relList.toggle('prefetch', true);
|
||||
assert_equals(element.rel, 'prefetch', 'tag = ' + tag + ', toggle must work');
|
||||
// Test that replace() works.
|
||||
element.relList.replace('prefetch', 'first');
|
||||
assert_equals(element.rel, 'first', 'tag = ' + tag + ', replace must work');
|
||||
// Test that indexed item getter works.
|
||||
element.relList.add('second');
|
||||
assert_equals(element.relList.length, 2, 'tag = ' + tag + ', relList length must be correct');
|
||||
assert_equals(element.relList[0], 'first', 'tag = ' + tag + ', relList indexed item must work');
|
||||
assert_equals(element.relList[1], 'second', 'tag = ' + tag + ', relList indexed item must work');
|
||||
// Test that relList is [SameObject].
|
||||
let savedRelList = element.relList;
|
||||
element.rel = 'something';
|
||||
assert_equals(element.relList, savedRelList, 'tag = ' + tag + ', SameObject must work');
|
||||
|
||||
// Test that supports() is returning true for valid values
|
||||
// and false for invalid ones.
|
||||
let supported = rel_table['supported'];
|
||||
for (let link_type in supported) {
|
||||
assert_true(element.relList.supports(supported[link_type]), 'tag = ' + tag + ', link type = ' + supported[link_type] + ' must be supported');
|
||||
}
|
||||
let unsupported = rel_table['unsupported'];
|
||||
for (let link_type in unsupported) {
|
||||
assert_false(element.relList.supports(unsupported[link_type]), 'tag = ' + tag + ', link type = ' + unsupported[link_type] + ' must be unsupported');
|
||||
}
|
||||
}
|
||||
|
||||
test(function() {
|
||||
test_rellist('LINK', link_support_table['link']);
|
||||
test_rellist('A', link_support_table['a']);
|
||||
test_rellist('AREA', link_support_table['area']);
|
||||
}, 'Make sure that relList based feature detection is working');
|
||||
</script>
|
|
@ -0,0 +1,29 @@
|
|||
<html>
|
||||
<head>
|
||||
<title>Inline async module script execution order</title>
|
||||
<meta name=timeout content=long>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<script>
|
||||
let loaded = [];
|
||||
let test = async_test("Inline async module script execution order");
|
||||
window.addEventListener("load", test.step_func(function() {
|
||||
assert_array_equals(loaded,
|
||||
["fast", "fast", "fast", "slow", "slow", "slow"]);
|
||||
test.done();
|
||||
}));
|
||||
</script>
|
||||
<script type="module" async src="resources/slow-module.js?pipe=trickle(d2)&unique=1"></script>
|
||||
<script type="module" async>
|
||||
import "./resources/slow-module.js?pipe=trickle(d2)&unique=2";
|
||||
loaded.push("slow");
|
||||
</script>
|
||||
<script type="module" async src="resources/fast-module.js?unique=1"></script>
|
||||
<script type="module" async>
|
||||
import "./resources/fast-module.js?unique=2";
|
||||
loaded.push("fast");
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -59,4 +59,3 @@ document.head.appendChild(script4_dynamic_error);
|
|||
<script onload="onLoad(test4_load);" onerror="onError(test4_load);" type="module" async>"use strict";onExecute(test4_load);</script>
|
||||
<script onload="onLoad(test1_error);" onerror="onError(test1_error);" type="module">"use strict";import "./not_found.js";</script>
|
||||
<script onload="onLoad(test4_error);" onerror="onError(test4_error);" type="module" async>"use strict";import "./not_found.js";</script>
|
||||
</script>
|
||||
|
|
|
@ -10,7 +10,11 @@
|
|||
window.evaluated_module_script = true;
|
||||
</script>
|
||||
<script>
|
||||
test(() => assert_true(window.evaluated_module_script), "module script in XHTML documents should be evaluated.");
|
||||
var test = async_test("module script in XHTML documents should be evaluated.");
|
||||
window.addEventListener("load", () => {
|
||||
test.step(() => { assert_true(window.evaluated_module_script); });
|
||||
test.done();
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
loaded.push("fast");
|
|
@ -0,0 +1,3 @@
|
|||
// This module is imported with pipe=trickle(d2) to make it load more slowly
|
||||
// than fast-module.js
|
||||
loaded.push("slow");
|
|
@ -1,57 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<title>HTMLAnchorElement relList</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script>
|
||||
test(function() {
|
||||
var element = document.createElement("a");
|
||||
// Test that setting rel is also setting relList, for both
|
||||
// valid and invalid values.
|
||||
element.rel = "whatever";
|
||||
assert_true(element.relList.contains("whatever"));
|
||||
element.rel = "prefetch";
|
||||
assert_true(element.relList.contains("prefetch"));
|
||||
// Test that add() works.
|
||||
element.relList.add("preloadwhatever");
|
||||
assert_equals(element.rel, "prefetch preloadwhatever");
|
||||
assert_true(element.relList.contains("preloadwhatever"));
|
||||
// Test that remove() works.
|
||||
element.relList.remove("preloadwhatever");
|
||||
assert_equals(element.rel, "prefetch");
|
||||
assert_false(element.relList.contains("preloadwhatever"));
|
||||
// Test that toggle() works.
|
||||
element.relList.toggle("prefetch", false);
|
||||
assert_equals(element.rel, "");
|
||||
element.relList.toggle("prefetch", true);
|
||||
assert_equals(element.rel, "prefetch");
|
||||
// Test that replace() works.
|
||||
element.relList.replace("prefetch", "first");
|
||||
assert_equals(element.rel, "first");
|
||||
// Test that indexed item getter works.
|
||||
element.relList.add("second");
|
||||
assert_equals(element.relList.length, 2);
|
||||
assert_equals(element.relList[0], "first");
|
||||
assert_equals(element.relList[1], "second");
|
||||
// Test that relList is [SameObject].
|
||||
let savedRelList = element.relList;
|
||||
element.rel = "something";
|
||||
assert_equals(element.relList, savedRelList);
|
||||
|
||||
// Test that supports() is returning true for valid values
|
||||
// and false for invalid ones.
|
||||
assert_false(element.relList.supports("bogus"));
|
||||
assert_false(element.relList.supports("alternate"));
|
||||
assert_false(element.relList.supports("author"));
|
||||
assert_false(element.relList.supports("bookmark"));
|
||||
assert_false(element.relList.supports("external"));
|
||||
assert_false(element.relList.supports("help"));
|
||||
assert_false(element.relList.supports("license"));
|
||||
assert_false(element.relList.supports("next"));
|
||||
assert_false(element.relList.supports("nofollow"));
|
||||
assert_false(element.relList.supports("prev"));
|
||||
assert_false(element.relList.supports("search"));
|
||||
assert_false(element.relList.supports("tag"));
|
||||
assert_true(element.relList.supports("noreferrer"));
|
||||
assert_true(element.relList.supports("noopener"));
|
||||
}, "Make sure that relList based feature detection is working");
|
||||
</script>
|
|
@ -1,57 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<title>HTMLAreaElement relList</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script>
|
||||
test(function() {
|
||||
var element = document.createElement("area");
|
||||
// Test that setting rel is also setting relList, for both
|
||||
// valid and invalid values.
|
||||
element.rel = "whatever";
|
||||
assert_true(element.relList.contains("whatever"));
|
||||
element.rel = "prefetch";
|
||||
assert_true(element.relList.contains("prefetch"));
|
||||
// Test that add() works.
|
||||
element.relList.add("preloadwhatever");
|
||||
assert_equals(element.rel, "prefetch preloadwhatever");
|
||||
assert_true(element.relList.contains("preloadwhatever"));
|
||||
// Test that remove() works.
|
||||
element.relList.remove("preloadwhatever");
|
||||
assert_equals(element.rel, "prefetch");
|
||||
assert_false(element.relList.contains("preloadwhatever"));
|
||||
// Test that toggle() works.
|
||||
element.relList.toggle("prefetch", false);
|
||||
assert_equals(element.rel, "");
|
||||
element.relList.toggle("prefetch", true);
|
||||
assert_equals(element.rel, "prefetch");
|
||||
// Test that replace() works.
|
||||
element.relList.replace("prefetch", "first");
|
||||
assert_equals(element.rel, "first");
|
||||
// Test that indexed item getter works.
|
||||
element.relList.add("second");
|
||||
assert_equals(element.relList.length, 2);
|
||||
assert_equals(element.relList[0], "first");
|
||||
assert_equals(element.relList[1], "second");
|
||||
// Test that relList is [SameObject].
|
||||
let savedRelList = element.relList;
|
||||
element.rel = "something";
|
||||
assert_equals(element.relList, savedRelList);
|
||||
|
||||
// Test that supports() is returning true for valid values
|
||||
// and false for invalid ones.
|
||||
assert_false(element.relList.supports("bogus"));
|
||||
assert_false(element.relList.supports("alternate"));
|
||||
assert_false(element.relList.supports("author"));
|
||||
assert_false(element.relList.supports("bookmark"));
|
||||
assert_false(element.relList.supports("external"));
|
||||
assert_false(element.relList.supports("help"));
|
||||
assert_false(element.relList.supports("license"));
|
||||
assert_false(element.relList.supports("next"));
|
||||
assert_false(element.relList.supports("nofollow"));
|
||||
assert_false(element.relList.supports("prev"));
|
||||
assert_false(element.relList.supports("search"));
|
||||
assert_false(element.relList.supports("tag"));
|
||||
assert_true(element.relList.supports("noreferrer"));
|
||||
assert_true(element.relList.supports("noopener"));
|
||||
}, "Make sure that relList based feature detection is working");
|
||||
</script>
|
|
@ -70,124 +70,6 @@ function btoaLookup(idx) {
|
|||
// Throw INVALID_CHARACTER_ERR exception here -- won't be hit in the tests.
|
||||
}
|
||||
|
||||
/**
|
||||
* Implementation of atob() according to the HTML spec, except that instead of
|
||||
* throwing INVALID_CHARACTER_ERR we return null.
|
||||
*/
|
||||
function myatob(input) {
|
||||
// WebIDL requires DOMStrings to just be converted using ECMAScript
|
||||
// ToString, which in our case amounts to calling String().
|
||||
input = String(input);
|
||||
|
||||
// "Remove all space characters from input."
|
||||
input = input.replace(/[ \t\n\f\r]/g, "");
|
||||
|
||||
// "If the length of input divides by 4 leaving no remainder, then: if
|
||||
// input ends with one or two U+003D EQUALS SIGN (=) characters, remove
|
||||
// them from input."
|
||||
if (input.length % 4 == 0 && /==?$/.test(input)) {
|
||||
input = input.replace(/==?$/, "");
|
||||
}
|
||||
|
||||
// "If the length of input divides by 4 leaving a remainder of 1, throw an
|
||||
// INVALID_CHARACTER_ERR exception and abort these steps."
|
||||
//
|
||||
// "If input contains a character that is not in the following list of
|
||||
// characters and character ranges, throw an INVALID_CHARACTER_ERR
|
||||
// exception and abort these steps:
|
||||
//
|
||||
// U+002B PLUS SIGN (+)
|
||||
// U+002F SOLIDUS (/)
|
||||
// U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9)
|
||||
// U+0041 LATIN CAPITAL LETTER A to U+005A LATIN CAPITAL LETTER Z
|
||||
// U+0061 LATIN SMALL LETTER A to U+007A LATIN SMALL LETTER Z"
|
||||
if (input.length % 4 == 1
|
||||
|| !/^[+/0-9A-Za-z]*$/.test(input)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// "Let output be a string, initially empty."
|
||||
var output = "";
|
||||
|
||||
// "Let buffer be a buffer that can have bits appended to it, initially
|
||||
// empty."
|
||||
//
|
||||
// We append bits via left-shift and or. accumulatedBits is used to track
|
||||
// when we've gotten to 24 bits.
|
||||
var buffer = 0;
|
||||
var accumulatedBits = 0;
|
||||
|
||||
// "While position does not point past the end of input, run these
|
||||
// substeps:"
|
||||
for (var i = 0; i < input.length; i++) {
|
||||
// "Find the character pointed to by position in the first column of
|
||||
// the following table. Let n be the number given in the second cell of
|
||||
// the same row."
|
||||
//
|
||||
// "Append to buffer the six bits corresponding to number, most
|
||||
// significant bit first."
|
||||
//
|
||||
// atobLookup() implements the table from the spec.
|
||||
buffer <<= 6;
|
||||
buffer |= atobLookup(input[i]);
|
||||
|
||||
// "If buffer has accumulated 24 bits, interpret them as three 8-bit
|
||||
// big-endian numbers. Append the three characters with code points
|
||||
// equal to those numbers to output, in the same order, and then empty
|
||||
// buffer."
|
||||
accumulatedBits += 6;
|
||||
if (accumulatedBits == 24) {
|
||||
output += String.fromCharCode((buffer & 0xff0000) >> 16);
|
||||
output += String.fromCharCode((buffer & 0xff00) >> 8);
|
||||
output += String.fromCharCode(buffer & 0xff);
|
||||
buffer = accumulatedBits = 0;
|
||||
}
|
||||
|
||||
// "Advance position by one character."
|
||||
}
|
||||
|
||||
// "If buffer is not empty, it contains either 12 or 18 bits. If it
|
||||
// contains 12 bits, discard the last four and interpret the remaining
|
||||
// eight as an 8-bit big-endian number. If it contains 18 bits, discard the
|
||||
// last two and interpret the remaining 16 as two 8-bit big-endian numbers.
|
||||
// Append the one or two characters with code points equal to those one or
|
||||
// two numbers to output, in the same order."
|
||||
if (accumulatedBits == 12) {
|
||||
buffer >>= 4;
|
||||
output += String.fromCharCode(buffer);
|
||||
} else if (accumulatedBits == 18) {
|
||||
buffer >>= 2;
|
||||
output += String.fromCharCode((buffer & 0xff00) >> 8);
|
||||
output += String.fromCharCode(buffer & 0xff);
|
||||
}
|
||||
|
||||
// "Return output."
|
||||
return output;
|
||||
}
|
||||
|
||||
/**
|
||||
* A lookup table for atob(), which converts an ASCII character to the
|
||||
* corresponding six-bit number.
|
||||
*/
|
||||
function atobLookup(chr) {
|
||||
if (/[A-Z]/.test(chr)) {
|
||||
return chr.charCodeAt(0) - "A".charCodeAt(0);
|
||||
}
|
||||
if (/[a-z]/.test(chr)) {
|
||||
return chr.charCodeAt(0) - "a".charCodeAt(0) + 26;
|
||||
}
|
||||
if (/[0-9]/.test(chr)) {
|
||||
return chr.charCodeAt(0) - "0".charCodeAt(0) + 52;
|
||||
}
|
||||
if (chr == "+") {
|
||||
return 62;
|
||||
}
|
||||
if (chr == "/") {
|
||||
return 63;
|
||||
}
|
||||
// Throw exception; should not be hit in tests
|
||||
}
|
||||
|
||||
function btoaException(input) {
|
||||
input = String(input);
|
||||
for (var i = 0; i < input.length; i++) {
|
||||
|
@ -252,55 +134,40 @@ tests.push(["btoa(first 256 code points concatenated)", everything]);
|
|||
|
||||
generate_tests(testBtoa, tests);
|
||||
|
||||
function testAtob(input) {
|
||||
var expected = myatob(input);
|
||||
if (expected === null) {
|
||||
assert_throws("InvalidCharacterError", function() { atob(input) });
|
||||
return;
|
||||
}
|
||||
promise_test(() => fetch("../../../fetch/data-urls/resources/base64.json").then(res => res.json()).then(runAtobTests), "atob() setup.");
|
||||
|
||||
assert_equals(atob(input), expected);
|
||||
}
|
||||
|
||||
var tests = ["", "abcd", " abcd", "abcd ", " abcd===", "abcd=== ",
|
||||
"abcd ===", "a", "ab", "abc", "abcde", String.fromCharCode(0xd800, 0xdc00),
|
||||
"=", "==", "===", "====", "=====",
|
||||
"a=", "a==", "a===", "a====", "a=====",
|
||||
"ab=", "ab==", "ab===", "ab====", "ab=====",
|
||||
"abc=", "abc==", "abc===", "abc====", "abc=====",
|
||||
"abcd=", "abcd==", "abcd===", "abcd====", "abcd=====",
|
||||
"abcde=", "abcde==", "abcde===", "abcde====", "abcde=====",
|
||||
"=a", "=a=", "a=b", "a=b=", "ab=c", "ab=c=", "abc=d", "abc=d=",
|
||||
// With whitespace
|
||||
"ab\tcd", "ab\ncd", "ab\fcd", "ab\rcd", "ab cd", "ab\u00a0cd",
|
||||
"ab\t\n\f\r cd", " \t\n\f\r ab\t\n\f\r cd\t\n\f\r ",
|
||||
"ab\t\n\f\r =\t\n\f\r =\t\n\f\r ",
|
||||
// Test if any bits are set at the end. These should all be fine, since
|
||||
// they end with A, which becomes 0:
|
||||
"A", "/A", "//A", "///A", "////A",
|
||||
// These are all bad, since they end in / (= 63, all bits set) but their
|
||||
// length isn't a multiple of four characters, so they can't be output by
|
||||
// btoa(). Thus one might expect some UAs to throw exceptions or otherwise
|
||||
// object, since they could never be output by btoa(), so they're good to
|
||||
// test.
|
||||
"/", "A/", "AA/", "AAAA/",
|
||||
// But this one is possible:
|
||||
"AAA/",
|
||||
// Binary-safety tests
|
||||
"\0nonsense", "abcd\0nonsense",
|
||||
// WebIDL tests
|
||||
undefined, null, 7, 12, 1.5, true, false, NaN, +Infinity, -Infinity, 0, -0,
|
||||
{toString: function() { return "foo" }},
|
||||
{toString: function() { return "abcd" }},
|
||||
const idlTests = [
|
||||
[undefined, null],
|
||||
[null, [158, 233, 101]],
|
||||
[7, null],
|
||||
[12, [215]],
|
||||
[1.5, null],
|
||||
[true, [182, 187]],
|
||||
[false, null],
|
||||
[NaN, [53, 163]],
|
||||
[+Infinity, [34, 119, 226, 158, 43, 114]],
|
||||
[-Infinity, null],
|
||||
[0, null],
|
||||
[-0, null],
|
||||
[{toString: function() { return "foo" }}, [126, 138]],
|
||||
[{toString: function() { return "abcd" }}, [105, 183, 29]]
|
||||
];
|
||||
tests = tests.map(
|
||||
function(elem) {
|
||||
if (myatob(elem) === null) {
|
||||
return ["atob(" + format_value(elem) + ") must raise InvalidCharacterError", elem];
|
||||
}
|
||||
return ["atob(" + format_value(elem) + ") == " + format_value(myatob(elem)), elem];
|
||||
}
|
||||
);
|
||||
|
||||
generate_tests(testAtob, tests);
|
||||
function runAtobTests(tests) {
|
||||
const allTests = tests.concat(idlTests);
|
||||
for(let i = 0; i < allTests.length; i++) {
|
||||
const input = allTests[i][0],
|
||||
output = allTests[i][1];
|
||||
test(() => {
|
||||
if(output === null) {
|
||||
assert_throws("InvalidCharacterError", () => window.atob(input));
|
||||
} else {
|
||||
const result = window.atob(input);
|
||||
for(let ii = 0; ii < output.length; ii++) {
|
||||
assert_equals(result.charCodeAt(ii), output[ii]);
|
||||
}
|
||||
}
|
||||
}, "atob(" + format_value(input) + ")");
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue