-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug 1907849: part 8) Add WPTs for trusted types when constructing Wor…
…kers from WorkerGlobalScope. r=smaug Fixes w3c/trusted-types#567. Differential Revision: https://phabricator.services.mozilla.com/D232359 UltraBlame original commit: 1615038844f1294ee4033d766e9080f0c7dbda3b
- Loading branch information
Showing
4 changed files
with
306 additions
and
0 deletions.
There are no files selected for viewing
22 changes: 22 additions & 0 deletions
22
testing/web-platform/meta/trusted-types/WorkerGlobalScope-worker-constructor.html.ini
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
[ | ||
WorkerGlobalScope | ||
- | ||
worker | ||
- | ||
constructor | ||
. | ||
html | ||
] | ||
[ | ||
Creating | ||
a | ||
Worker | ||
from | ||
a | ||
string | ||
should | ||
throw | ||
] | ||
expected | ||
: | ||
FAIL |
96 changes: 96 additions & 0 deletions
96
testing/web-platform/tests/trusted-types/WorkerGlobalScope-worker-constructor.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
< | ||
! | ||
DOCTYPE | ||
html | ||
> | ||
< | ||
html | ||
> | ||
< | ||
head | ||
> | ||
< | ||
meta | ||
charset | ||
= | ||
" | ||
utf | ||
- | ||
8 | ||
" | ||
> | ||
< | ||
script | ||
src | ||
= | ||
" | ||
/ | ||
resources | ||
/ | ||
testharness | ||
. | ||
js | ||
" | ||
> | ||
< | ||
/ | ||
script | ||
> | ||
< | ||
script | ||
src | ||
= | ||
" | ||
/ | ||
resources | ||
/ | ||
testharnessreport | ||
. | ||
js | ||
" | ||
> | ||
< | ||
/ | ||
script | ||
> | ||
< | ||
/ | ||
head | ||
> | ||
< | ||
body | ||
> | ||
< | ||
script | ||
> | ||
fetch_tests_from_worker | ||
( | ||
new | ||
Worker | ||
( | ||
" | ||
support | ||
/ | ||
WorkerGlobalScope | ||
- | ||
worker | ||
- | ||
constructor | ||
. | ||
js | ||
" | ||
) | ||
) | ||
; | ||
< | ||
/ | ||
script | ||
> | ||
< | ||
/ | ||
body | ||
> | ||
< | ||
/ | ||
html | ||
> |
172 changes: 172 additions & 0 deletions
172
testing/web-platform/tests/trusted-types/support/WorkerGlobalScope-worker-constructor.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,172 @@ | ||
const | ||
test_setup_policy | ||
= | ||
trustedTypes | ||
. | ||
createPolicy | ||
( | ||
" | ||
p | ||
" | ||
{ | ||
createScriptURL | ||
: | ||
s | ||
= | ||
> | ||
s | ||
} | ||
) | ||
; | ||
importScripts | ||
( | ||
test_setup_policy | ||
. | ||
createScriptURL | ||
( | ||
" | ||
/ | ||
resources | ||
/ | ||
testharness | ||
. | ||
js | ||
" | ||
) | ||
) | ||
; | ||
test | ||
( | ||
( | ||
) | ||
= | ||
> | ||
{ | ||
assert_throws_js | ||
( | ||
TypeError | ||
( | ||
) | ||
= | ||
> | ||
{ | ||
new | ||
Worker | ||
( | ||
" | ||
w | ||
" | ||
) | ||
; | ||
} | ||
" | ||
Creating | ||
a | ||
Worker | ||
threw | ||
" | ||
) | ||
; | ||
} | ||
" | ||
Creating | ||
a | ||
Worker | ||
from | ||
a | ||
string | ||
should | ||
throw | ||
" | ||
) | ||
; | ||
test | ||
( | ||
( | ||
) | ||
= | ||
> | ||
{ | ||
new | ||
Worker | ||
( | ||
test_setup_policy | ||
. | ||
createScriptURL | ||
( | ||
" | ||
u | ||
" | ||
) | ||
) | ||
; | ||
} | ||
" | ||
Creating | ||
a | ||
Worker | ||
from | ||
a | ||
TrustedScriptURL | ||
should | ||
not | ||
throw | ||
" | ||
) | ||
; | ||
test | ||
( | ||
( | ||
) | ||
= | ||
> | ||
{ | ||
trustedTypes | ||
. | ||
createPolicy | ||
( | ||
" | ||
default | ||
" | ||
{ | ||
createScriptURL | ||
: | ||
s | ||
= | ||
> | ||
" | ||
defaultValue | ||
" | ||
} | ||
) | ||
; | ||
new | ||
Worker | ||
( | ||
" | ||
s | ||
" | ||
) | ||
; | ||
} | ||
" | ||
Creating | ||
a | ||
Worker | ||
from | ||
a | ||
string | ||
with | ||
a | ||
default | ||
policy | ||
should | ||
not | ||
throw | ||
" | ||
) | ||
; | ||
done | ||
( | ||
) | ||
; |
16 changes: 16 additions & 0 deletions
16
.../web-platform/tests/trusted-types/support/WorkerGlobalScope-worker-constructor.js.headers
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
Content | ||
- | ||
Security | ||
- | ||
Policy | ||
: | ||
require | ||
- | ||
trusted | ||
- | ||
types | ||
- | ||
for | ||
' | ||
script | ||
' |