mirror of
https://github.com/servo/servo.git
synced 2025-07-02 13:03:43 +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,32 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<title>window.onerror - addEventListener</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id=log></div>
|
||||
<script>
|
||||
setup({allow_uncaught_exception:true});
|
||||
var t = async_test();
|
||||
var ran = false;
|
||||
// spec doesn't say to fire an event so this should do nothing
|
||||
window.addEventListener('error', t.step_func(function(e){
|
||||
ran = true;
|
||||
}), false);
|
||||
</script>
|
||||
<script>
|
||||
undefined_variable;
|
||||
</script>
|
||||
<script>
|
||||
for (;) {}
|
||||
</script>
|
||||
<script>
|
||||
t.step(function(){
|
||||
assert_false(ran, 'ran');
|
||||
t.done();
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,37 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<title><body onerror> - compile error in <script src=data:...></title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<script>
|
||||
setup({allow_uncaught_exception:true});
|
||||
var t = async_test();
|
||||
var t_col = async_test(document.title+' (column)');
|
||||
var ran = false;
|
||||
</script>
|
||||
<body onerror="
|
||||
t.step(function(){
|
||||
ran = true;
|
||||
assert_equals(typeof event, 'string', 'first arg');
|
||||
assert_equals(source, 'data:text/javascript,for(;){}', 'second arg');
|
||||
assert_equals(typeof lineno, 'number', 'third arg');
|
||||
});
|
||||
t_col.step(function() {
|
||||
assert_equals(typeof column, 'number', 'fourth arg');
|
||||
});
|
||||
">
|
||||
<div id=log></div>
|
||||
<script src="data:text/javascript,for(;){}"></script>
|
||||
<script>
|
||||
t.step(function(){
|
||||
assert_true(ran, 'ran');
|
||||
t.done();
|
||||
});
|
||||
t_col.step(function(){
|
||||
t_col.done();
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,39 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<title><body onerror> - compile error in <script></title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<script>
|
||||
setup({allow_uncaught_exception:true});
|
||||
var t = async_test();
|
||||
var t_col = async_test(document.title+' (column)');
|
||||
var ran = false;
|
||||
</script>
|
||||
<body onerror="
|
||||
t.step(function(){
|
||||
ran = true;
|
||||
assert_equals(typeof event, 'string', 'first arg');
|
||||
assert_equals(source, location.href, 'second arg');
|
||||
assert_equals(typeof lineno, 'number', 'third arg');
|
||||
});
|
||||
t_col.step(function() {
|
||||
assert_equals(typeof column, 'number', 'fourth arg');
|
||||
});
|
||||
">
|
||||
<div id=log></div>
|
||||
<script>
|
||||
for(;) {}
|
||||
</script>
|
||||
<script>
|
||||
t.step(function(){
|
||||
assert_true(ran, 'ran');
|
||||
t.done();
|
||||
});
|
||||
t_col.step(function(){
|
||||
t_col.done();
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,39 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<title><body onerror> - runtime error in <script></title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<script>
|
||||
setup({allow_uncaught_exception:true});
|
||||
var t = async_test();
|
||||
var t_col = async_test(document.title+' (column)');
|
||||
var ran = false;
|
||||
</script>
|
||||
<body onerror="
|
||||
t.step(function(){
|
||||
ran = true;
|
||||
assert_equals(typeof event, 'string', 'first arg');
|
||||
assert_equals(source, location.href, 'second arg');
|
||||
assert_equals(typeof lineno, 'number', 'third arg');
|
||||
});
|
||||
t_col.step(function(){
|
||||
assert_equals(typeof column, 'number', 'fourth arg');
|
||||
});
|
||||
">
|
||||
<div id=log></div>
|
||||
<script>
|
||||
undefined_variable;
|
||||
</script>
|
||||
<script>
|
||||
t.step(function(){
|
||||
assert_true(ran, 'ran');
|
||||
t.done();
|
||||
});
|
||||
t_col.step(function(){
|
||||
t_col.done();
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,34 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<title>window.onerror - compile error in cross-origin setInterval</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id=log></div>
|
||||
<script>
|
||||
setup({allow_uncaught_exception:true});
|
||||
var t = async_test();
|
||||
var t_col = async_test(document.title+' (column)');
|
||||
var ran = false;
|
||||
var col_value;
|
||||
var interval;
|
||||
window.onerror = t.step_func(function(a, b, c, d){
|
||||
clearInterval(interval);
|
||||
ran = true;
|
||||
col_value = d;
|
||||
assert_equals(a, 'Script error.', 'first arg');
|
||||
assert_equals(b, '', 'second arg');
|
||||
assert_equals(c, 0, 'third arg');
|
||||
});
|
||||
function col_check() {
|
||||
assert_equals(col_value, 0, 'fourth arg');
|
||||
t_col.done();
|
||||
}
|
||||
var script = document.createElement('script');
|
||||
script.src = location.href.replace('://', '://www1.').replace(/\/[^\/]+$/, '/support/syntax-error-in-setInterval.js');
|
||||
document.body.appendChild(script);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,32 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<title>window.onerror - compile error in cross-origin setTimeout</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id=log></div>
|
||||
<script>
|
||||
setup({allow_uncaught_exception:true});
|
||||
var t = async_test();
|
||||
var t_col = async_test(document.title+' (column)');
|
||||
var ran = false;
|
||||
var col_value;
|
||||
window.onerror = t.step_func(function(a, b, c, d){
|
||||
ran = true;
|
||||
col_value = d;
|
||||
assert_equals(a, 'Script error.', 'first arg');
|
||||
assert_equals(b, '', 'second arg');
|
||||
assert_equals(c, 0, 'third arg');
|
||||
});
|
||||
function col_check() {
|
||||
assert_equals(col_value, 0, 'fourth arg');
|
||||
t_col.done();
|
||||
}
|
||||
var script = document.createElement('script');
|
||||
script.src = location.href.replace('://', '://www1.').replace(/\/[^\/]+$/, '/support/syntax-error-in-setTimeout.js');
|
||||
document.body.appendChild(script);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,38 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<title>window.onerror - compile error in <script src=//www1...></title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id=log></div>
|
||||
<script>
|
||||
setup({allow_uncaught_exception:true});
|
||||
var t = async_test();
|
||||
var t_col = async_test(document.title+' (column)');
|
||||
var ran = false;
|
||||
var col_value;
|
||||
window.onerror = t.step_func(function(a, b, c, d){
|
||||
ran = true;
|
||||
col_value = d;
|
||||
assert_equals(a, 'Script error.', 'first arg');
|
||||
assert_equals(b, '', 'second arg');
|
||||
assert_equals(c, 0, 'third arg');
|
||||
});
|
||||
var script = document.createElement('script');
|
||||
script.src = location.href.replace('://', '://www1.').replace(/\/[^\/]+$/, '/support/syntax-error.js');
|
||||
document.body.appendChild(script);
|
||||
onload = function(){
|
||||
t.step(function(){
|
||||
assert_true(ran, 'ran');
|
||||
t.done();
|
||||
});
|
||||
t_col.step(function(){
|
||||
assert_equals(col_value, 0, 'fourth arg');
|
||||
t_col.done();
|
||||
});
|
||||
};
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,36 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<title>window.onerror - compile error in <script src=data:...></title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id=log></div>
|
||||
<script>
|
||||
setup({allow_uncaught_exception:true});
|
||||
var t = async_test();
|
||||
var t_col = async_test(document.title+' (column)');
|
||||
var ran = false;
|
||||
var col_value;
|
||||
window.onerror = t.step_func(function(a, b, c, d){
|
||||
ran = true;
|
||||
col_value = d;
|
||||
assert_equals(typeof a, 'string', 'first arg');
|
||||
assert_equals(b, 'data:text/javascript,for(;) {}', 'second arg');
|
||||
assert_equals(typeof c, 'number', 'third arg');
|
||||
});
|
||||
</script>
|
||||
<script src="data:text/javascript,for(;) {}"></script>
|
||||
<script>
|
||||
t.step(function(){
|
||||
assert_true(ran, 'ran');
|
||||
t.done();
|
||||
});
|
||||
t_col.step(function(){
|
||||
assert_equals(typeof col_value, 'number', 'fourth arg');
|
||||
t_col.done();
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,39 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<title>window.onerror - compile error in attribute</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id=log></div>
|
||||
<script>
|
||||
setup({allow_uncaught_exception:true});
|
||||
var t = async_test();
|
||||
var t_col = async_test(document.title+' (column)');
|
||||
var ran = false;
|
||||
var col_value;
|
||||
window.onerror = t.step_func(function(a, b, c, d){
|
||||
ran = true;
|
||||
col_value = d;
|
||||
assert_equals(typeof a, 'string', 'first arg');
|
||||
assert_equals(b, location.href, 'second arg');
|
||||
assert_equals(typeof c, 'number', 'third arg');
|
||||
});
|
||||
</script>
|
||||
<p onclick="{"></p>
|
||||
<script>
|
||||
t.step(function(){
|
||||
var ev = document.createEvent('Event');
|
||||
ev.initEvent('click', false, false);
|
||||
document.querySelector('p').dispatchEvent(ev);
|
||||
assert_true(ran, 'ran');
|
||||
t.done();
|
||||
});
|
||||
t_col.step(function(){
|
||||
assert_equals(typeof col_value, 'number', 'fourth arg');
|
||||
t_col.done();
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,28 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<title>window.onerror - compile error in <body onerror></title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script>
|
||||
setup({allow_uncaught_exception:true});
|
||||
var t = async_test();
|
||||
var ran = false;
|
||||
window.onerror = t.step_func(function(){
|
||||
ran = true;
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
<body onerror="{"><!-- sets the event handler to null before compiling -->
|
||||
<div id=log></div>
|
||||
<script>
|
||||
for(;) {}
|
||||
</script>
|
||||
<script>
|
||||
t.step(function(){
|
||||
assert_false(ran, 'ran');
|
||||
t.done();
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,39 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<title>window.onerror - compile error in setInterval</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id=log></div>
|
||||
<script>
|
||||
setup({allow_uncaught_exception:true});
|
||||
var t = async_test();
|
||||
var t_col = async_test(document.title+' (column)');
|
||||
var ran = false;
|
||||
var col_value;
|
||||
var interval;
|
||||
window.onerror = t.step_func(function(a, b, c, d){
|
||||
clearInterval(interval);
|
||||
ran = true;
|
||||
col_value = d;
|
||||
assert_equals(typeof a, 'string', 'first arg');
|
||||
assert_equals(b, location.href, 'second arg');
|
||||
assert_equals(typeof c, 'number', 'third arg');
|
||||
});
|
||||
interval = setInterval("{", 10);
|
||||
setTimeout(function(){
|
||||
t.step(function(){
|
||||
clearInterval(interval);
|
||||
assert_true(ran, 'ran');
|
||||
t.done();
|
||||
});
|
||||
t_col.step(function(){
|
||||
assert_equals(typeof col_value, 'number', 'fourth arg');
|
||||
t_col.done();
|
||||
});
|
||||
}, 20);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,36 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<title>window.onerror - compile error in setTimeout</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id=log></div>
|
||||
<script>
|
||||
setup({allow_uncaught_exception:true});
|
||||
var t = async_test();
|
||||
var t_col = async_test(document.title+' (column)');
|
||||
var ran = false;
|
||||
var col_value;
|
||||
window.onerror = t.step_func(function(a, b, c, d){
|
||||
ran = true;
|
||||
col_value = d;
|
||||
assert_equals(typeof a, 'string', 'first arg');
|
||||
assert_equals(b, location.href, 'second arg');
|
||||
assert_equals(typeof c, 'number', 'third arg');
|
||||
});
|
||||
setTimeout("{", 10);
|
||||
setTimeout(function(){
|
||||
t.step(function(){
|
||||
assert_true(ran, 'ran');
|
||||
t.done();
|
||||
});
|
||||
t_col.step(function(){
|
||||
assert_equals(typeof col_value, 'number', 'fourth arg');
|
||||
t_col.done();
|
||||
});
|
||||
}, 20);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,36 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<title>window.onerror - compile error in <script src=...></title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id=log></div>
|
||||
<script>
|
||||
setup({allow_uncaught_exception:true});
|
||||
var t = async_test();
|
||||
var t_col = async_test(document.title+' (column)');
|
||||
var ran = false;
|
||||
var col_value;
|
||||
window.onerror = t.step_func(function(a, b, c, d){
|
||||
ran = true;
|
||||
col_value = d;
|
||||
assert_equals(typeof a, 'string', 'first arg');
|
||||
assert_equals(b, document.querySelector('script[src="support/syntax-error.js"]').src, 'second arg');
|
||||
assert_equals(typeof c, 'number', 'third arg');
|
||||
});
|
||||
</script>
|
||||
<script src="support/syntax-error.js"></script>
|
||||
<script>
|
||||
t.step(function(){
|
||||
assert_true(ran, 'ran');
|
||||
t.done();
|
||||
});
|
||||
t_col.step(function(){
|
||||
assert_equals(typeof col_value, 'number', 'fourth arg');
|
||||
t_col.done();
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,38 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<title>window.onerror - compile error in <script></title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id=log></div>
|
||||
<script>
|
||||
setup({allow_uncaught_exception:true});
|
||||
var t = async_test();
|
||||
var t_col = async_test(document.title+' (column)');
|
||||
var ran = false;
|
||||
var col_value;
|
||||
window.onerror = t.step_func(function(a, b, c, d){
|
||||
ran = true;
|
||||
col_value = d;
|
||||
assert_equals(typeof a, 'string', 'first arg');
|
||||
assert_equals(b, location.href, 'second arg');
|
||||
assert_equals(typeof c, 'number', 'third arg');
|
||||
});
|
||||
</script>
|
||||
<script>
|
||||
for(;) {}
|
||||
</script>
|
||||
<script>
|
||||
t.step(function(){
|
||||
assert_true(ran, 'ran');
|
||||
t.done();
|
||||
});
|
||||
t_col.step(function(){
|
||||
assert_equals(typeof col_value, 'number', 'fourth arg');
|
||||
t_col.done();
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,28 @@
|
|||
[
|
||||
{
|
||||
"id": "definitions-0",
|
||||
"original_id": "definitions-0"
|
||||
},
|
||||
{
|
||||
"id": "calling-scripts",
|
||||
"original_id": "calling-scripts"
|
||||
},
|
||||
{
|
||||
"id": "creating-scripts",
|
||||
"original_id": "creating-scripts"
|
||||
},
|
||||
{
|
||||
"id": "killing-scripts",
|
||||
"original_id": "killing-scripts"
|
||||
},
|
||||
{
|
||||
"id": "runtime-script-errors",
|
||||
"original_id": "runtime-script-errors",
|
||||
"children": [
|
||||
{
|
||||
"id": "runtime-script-errors-in-documents",
|
||||
"original_id": "runtime-script-errors-in-documents"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
|
@ -0,0 +1,34 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<title>window.onerror - runtime error in cross-origin setInterval</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id=log></div>
|
||||
<script>
|
||||
setup({allow_uncaught_exception:true});
|
||||
var t = async_test();
|
||||
var t_col = async_test(document.title+' (column)');
|
||||
var ran = false;
|
||||
var col_value;
|
||||
var interval;
|
||||
window.onerror = t.step_func(function(a, b, c, d){
|
||||
clearInterval(interval);
|
||||
ran = true;
|
||||
col_value = d;
|
||||
assert_equals(a, 'Script error.', 'first arg');
|
||||
assert_equals(b, '', 'second arg');
|
||||
assert_equals(c, 0, 'third arg');
|
||||
});
|
||||
function col_check() {
|
||||
assert_equals(col_value, 0, 'fourth arg');
|
||||
t_col.done();
|
||||
}
|
||||
var script = document.createElement('script');
|
||||
script.src = location.href.replace('://', '://www1.').replace(/\/[^\/]+$/, '/support/undefined-variable-in-setInterval.js');
|
||||
document.body.appendChild(script);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,32 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<title>window.onerror - runtime error in cross-origin setTimeout</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id=log></div>
|
||||
<script>
|
||||
setup({allow_uncaught_exception:true});
|
||||
var t = async_test();
|
||||
var t_col = async_test(document.title+' (column)');
|
||||
var ran = false;
|
||||
var col_value;
|
||||
window.onerror = t.step_func(function(a, b, c, d){
|
||||
ran = true;
|
||||
col_value = d;
|
||||
assert_equals(a, 'Script error.', 'first arg');
|
||||
assert_equals(b, '', 'second arg');
|
||||
assert_equals(c, 0, 'third arg');
|
||||
});
|
||||
function col_check() {
|
||||
assert_equals(col_value, 0, 'fourth arg');
|
||||
t_col.done();
|
||||
}
|
||||
var script = document.createElement('script');
|
||||
script.src = location.href.replace('://', '://www1.').replace(/\/[^\/]+$/, '/support/undefined-variable-in-setTimeout.js');
|
||||
document.body.appendChild(script);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,38 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<title>window.onerror - runtime error in <script src=//www1...></title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id=log></div>
|
||||
<script>
|
||||
setup({allow_uncaught_exception:true});
|
||||
var t = async_test();
|
||||
var t_col = async_test(document.title+' (column)');
|
||||
var ran = false;
|
||||
var col_value;
|
||||
window.onerror = t.step_func(function(a, b, c, d){
|
||||
ran = true;
|
||||
col_value = d;
|
||||
assert_equals(a, 'Script error.', 'first arg');
|
||||
assert_equals(b, '', 'second arg');
|
||||
assert_equals(c, 0, 'third arg');
|
||||
});
|
||||
var script = document.createElement('script');
|
||||
script.src = location.href.replace('://', '://www1.').replace(/\/[^\/]+$/, '/support/undefined-variable.js');
|
||||
document.body.appendChild(script);
|
||||
onload = function(){
|
||||
t.step(function(){
|
||||
assert_true(ran, 'ran');
|
||||
t.done();
|
||||
});
|
||||
t_col.step(function(){
|
||||
assert_equals(col_value, 0, 'fourth arg');
|
||||
t_col.done();
|
||||
});
|
||||
};
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,36 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<title>window.onerror - runtime error in <script src=data:...></title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id=log></div>
|
||||
<script>
|
||||
setup({allow_uncaught_exception:true});
|
||||
var t = async_test();
|
||||
var t_col = async_test(document.title+' (column)');
|
||||
var ran = false;
|
||||
var col_value;
|
||||
window.onerror = t.step_func(function(a, b, c, d){
|
||||
ran = true;
|
||||
col_value = d;
|
||||
assert_equals(typeof a, 'string', 'first arg');
|
||||
assert_equals(b, 'data:text/javascript,undefined_variable;', 'second arg');
|
||||
assert_equals(typeof c, 'number', 'third arg');
|
||||
});
|
||||
</script>
|
||||
<script src="data:text/javascript,undefined_variable;"></script>
|
||||
<script>
|
||||
t.step(function(){
|
||||
assert_true(ran, 'ran');
|
||||
t.done();
|
||||
});
|
||||
t_col.step(function(){
|
||||
assert_equals(typeof col_value, number, 'fourth arg');
|
||||
t_col.done();
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,39 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<title>window.onerror - runtime error in attribute</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id=log></div>
|
||||
<script>
|
||||
setup({allow_uncaught_exception:true});
|
||||
var t = async_test();
|
||||
var t_col = async_test(document.title+' (column)');
|
||||
var ran = false;
|
||||
var col_value;
|
||||
window.onerror = t.step_func(function(a, b, c, d){
|
||||
ran = true;
|
||||
col_value = d;
|
||||
assert_equals(typeof a, 'string', 'first arg');
|
||||
assert_equals(b, location.href, 'second arg');
|
||||
assert_equals(typeof c, 'number', 'third arg');
|
||||
});
|
||||
</script>
|
||||
<p onclick="undefined_variable;"></p>
|
||||
<script>
|
||||
t.step(function(){
|
||||
var ev = document.createEvent('Event');
|
||||
ev.initEvent('click', false, false);
|
||||
document.querySelector('p').dispatchEvent(ev);
|
||||
assert_true(ran, 'ran');
|
||||
t.done();
|
||||
});
|
||||
t_col.step(function(){
|
||||
assert_equals(typeof col_value, 'number', 'fourth arg');
|
||||
t_col.done();
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,25 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<title>runtime error in <body onerror></title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script>
|
||||
setup({allow_uncaught_exception:true});
|
||||
var t = async_test();
|
||||
var ran = 0;
|
||||
</script>
|
||||
</head>
|
||||
<body onerror="ran++; undefined_variable_in_onerror;">
|
||||
<div id=log></div>
|
||||
<script>
|
||||
undefined_variable;
|
||||
</script>
|
||||
<script>
|
||||
t.step(function(){
|
||||
assert_equals(ran, 1, 'ran');
|
||||
t.done();
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,39 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<title>window.onerror - runtime error in setInterval</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id=log></div>
|
||||
<script>
|
||||
setup({allow_uncaught_exception:true});
|
||||
var t = async_test();
|
||||
var t_col = async_test(document.title+' (column)');
|
||||
var ran = false;
|
||||
var col_value;
|
||||
var interval;
|
||||
window.onerror = t.step_func(function(a, b, c, d){
|
||||
clearInterval(interval);
|
||||
ran = true;
|
||||
col_value = d;
|
||||
assert_equals(typeof a, 'string', 'first arg');
|
||||
assert_equals(b, location.href, 'second arg');
|
||||
assert_equals(typeof c, 'number', 'third arg');
|
||||
});
|
||||
interval = setInterval("undefined_variable;", 10);
|
||||
setTimeout(function(){
|
||||
clearInterval(interval);
|
||||
t.step(function(){
|
||||
assert_true(ran, 'ran');
|
||||
t.done();
|
||||
});
|
||||
t_col.step(function(){
|
||||
assert_equals(typeof col_value, 'number', 'fourth arg');
|
||||
t_col.done();
|
||||
});
|
||||
}, 20);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,36 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<title>window.onerror - runtime error in setTimeout</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id=log></div>
|
||||
<script>
|
||||
setup({allow_uncaught_exception:true});
|
||||
var t = async_test();
|
||||
var t_col = async_test(document.title+' (column)');
|
||||
var ran = false;
|
||||
var col_value;
|
||||
window.onerror = t.step_func(function(a, b, c, d){
|
||||
ran = true;
|
||||
col_value = d;
|
||||
assert_equals(typeof a, 'string', 'first arg');
|
||||
assert_equals(b, location.href, 'second arg');
|
||||
assert_equals(typeof c, 'number', 'third arg');
|
||||
});
|
||||
setTimeout("undefined_variable;", 10);
|
||||
setTimeout(function(){
|
||||
t.step(function(){
|
||||
assert_true(ran, 'ran');
|
||||
t.done();
|
||||
});
|
||||
t_col.step(function(){
|
||||
assert_equals(typeof col_value, 'number', 'fourth arg');
|
||||
t_col.done();
|
||||
});
|
||||
}, 20);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,29 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<title>runtime error in window.onerror</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id=log></div>
|
||||
<script>
|
||||
setup({allow_uncaught_exception:true});
|
||||
var t = async_test();
|
||||
var ran = 0;
|
||||
window.onerror = function(){
|
||||
ran++;
|
||||
undefined_variable_in_onerror;
|
||||
};
|
||||
</script>
|
||||
<script>
|
||||
undefined_variable;
|
||||
</script>
|
||||
<script>
|
||||
t.step(function(){
|
||||
assert_equals(ran, 1, 'ran');
|
||||
t.done();
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,36 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<title>window.onerror - runtime error in <script src=...></title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id=log></div>
|
||||
<script>
|
||||
setup({allow_uncaught_exception:true});
|
||||
var t = async_test();
|
||||
var t_col = async_test(document.title+' (column)');
|
||||
var ran = false;
|
||||
var col_value;
|
||||
window.onerror = t.step_func(function(a, b, c, d){
|
||||
ran = true;
|
||||
col_value = d;
|
||||
assert_equals(typeof a, 'string', 'first arg');
|
||||
assert_equals(b, document.querySelector('script[src="support/undefined-variable.js"]').src, 'second arg');
|
||||
assert_equals(typeof c, 'number', 'third arg');
|
||||
});
|
||||
</script>
|
||||
<script src="support/undefined-variable.js"></script>
|
||||
<script>
|
||||
t.step(function(){
|
||||
assert_true(ran, 'ran');
|
||||
t.done();
|
||||
});
|
||||
t_col.step(function(){
|
||||
assert_equals(typeof col_value, 'number', 'fourth arg');
|
||||
t_col.done();
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,38 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<title>window.onerror - runtime error in <script></title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id=log></div>
|
||||
<script>
|
||||
setup({allow_uncaught_exception:true});
|
||||
var t = async_test();
|
||||
var t_col = async_test(document.title+' (column)');
|
||||
var ran = false;
|
||||
var col_value;
|
||||
window.onerror = t.step_func(function(a, b, c, d){
|
||||
ran = true;
|
||||
col_value = d;
|
||||
assert_equals(typeof a, 'string', 'first arg');
|
||||
assert_equals(b, location.href, 'second arg');
|
||||
assert_equals(typeof c, 'number', 'third arg');
|
||||
});
|
||||
</script>
|
||||
<script>
|
||||
undefined_variable;
|
||||
</script>
|
||||
<script>
|
||||
t.step(function(){
|
||||
assert_true(ran, 'ran');
|
||||
t.done();
|
||||
});
|
||||
t_col.step(function(){
|
||||
assert_equals(typeof col_value, 'number', 'fourth arg');
|
||||
t_col.done();
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,9 @@
|
|||
interval = setInterval('{', 10);
|
||||
setTimeout(function(){
|
||||
clearInterval(interval);
|
||||
t.step(function(){
|
||||
assert_true(ran, 'ran');
|
||||
t.done();
|
||||
});
|
||||
t_col.step(col_check);
|
||||
}, 20);
|
|
@ -0,0 +1,8 @@
|
|||
setTimeout('{', 10);
|
||||
setTimeout(function(){
|
||||
t.step(function(){
|
||||
assert_true(ran, 'ran');
|
||||
t.done();
|
||||
});
|
||||
t_col.step(col_check);
|
||||
}, 20);
|
|
@ -0,0 +1 @@
|
|||
for (;) {}
|
|
@ -0,0 +1,9 @@
|
|||
interval = setInterval('undefined_variable;', 10);
|
||||
setTimeout(function(){
|
||||
clearInterval(interval);
|
||||
t.step(function(){
|
||||
assert_true(ran, 'ran');
|
||||
t.done();
|
||||
});
|
||||
t_col.step(col_check);
|
||||
}, 20);
|
|
@ -0,0 +1,8 @@
|
|||
setTimeout('undefined_variable;', 10);
|
||||
setTimeout(function(){
|
||||
t.step(function(){
|
||||
assert_true(ran, 'ran');
|
||||
t.done();
|
||||
});
|
||||
t_col.step(col_check);
|
||||
}, 20);
|
|
@ -0,0 +1 @@
|
|||
undefined_variable;
|
|
@ -0,0 +1,40 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<title>window.onerror: parse errors</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<!--
|
||||
|
||||
In https://html.spec.whatwg.org/multipage/#creating-scripts ,
|
||||
step 3 describes parsing the script, and step 5 says:
|
||||
# Otherwise, report the error using the onerror event handler of
|
||||
# the script's global object. If the error is still not handled
|
||||
# after this, then the error may be reported to the user.
|
||||
which links to
|
||||
https://html.spec.whatwg.org/multipage/#report-the-error ,
|
||||
which describes what to do when onerror is a Function.
|
||||
|
||||
-->
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
setup({allow_uncaught_exception:true});
|
||||
var error_count = 0;
|
||||
window.onerror = function(msg, url, lineno) {
|
||||
++error_count;
|
||||
test(function() {assert_equals(url, window.location.href)},
|
||||
"correct url passed to window.onerror");
|
||||
test(function() {assert_equals(lineno, 34)},
|
||||
"correct line number passed to window.onerror");
|
||||
};
|
||||
</script>
|
||||
<script>This script does not parse correctly.</script>
|
||||
<script>
|
||||
test(function() {assert_equals(error_count, 1)},
|
||||
"correct number of calls to window.onerror");
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,39 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<title>window.onerror: runtime scripterrors</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<!--
|
||||
|
||||
https://html.spec.whatwg.org/multipage/#runtime-script-errors
|
||||
says what to do for uncaught runtime script errors, and just below
|
||||
describes what to do when onerror is a Function.
|
||||
|
||||
-->
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
setup({allow_uncaught_exception:true});
|
||||
var error_count = 0;
|
||||
window.onerror = function(msg, url, lineno) {
|
||||
++error_count;
|
||||
};
|
||||
</script>
|
||||
<script>
|
||||
try {
|
||||
// This error is caught, so it should NOT trigger onerror.
|
||||
throw "foo";
|
||||
} catch (ex) {
|
||||
}
|
||||
// This error is NOT caught, so it should trigger onerror.
|
||||
throw "bar";
|
||||
</script>
|
||||
<script>
|
||||
test(function() {assert_equals(error_count, 1)},
|
||||
"correct number of calls to window.onerror");
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,43 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<title>window.onerror: runtime scripterrors</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<!--
|
||||
|
||||
https://html.spec.whatwg.org/multipage/#runtime-script-errors
|
||||
says what to do for uncaught runtime script errors, and just below
|
||||
describes what to do when onerror is a Function.
|
||||
|
||||
-->
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
setup({allow_uncaught_exception:true});
|
||||
var error_count = 0;
|
||||
window.onerror = function(msg, url, lineno) {
|
||||
++error_count;
|
||||
test(function() {assert_equals(url, window.location.href)},
|
||||
"correct url passed to window.onerror");
|
||||
test(function() {assert_equals(lineno, 36)},
|
||||
"correct line number passed to window.onerror");
|
||||
};
|
||||
</script>
|
||||
<script>
|
||||
try {
|
||||
// This error is caught, so it should NOT trigger onerror.
|
||||
window.nonexistentproperty.oops();
|
||||
} catch (ex) {
|
||||
}
|
||||
// This error is NOT caught, so it should trigger onerror.
|
||||
window.nonexistentproperty.oops();
|
||||
</script>
|
||||
<script>
|
||||
test(function() {assert_equals(error_count, 1)},
|
||||
"correct number of calls to window.onerror");
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
Loading…
Add table
Add a link
Reference in a new issue