Skip to content

Commit

Permalink
cache: fix most failing WPTs (nodejs#2100)
Browse files Browse the repository at this point in the history
  • Loading branch information
KhafraDev authored and metcoder95 committed Jul 21, 2023
1 parent 116c724 commit 3bf1b4c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 32 deletions.
8 changes: 3 additions & 5 deletions lib/cache/cache.js
Original file line number Diff line number Diff line change
Expand Up @@ -575,7 +575,7 @@ class Cache {
}

/**
* @see https://w3c.github.io/ServiceWorker/#batch-cache-operations
* @see https://w3c.github.io/ServiceWorker/#batch-cache-operations-algorithm
* @param {CacheBatchOperation[]} operations
* @returns {requestResponseList}
*/
Expand Down Expand Up @@ -746,11 +746,9 @@ class Cache {
// return false
// }

/** @type {URL} */
const queryURL = requestQuery.url
const queryURL = new URL(requestQuery.url)

/** @type {URL} */
const cachedURL = request.url
const cachedURL = new URL(request.url)

if (options?.ignoreSearch) {
cachedURL.search = ''
Expand Down
29 changes: 2 additions & 27 deletions test/wpt/status/service-workers/cache-storage.status.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,38 +11,13 @@
"note": "probably can be fixed",
"fail": [
"Cache.put with a VARY:* opaque response should not reject",
"Cache.put with opaque-filtered HTTP 206 response",
"Cache.put with a relative URL"
"Cache.put with opaque-filtered HTTP 206 response"
]
},
"cache-match.https.any.js": {
"note": "requires https server",
"fail": [
"cors-exposed header should be stored correctly.",
"Cache.match ignores vary headers on opaque response."
]
},
"cache-delete.https.any.js": {
"note": "spec bug? - https://github.com/w3c/ServiceWorker/issues/1677 (first fail)",
"fail": [
"Cache.delete with ignoreSearch option (when it is specified as false)"
]
},
"cache-keys.https.any.js": {
"note": "probably can be fixed",
"fail": [
"Cache.keys with ignoreSearch option (request with search parameters)",
"Cache.keys without parameters",
"Cache.keys with explicitly undefined request"
]
},
"cache-matchAll.https.any.js": {
"note": "probably can be fixed",
"fail": [
"Cache.matchAll with ignoreSearch option (request with search parameters)",
"Cache.matchAll without parameters",
"Cache.matchAll with explicitly undefined request",
"Cache.matchAll with explicitly undefined request and empty options"
"cors-exposed header should be stored correctly."
]
}
}
Expand Down

0 comments on commit 3bf1b4c

Please sign in to comment.