Skip to content

Commit

Permalink
Bug 1669612 [wpt PR 26019] - [top-level await] Prohibit top-level awa…
Browse files Browse the repository at this point in the history
…it in service workers, a=testonly

Automatic update from web-platform-tests
[top-level await] Prohibit top-level await in service workers

This CL disallows top-level await for service workers by
terminating the worker.

The error that's thrown when Run Service Worker fails is changed
to a TypeError per the spec draft for top-level await integration [0].

Note that this also changes the sudden termination errors that were
previously AbortErrors to TypeErrors.

[0] w3c/ServiceWorker#1444

Bug: 1129795
Bug: 1022182
Bug: v8:9344
Change-Id: Ia764ab553b88e52d48125f23632dc77f4c256009
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2454306
Commit-Queue: Shu-yu Guo <sygchromium.org>
Reviewed-by: Dominic Farolino <domchromium.org>
Reviewed-by: Makoto Shimazu <shimazuchromium.org>
Reviewed-by: Hiroshige Hayashizaki <hiroshigechromium.org>
Cr-Commit-Position: refs/heads/master{#832849}

--

wpt-commits: aa77795ebe17dc0d7c3259a3fe92023b9da62d3e
wpt-pr: 26019

UltraBlame original commit: 259caf0f5dd8d0d96bc5604e0b5f0ad11f16faf1
  • Loading branch information
marco-c committed Dec 14, 2020
1 parent f256dc9 commit 65c020f
Show file tree
Hide file tree
Showing 2 changed files with 116 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,27 @@
)
;
'

u
'
top
-
level
-
await
'
:
u
'
await
Promise
.
resolve
(
1
)
;
'
}
[
request
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,101 @@ script
)
;
}
if
(
type
=
=
=
'
module
'
)
{
promise_test
(
function
(
t
)
{
var
script
=
'
resources
/
malformed
-
worker
.
py
?
top
-
level
-
await
'
;
var
scope
=
'
resources
/
scope
/
top
-
level
-
await
'
;
return
promise_rejects_js
(
t
TypeError
register_method
(
script
{
scope
:
scope
}
)
'
Registration
of
script
with
await
top
-
level
await
should
fail
.
'
)
;
}
'
Registering
script
with
top
-
level
await
'
)
;
}
promise_test
(
function
Expand Down

0 comments on commit 65c020f

Please sign in to comment.