-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Along with https://chromium-review.googlesource.com/c/chromium/src/+/1670572, this aligns the KV Storage implementation with WICG/kv-storage#68, which uses Web IDL to define the API. The observable changes are to: * Enumerability of methods * Adding @@toStringTag (affecting Object.prototype.toString.call) This includes web platform tests that abuse the current idlharness.js infrastructure, plus some ad-hoc hand-written tests that we expect to be generated by future versions of idlharness.js once the relevant Web IDL pull requests are merged. It removes the existing API surface tests and helpers in favor of idlharness.js. Bug: 931263 Change-Id: I9205d1a8b3040617cbb6200f825ba9ad250e61c5 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1672137 Commit-Queue: Domenic Denicola <domenic@chromium.org> Reviewed-by: Joshua Bell <jsbell@chromium.org> Cr-Commit-Position: refs/heads/master@{#671975}
- Loading branch information
1 parent
7f07938
commit 400877c
Showing
9 changed files
with
236 additions
and
239 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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
This file was deleted.
Oops, something went wrong.
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,8 @@ | ||
<!DOCTYPE html> | ||
<meta charset="utf-8"> | ||
<title>Helper file to be loaded in an iframe that exposes a copy of StorageArea as a global</title> | ||
|
||
<script type="module"> | ||
import { StorageArea } from "std:kv-storage"; | ||
window.StorageArea = StorageArea; | ||
</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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
export function iterResultCustom(o, expectedValue, expectedDone, valueAsserter, label) { | ||
label = formatLabel(label); | ||
|
||
assert_equals(typeof expectedDone, "boolean", | ||
`${label} iterResult assert usage check: expectedDone must be a boolean`); | ||
|
||
propertyKeys(o, ["value", "done"], [], label); | ||
assert_equals(Object.getPrototypeOf(o), Object.prototype, `${label}prototype must be Object.prototype`); | ||
valueAsserter(o.value, expectedValue, `${label}value`); | ||
assert_equals(o.done, expectedDone, `${label}done`); | ||
} | ||
|
||
export function iterResult(o, expectedValue, expectedDone, label) { | ||
return iterResultCustom(o, expectedValue, expectedDone, assert_equals, label); | ||
} | ||
|
||
export function iterResultsCustom(actualArray, expectedArrayOfArrays, valueAsserter, label) { | ||
label = formatLabel(label); | ||
|
||
assert_equals(actualArray.length, expectedArrayOfArrays.length, | ||
`${label} iterResults assert usage check: actual and expected must have the same length`); | ||
|
||
for (let i = 0; i < actualArray.length; ++i) { | ||
const [expectedValue, expectedDone] = expectedArrayOfArrays[i]; | ||
iterResultCustom(actualArray[i], expectedValue, expectedDone, valueAsserter, `${label}iter result ${i}`); | ||
} | ||
} | ||
|
||
export function iterResults(actualArray, expectedArrayOfArrays, label) { | ||
return iterResultsCustom(actualArray, expectedArrayOfArrays, assert_equals, label); | ||
} | ||
|
||
function propertyKeys(o, expectedNames, expectedSymbols, label) { | ||
label = formatLabel(label); | ||
assert_array_equals(Object.getOwnPropertyNames(o), expectedNames, `${label}property names`); | ||
assert_array_equals(Object.getOwnPropertySymbols(o), expectedSymbols, | ||
`${label}property symbols`); | ||
} | ||
|
||
function formatLabel(label) { | ||
return label !== undefined ? `${label} ` : ""; | ||
} |
Oops, something went wrong.