request-error.html:
- Add test verifying we enforce only-if-cached requires same-origin mode.
request-cache.html (only-if-cached does not hit network):
- Add comment block explaining the test dictionary arguments.
- Eliminate duplicated code in populate_cache which seems to have existed only
for historical reasons and is now moot.
- Add `response` optional test dictionary array for cases where a network error
is expected as the result of the fetch. Normalize server results to handle
this case since test cases may no longer talk to the server at all.
- Add only-if-cached tests that verify the network is not touched in any of
the fresh cached, stale cached, and not cached cases.
request-cache.html (cross-origin redirects in the cache are not traversed):
- Tests added to request/request-cache.html instead of under redirect/ because
redirect/ and redirect.py explicitly disable caching. Also, the issue is
about cache behavior, not the redirect-following logic.
- Enhance cache.py to accept a "redirect" parameter that generates a 302
redirect using a Location header when received.
- Make the "error" handling generate a test failure if we don't fail when
expected.
- Add "redirect" argument to request-cache.html test info dicts to tell
cache.py to generate a redirect.
- Add test cases for "only-if-cached" to first prime with redirect, expecting
success on same-origin redirects and failure on cross-origin redirects.