1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5
6#include "nsISupports.idl"
7
8interface nsIChannel;
9
10/**
11 * An interface to access the the base channel
12 * associated with a MultiPartChannel.
13 */
14
15[scriptable, builtinclass, uuid(4fefb490-5567-11e5-a837-0800200c9a66)]
16interface nsIMultiPartChannel : nsISupports
17{
18    /**
19     * readonly attribute to access the underlying channel
20     */
21    readonly attribute nsIChannel baseChannel;
22
23    /**
24     * Attribute guaranteed to be different for different parts of
25     * the same multipart document.
26     */
27    readonly attribute uint32_t partID;
28
29    [noscript] readonly attribute boolean isFirstPart;
30
31    /**
32     * Set to true when onStopRequest is received from the base channel.
33     * The listener can check this from its onStopRequest to determine
34     * whether more data can be expected.
35     */
36    readonly attribute boolean isLastPart;
37};
38
39/**
40 * An interface that listeners can implement to receive a notification
41 * when the last part of the multi-part channel has finished, and the
42 * final OnStopRequest has been sent.
43  */
44[scriptable, uuid(b084959a-4fb9-41a5-88a0-d0f045ce75cf)]
45interface nsIMultiPartChannelListener : nsISupports
46{
47    /**
48     * Sent when all parts have finished and sent OnStopRequest.
49     */
50    void onAfterLastPart(in nsresult status);
51};
52