This is an automated email from the ASF dual-hosted git repository.
guan404ming pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tvm.git
The following commit(s) were added to refs/heads/main by this push:
new d658ce726f [Web] use singular requestFileHandle() instead of
requestFileHandles() (#19780)
d658ce726f is described below
commit d658ce726f204a895c2d003383b51a7f24ccb894
Author: Thomas Steiner <[email protected]>
AuthorDate: Tue Jun 16 18:30:45 2026 +0200
[Web] use singular requestFileHandle() instead of requestFileHandles()
(#19780)
Switches from the deprecated plural `requestFileHandles([hash])` to the
new singular `requestFileHandle(hash)` API, which returns a handle
directly rather than a single-element array. Also updates the interface
definition and removes the now-redundant `handles[0]` indexing.
The rename was adopted in the COS spec after a survey of all known
real-world implementations found that every call site passed a
single-element array and immediately indexed `[0]` — no implementation
ever used the plural form as a batch.
FYI guan404ming CharlieFRuan — as reviewers of the original COS PR
([#18893](https://github.com/apache/tvm/pull/18893)).
See https://github.com/WICG/cross-origin-storage/issues/61 for details.
---
web/src/artifact_cache.ts | 14 ++++++--------
1 file changed, 6 insertions(+), 8 deletions(-)
diff --git a/web/src/artifact_cache.ts b/web/src/artifact_cache.ts
index 2d66fd0c0a..35cc918f02 100644
--- a/web/src/artifact_cache.ts
+++ b/web/src/artifact_cache.ts
@@ -119,10 +119,10 @@ interface CrossOriginStorageWritable {
}
interface CrossOriginStorageAPI {
- requestFileHandles(
- descriptors: CrossOriginHashDescriptor[],
+ requestFileHandle(
+ descriptor: CrossOriginHashDescriptor,
options?: CrossOriginStorageRequestFileHandleOptions,
- ): Promise<CrossOriginStorageHandle[]>;
+ ): Promise<CrossOriginStorageHandle>;
}
declare global {
@@ -169,8 +169,7 @@ class CrossOriginStorage {
if (!api) {
return undefined;
}
- const handles = await api.requestFileHandles([hash]);
- const handle = handles[0];
+ const handle = await api.requestFileHandle(hash);
if (!handle) {
return undefined;
}
@@ -189,10 +188,9 @@ class CrossOriginStorage {
if (!api) {
throw new Error("Cross-origin storage API unavailable.");
}
- const handles = await api.requestFileHandles([hash], { create: true });
- const handle = handles[0];
+ const handle = await api.requestFileHandle(hash, { create: true });
if (!handle) {
- throw new Error("Cross-origin storage API returned no handles.");
+ throw new Error("Cross-origin storage API returned no handle.");
}
const writableStream = await handle.createWritable();
await writableStream.write(blob);