Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5)

Unified Diff: third_party/WebKit/LayoutTests/imported/wpt/workers/constructors/Worker/AbstractWorker.onerror.html

Issue 2418853003: Worker: Import "imported/wpt/workers" tests (Retry) (Closed)
Patch Set: rebase Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/imported/wpt/workers/constructors/Worker/AbstractWorker.onerror.html
diff --git a/third_party/WebKit/LayoutTests/imported/wpt/workers/constructors/Worker/AbstractWorker.onerror.html b/third_party/WebKit/LayoutTests/imported/wpt/workers/constructors/Worker/AbstractWorker.onerror.html
new file mode 100644
index 0000000000000000000000000000000000000000..c40424d656d730a8a7b1236d9e618b9d43cd031d
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/imported/wpt/workers/constructors/Worker/AbstractWorker.onerror.html
@@ -0,0 +1,48 @@
+<!--
+for (;) // should cause onerror to be invoked, but onerror is null, so
+ // the error is "not handled". should fire an ErrorEvent on the
+ // worker.
+ break;
+postMessage(1); // shouldn't do anything since the script doesn't compile
+/*
+-->
+<!doctype html>
+<title>AbstractWorker.onerror</title>
+<link rel=help href="https://html.spec.whatwg.org/multipage/#runtime-script-errors-2">
+<link rel=help href="https://html.spec.whatwg.org/multipage/#report-the-error">
+<link rel=help href="https://html.spec.whatwg.org/multipage/#the-event-handler-processing-algorithm">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id="log"></div>
+<script>
+setup({allow_uncaught_exception:true});
+async_test(function() {
+ var worker = new Worker('#');
+ var error;
+ worker.onerror = this.step_func(function(a, b, c) {
+ error = a;
+ assert_equals('' + a, '[object ErrorEvent]');
+ assert_true("message" in a, 'ErrorEvent.message');
+ assert_equals(typeof a.message, "string", 'ErrorEvent.message');
+ assert_equals(a.filename, document.URL + '#', 'ErrorEvent.filename');
+ assert_true("lineno" in a, 'ErrorEvent.lineno');
+ assert_equals(typeof a.lineno, "number", 'ErrorEvent.lineno');
+ assert_equals(b, undefined, 'unexpected second argument to onerror');
+ assert_equals(c, undefined, 'unexpected third argument to onerror');
+ });
+ worker.onmessage = this.step_func(function(e) {
+ assert_unreached('onmessage was invoked but worker script shouldn\'t have compiled');
+ });
+ window.onerror = this.step_func_done(function(a, b, c, d, e, f) {
+ assert_equals(a, error.message, 'message');
+ assert_equals(b, error.filename, 'filename');
+ assert_equals(c, error.lineno, 'lineno');
+ assert_equals(d, error.colno, 'colno');
+ assert_equals(e, error.error, 'error');
+ assert_equals(f, undefined, 'unexpected sixth argument to onerror');
+ });
+});
+</script>
+<!--
+*/
+//-->

Powered by Google App Engine
This is Rietveld 408576698