gecko-dev/testing/web-platform/tests/native-io/delete_async_basic.tentative.https.any.js
Victor Costan cc3c1b70da Bug 1621898 [wpt PR 22212] - NativeIO: Plumbing and minimal functionality., a=testonly
Automatic update from web-platform-tests
NativeIO: Plumbing and minimal functionality.

This is a scaffolding CL for NativeIO, a.k.a. Low-Level Storage. Most
details will probably change over time, but the overall architecture is
intended to be stable. To facilitate review, this CL aims to introduce
enough aspects of the API for readers to reason about IPC security and
general architectural concerns in the browser and in Blink.

The summary below is also intended to facilitate review.

* NativeIO introduces new per-origin storage. The per-origin model
  matches other existing storage APIs, so no new permissions are added.
* NativeIO storage is structured as files in a flat per-origin
  namespace. Files are stored in a per-origin directory under the user's
  profile.
* The browser-side implementation enforces access control at the file
  level. Once a renderer is allowed to open a file, the browser passes
  the file descriptor to the renderer. This approach aims to minimize
  the latency of I/O operations.
* The renderer exposes two API flavors to web pages -- an asynchronous
  version and a synchronous version. The latter is only available in
  dedicated workers. The goal is to allow developers to experiment with
  both flavors of the API, and report back on performance and stability.
* In the asynchronous API, all file I/O is done on tasks posted to
  Blink's worker thread pool. This avoids jank on the main thread, at
  the cost of two thread hops per I/O operation.

This CL adds two READMEs with some minimal information.
* //third_party/blink/renderer/modules/native_io/README.md
* //third_party/blink/web_tests/external/wpt/native-io/README.md

An API explainer is available at
https://github.com/fivedots/nativeio-explainer

Binary-Size: New Web Platform feature. Fugu P1.
Bug: 914488
Change-Id: I2c8c794837c5332d81bfbab2ed0827e1f26f7cf4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2093918
Commit-Queue: Victor Costan <pwnall@chromium.org>
Reviewed-by: John Abd-El-Malek <jam@chromium.org>
Reviewed-by: Marijn Kruisselbrink <mek@chromium.org>
Reviewed-by: Daniel Vogelheim <vogelheim@chromium.org>
Reviewed-by: Mike West <mkwst@chromium.org>
Cr-Commit-Position: refs/heads/master@{#753327}

--

wpt-commits: 48f8659c8f7f63c7e70ae02da89df0524ff52f0c
wpt-pr: 22212
2020-03-31 11:31:03 +00:00

20 lines
623 B
JavaScript

// META: title=NativeIO API: File deletion is reflected in listing.
// META: global=window,worker
'use strict';
promise_test(async testCase => {
const file = await nativeIO.open('test_file');
testCase.add_cleanup(async () => {
await nativeIO.delete('test_file');
});
await file.close();
const fileNamesBeforeDelete = await nativeIO.getAll();
assert_in_array('test_file', fileNamesBeforeDelete);
await nativeIO.delete('test_file');
const fileNames = await nativeIO.getAll();
assert_equals(fileNames.indexOf('test_file'), -1);
}, 'nativeIO.getAll does not return file deleted by nativeIO.delete');