Bug 1503787 Comment 24 Edit History

Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.

I think that call to ShouldInterceptURI will be made, but because content-process ServiceWorkerManagers have no registrations, the call-chain[1] that terminates in a call to [ServiceWorkerManager::IsAvailable](https://searchfox.org/mozilla-central/rev/690e903ef689a4eca335b96bd903580394864a1c/dom/serviceworkers/ServiceWorkerManager.cpp#2171) will return false at that point.  Unfortunately, all the logic related to STS upgrades and maybe other side-effects happen.

I think we want a parent-intercept guard at the [ShouldInterceptURI](https://searchfox.org/mozilla-central/rev/690e903ef689a4eca335b96bd903580394864a1c/netwerk/protocol/http/HttpChannelChild.cpp#2544) call-site.  Probably we should be asserting that if parent-intercept is on, `mPostRedirectChannelShouldIntercept` is false, and we should not invoke that call.

1: Calls:
- [HttpChannelChild::AsyncOpenInternal calls ShouldIntercepURI](https://searchfox.org/mozilla-central/rev/690e903ef689a4eca335b96bd903580394864a1c/netwerk/protocol/http/HttpChannelChild.cpp#2544)
- [HCC:ShouldInterceptURI calls HttpBaseChannel::ShouldIntercept](https://searchfox.org/mozilla-central/rev/690e903ef689a4eca335b96bd903580394864a1c/netwerk/protocol/http/HttpChannelChild.cpp#3909)
- [HBC::ShouldIntercept calls nsINetworkInterceptController::ShouldPrepareForIntercept](https://searchfox.org/mozilla-central/rev/690e903ef689a4eca335b96bd903580394864a1c/netwerk/protocol/http/HttpBaseChannel.cpp#2834)
- [ServiceWorkerInterceptController::ShouldPrepareForIntercept calls ServiceWorkerManager::IsAvailable](https://searchfox.org/mozilla-central/rev/690e903ef689a4eca335b96bd903580394864a1c/dom/serviceworkers/ServiceWorkerInterceptController.cpp#44)
- [SWM::IsAvailable gets a null registration](https://searchfox.org/mozilla-central/rev/690e903ef689a4eca335b96bd903580394864a1c/dom/serviceworkers/ServiceWorkerManager.cpp#2177)
EDIT: I mis-spoke somewhat here.  There should not be an intercept controller because the client docshell [won't create one](https://searchfox.org/mozilla-central/rev/690e903ef689a4eca335b96bd903580394864a1c/docshell/base/nsDocShell.cpp#480).  This means the real call-stack is:

Calls:
- [HttpChannelChild::AsyncOpenInternal calls ShouldIntercepURI](https://searchfox.org/mozilla-central/rev/690e903ef689a4eca335b96bd903580394864a1c/netwerk/protocol/http/HttpChannelChild.cpp#2544)
- [HCC:ShouldInterceptURI calls HttpBaseChannel::ShouldIntercept](https://searchfox.org/mozilla-central/rev/690e903ef689a4eca335b96bd903580394864a1c/netwerk/protocol/http/HttpChannelChild.cpp#3909)
- [HBC::ShouldIntercept will not have a controller and not be able to call ShouldPrepareForIntercept](https://searchfox.org/mozilla-central/rev/690e903ef689a4eca335b96bd903580394864a1c/netwerk/protocol/http/HttpBaseChannel.cpp#2833)

### Original Comment

I think that call to ShouldInterceptURI will be made, but because content-process ServiceWorkerManagers have no registrations, the call-chain[1] that terminates in a call to [ServiceWorkerManager::IsAvailable](https://searchfox.org/mozilla-central/rev/690e903ef689a4eca335b96bd903580394864a1c/dom/serviceworkers/ServiceWorkerManager.cpp#2171) will return false at that point.  Unfortunately, all the logic related to STS upgrades and maybe other side-effects happen.

I think we want a parent-intercept guard at the [ShouldInterceptURI](https://searchfox.org/mozilla-central/rev/690e903ef689a4eca335b96bd903580394864a1c/netwerk/protocol/http/HttpChannelChild.cpp#2544) call-site.  Probably we should be asserting that if parent-intercept is on, `mPostRedirectChannelShouldIntercept` is false, and we should not invoke that call.

1: Calls:
- [HttpChannelChild::AsyncOpenInternal calls ShouldIntercepURI](https://searchfox.org/mozilla-central/rev/690e903ef689a4eca335b96bd903580394864a1c/netwerk/protocol/http/HttpChannelChild.cpp#2544)
- [HCC:ShouldInterceptURI calls HttpBaseChannel::ShouldIntercept](https://searchfox.org/mozilla-central/rev/690e903ef689a4eca335b96bd903580394864a1c/netwerk/protocol/http/HttpChannelChild.cpp#3909)
- [HBC::ShouldIntercept calls nsINetworkInterceptController::ShouldPrepareForIntercept](https://searchfox.org/mozilla-central/rev/690e903ef689a4eca335b96bd903580394864a1c/netwerk/protocol/http/HttpBaseChannel.cpp#2834)
- [ServiceWorkerInterceptController::ShouldPrepareForIntercept calls ServiceWorkerManager::IsAvailable](https://searchfox.org/mozilla-central/rev/690e903ef689a4eca335b96bd903580394864a1c/dom/serviceworkers/ServiceWorkerInterceptController.cpp#44)
- [SWM::IsAvailable gets a null registration](https://searchfox.org/mozilla-central/rev/690e903ef689a4eca335b96bd903580394864a1c/dom/serviceworkers/ServiceWorkerManager.cpp#2177)

Back to Bug 1503787 Comment 24