(request, options = {})
| 388 | } |
| 389 | |
| 390 | async delete (request, options = {}) { |
| 391 | webidl.brandCheck(this, Cache) |
| 392 | |
| 393 | const prefix = 'Cache.delete' |
| 394 | webidl.argumentLengthCheck(arguments, 1, prefix) |
| 395 | |
| 396 | request = webidl.converters.RequestInfo(request) |
| 397 | options = webidl.converters.CacheQueryOptions(options, prefix, 'options') |
| 398 | |
| 399 | /** |
| 400 | * @type {Request} |
| 401 | */ |
| 402 | let r = null |
| 403 | |
| 404 | if (webidl.is.Request(request)) { |
| 405 | r = getRequestState(request) |
| 406 | |
| 407 | if (r.method !== 'GET' && !options.ignoreMethod) { |
| 408 | return false |
| 409 | } |
| 410 | } else { |
| 411 | assert(typeof request === 'string') |
| 412 | |
| 413 | r = getRequestState(new Request(request)) |
| 414 | } |
| 415 | |
| 416 | /** @type {CacheBatchOperation[]} */ |
| 417 | const operations = [] |
| 418 | |
| 419 | /** @type {CacheBatchOperation} */ |
| 420 | const operation = { |
| 421 | type: 'delete', |
| 422 | request: r, |
| 423 | options |
| 424 | } |
| 425 | |
| 426 | operations.push(operation) |
| 427 | |
| 428 | const cacheJobPromise = Promise.withResolvers() |
| 429 | |
| 430 | let errorData = null |
| 431 | let requestResponses |
| 432 | |
| 433 | try { |
| 434 | requestResponses = this.#batchCacheOperations(operations) |
| 435 | } catch (e) { |
| 436 | errorData = e |
| 437 | } |
| 438 | |
| 439 | queueMicrotask(() => { |
| 440 | if (errorData === null) { |
| 441 | cacheJobPromise.resolve(!!requestResponses?.length) |
| 442 | } else { |
| 443 | cacheJobPromise.reject(errorData) |
| 444 | } |
| 445 | }) |
| 446 | |
| 447 | return cacheJobPromise.promise |
nothing calls this directly
no test coverage detected