Closed Bug 1121157 Opened 9 years ago Closed 9 years ago

Fetch API: Add tests to check request's context on intercepted requests.

Categories

(Core :: DOM: Core & HTML, defect)

33 Branch
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla42

People

(Reporter: nsm, Assigned: ehsan.akhgari)

References

Details

Requests sent via fetch events to a ServiceWorker should have the correct context set on them. It is impossible to test this until Bug 1065216 and Bug 1113555 have landed, so wait on them.
Why does Request.context reflect Request::mContext, and not InternalRequest::mContentPolicyType?  It seems that the Request objects intercepted in FetchEvent should always have the wrong context attribute because of this (unless the request is coming from fetch).
Flags: needinfo?(nsm.nikhil)
Blocks: 1126820
We don't have code that maps from the channel's policy type + originating node and other factors to a valid context and context frame type as specified in the fetch spec. In addition our nsIContentPolicyType does not map onto the full set of contexts specified in the spec. Yes, by default Requests intercepted by SW will have context 'fetch' even if they don't come from fetch. A minimum fix would be to have FetchEventRunnable::Init() at least set the correct type on the InternalRequest as grabbed from the channel. The spec fix so that JS observes the right context needs someone to put in the work to come up with this mapping, including being aware of any subtleties.
Flags: needinfo?(nsm.nikhil)
Assignee: nobody → ehsan
Depends on: 1147367
Depends on: 1147668
Depends on: 1147695
Depends on: 1147699
Depends on: 1147899
Depends on: 1147996
Depends on: 1148030
Depends on: 1148044
Depends on: 1148064
No longer blocks: 1126820
Depends on: 1131323
Depends on: 1148935
Depends on: 1149853
Depends on: 1150856
No longer depends on: 1147899
Depends on: 1174307
Depends on: 1174849
Depends on: 1174868
Depends on: 1174982
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla42
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.