(_0)
| 16029 | types: ["undefined is not allowed"] |
| 16030 | }); |
| 16031 | } |
| 16032 | request = webidl.converters.RequestInfo(request); |
| 16033 | if (typeof request === "string") { |
| 16034 | continue; |
| 16035 | } |
| 16036 | const r = request[kState]; |
| 16037 | if (!urlIsHttpHttpsScheme(r.url) || r.method !== "GET") { |
| 16038 | throw webidl.errors.exception({ |
| 16039 | header: prefix, |
| 16040 | message: "Expected http/s scheme when method is not GET." |
| 16041 | }); |
| 16042 | } |
| 16043 | } |
| 16044 | const fetchControllers = []; |
| 16045 | for (const request of requests) { |
| 16046 | const r = new Request(request)[kState]; |
| 16047 | if (!urlIsHttpHttpsScheme(r.url)) { |
| 16048 | throw webidl.errors.exception({ |
| 16049 | header: prefix, |
| 16050 | message: "Expected http/s scheme." |
| 16051 | }); |
| 16052 | } |
| 16053 | r.initiator = "fetch"; |
| 16054 | r.destination = "subresource"; |
| 16055 | requestList.push(r); |
| 16056 | const responsePromise = createDeferredPromise(); |
| 16057 | fetchControllers.push(fetching({ |
| 16058 | request: r, |
| 16059 | processResponse(response) { |
| 16060 | if (response.type === "error" || response.status === 206 || response.status < 200 || response.status > 299) { |
| 16061 | responsePromise.reject(webidl.errors.exception({ |
| 16062 | header: "Cache.addAll", |
| 16063 | message: "Received an invalid status code or the request failed." |
| 16064 | })); |
| 16065 | } else if (response.headersList.contains("vary")) { |
| 16066 | const fieldValues = getFieldValues(response.headersList.get("vary")); |
| 16067 | for (const fieldValue of fieldValues) { |
| 16068 | if (fieldValue === "*") { |
| 16069 | responsePromise.reject(webidl.errors.exception({ |
| 16070 | header: "Cache.addAll", |
| 16071 | message: "invalid vary field value" |
| 16072 | })); |
| 16073 | for (const controller of fetchControllers) { |
| 16074 | controller.abort(); |
| 16075 | } |
no test coverage detected