Closed Bug 1263469 Opened 5 years ago Closed 5 years ago

FetchEvent.request.cache is not set correctly for non-fetch channels

Categories

(Core :: DOM: Service Workers, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla48
Tracking Status
firefox48 --- fixed

People

(Reporter: bkelly, Assigned: bkelly)

References

(Blocks 1 open bug)

Details

(Whiteboard: btpp-active)

Attachments

(5 files)

There is a mapping between our load flags and fetch RequestCache values.  We convert from RequestCache to load flags when setting an explicit RequestCache value.  We don't, however, translate the other way creating a Request from an nsIChannel.  So non-fetch channels never produce any RequestCache values besides "default".

I think we should fix this.
This maintains the current behavior for explicitly set fetch cache modes, but will otherwise guess the cache mode from the load flags.
Attachment #8739796 - Flags: review?(honzab.moz)
I will add a check for this in one of our tests that trigger a window refresh since we should get "no-cache" for those requests.  Should get to that tomorrow.
Add a check for evt.request.cache to our current refresh test.  This causes the test to time out without the P1 and pass with the P1.
Attachment #8739988 - Flags: review?(ehsan)
Whiteboard: btpp-active
I will add a test for EventSource as well since its required to bypass the http cache.
Comment on attachment 8739988 [details] [diff] [review]
bug1263469_p2_test.patch

Review of attachment 8739988 [details] [diff] [review]:
-----------------------------------------------------------------

This is good, but it would be nice if you can add a web platform test for this.  Either in addition or instead of this one.  r=me.
Attachment #8739988 - Flags: review?(ehsan) → review+
We discussed this at the service worker face-to-face and decided we should implement this:

  https://github.com/slightlyoff/ServiceWorker/issues/875
See Also: → 1120715
Attachment #8739796 - Flags: review?(honzab.moz) → review+
WPT version of test validating frame reload cache value.  I'll look at writing a wpt EventSource test now.  We don't test EventSource at all there.
Attachment #8741834 - Flags: review?(ehsan)
Update our EventSource mochitest to check for cache.
Attachment #8741885 - Flags: review?(ehsan)
Attachment #8741834 - Flags: review?(ehsan) → review+
After much pain, this adds a wpt test case for EventSource.

https://treeherder.mozilla.org/#/jobs?repo=try&revision=b42011ab8f71
Attachment #8741920 - Flags: review?(ehsan)
Attachment #8741885 - Flags: review?(ehsan) → review+
Attachment #8741920 - Flags: review?(ehsan) → review+
Depends on: 1437080
You need to log in before you can comment on or make changes to this bug.