Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose kv-storage built-in module only on SecureContexts #17863

Merged
merged 1 commit into from
Aug 29, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions kv-storage/secure-context/import-maps.html
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>
13 changes: 7 additions & 6 deletions kv-storage/secure-context/import-statement.html
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>