Skip to content

Commit

Permalink
Bug 1566598 [wpt PR 17863] - Expose kv-storage built-in module only o…
Browse files Browse the repository at this point in the history
…n SecureContexts, a=testonly

Automatic update from web-platform-tests
Expose kv-storage built-in module only on SecureContexts

This CL adds actual restriction in Blink implementation.

This CL also modifies tests and expectations to match with
the current Blink built-in/import maps infra.

A subtest in WPT test `import-statement.html` is failing
because the current Blink implementation is based on
pre-import-map spec and thus
importing unavailable built-in causes fetch error.
See 'import 'std:nonexistent';' row of
WICG/import-maps#159.

Bug: 977470
Change-Id: I107f60ed95e1f91d62f468c29c5d741eef13f4f9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1702754
Commit-Queue: Hiroshige Hayashizaki <hiroshige@chromium.org>
Reviewed-by: Kouhei Ueno <kouhei@chromium.org>
Cr-Commit-Position: refs/heads/master@{#691821}

--

wpt-commits: cb808982deeb57212fb856858c1a7716d0ac2ecb
wpt-pr: 17863
  • Loading branch information
hiroshige-g authored and moz-wptsync-bot committed Sep 3, 2019
1 parent 10e955e commit 1a8eebc
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<script type="importmap">
{
"imports": {
"std:kv-storage": [
"./resources/dummy-module.js": [
"std:kv-storage",
"./resources/dummy-module.js"
]
Expand All @@ -25,7 +25,7 @@

<script type="module">
promise_test(async () => {
const result = await import("std:kv-storage");
assert_equals(namespaceObj.myExport, "not the real KV storage");
const result = await import("./resources/dummy-module.js");
assert_equals(result.myExport, "not the real KV storage");
});
</script>
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,14 @@
assert_false(self.isSecureContext, "This test must run in a non-secure context");
}, "Prerequisite check");

async_test(t => {
window.addEventListener("error", t.step_func_done(errorEvent => {
assert_equals(errorEvent.error.constructor, TypeError, "Must trigger a TypeError");
}, { once: true }));
});
const t = async_test('Static import kv-storage in non-secure context');

window.addEventListener("error", t.step_func_done(errorEvent => {
assert_equals(errorEvent.error.constructor, TypeError, "Must trigger a TypeError");
}, { once: true }));
</script>

<script type="module">
<script type="module"
onerror="t.unreached_func('script error event should not be fired')()">
import "std:kv-storage";
</script>

0 comments on commit 1a8eebc

Please sign in to comment.