Closed Bug 1121157 Opened 8 years ago Closed 7 years ago
Fetch API: Add tests to check request's context on intercepted requests
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.
8 years ago
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).
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.
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla42
You need to log in before you can comment on or make changes to this bug.