diff --git a/workers/modules/shared-worker-parse-error-failure.html b/workers/modules/shared-worker-parse-error-failure.html
index f6f13405035edaf..d3d86b3f8fca9c5 100644
--- a/workers/modules/shared-worker-parse-error-failure.html
+++ b/workers/modules/shared-worker-parse-error-failure.html
@@ -27,21 +27,31 @@
);
});
+const checkArguments = (args) => {
+ assert_equals(args.a.constructor, Event);
+ assert_true('message' in args.a, 'Event.message');
+ assert_equals(typeof args.a.message, 'string', 'Event.message');
+ assert_equals(args.a.filename, location.href + '/resources/syntax-error.js');
+ assert_equals(args.a.lineno, 1, 'Event.lineno');
+ assert_equals(args.b, undefined, 'unexpected second argument to onerror');
+ assert_equals(args.c, undefined, 'unexpected third argument to onerror');
+};
+
promise_test(async () => {
const scriptURL = 'resources/syntax-error.js';
const worker = new SharedWorker(scriptURL, { type: 'module' });
- const type = await new Promise(resolve =>
- worker.onerror = error => resolve(error.type));
- assert_equals(type, 'error');
+ const args = await new Promise(resolve =>
+ worker.onerror = (a, b, c) => resolve({a, b, c}));
+ checkArguments(args);
}, 'Module shared worker construction for script with syntax error should ' +
'dispatch an event named error.');
promise_test(async () => {
const scriptURL = 'resources/static-import-syntax-error.js';
const worker = new SharedWorker(scriptURL, { type: 'module' });
- const type = await new Promise(resolve =>
- worker.onerror = error => resolve(error.type));
- assert_equals(type, 'error');
+ const args = await new Promise(resolve =>
+ worker.onerror = (a, b, c) => resolve({a, b, c}));
+ checkArguments(args);
}, 'Static import on module shared worker for script with syntax error ' +
'should dispatch an event named error.');
diff --git a/workers/shared-worker-parse-error-failure.html b/workers/shared-worker-parse-error-failure.html
index dc4ad1d7700a04c..5f98e59d8fe8aea 100644
--- a/workers/shared-worker-parse-error-failure.html
+++ b/workers/shared-worker-parse-error-failure.html
@@ -4,21 +4,31 @@