refactor(service-worker): make the caching behavior more explicit (#30977)
refactor(service-worker): make the caching behavior more explicit (#30977)

This commit doesn't change the behavior wrt caching, but it makes it
more explicit that only non-timed-out responses are cached. In case of a
timeout, `res` would be set to a programmatically created 504
`Response`, so `cacheResponse()` (which checks for `res.ok`) would not
have cached it anyway, but this makes change makes it more explicit (and
more similar to the equivalent part in [handleFetchWithFreshness()][1]).

[1]: https://github.com/angular/angular/blob/2b4d5c754/packages/service-worker/worker/src/data.ts#L379-L388

PR Close #30977

angular/angular,snaptech/angular,Brocco/angular,mhevery/angular,gdi2290/angular,StephenFluin/angular,alxhub/angular,manekinekko/angular,Brocco/angular,Toxicable/angular,angular/angular,gdi2290/angular,Brocco/angular,Toxicable/angular,IdeaBlade/angular,gdi2290/angular,manekinekko/angular,StephenFluin/angular,sarunint/angular,brandonroberts/angular,brandonroberts/angular,mgechev/angular,wKoza/angular,blesh/angular,alxhub/angular,gdi2290/angular,manekinekko/angular,vikerman/angular,sarunint/angular,JiaLiPassion/angular,alexeagle/angular,alxhub/angular,snaptech/angular,sarunint/angular,gdi2290/angular,vikerman/angular,JiaLiPassion/angular,mprobst/angular,matsko/angular,angular/angular,mgechev/angular,blesh/angular,brandonroberts/angular,filipesilva/angular,sarunint/angular,Brocco/angular,wKoza/angular,snaptech/angular,wKoza/angular,angular-indonesia/angular,matsko/angular,mhevery/angular,Brocco/angular,filipesilva/angular,Brocco/angular,shairez/angular,mgechev/angular,matsko/angular,ocombe/angular,Toxicable/angular,Toxicable/angular,gnomeontherun/angular,shairez/angular,gkalpak/angular,gnomeontherun/angular,mprobst/angular,gnomeontherun/angular,shairez/angular,angular-indonesia/angular,alexeagle/angular,IdeaBlade/angular,mhevery/angular,snaptech/angular,mprobst/angular,ocombe/angular,alexeagle/angular,angular-indonesia/angular,StephenFluin/angular,Toxicable/angular,filipesilva/angular,mgechev/angular,JiaLiPassion/angular,JiaLiPassion/angular,manekinekko/angular,blesh/angular,filipesilva/angular,gkalpak/angular,angular/angular,mprobst/angular,snaptech/angular,gnomeontherun/angular,shairez/angular,gkalpak/angular,vikerman/angular,mhevery/angular,brandonroberts/angular,mprobst/angular,gkalpak/angular,snaptech/angular,mgechev/angular,filipesilva/angular,manekinekko/angular,ocombe/angular,IdeaBlade/angular,alxhub/angular,mprobst/angular,alexeagle/angular,wKoza/angular,vikerman/angular,sarunint/angular,angular-indonesia/angular,StephenFluin/angular,wKoza/angular,gdi2290/angular,wKoza/angular,brandonroberts/angular,shairez/angular,ocombe/angular,mhevery/angular,ocombe/angular,mhevery/angular,IdeaBlade/angular,vikerman/angular,ocombe/angular,brandonroberts/angular,sarunint/angular,blesh/angular,alxhub/angular,IdeaBlade/angular,StephenFluin/angular,matsko/angular,alexeagle/angular,matsko/angular,vikerman/angular,blesh/angular,Toxicable/angular,alexeagle/angular,manekinekko/angular