mirror of
https://github.com/denoland/deno.git
synced 2025-08-04 02:48:24 +00:00
refactor(webidl): move prefix & context out of converters options bag (#18931)
This commit is contained in:
parent
d856bfd336
commit
b31cf9fde6
31 changed files with 1042 additions and 964 deletions
41
ext/cache/01_cache.js
vendored
41
ext/cache/01_cache.js
vendored
|
@ -27,10 +27,7 @@ class CacheStorage {
|
|||
webidl.assertBranded(this, CacheStoragePrototype);
|
||||
const prefix = "Failed to execute 'open' on 'CacheStorage'";
|
||||
webidl.requiredArguments(arguments.length, 1, prefix);
|
||||
cacheName = webidl.converters["DOMString"](cacheName, {
|
||||
prefix,
|
||||
context: "Argument 1",
|
||||
});
|
||||
cacheName = webidl.converters["DOMString"](cacheName, prefix, "Argument 1");
|
||||
const cacheId = await core.opAsync("op_cache_storage_open", cacheName);
|
||||
const cache = webidl.createBranded(Cache);
|
||||
cache[_id] = cacheId;
|
||||
|
@ -41,10 +38,7 @@ class CacheStorage {
|
|||
webidl.assertBranded(this, CacheStoragePrototype);
|
||||
const prefix = "Failed to execute 'has' on 'CacheStorage'";
|
||||
webidl.requiredArguments(arguments.length, 1, prefix);
|
||||
cacheName = webidl.converters["DOMString"](cacheName, {
|
||||
prefix,
|
||||
context: "Argument 1",
|
||||
});
|
||||
cacheName = webidl.converters["DOMString"](cacheName, prefix, "Argument 1");
|
||||
return await core.opAsync("op_cache_storage_has", cacheName);
|
||||
}
|
||||
|
||||
|
@ -52,10 +46,7 @@ class CacheStorage {
|
|||
webidl.assertBranded(this, CacheStoragePrototype);
|
||||
const prefix = "Failed to execute 'delete' on 'CacheStorage'";
|
||||
webidl.requiredArguments(arguments.length, 1, prefix);
|
||||
cacheName = webidl.converters["DOMString"](cacheName, {
|
||||
prefix,
|
||||
context: "Argument 1",
|
||||
});
|
||||
cacheName = webidl.converters["DOMString"](cacheName, prefix, "Argument 1");
|
||||
return await core.opAsync("op_cache_storage_delete", cacheName);
|
||||
}
|
||||
}
|
||||
|
@ -76,14 +67,12 @@ class Cache {
|
|||
webidl.assertBranded(this, CachePrototype);
|
||||
const prefix = "Failed to execute 'put' on 'Cache'";
|
||||
webidl.requiredArguments(arguments.length, 2, prefix);
|
||||
request = webidl.converters["RequestInfo_DOMString"](request, {
|
||||
request = webidl.converters["RequestInfo_DOMString"](
|
||||
request,
|
||||
prefix,
|
||||
context: "Argument 1",
|
||||
});
|
||||
response = webidl.converters["Response"](response, {
|
||||
prefix,
|
||||
context: "Argument 2",
|
||||
});
|
||||
"Argument 1",
|
||||
);
|
||||
response = webidl.converters["Response"](response, prefix, "Argument 2");
|
||||
// Step 1.
|
||||
let innerRequest = null;
|
||||
// Step 2.
|
||||
|
@ -166,10 +155,11 @@ class Cache {
|
|||
webidl.assertBranded(this, CachePrototype);
|
||||
const prefix = "Failed to execute 'match' on 'Cache'";
|
||||
webidl.requiredArguments(arguments.length, 1, prefix);
|
||||
request = webidl.converters["RequestInfo_DOMString"](request, {
|
||||
request = webidl.converters["RequestInfo_DOMString"](
|
||||
request,
|
||||
prefix,
|
||||
context: "Argument 1",
|
||||
});
|
||||
"Argument 1",
|
||||
);
|
||||
const p = await this[_matchAll](request, options);
|
||||
if (p.length > 0) {
|
||||
return p[0];
|
||||
|
@ -183,10 +173,11 @@ class Cache {
|
|||
webidl.assertBranded(this, CachePrototype);
|
||||
const prefix = "Failed to execute 'delete' on 'Cache'";
|
||||
webidl.requiredArguments(arguments.length, 1, prefix);
|
||||
request = webidl.converters["RequestInfo_DOMString"](request, {
|
||||
request = webidl.converters["RequestInfo_DOMString"](
|
||||
request,
|
||||
prefix,
|
||||
context: "Argument 1",
|
||||
});
|
||||
"Argument 1",
|
||||
);
|
||||
// Step 1.
|
||||
let r = null;
|
||||
// Step 2.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue