| 157 | fetchControllers.push(fetching({ |
| 158 | request: r, |
| 159 | processResponse (response) { |
| 160 | // 1. |
| 161 | if (response.type === 'error' || response.status === 206 || response.status < 200 || response.status > 299) { |
| 162 | responsePromise.reject(webidl.errors.exception({ |
| 163 | header: 'Cache.addAll', |
| 164 | message: 'Received an invalid status code or the request failed.' |
| 165 | })) |
| 166 | } else if (response.headersList.contains('vary')) { // 2. |
| 167 | // 2.1 |
| 168 | const fieldValues = getFieldValues(response.headersList.get('vary')) |
| 169 | |
| 170 | // 2.2 |
| 171 | for (const fieldValue of fieldValues) { |
| 172 | // 2.2.1 |
| 173 | if (fieldValue === '*') { |
| 174 | responsePromise.reject(webidl.errors.exception({ |
| 175 | header: 'Cache.addAll', |
| 176 | message: 'invalid vary field value' |
| 177 | })) |
| 178 | |
| 179 | for (const controller of fetchControllers) { |
| 180 | controller.abort() |
| 181 | } |
| 182 | |
| 183 | return |
| 184 | } |
| 185 | } |
| 186 | } |
| 187 | }, |
| 188 | processResponseEndOfBody (response) { |
| 189 | // 1. |
| 190 | if (response.aborted) { |