Commit 34ec06a4 authored by Hiroshige Hayashizaki's avatar Hiroshige Hayashizaki Committed by Commit Bot

[WPT] Fix muted errors flag around setTimeout/setInterval

According to the spec
https://html.spec.whatwg.org/C/#timer-initialisation-steps
setTimeout()/setInterval() don't inherit
initiating script's muted errors flag,
which matches with Chromium/Firefox/Safari.

This CL fixes WPT tests to match with the spec/impl, i.e.
to expect errors from setTimeout()/setInterval()
from cross-origin scripts not to be muted.

Bug: 1111134
Change-Id: I3b4d0a5450ccee8fb04113846c9e9773d476cfe7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2485416Reviewed-by: default avatarDomenic Denicola <domenic@chromium.org>
Reviewed-by: default avatarKouhei Ueno <kouhei@chromium.org>
Commit-Queue: Hiroshige Hayashizaki <hiroshige@chromium.org>
Cr-Commit-Position: refs/heads/master@{#822054}
parent 6f75c16b
...@@ -132,10 +132,8 @@ void ScheduledAction::Execute(ExecutionContext* context) { ...@@ -132,10 +132,8 @@ void ScheduledAction::Execute(ExecutionContext* context) {
return; return;
} }
// We're using |SanitizeScriptErrors::kDoNotSanitize| to keep the existing // We use |SanitizeScriptErrors::kDoNotSanitize| because muted errors flag is
// behavior, but this causes failures on // not set in https://html.spec.whatwg.org/C/#timer-initialisation-steps
// wpt/html/webappapis/scripting/processing-model-2/compile-error-cross-origin-setTimeout.html
// and friends.
DVLOG(1) << "ScheduledAction::execute " << this << ": executing from source"; DVLOG(1) << "ScheduledAction::execute " << this << ": executing from source";
if (LocalDOMWindow* window = DynamicTo<LocalDOMWindow>(context)) { if (LocalDOMWindow* window = DynamicTo<LocalDOMWindow>(context)) {
window->GetScriptController().ExecuteScriptAndReturnValue( window->GetScriptController().ExecuteScriptAndReturnValue(
......
...@@ -2720,8 +2720,6 @@ crbug.com/1050754 external/wpt/html/webappapis/scripting/events/event-handler-al ...@@ -2720,8 +2720,6 @@ crbug.com/1050754 external/wpt/html/webappapis/scripting/events/event-handler-al
crbug.com/1050754 external/wpt/html/webappapis/scripting/events/event-handler-attributes-body-window.html [ Failure ] crbug.com/1050754 external/wpt/html/webappapis/scripting/events/event-handler-attributes-body-window.html [ Failure ]
crbug.com/1050754 external/wpt/html/webappapis/scripting/events/event-handler-attributes-frameset-window.html [ Failure ] crbug.com/1050754 external/wpt/html/webappapis/scripting/events/event-handler-attributes-frameset-window.html [ Failure ]
crbug.com/1050754 external/wpt/html/webappapis/scripting/events/event-handler-attributes-windowless-body.html [ Failure ] crbug.com/1050754 external/wpt/html/webappapis/scripting/events/event-handler-attributes-windowless-body.html [ Failure ]
crbug.com/1050754 external/wpt/html/webappapis/scripting/processing-model-2/compile-error-cross-origin-setInterval.html [ Failure ]
crbug.com/1050754 external/wpt/html/webappapis/scripting/processing-model-2/compile-error-cross-origin-setTimeout.html [ Failure ]
crbug.com/1050754 external/wpt/html/webappapis/scripting/processing-model-2/compile-error-in-setInterval.html [ Failure ] crbug.com/1050754 external/wpt/html/webappapis/scripting/processing-model-2/compile-error-in-setInterval.html [ Failure ]
crbug.com/1050754 external/wpt/html/webappapis/scripting/processing-model-2/compile-error-same-origin-with-hash.html [ Failure ] crbug.com/1050754 external/wpt/html/webappapis/scripting/processing-model-2/compile-error-same-origin-with-hash.html [ Failure ]
crbug.com/1050754 external/wpt/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-agent-formalism/requires-failure.https.any.html [ Failure ] crbug.com/1050754 external/wpt/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-agent-formalism/requires-failure.https.any.html [ Failure ]
...@@ -2729,8 +2727,6 @@ crbug.com/1050754 external/wpt/html/webappapis/scripting/processing-model-2/inte ...@@ -2729,8 +2727,6 @@ crbug.com/1050754 external/wpt/html/webappapis/scripting/processing-model-2/inte
crbug.com/1050754 external/wpt/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-agent-formalism/requires-success.any.sharedworker.html [ Failure ] crbug.com/1050754 external/wpt/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-agent-formalism/requires-success.any.sharedworker.html [ Failure ]
crbug.com/1050754 external/wpt/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-agent-formalism/requires-success.any.worker.html [ Failure ] crbug.com/1050754 external/wpt/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-agent-formalism/requires-success.any.worker.html [ Failure ]
crbug.com/1050754 external/wpt/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/promise-job-incumbent.html [ Failure ] crbug.com/1050754 external/wpt/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/promise-job-incumbent.html [ Failure ]
crbug.com/1050754 external/wpt/html/webappapis/scripting/processing-model-2/runtime-error-cross-origin-setInterval.html [ Failure ]
crbug.com/1050754 external/wpt/html/webappapis/scripting/processing-model-2/runtime-error-cross-origin-setTimeout.html [ Failure ]
crbug.com/1050754 external/wpt/html/webappapis/scripting/processing-model-2/runtime-error-in-setInterval.html [ Failure ] crbug.com/1050754 external/wpt/html/webappapis/scripting/processing-model-2/runtime-error-in-setInterval.html [ Failure ]
crbug.com/1050754 external/wpt/html/webappapis/scripting/processing-model-2/runtime-error-in-setTimeout.html [ Failure ] crbug.com/1050754 external/wpt/html/webappapis/scripting/processing-model-2/runtime-error-in-setTimeout.html [ Failure ]
crbug.com/1050754 external/wpt/html/webappapis/scripting/processing-model-2/runtime-error-same-origin-with-hash.html [ Failure ] crbug.com/1050754 external/wpt/html/webappapis/scripting/processing-model-2/runtime-error-same-origin-with-hash.html [ Failure ]
......
...@@ -2624,8 +2624,6 @@ crbug.com/1050754 external/wpt/html/webappapis/scripting/events/event-handler-al ...@@ -2624,8 +2624,6 @@ crbug.com/1050754 external/wpt/html/webappapis/scripting/events/event-handler-al
crbug.com/1050754 external/wpt/html/webappapis/scripting/events/event-handler-attributes-body-window.html [ Failure ] crbug.com/1050754 external/wpt/html/webappapis/scripting/events/event-handler-attributes-body-window.html [ Failure ]
crbug.com/1050754 external/wpt/html/webappapis/scripting/events/event-handler-attributes-frameset-window.html [ Failure ] crbug.com/1050754 external/wpt/html/webappapis/scripting/events/event-handler-attributes-frameset-window.html [ Failure ]
crbug.com/1050754 external/wpt/html/webappapis/scripting/events/event-handler-attributes-windowless-body.html [ Failure ] crbug.com/1050754 external/wpt/html/webappapis/scripting/events/event-handler-attributes-windowless-body.html [ Failure ]
crbug.com/1050754 external/wpt/html/webappapis/scripting/processing-model-2/compile-error-cross-origin-setInterval.html [ Failure ]
crbug.com/1050754 external/wpt/html/webappapis/scripting/processing-model-2/compile-error-cross-origin-setTimeout.html [ Failure ]
crbug.com/1050754 external/wpt/html/webappapis/scripting/processing-model-2/compile-error-in-setInterval.html [ Failure ] crbug.com/1050754 external/wpt/html/webappapis/scripting/processing-model-2/compile-error-in-setInterval.html [ Failure ]
crbug.com/1050754 external/wpt/html/webappapis/scripting/processing-model-2/compile-error-same-origin-with-hash.html [ Failure ] crbug.com/1050754 external/wpt/html/webappapis/scripting/processing-model-2/compile-error-same-origin-with-hash.html [ Failure ]
crbug.com/1050754 external/wpt/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-agent-formalism/requires-failure.https.any.html [ Failure ] crbug.com/1050754 external/wpt/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-agent-formalism/requires-failure.https.any.html [ Failure ]
...@@ -2633,8 +2631,6 @@ crbug.com/1050754 external/wpt/html/webappapis/scripting/processing-model-2/inte ...@@ -2633,8 +2631,6 @@ crbug.com/1050754 external/wpt/html/webappapis/scripting/processing-model-2/inte
crbug.com/1050754 external/wpt/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-agent-formalism/requires-success.any.sharedworker.html [ Failure ] crbug.com/1050754 external/wpt/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-agent-formalism/requires-success.any.sharedworker.html [ Failure ]
crbug.com/1050754 external/wpt/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-agent-formalism/requires-success.any.worker.html [ Failure ] crbug.com/1050754 external/wpt/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-agent-formalism/requires-success.any.worker.html [ Failure ]
crbug.com/1050754 external/wpt/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/promise-job-incumbent.html [ Failure ] crbug.com/1050754 external/wpt/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/promise-job-incumbent.html [ Failure ]
crbug.com/1050754 external/wpt/html/webappapis/scripting/processing-model-2/runtime-error-cross-origin-setInterval.html [ Failure ]
crbug.com/1050754 external/wpt/html/webappapis/scripting/processing-model-2/runtime-error-cross-origin-setTimeout.html [ Failure ]
crbug.com/1050754 external/wpt/html/webappapis/scripting/processing-model-2/runtime-error-in-setInterval.html [ Failure ] crbug.com/1050754 external/wpt/html/webappapis/scripting/processing-model-2/runtime-error-in-setInterval.html [ Failure ]
crbug.com/1050754 external/wpt/html/webappapis/scripting/processing-model-2/runtime-error-in-setTimeout.html [ Failure ] crbug.com/1050754 external/wpt/html/webappapis/scripting/processing-model-2/runtime-error-in-setTimeout.html [ Failure ]
crbug.com/1050754 external/wpt/html/webappapis/scripting/processing-model-2/runtime-error-same-origin-with-hash.html [ Failure ] crbug.com/1050754 external/wpt/html/webappapis/scripting/processing-model-2/runtime-error-same-origin-with-hash.html [ Failure ]
......
...@@ -2835,8 +2835,6 @@ crbug.com/1050754 external/wpt/html/webappapis/scripting/events/event-handler-al ...@@ -2835,8 +2835,6 @@ crbug.com/1050754 external/wpt/html/webappapis/scripting/events/event-handler-al
crbug.com/1050754 external/wpt/html/webappapis/scripting/events/event-handler-attributes-body-window.html [ Failure ] crbug.com/1050754 external/wpt/html/webappapis/scripting/events/event-handler-attributes-body-window.html [ Failure ]
crbug.com/1050754 external/wpt/html/webappapis/scripting/events/event-handler-attributes-frameset-window.html [ Failure ] crbug.com/1050754 external/wpt/html/webappapis/scripting/events/event-handler-attributes-frameset-window.html [ Failure ]
crbug.com/1050754 external/wpt/html/webappapis/scripting/events/event-handler-attributes-windowless-body.html [ Failure ] crbug.com/1050754 external/wpt/html/webappapis/scripting/events/event-handler-attributes-windowless-body.html [ Failure ]
crbug.com/1050754 external/wpt/html/webappapis/scripting/processing-model-2/compile-error-cross-origin-setInterval.html [ Failure ]
crbug.com/1050754 external/wpt/html/webappapis/scripting/processing-model-2/compile-error-cross-origin-setTimeout.html [ Failure ]
crbug.com/1050754 external/wpt/html/webappapis/scripting/processing-model-2/compile-error-in-setInterval.html [ Failure ] crbug.com/1050754 external/wpt/html/webappapis/scripting/processing-model-2/compile-error-in-setInterval.html [ Failure ]
crbug.com/1050754 external/wpt/html/webappapis/scripting/processing-model-2/compile-error-same-origin-with-hash.html [ Failure ] crbug.com/1050754 external/wpt/html/webappapis/scripting/processing-model-2/compile-error-same-origin-with-hash.html [ Failure ]
crbug.com/1050754 external/wpt/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-agent-formalism/requires-failure.https.any.html [ Failure ] crbug.com/1050754 external/wpt/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-agent-formalism/requires-failure.https.any.html [ Failure ]
...@@ -2846,8 +2844,6 @@ crbug.com/1050754 external/wpt/html/webappapis/scripting/processing-model-2/inte ...@@ -2846,8 +2844,6 @@ crbug.com/1050754 external/wpt/html/webappapis/scripting/processing-model-2/inte
crbug.com/1050754 external/wpt/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/promise-job-entry-different-function-realm.html [ Timeout ] crbug.com/1050754 external/wpt/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/promise-job-entry-different-function-realm.html [ Timeout ]
crbug.com/1050754 external/wpt/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/promise-job-entry.html [ Timeout ] crbug.com/1050754 external/wpt/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/promise-job-entry.html [ Timeout ]
crbug.com/1050754 external/wpt/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/promise-job-incumbent.html [ Failure ] crbug.com/1050754 external/wpt/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/promise-job-incumbent.html [ Failure ]
crbug.com/1050754 external/wpt/html/webappapis/scripting/processing-model-2/runtime-error-cross-origin-setInterval.html [ Failure ]
crbug.com/1050754 external/wpt/html/webappapis/scripting/processing-model-2/runtime-error-cross-origin-setTimeout.html [ Failure ]
crbug.com/1050754 external/wpt/html/webappapis/scripting/processing-model-2/runtime-error-in-setInterval.html [ Failure ] crbug.com/1050754 external/wpt/html/webappapis/scripting/processing-model-2/runtime-error-in-setInterval.html [ Failure ]
crbug.com/1050754 external/wpt/html/webappapis/scripting/processing-model-2/runtime-error-in-setTimeout.html [ Failure ] crbug.com/1050754 external/wpt/html/webappapis/scripting/processing-model-2/runtime-error-in-setTimeout.html [ Failure ]
crbug.com/1050754 external/wpt/html/webappapis/scripting/processing-model-2/runtime-error-same-origin-with-hash.html [ Failure ] crbug.com/1050754 external/wpt/html/webappapis/scripting/processing-model-2/runtime-error-same-origin-with-hash.html [ Failure ]
......
This is a testharness.js-based test.
FAIL window.onerror - compile error in cross-origin setInterval assert_equals: first arg expected "Script error." but got "Uncaught SyntaxError: Unexpected end of input"
FAIL window.onerror - compile error in cross-origin setInterval (column) assert_equals: fourth arg expected 0 but got 2
Harness: the test ran to completion.
...@@ -10,22 +10,13 @@ ...@@ -10,22 +10,13 @@
<script> <script>
setup({allow_uncaught_exception:true}); setup({allow_uncaught_exception:true});
var t = async_test(); var t = async_test();
var t_col = async_test(document.title+' (column)');
var ran = false; var ran = false;
var col_value;
var interval; var interval;
window.onerror = t.step_func(function(a, b, c, d){ window.addEventListener('error', t.step_func(e => {
clearInterval(interval); clearInterval(interval);
ran = true; ran = true;
col_value = d; assert_equals(e.error.constructor, SyntaxError);
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'); var script = document.createElement('script');
script.src = location.href.replace('://', '://www1.').replace(/\/[^\/]+$/, '/support/syntax-error-in-setInterval.js'); script.src = location.href.replace('://', '://www1.').replace(/\/[^\/]+$/, '/support/syntax-error-in-setInterval.js');
document.body.appendChild(script); document.body.appendChild(script);
......
This is a testharness.js-based test.
FAIL window.onerror - compile error in cross-origin setTimeout assert_equals: first arg expected "Script error." but got "Uncaught SyntaxError: Unexpected end of input"
FAIL window.onerror - compile error in cross-origin setTimeout (column) assert_equals: fourth arg expected 0 but got 2
Harness: the test ran to completion.
...@@ -10,20 +10,11 @@ ...@@ -10,20 +10,11 @@
<script> <script>
setup({allow_uncaught_exception:true}); setup({allow_uncaught_exception:true});
var t = async_test(); var t = async_test();
var t_col = async_test(document.title+' (column)');
var ran = false; var ran = false;
var col_value; window.addEventListener('error', t.step_func(e => {
window.onerror = t.step_func(function(a, b, c, d){
ran = true; ran = true;
col_value = d; assert_equals(e.error.constructor, SyntaxError);
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'); var script = document.createElement('script');
script.src = location.href.replace('://', '://www1.').replace(/\/[^\/]+$/, '/support/syntax-error-in-setTimeout.js'); script.src = location.href.replace('://', '://www1.').replace(/\/[^\/]+$/, '/support/syntax-error-in-setTimeout.js');
document.body.appendChild(script); document.body.appendChild(script);
......
This is a testharness.js-based test.
FAIL window.onerror - runtime error in cross-origin setInterval assert_equals: first arg expected "Script error." but got "Uncaught ReferenceError: undefined_variable is not defined"
FAIL window.onerror - runtime error in cross-origin setInterval (column) assert_equals: fourth arg expected 0 but got 1
Harness: the test ran to completion.
...@@ -10,22 +10,13 @@ ...@@ -10,22 +10,13 @@
<script> <script>
setup({allow_uncaught_exception:true}); setup({allow_uncaught_exception:true});
var t = async_test(); var t = async_test();
var t_col = async_test(document.title+' (column)');
var ran = false; var ran = false;
var col_value;
var interval; var interval;
window.onerror = t.step_func(function(a, b, c, d){ window.addEventListener('error', t.step_func(e => {
clearInterval(interval); clearInterval(interval);
ran = true; ran = true;
col_value = d; assert_equals(e.error.constructor, ReferenceError);
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'); var script = document.createElement('script');
script.src = location.href.replace('://', '://www1.').replace(/\/[^\/]+$/, '/support/undefined-variable-in-setInterval.js'); script.src = location.href.replace('://', '://www1.').replace(/\/[^\/]+$/, '/support/undefined-variable-in-setInterval.js');
document.body.appendChild(script); document.body.appendChild(script);
......
This is a testharness.js-based test.
FAIL window.onerror - runtime error in cross-origin setTimeout assert_equals: first arg expected "Script error." but got "Uncaught ReferenceError: undefined_variable is not defined"
FAIL window.onerror - runtime error in cross-origin setTimeout (column) assert_equals: fourth arg expected 0 but got 1
Harness: the test ran to completion.
...@@ -10,20 +10,11 @@ ...@@ -10,20 +10,11 @@
<script> <script>
setup({allow_uncaught_exception:true}); setup({allow_uncaught_exception:true});
var t = async_test(); var t = async_test();
var t_col = async_test(document.title+' (column)');
var ran = false; var ran = false;
var col_value; window.addEventListener('error', t.step_func(e => {
window.onerror = t.step_func(function(a, b, c, d){
ran = true; ran = true;
col_value = d; assert_equals(e.error.constructor, ReferenceError);
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'); var script = document.createElement('script');
script.src = location.href.replace('://', '://www1.').replace(/\/[^\/]+$/, '/support/undefined-variable-in-setTimeout.js'); script.src = location.href.replace('://', '://www1.').replace(/\/[^\/]+$/, '/support/undefined-variable-in-setTimeout.js');
document.body.appendChild(script); document.body.appendChild(script);
......
...@@ -5,5 +5,4 @@ step_timeout(function(){ ...@@ -5,5 +5,4 @@ step_timeout(function(){
assert_true(ran, 'ran'); assert_true(ran, 'ran');
t.done(); t.done();
}); });
t_col.step(col_check);
}, 20); }, 20);
\ No newline at end of file
...@@ -4,5 +4,4 @@ setTimeout(function(){ ...@@ -4,5 +4,4 @@ setTimeout(function(){
assert_true(ran, 'ran'); assert_true(ran, 'ran');
t.done(); t.done();
}); });
t_col.step(col_check);
}, 20); }, 20);
...@@ -5,5 +5,4 @@ step_timeout(function(){ ...@@ -5,5 +5,4 @@ step_timeout(function(){
assert_true(ran, 'ran'); assert_true(ran, 'ran');
t.done(); t.done();
}); });
t_col.step(col_check);
}, 20); }, 20);
\ No newline at end of file
...@@ -4,5 +4,4 @@ setTimeout(function(){ ...@@ -4,5 +4,4 @@ setTimeout(function(){
assert_true(ran, 'ran'); assert_true(ran, 'ran');
t.done(); t.done();
}); });
t_col.step(col_check);
}, 20); }, 20);
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment