1/* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4
5#include "nsISupports.idl"
6interface nsIHttpChannel;
7
8/**
9 * nsIHttpPushListener
10 *
11 * Used for triggering when a HTTP/2 push is received.
12 *
13 */
14[scriptable, uuid(0d6ce59c-ad5d-4520-b4d3-09664868f279)]
15interface nsIHttpPushListener : nsISupports
16{
17  /**
18   * When provided as a notificationCallback to an httpChannel, this.onPush()
19   * will be invoked when there is a >= Http2 push to that
20   * channel. The push may be in progress.
21   *
22   * The consumer must start the new channel in the usual way by calling
23   * pushChannel.AsyncOpen with a nsIStreamListener object that
24   * will receive the normal sequence of OnStartRequest(),
25   * 0 to N OnDataAvailable(), and onStopRequest().
26   *
27   * The new channel can be canceled after the AsyncOpen if it is not wanted.
28   *
29   * @param associatedChannel
30   *        the monitor channel that was recieved on
31   * @param pushChannel
32   *        a channel to the resource which is being pushed
33   */
34  void onPush(in nsIHttpChannel associatedChannel,
35              in nsIHttpChannel pushChannel);
36};
37