-
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 1566566 [wpt PR 17424] - KV Storage: tweak secure context restric…
…tion and expand tests, a=testonly Automatic update from web-platform-tests KV Storage: tweak secure context restriction and expand tests Recent discussions on the KV Storage spec (WICG/kv-storage#53, WICG/kv-storage#68) have decided on a slightly different model for restricting modules to secure contexts, that is based on preventing them from entering the module map, instead of throwing an error at module evaluation time. This is mostly observably the same, with a few small differences: * The error type changes from DOMException "SecurityError" to TypeError. This CL updates the implementation's runtime check, and all associated tests, to match the new error type. * Not being present in the module map means module graph initialization fails earlier, preventing any side effects from earlier modules in the graph from being evaluated. This is tested in the new WPT kv-storage/secure-context/side-effects.html, which we fail for now. * Not being present in the module map means that import map failover works. This is is tested in the new WPT kv-storage/secure-context/import-maps.html, which we fail for now. https://crbug.com/977470 tracks the infrastructure work necessary to move from a runtime check to selectively filling the module map, which will allow us to pass the two newly-added tests. BUG=977470 Change-Id: I9371400e9beed5be4ed5fbb0c94747a7bc0b3e86 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1670572 Reviewed-by: Hiroshige Hayashizaki <hiroshigechromium.org> Reviewed-by: Joshua Bell <jsbellchromium.org> Commit-Queue: Domenic Denicola <domenicchromium.org> Cr-Commit-Position: refs/heads/master{#677454} -- wpt-commits: b3a9dd55d31874e8f2d197b4b958c0dac96ea844 wpt-pr: 17424 UltraBlame original commit: 81bbfa205f27cb1996d5843bcbf58cc98863012d
- Loading branch information
Showing
8 changed files
with
566 additions
and
106 deletions.
There are no files selected for viewing
77 changes: 77 additions & 0 deletions
77
testing/web-platform/tests/kv-storage/secure-context/README.md
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,77 @@ | ||
# | ||
KV | ||
Storage | ||
[ | ||
SecureContext | ||
] | ||
tests | ||
These | ||
tests | ||
ensure | ||
that | ||
KV | ||
Storage | ||
follows | ||
the | ||
rules | ||
for | ||
[ | ||
SecureContext | ||
] | ||
modules | ||
. | ||
( | ||
As | ||
of | ||
the | ||
time | ||
of | ||
this | ||
writing | ||
they | ||
are | ||
only | ||
proposed | ||
rules | ||
in | ||
[ | ||
heycam | ||
/ | ||
webidl | ||
# | ||
675 | ||
] | ||
( | ||
https | ||
: | ||
/ | ||
/ | ||
github | ||
. | ||
com | ||
/ | ||
heycam | ||
/ | ||
webidl | ||
/ | ||
pull | ||
/ | ||
675 | ||
) | ||
. | ||
) | ||
Eventually | ||
these | ||
should | ||
probably | ||
be | ||
generalized | ||
and | ||
tested | ||
as | ||
part | ||
of | ||
idlharness | ||
. | ||
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 |
---|---|---|
|
@@ -122,9 +122,10 @@ | |
promise_rejects | ||
( | ||
t | ||
" | ||
SecurityError | ||
" | ||
new | ||
TypeError | ||
( | ||
) | ||
import | ||
( | ||
" | ||
|
215 changes: 215 additions & 0 deletions
215
testing/web-platform/tests/kv-storage/secure-context/import-maps.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,215 @@ | ||
< | ||
! | ||
DOCTYPE | ||
html | ||
> | ||
< | ||
meta | ||
charset | ||
= | ||
" | ||
utf | ||
- | ||
8 | ||
" | ||
> | ||
< | ||
title | ||
> | ||
KV | ||
Storage | ||
: | ||
in | ||
non | ||
- | ||
secure | ||
contexts | ||
import | ||
map | ||
mappings | ||
should | ||
fall | ||
back | ||
< | ||
/ | ||
title | ||
> | ||
< | ||
script | ||
src | ||
= | ||
" | ||
/ | ||
resources | ||
/ | ||
testharness | ||
. | ||
js | ||
" | ||
> | ||
< | ||
/ | ||
script | ||
> | ||
< | ||
script | ||
src | ||
= | ||
" | ||
/ | ||
resources | ||
/ | ||
testharnessreport | ||
. | ||
js | ||
" | ||
> | ||
< | ||
/ | ||
script | ||
> | ||
< | ||
script | ||
> | ||
" | ||
use | ||
strict | ||
" | ||
; | ||
test | ||
( | ||
( | ||
) | ||
= | ||
> | ||
{ | ||
assert_false | ||
( | ||
self | ||
. | ||
isSecureContext | ||
" | ||
This | ||
test | ||
must | ||
run | ||
in | ||
a | ||
non | ||
- | ||
secure | ||
context | ||
" | ||
) | ||
; | ||
} | ||
" | ||
Prerequisite | ||
check | ||
" | ||
) | ||
; | ||
< | ||
/ | ||
script | ||
> | ||
< | ||
script | ||
type | ||
= | ||
" | ||
importmap | ||
" | ||
> | ||
{ | ||
" | ||
imports | ||
" | ||
: | ||
{ | ||
" | ||
std | ||
: | ||
kv | ||
- | ||
storage | ||
" | ||
: | ||
[ | ||
" | ||
std | ||
: | ||
kv | ||
- | ||
storage | ||
" | ||
" | ||
. | ||
/ | ||
resources | ||
/ | ||
dummy | ||
- | ||
module | ||
. | ||
js | ||
" | ||
] | ||
} | ||
} | ||
< | ||
/ | ||
script | ||
> | ||
< | ||
script | ||
type | ||
= | ||
" | ||
module | ||
" | ||
> | ||
promise_test | ||
( | ||
async | ||
( | ||
) | ||
= | ||
> | ||
{ | ||
const | ||
result | ||
= | ||
await | ||
import | ||
( | ||
" | ||
std | ||
: | ||
kv | ||
- | ||
storage | ||
" | ||
) | ||
; | ||
assert_equals | ||
( | ||
namespaceObj | ||
. | ||
myExport | ||
" | ||
not | ||
the | ||
real | ||
KV | ||
storage | ||
" | ||
) | ||
; | ||
} | ||
) | ||
; | ||
< | ||
/ | ||
script | ||
> |
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
12 changes: 12 additions & 0 deletions
12
testing/web-platform/tests/kv-storage/secure-context/resources/dummy-module.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,12 @@ | ||
export | ||
const | ||
myExport | ||
= | ||
" | ||
not | ||
the | ||
real | ||
KV | ||
storage | ||
" | ||
; |
6 changes: 6 additions & 0 deletions
6
testing/web-platform/tests/kv-storage/secure-context/resources/test-side-effects.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,6 @@ | ||
window | ||
. | ||
sideEffectsHappened | ||
= | ||
true | ||
; |
Oops, something went wrong.