Closed Bug 1119026 Opened 9 years ago Closed 9 years ago

Fetch API: Set skip serviceworker flag for fetch() invoked in ServiceWorkers

Categories

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

33 Branch
x86_64
Linux
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla38

People

(Reporter: nsm, Assigned: nsm)

References

Details

Attachments

(1 file)

Assignee: nobody → nsm.nikhil
Status: NEW → ASSIGNED
Comment on attachment 8545526 [details] [diff] [review]
Respect skip serviceworker flag

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

One question, but otherwise looks good to me.  Flag Andrea for DOM peer sign off.

::: dom/fetch/FetchDriver.cpp
@@ +373,5 @@
> +  // While the spec also gates on the client being a ServiceWorker, we can't
> +  // infer that here. Instead we rely on callers to set the flag correctly.
> +  if (mRequest->SkipServiceWorker()) {
> +    nsCOMPtr<nsIHttpChannelInternal> internalChan = do_QueryInterface(httpChan);
> +    internalChan->ForceNoIntercept();

Do you need to do this for redirect channels as well?

::: dom/fetch/InternalRequest.h
@@ +135,5 @@
>      mReferrer.Assign(aReferrer);
>    }
>  
>    bool
> +  SkipServiceWorker()

const
Attachment #8545526 - Flags: review?(bkelly)
Attachment #8545526 - Flags: review?(amarchesini)
Attachment #8545526 - Flags: review+
Also, it seems we need to set the skip service worker if a ServiceWorker is consulted and declines to override the network response.  Is that something Josh's code will need to do?
Attachment #8545526 - Flags: review?(amarchesini) → review+
(In reply to Ben Kelly [:bkelly] from comment #2)
> Comment on attachment 8545526 [details] [diff] [review]
> Respect skip serviceworker flag
> 
> Review of attachment 8545526 [details] [diff] [review]:
> -----------------------------------------------------------------
> 
> One question, but otherwise looks good to me.  Flag Andrea for DOM peer sign
> off.
> 
> ::: dom/fetch/FetchDriver.cpp
> @@ +373,5 @@
> > +  // While the spec also gates on the client being a ServiceWorker, we can't
> > +  // infer that here. Instead we rely on callers to set the flag correctly.
> > +  if (mRequest->SkipServiceWorker()) {
> > +    nsCOMPtr<nsIHttpChannelInternal> internalChan = do_QueryInterface(httpChan);
> > +    internalChan->ForceNoIntercept();
> 
> Do you need to do this for redirect channels as well?

I've filed a followup to test it once we can actually test this.
(In reply to Ben Kelly [:bkelly] from comment #3)
> Also, it seems we need to set the skip service worker if a ServiceWorker is
> consulted and declines to override the network response.  Is that something
> Josh's code will need to do?

The interception code will have to make sure it sets SkipServiceWorker() on the request then.
https://hg.mozilla.org/mozilla-central/rev/7ad380221ba6
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla38
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: