Closed Bug 1148064 Opened 9 years ago Closed 9 years ago

Enable interception of pings through service workers

Categories

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

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla40
Tracking Status
firefox40 --- fixed

People

(Reporter: ehsan.akhgari, Assigned: ehsan.akhgari)

References

Details

Attachments

(1 file, 1 obsolete file)

This is similar to bug 1147695 but for pings.
Currently when sending a beacon, HttpBaseChannel::ShouldIntercept tries
to get access to the nsINetworkInterceptController interface through the
channel's notification callbacks, but in this case the notification
callback is the nsPingListener object.

This patch extends nsPingListener to make it aware of
nsINetworkInterceptController, and have it route the request for
nsINetworkInterceptController correctly to the docshell without the need
to mess with the notification callbacks.

This will be tested in bug 1147699.
Attachment #8584017 - Flags: review?(nsm.nikhil)
Comment on attachment 8584017 [details] [diff] [review]
Enable interception of pings through service workers

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

Please pass this by someone who knows docshell once.

::: docshell/base/nsDocShell.cpp
@@ +531,5 @@
> +  if (aIID.Equals(NS_GET_IID(nsINetworkInterceptController)) &&
> +      mInterceptController) {
> +    nsCOMPtr<nsINetworkInterceptController> copy(mInterceptController);
> +    *aResult = copy.forget().take();
> +    return NS_OK;

Why not use the same pattern as for channel event sink?
Attachment #8584017 - Flags: review?(nsm.nikhil) → review+
(In reply to Nikhil Marathe [:nsm] (needinfo? please) from comment #2)
> ::: docshell/base/nsDocShell.cpp
> @@ +531,5 @@
> > +  if (aIID.Equals(NS_GET_IID(nsINetworkInterceptController)) &&
> > +      mInterceptController) {
> > +    nsCOMPtr<nsINetworkInterceptController> copy(mInterceptController);
> > +    *aResult = copy.forget().take();
> > +    return NS_OK;
> 
> Why not use the same pattern as for channel event sink?

Because I'd prefer us to move away from calling AddRef and Release manually...  But you have a good point on the inconsistency, so I'll change the other pattern.  :-)
Currently when sending a beacon, HttpBaseChannel::ShouldIntercept tries
to get access to the nsINetworkInterceptController interface through the
channel's notification callbacks, but in this case the notification
callback is the nsPingListener object.

This patch extends nsPingListener to make it aware of
nsINetworkInterceptController, and have it route the request for
nsINetworkInterceptController correctly to the docshell without the need
to mess with the notification callbacks.

This will be tested in bug 1147699.
Attachment #8584017 - Attachment is obsolete: true
Attachment #8585103 - Flags: review?(bugs)
Comment on attachment 8585103 [details] [diff] [review]
Enable interception of pings through service workers

Could we mark SendPingInfo to be stack class?
Attachment #8585103 - Flags: review?(bugs) → review+
Of course!
https://hg.mozilla.org/mozilla-central/rev/aca9840cf06f
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla40
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: