docshell/base/nsIDocShellLoadInfo.idl
author Brad Werth <bwerth@mozilla.com>
Fri, 23 Mar 2018 15:40:02 -0700
changeset 467905 4f5b6a619ca0ac514ef0e86f7ed90b1fa8bff1df
parent 450398 ff6e9d3a6441aa4510ed47d5383e79fe5a412576
child 478132 7a7bb13a3f1477e00a86d68172d43ff5184afc8b
permissions -rw-r--r--
Bug 1451098 Part 1: Add asserts to widget/gtk/nsWindow.cpp to fail early when setting an invalid window size. r=karlt MozReview-Commit-ID: GHq7ik6EyIl

/* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
 *
 * 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"

/**
 * The nsIDocShellLoadInfo interface defines an interface for specifying
 * setup information used in a nsIDocShell::loadURI call.
 */
 
interface nsIURI;
interface nsIInputStream;
interface nsISHEntry;
interface nsIDocShell;
interface nsIPrincipal;

typedef long nsDocShellInfoLoadType;
typedef unsigned long nsDocShellInfoReferrerPolicy;

[scriptable, uuid(e7570e5a-f1d6-452d-b4f8-b35fdc63aa03)]
interface nsIDocShellLoadInfo : nsISupports
{
    /** This is the referrer for the load. */
    attribute nsIURI referrer;

    /**
     * The originalURI to be passed to nsIDocShell.internalLoad. May be null.
     */
    attribute nsIURI originalURI;

    /**
     * Result principal URL from nsILoadInfo, may be null.  Valid only if
     * the "IsSome" part is true (has the same meaning as isSome()
     * on mozilla::Maybe.)
     *
     * In C++ please use Get/SetMaybeResultPrincipalURI helper functions.
     */
    attribute nsIURI resultPrincipalURI;
    attribute boolean resultPrincipalURIIsSome;

    /**
     * loadReplace flag to be passed to nsIDocShell.internalLoad.
     */
    attribute boolean loadReplace;

    /** The principal of the load, that is, the entity responsible for 
     *  causing the load to occur. In most cases the referrer and
     *  the triggeringPrincipal's URI will be identical.
     */
    attribute nsIPrincipal triggeringPrincipal;

    /** If this attribute is true and no triggeringPrincipal is specified,
     * copy the principal from the referring document.
     */
    attribute boolean inheritPrincipal;

    /** If this attribute is true only ever use the principal specified
     *  by the triggeringPrincipal and inheritPrincipal attributes.
     *  If there are security reasons for why this is unsafe, such
     *  as trying to use a systemprincipal as the triggeringPrincipal
     *  for a content docshell the load fails.
     */
    attribute boolean principalIsExplicit;

    /**
     * If this attribute is true, then a top-level navigation
     * to a data URI will be allowed.
     */
    attribute boolean forceAllowDataURI;

    /**
     * If this attribute is true, this load corresponds to a frame
     * element loading its original src (or srcdoc) attribute.
     */
    attribute boolean originalFrameSrc;

    /* these are load type enums... */
    const long loadNormal = 0;                     // Normal Load
    const long loadNormalReplace = 1;              // Normal Load but replaces current history slot
    const long loadHistory = 2;                    // Load from history
    const long loadReloadNormal = 3;               // Reload
    const long loadReloadBypassCache = 4;
    const long loadReloadBypassProxy = 5;
    const long loadReloadBypassProxyAndCache = 6;
    const long loadLink = 7;
    const long loadRefresh = 8;
    const long loadReloadCharsetChange = 9;
    const long loadBypassHistory = 10;
    const long loadStopContent = 11;
    const long loadStopContentAndReplace = 12;
    const long loadNormalExternal = 13;
    const long loadNormalBypassCache = 14;
    const long loadNormalBypassProxy = 15;
    const long loadNormalBypassProxyAndCache = 16;
    const long loadPushState = 17;                 // history.pushState or replaceState
    const long loadReplaceBypassCache = 18;
    const long loadReloadMixedContent = 19;
    const long loadNormalAllowMixedContent = 20;
    const long loadReloadCharsetChangeBypassCache = 21;
    const long loadReloadCharsetChangeBypassProxyAndCache = 22;

    /** Contains a load type as specified by the load* constants */
    attribute nsDocShellInfoLoadType loadType;

    /** SHEntry for this page */
    attribute nsISHEntry SHEntry;

    /** Target for load, like _content, _blank etc. */
    attribute wstring target;

    /** Post data */
    attribute nsIInputStream postDataStream;

    /** Additional headers */
    attribute nsIInputStream headersStream;

    /** True if the referrer should be sent, false if it shouldn't be
     *  sent, even if it's available. This attribute defaults to true.
     */
    attribute boolean sendReferrer;

    /** Referrer policy for the load. This attribute holds one of
     *  the values (REFERRER_POLICY_*) defined in nsIHttpChannel.
     */
    attribute nsDocShellInfoReferrerPolicy referrerPolicy;

    /** True if the docshell has been created to load an iframe where the
     * srcdoc attribute has been set.  Set when srcdocData is specified.
     */
    readonly attribute boolean isSrcdocLoad;

    /** When set, the load will be interpreted as a srcdoc load, where contents
     * of this string will be loaded instead of the URI.  Setting srcdocData
     * sets isSrcdocLoad to true
     */
    attribute AString srcdocData;

    /** When set, this is the Source Browsing Context for the navigation. */
    attribute nsIDocShell sourceDocShell;

    /**
     * Used for srcdoc loads to give view-source knowledge of the load's base
     * URI as this information isn't embedded in the load's URI.
     */
    attribute nsIURI baseURI;
};

%{C++

#include "mozilla/Maybe.h"

namespace mozilla {

/**
 * Helper function allowing convenient work with mozilla::Maybe in C++, hiding
 * resultPrincipalURI and resultPrincipalURIIsSome attributes from the consumer.
 */
void
GetMaybeResultPrincipalURI(nsIDocShellLoadInfo* aLoadInfo, Maybe<nsCOMPtr<nsIURI>>& aRPURI);
void
SetMaybeResultPrincipalURI(nsIDocShellLoadInfo* aLoadInfo, Maybe<nsCOMPtr<nsIURI>> const& aRPURI);

} // mozilla

%}