(cacheKey, location)
| 59 | } |
| 60 | |
| 61 | function getSameOriginPath (cacheKey, location) { |
| 62 | if (typeof location !== 'string') { |
| 63 | return undefined |
| 64 | } |
| 65 | |
| 66 | let originUrl |
| 67 | let requestUrl |
| 68 | let locationUrl |
| 69 | try { |
| 70 | originUrl = new URL(cacheKey.origin) |
| 71 | requestUrl = new URL(cacheKey.path, originUrl) |
| 72 | locationUrl = new URL(location, requestUrl) |
| 73 | } catch { |
| 74 | return undefined |
| 75 | } |
| 76 | |
| 77 | if (locationUrl.origin !== originUrl.origin) { |
| 78 | return undefined |
| 79 | } |
| 80 | |
| 81 | return locationUrl.pathname + locationUrl.search |
| 82 | } |
| 83 | |
| 84 | function deleteCachedUri (store, cacheKey, path) { |
| 85 | deleteCachedValue(store, { |
no outgoing calls
no test coverage detected