Handle Fetch: Use correct storage key for subresource requests (#1790)
This change corrects the cache resolution logic within the Handle Fetch
algorithm when the router source is RouterSourceEnum/"cache".
The Problem:
Previously, the algorithm always used reservedClient to resolve the
storage key, regardless of the request type. However, reservedClient is
only valid for top-level navigation requests and is not available for
subresource requests. This could lead to accessing the incorrect cache
storage during subresource fetches.
The Fix:
Logic has been added to differentiate between a non-subresource request
and a subresource request.
- For a non-subresource request: It continues to use reservedClient as
before.
- For a subresource request: It now uses the client associated with the
request object.
This ensures that the correct storage key, based on the requesting
client, is used for subresource requests.
Fixes: https://github.com/w3c/ServiceWorker/issues/1784