mirror of
https://github.com/servo/servo.git
synced 2025-08-07 14:35:33 +01:00
Update web-platform-tests to revision 0d318188757a9c996e20b82db201fd04de5aa255
This commit is contained in:
parent
b2a5225831
commit
1a81b18b9f
12321 changed files with 544385 additions and 6 deletions
|
@ -0,0 +1,31 @@
|
|||
<!doctype html>
|
||||
<meta charset=utf-8>
|
||||
<title>Synthetic popstate events</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
test(function () {
|
||||
assert_throws('NotSupportedError', function() {
|
||||
document.createEvent('PopStateEvent');
|
||||
}, 'document.createEvent("PopStateEvent") should not be supported');
|
||||
}, 'document.createEvent');
|
||||
|
||||
test(function () {
|
||||
assert_false('initPopStateEvent' in PopStateEvent.prototype,
|
||||
'There should be no PopStateEvent#initPopStateEvent');
|
||||
}, 'initPopStateEvent');
|
||||
|
||||
test(function () {
|
||||
var state = history.state;
|
||||
var data;
|
||||
window.addEventListener('popstate', function (e) {
|
||||
data = e.state;
|
||||
});
|
||||
window.dispatchEvent(new PopStateEvent('popstate', {
|
||||
'state': {testdata:true}
|
||||
}));
|
||||
assert_true(data.testdata,'state data was corrupted');
|
||||
assert_equals(history.state, state, "history.state was NOT set by dispatching the event");
|
||||
}, 'Dispatching a synthetic PopStateEvent');
|
||||
</script>
|
|
@ -0,0 +1,6 @@
|
|||
[
|
||||
{
|
||||
"id": "event-definitions-0",
|
||||
"original_id": "event-definitions-0"
|
||||
}
|
||||
]
|
|
@ -0,0 +1,30 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Media documents: image</title>
|
||||
<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.");
|
||||
|
||||
function frameLoaded() {
|
||||
var testframe = document.getElementById('testframe');
|
||||
var testframeChildren = testframe.contentDocument.body.childNodes;
|
||||
assert_equals(testframeChildren.length, 1, "Body of image document has 1 child");
|
||||
assert_equals(testframeChildren[0].nodeName, "IMG", "Only child of body must be an <img> element");
|
||||
assert_equals(testframeChildren[0].namespaceURI, "http://www.w3.org/1999/xhtml",
|
||||
"Only child of body must be an HTML element");
|
||||
t.done();
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="log"></div>
|
||||
<iframe id="testframe" onload="t.step(frameLoaded)"
|
||||
src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAIAAACQd1PeAAAAAXNSR0IArs4c6QAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9oMFgQGMyFwHucAAAAZdEVYdENvbW1lbnQAQ3JlYXRlZCB3aXRoIEdJTVBXgQ4XAAAADElEQVQI12P4//8/AAX+Av7czFnnAAAAAElFTkSuQmCC"></iframe>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,30 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Media documents: video</title>
|
||||
<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.");
|
||||
|
||||
function frameLoaded() {
|
||||
var testframe = document.getElementById('testframe');
|
||||
var testframeChildren = testframe.contentDocument.body.childNodes;
|
||||
assert_equals(testframeChildren.length, 1, "Body of image document has 1 child");
|
||||
assert_equals(testframeChildren[0].nodeName, "VIDEO", "Only child of body must be an <video> element");
|
||||
assert_equals(testframeChildren[0].namespaceURI, "http://www.w3.org/1999/xhtml",
|
||||
"Only child of body must be an HTML element");
|
||||
t.done();
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="log"></div>
|
||||
<iframe id="testframe" onload="t.step(frameLoaded)"
|
||||
src="data:video/webm,"></iframe>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,41 @@
|
|||
<!DOCTYPE html>
|
||||
<title>Page load processing model for text files</title>
|
||||
<link rel="author" title="Ms2ger" href="ms2ger@gmail.com">
|
||||
<link rel="help" href="https://html.spec.whatwg.org/multipage/#read-text">
|
||||
<link rel="stylesheet" href="/resources/testharness.css">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
var t = async_test("Checking document metadata for text file");
|
||||
var tD = async_test("Checking DOM for text file");
|
||||
var tC = async_test("Checking contents for text file");
|
||||
var iframe = document.body.appendChild(document.createElement("iframe"));
|
||||
iframe.onload = function(e) {
|
||||
var doc = iframe.contentDocument;
|
||||
t.step(function() {
|
||||
assert_equals(doc.compatMode, "BackCompat");
|
||||
assert_equals(doc.contentType, "text/plain");
|
||||
assert_equals(doc.doctype, null);
|
||||
t.done();
|
||||
})
|
||||
tD.step(function() {
|
||||
assert_equals(doc.childNodes.length, 1, "Document should have 1 child")
|
||||
assert_equals(doc.documentElement.tagName, "HTML");
|
||||
assert_equals(doc.documentElement.childNodes.length, 2,
|
||||
"Root element should have 2 children")
|
||||
assert_equals(doc.documentElement.firstChild.tagName, "HEAD");
|
||||
assert_equals(doc.documentElement.lastChild.tagName, "BODY");
|
||||
assert_equals(doc.documentElement.lastChild.childNodes.length, 1,
|
||||
"Body element should have 1 child")
|
||||
assert_equals(doc.documentElement.lastChild.firstChild.tagName, "PRE");
|
||||
tD.done();
|
||||
})
|
||||
tC.step(function() {
|
||||
assert_equals(doc.documentElement.lastChild.firstChild.firstChild.data,
|
||||
"This is a sample text/plain document.\n\nThis is not an HTML document.\n\n");
|
||||
tC.done();
|
||||
})
|
||||
};
|
||||
iframe.src = "../../../../common/text-plain.txt";
|
||||
</script>
|
|
@ -0,0 +1,23 @@
|
|||
<!DOCTYPE HTML>
|
||||
<script>
|
||||
t = opener.t;
|
||||
do_test = t.step(function () {
|
||||
localStorage.test6564729 += '4';
|
||||
var d = document;
|
||||
var e = document.open(); // has no effect (ignore-opens-during-unload > 0)
|
||||
localStorage.test6564729 += (e == d) ? '5' : 'A [' + e + '] ';
|
||||
document.write('FAIL - document.write executed and blocked navigation!'); // has no effect (ignore-opens-during-unload > 0)
|
||||
localStorage.test6564729 += document.body.textContent.match('FAIL') ? 'B' : '6';
|
||||
document.close(); // has no effect (no script-created parser)
|
||||
localStorage.test6564729 += '7';
|
||||
})
|
||||
onload = t.step_func(function() {
|
||||
localStorage.test6564729 = '0';
|
||||
setTimeout(t.step_func(function() {document.links[0].click()}));
|
||||
});
|
||||
</script>
|
||||
<body onbeforeunload="localStorage.test6564729 += '1'"
|
||||
onpagehide="localStorage.test6564729 += '3'"
|
||||
onunload="do_test()">
|
||||
<p><a href="001a.html">Follow this link to run the test.</a>
|
||||
<p><iframe src="001b.html"></iframe>
|
|
@ -0,0 +1,15 @@
|
|||
<!doctype html>
|
||||
<title>document.open in unload</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
var t = async_test();
|
||||
var win;
|
||||
|
||||
t.step(function() {
|
||||
win = window.open("001-1.html");
|
||||
});
|
||||
|
||||
add_completion_callback(function() {win.close()});
|
||||
</script>
|
|
@ -0,0 +1,7 @@
|
|||
<!DOCTYPE HTML>
|
||||
<script>
|
||||
opener.t.step(function() {
|
||||
opener.assert_equals(localStorage.test6564729, '0123456789');
|
||||
opener.t.done();
|
||||
});
|
||||
</script>
|
|
@ -0,0 +1,5 @@
|
|||
<!DOCTYPE HTML>
|
||||
<body onbeforeunload="localStorage.test6564729 += '2'"
|
||||
onpagehide="localStorage.test6564729 += '8'"
|
||||
onunload="localStorage.test6564729 += '9'">
|
||||
<p>Inner frame
|
|
@ -0,0 +1,28 @@
|
|||
<!DOCTYPE HTML>
|
||||
<script>
|
||||
var t = opener.t;
|
||||
|
||||
var do_test = t.step_func(function() {
|
||||
localStorage.test6564729 += '1';
|
||||
var d = document;
|
||||
var e = document.open(); // unload triggered here - beforeunload 2, 3 in 002b; pagehide 4, unload 5, pagehide 6 in 002b, unload 7 in 002b
|
||||
localStorage.test6564729 += (e == d) ? '8' : 'X';
|
||||
var s = 'FAIL if you see this | ' + localStorage.test6564729;
|
||||
document.write(s);
|
||||
localStorage.test6564729 += document.body.textContent == s ? '9' : 'x';
|
||||
document.close();
|
||||
localStorage.test6564729 += 'Z';
|
||||
document.body.textContent += ' // ' + localStorage.test6564729;
|
||||
location = '002a.html'; // unload triggers again here, but they're not registered event listeners any more
|
||||
});
|
||||
|
||||
onload = t.step_func(function() {
|
||||
localStorage.test6564729 = '0';
|
||||
setTimeout(function() {document.getElementsByTagName("input")[0].click()}, 100);
|
||||
});
|
||||
</script>
|
||||
<body onbeforeunload="localStorage.test6564729 += '2'"
|
||||
onpagehide="localStorage.test6564729 += '4'"
|
||||
onunload="localStorage.test6564729 += '5'">
|
||||
<input type=button value="Activate this button to run the test" onclick="do_test()">
|
||||
<p><iframe src="002b.html"></iframe>
|
|
@ -0,0 +1,15 @@
|
|||
<!doctype html>
|
||||
<title>document.open in unload</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
var t = async_test();
|
||||
var win;
|
||||
|
||||
t.step(function() {
|
||||
win = window.open("002-1.html");
|
||||
});
|
||||
|
||||
add_completion_callback(function() {win.close()});
|
||||
</script>
|
|
@ -0,0 +1,7 @@
|
|||
<!DOCTYPE HTML>
|
||||
<script>
|
||||
opener.t.step(function() {
|
||||
opener.assert_equals(localStorage.test6564729, '0123456789Z');
|
||||
opener.t.done();
|
||||
});
|
||||
</script>
|
|
@ -0,0 +1,5 @@
|
|||
<!DOCTYPE HTML>
|
||||
<body onbeforeunload="localStorage.test6564729 += '3'"
|
||||
onpagehide="localStorage.test6564729 += '6'"
|
||||
onunload="localStorage.test6564729 += '7'">
|
||||
<p>Inner frame
|
|
@ -0,0 +1,23 @@
|
|||
<!DOCTYPE HTML>
|
||||
<script>
|
||||
var t = opener.t;
|
||||
var do_test = t.step_func(function() {
|
||||
localStorage.test6564729 += '1';
|
||||
var d = document;
|
||||
var e = document.open(); // has no effect (ignore-opens-during-unload > 0 because we're in beforeunload)
|
||||
localStorage.test6564729 += (e == d) ? '2' : 'A [' + e + '] ';
|
||||
document.write('FAIL - document.write executed and blocked navigation!'); // has no effect (ignore-opens-during-unload > 0)
|
||||
localStorage.test6564729 += document.body.textContent.match('FAIL') ? 'B' : '3';
|
||||
document.close(); // has no effect (no script-created parser)
|
||||
localStorage.test6564729 += '4';
|
||||
})
|
||||
|
||||
onload=t.step_func(function() {localStorage.test6564729 = '0'; setTimeout(t.step_func(function() {document.links[0].click()}), 100)})
|
||||
|
||||
</script>
|
||||
<body
|
||||
onbeforeunload="do_test()"
|
||||
onpagehide="localStorage.test6564729 += '6'"
|
||||
onunload="localStorage.test6564729 += '7'">
|
||||
<p><a href="003a.html">Follow this link to run the test.</a>
|
||||
<p><iframe src="003b.html"></iframe>
|
|
@ -0,0 +1,15 @@
|
|||
<!doctype html>
|
||||
<title>document.open in beforeunload with link</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
var t = async_test();
|
||||
var win;
|
||||
|
||||
t.step(function() {
|
||||
win = window.open("003-1.html");
|
||||
});
|
||||
|
||||
add_completion_callback(function() {win.close()});
|
||||
</script>
|
|
@ -0,0 +1,8 @@
|
|||
<!DOCTYPE HTML>
|
||||
<p>FAIL</p>
|
||||
<script>
|
||||
opener.t.step(function() {
|
||||
opener.assert_equals(localStorage.test6564729, '0123456789')
|
||||
opener.t.done();
|
||||
})
|
||||
</script>
|
|
@ -0,0 +1,5 @@
|
|||
<!DOCTYPE HTML>
|
||||
<body onbeforeunload="localStorage.test6564729 += '5'"
|
||||
onpagehide="localStorage.test6564729 += '8'"
|
||||
onunload="localStorage.test6564729 += '9'">
|
||||
<p>Inner frame
|
|
@ -0,0 +1,25 @@
|
|||
<!DOCTYPE HTML>
|
||||
<script>
|
||||
var t = opener.t;
|
||||
var do_test = t.step_func(function() {
|
||||
localStorage.test6564729 += 'B';
|
||||
var d = document;
|
||||
var e = document.open(); // unload triggered here - beforeunload C, D in 004b; pagehide E, unload F, pagehide G in 004b, unload HIJK in 004b
|
||||
localStorage.test6564729 += (e == d) ? 'L' : 'Y';
|
||||
var s = 'FAIL if you see this | ' + localStorage.test6564729;
|
||||
document.write(s);
|
||||
localStorage.test6564729 += document.body.textContent == s ? 'M' : 'y';
|
||||
document.close();
|
||||
localStorage.test6564729 += 'N';
|
||||
location = '004a.html'; // unload triggers again here, but they're not registered event listeners any more
|
||||
})
|
||||
onload = t.step_func(function() {
|
||||
localStorage.test6564729 = 'A';
|
||||
setTimeout(t.step_func(function() {document.getElementsByTagName("input")[0].click()}), 100);
|
||||
})
|
||||
</script>
|
||||
<body onbeforeunload="localStorage.test6564729 += 'C'"
|
||||
onpagehide="localStorage.test6564729 += 'E'"
|
||||
onunload="localStorage.test6564729 += 'F'">
|
||||
<input type=button value="Activate this button to run the test" onclick="do_test()">
|
||||
<p><iframe src="004b.html"></iframe>
|
|
@ -0,0 +1,15 @@
|
|||
<!doctype html>
|
||||
<title>document.open in beforeunload with button</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
var t = async_test();
|
||||
var win;
|
||||
|
||||
t.step(function() {
|
||||
win = window.open("004-1.html");
|
||||
});
|
||||
|
||||
add_completion_callback(function() {win.close()});
|
||||
</script>
|
|
@ -0,0 +1,8 @@
|
|||
<!DOCTYPE HTML>
|
||||
<p>FAIL</p>
|
||||
<script>
|
||||
opener.t.step(function() {
|
||||
opener.assert_equals(localStorage.test6564729, 'ABCDEFGHIJKLMN');
|
||||
opener.t.done();
|
||||
});
|
||||
</script>
|
|
@ -0,0 +1,18 @@
|
|||
<!DOCTYPE HTML>
|
||||
<script>
|
||||
function testRun() {
|
||||
localStorage.test6564729 += 'H';
|
||||
var d = parent.document;
|
||||
var e = parent.document.open(); // no effect, since that document is already in unload
|
||||
localStorage.test6564729 += (e == d) ? 'I' : 'X';
|
||||
var s = 'FAIL';
|
||||
document.write(s);
|
||||
localStorage.test6564729 += document.body.textContent == s ? 'x' : 'J';
|
||||
document.close();
|
||||
localStorage.test6564729 += 'K';
|
||||
}
|
||||
</script>
|
||||
<body onbeforeunload="localStorage.test6564729 += 'D'"
|
||||
onpagehide="localStorage.test6564729 += 'G'"
|
||||
onunload="testRun()">
|
||||
<p>Inner frame
|
|
@ -0,0 +1,13 @@
|
|||
<!DOCTYPE HTML>
|
||||
<script>
|
||||
onload = opener.t.step_func(function() {
|
||||
localStorage.test6564729 = '0'
|
||||
setTimeout(opener.t.step_func(function() {document.links[0].click()}), 100);
|
||||
});
|
||||
</script>
|
||||
<body
|
||||
onbeforeunload="localStorage.test6564729 += '1'"
|
||||
onpagehide="localStorage.test6564729 += '3'"
|
||||
onunload="localStorage.test6564729 += '4'">
|
||||
<p><a href="005a.html">Follow this link to run the test.</a>
|
||||
<p><iframe src="005b.html"></iframe>
|
|
@ -0,0 +1,15 @@
|
|||
<!doctype html>
|
||||
<title>document.open in pagehide in iframe</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
var t = async_test();
|
||||
var win;
|
||||
|
||||
t.step(function() {
|
||||
win = window.open("005-1.html");
|
||||
});
|
||||
|
||||
add_completion_callback(function() {win.close()});
|
||||
</script>
|
|
@ -0,0 +1,8 @@
|
|||
<!DOCTYPE HTML>
|
||||
<p>FAIL</p>
|
||||
<script>
|
||||
opener.t.step(function() {
|
||||
opener.assert_equals(localStorage.test6564729, '012345678')
|
||||
opener.t.done();
|
||||
});
|
||||
</script>
|
|
@ -0,0 +1,17 @@
|
|||
<!DOCTYPE HTML>
|
||||
<script>
|
||||
var t = parent.opener.t;
|
||||
var do_test = t.step_func(function () {
|
||||
localStorage.test6564729 += '5';
|
||||
var s = 'FAIL: document.open() has canceled the navigation (' + localStorage.test6564729 + ')';
|
||||
parent.document.open();
|
||||
parent.document.write(s);
|
||||
parent.document.close();
|
||||
localStorage.test6564729 += parent.document.body.textContent.match('FAIL') == s ? 'X' : '6';
|
||||
localStorage.test6564729 += '7';
|
||||
});
|
||||
</script>
|
||||
<body onbeforeunload="localStorage.test6564729 += '2'"
|
||||
onpagehide="do_test()"
|
||||
onunload="localStorage.test6564729 += '8'">
|
||||
<p>Inner frame
|
|
@ -0,0 +1,6 @@
|
|||
[
|
||||
{
|
||||
"id": "event-definition",
|
||||
"original_id": "event-definition"
|
||||
}
|
||||
]
|
Loading…
Add table
Add a link
Reference in a new issue