netwerk/base/nsIInputStreamChannel.idl
author Alastor Wu <alwu@mozilla.com>
Tue, 10 Dec 2019 18:30:36 +0000
changeset 506291 1fb1ca98f23b29d1a8a287ad2db326c84df04c57
parent 475212 020c8c871c0d3b3920fe95935cfef06501976c0f
permissions -rw-r--r--
Bug 1602617 - part2 : reuse same event source all the time. r=MeFisto94 Because we won't change platform dynamically, so we should be able to keep same the event source all the time and use `Open()` and `Close()` to control if we need to monitor media keys event or not. Differential Revision: https://phabricator.services.mozilla.com/D56499

/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

#include "nsISupports.idl"

interface nsIInputStream;
interface nsIURI;

/**
 * nsIInputStreamChannel
 *
 * This interface provides methods to initialize an input stream channel.
 * The input stream channel serves as a data pump for an input stream.
 */
[scriptable, uuid(ea730238-4bfd-4015-8489-8f264d05b343)]
interface nsIInputStreamChannel : nsISupports
{
    /**
     * Sets the URI for this channel.  This must be called before the
     * channel is opened, and it may only be called once.
     */
    void setURI(in nsIURI aURI);

    /**
     * Get/set the content stream
     *
     * This stream contains the data that will be pushed to the channel's
     * stream listener.  If the stream is non-blocking and supports the
     * nsIAsyncInputStream interface, then the stream will be read directly.
     * Otherwise, the stream will be read on a background thread.
     *
     * This attribute must be set before the channel is opened, and it may
     * only be set once.
     *
     * @throws NS_ERROR_IN_PROGRESS if the setter is called after the channel
     * has been opened.
     */
    attribute nsIInputStream contentStream;

    /**
     * Get/set the srcdoc data string.  When the input stream channel is
     * created to load a srcdoc iframe, this is set to hold the value of the
     * srcdoc attribute.
     *
     * This should be the same value used to create contentStream, but this is
     * not checked.
     *
     * Changing the value of this attribute will not otherwise affect the
     * functionality of the channel or input stream.
     */
    attribute AString srcdocData;

    /**
     * Returns true if srcdocData has been set within the channel.
     */
    readonly attribute boolean isSrcdocChannel;

    /**
     * The base URI to be used for the channel.  Used when the base URI cannot
     * be inferred by other means, for example when this is a srcdoc channel.
     */
    attribute nsIURI baseURI;
};