mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-26 20:30:41 +00:00
Bug 1458388 [wpt PR 10744] - [Layered API] Implement std:async-local-storage behind a flag, a=testonly
Automatic update from web-platform-tests[Layered API] Implement std:async-local-storage behind a flag This CL imports the async-local-storage implementation as-is except for renaming to index.js. Original author: Domenic Denicola (domenic@chromium.org) https://github.com/domenic/async-local-storage All code were written and contributed by Googlers who are Chromium Contributors. Tentatively this CL imports the files under core/script/resources until a long-term plan for repository location etc. is settled. This is a still experimental feature behind a flag, and its API interface and implementation can be changed significantly before shipped. This CL also imports a test with some modifications. Change-Id: I99944c75240ab2f1d114aa85f5c8ffac1f5e9b98 Reviewed-on: https://chromium-review.googlesource.com/1033713 Commit-Queue: Hiroshige Hayashizaki <hiroshige@chromium.org> Reviewed-by: Kinuko Yasuda <kinuko@chromium.org> Cr-Commit-Position: refs/heads/master@{#555967} -- wpt-commits: 21779ed0b53a409d2b0a8c8ca5ab897e3326e2e0 wpt-pr: 10744
This commit is contained in:
parent
6e776c041e
commit
da60449fce
@ -310414,6 +310414,12 @@
|
||||
{}
|
||||
]
|
||||
],
|
||||
"async-local-storage/storage-smoke-test.https.tentative.html": [
|
||||
[
|
||||
"/async-local-storage/storage-smoke-test.https.tentative.html",
|
||||
{}
|
||||
]
|
||||
],
|
||||
"audio-output/HTMLMediaElement-sinkId-idl.html": [
|
||||
[
|
||||
"/audio-output/HTMLMediaElement-sinkId-idl.html",
|
||||
@ -407679,6 +407685,10 @@
|
||||
"32cf112fb1dcb4e7ec3c91bdf5bd6b976a1e4eac",
|
||||
"testharness"
|
||||
],
|
||||
"async-local-storage/storage-smoke-test.https.tentative.html": [
|
||||
"1e00cf5aff9d85ca66d8b831ee4c2c3cb8259071",
|
||||
"testharness"
|
||||
],
|
||||
"audio-output/HTMLMediaElement-sinkId-idl.html": [
|
||||
"8f37d8d2fc1cb9b5ad0d85234f733f534f4f0db8",
|
||||
"testharness"
|
||||
|
@ -0,0 +1,46 @@
|
||||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<title>Async local storage storage export smoke test</title>
|
||||
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
|
||||
<script type="module">
|
||||
import { storage } from "std:async-local-storage";
|
||||
|
||||
test(() => {
|
||||
const { backingStore } = storage;
|
||||
assert_array_equals(Object.keys(backingStore), ["database", "store", "version"]);
|
||||
assert_own_property(backingStore, "database");
|
||||
assert_own_property(backingStore, "store");
|
||||
assert_own_property(backingStore, "version");
|
||||
assert_equals(Object.getPrototypeOf(backingStore), Object.prototype);
|
||||
|
||||
assert_equals(backingStore.database, "async-local-storage:default");
|
||||
assert_equals(backingStore.store, "store");
|
||||
assert_equals(backingStore.version, 1);
|
||||
}, "backingStore returns the correct object");
|
||||
|
||||
promise_test(async (t) => {
|
||||
t.add_cleanup(async () => {
|
||||
await storage.clear();
|
||||
});
|
||||
|
||||
assert_equals(await storage.set("key", "value"), undefined);
|
||||
|
||||
assert_equals(await storage.get("key"), "value");
|
||||
assert_equals(await storage.has("key"), true);
|
||||
assert_array_equals(await storage.keys(), ["key"]);
|
||||
assert_array_equals(await storage.values(), ["value"]);
|
||||
|
||||
const entries = await storage.entries();
|
||||
assert_true(Array.isArray(entries));
|
||||
assert_equals(entries.length, 1);
|
||||
assert_array_equals(entries[0], ["key", "value"]);
|
||||
|
||||
assert_equals(await storage.delete("key"), undefined);
|
||||
|
||||
assert_equals(await storage.get("key"), undefined);
|
||||
assert_equals(await storage.has("key"), false);
|
||||
}, "storage methods work, at least for one entry with string key and value");
|
||||
</script>
|
Loading…
x
Reference in New Issue
Block a user