netwerk/protocol/about/nsIAboutModule.idl
author Andrew McCreight <continuation@gmail.com>
Fri, 27 May 2022 13:15:11 +0000
changeset 619075 cf40e7b79bb18c1e4c18726eb603702304cc531e
parent 596953 1226e02d41d8abc631a67fe4a5bede08f03d250e
permissions -rw-r--r--
Bug 1771381 - Use entries in TabAttributesInternal.set(). r=Gijs Differential Revision: https://phabricator.services.mozilla.com/D147457

/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* 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 nsIURI;
interface nsIChannel;
interface nsILoadInfo;

[scriptable, uuid(c0c19db9-1b5a-4ac5-b656-ed6f8149fa48)]
interface nsIAboutModule : nsISupports
{

    /**
     * Constructs a new channel for the about protocol module.
     *
     * @param aURI the uri of the new channel
     * @param aLoadInfo the loadinfo of the new channel
     */
    nsIChannel newChannel(in nsIURI aURI,
                          in nsILoadInfo aLoadInfo);

    /**
     * A flag that indicates whether a URI should be run with content
     * privileges. If it is, the about: protocol handler will enforce that
     * the principal of channels created for it be based on their
     * originalURI or URI (depending on the channel flags), by setting
     * their "owner" to null.
     * If content needs to be able to link to this URI, specify
     * URI_CONTENT_LINKABLE as well.
     */
    const unsigned long URI_SAFE_FOR_UNTRUSTED_CONTENT = (1 << 0);

    /**
     * A flag that indicates whether script should be enabled for the
     * given about: URI even if it's disabled in general.
     */
    const unsigned long ALLOW_SCRIPT = (1 << 1);

    /**
     * A flag that indicates whether this about: URI doesn't want to be listed
     * in about:about, especially if it's not useful without a query string.
     */
    const unsigned long HIDE_FROM_ABOUTABOUT = (1 << 2);

    /**
     * A flag that indicates whether this about: URI wants Indexed DB enabled.
     */
    const unsigned long ENABLE_INDEXED_DB = (1 << 3);

    /**
     * A flag that indicates that this URI can be loaded in a child process
     */
    const unsigned long URI_CAN_LOAD_IN_CHILD = (1 << 4);

    /**
     * A flag that indicates that this URI must be loaded in a child process
     */
    const unsigned long URI_MUST_LOAD_IN_CHILD = (1 << 5);

    /**
     * Obsolete. This flag no longer has any effect and will be removed in future.
     */
    const unsigned long MAKE_UNLINKABLE = (1 << 6);

    /**
     * A flag that indicates that this URI should be linkable from content.
     * Ignored unless URI_SAFE_FOR_UNTRUSTED_CONTENT is also specified.
     *
     * When adding a new about module with this flag make sure to also update
     * IsSafeToLinkForUntrustedContent() in nsAboutProtocolHandler.cpp
     */
    const unsigned long MAKE_LINKABLE = (1 << 7);

    /**
     * A flag that indicates that this URI can be loaded in the privileged
     * activity stream content process if said process is enabled. Ignored unless
     * URI_MUST_LOAD_IN_CHILD is also specified.
     */
    const unsigned long URI_CAN_LOAD_IN_PRIVILEGEDABOUT_PROCESS = (1 << 8);

    /**
     * A flag that indicates that this URI must be loaded in an extension process (if available).
     */
    const unsigned long URI_MUST_LOAD_IN_EXTENSION_PROCESS = (1 << 9);

    /**
     * A flag that indicates that this about: URI needs to allow unsanitized content.
     * Only to be used by about:home and about:newtab.
     */
    const unsigned long ALLOW_UNSANITIZED_CONTENT = (1 << 10);

    /**
     * A flag that indicates that this about: URI is a secure chrome UI
     */
    const unsigned long IS_SECURE_CHROME_UI = (1 << 11);

    /**
     * A method to get the flags that apply to a given about: URI.  The URI
     * passed in is guaranteed to be one of the URIs that this module
     * registered to deal with.
     */
    unsigned long getURIFlags(in nsIURI aURI);

    /**
     * A method to get the chrome URI that corresponds to a given about URI.
     */
    nsIURI getChromeURI(in nsIURI aURI);
};

%{C++

#define NS_ABOUT_MODULE_CONTRACTID        "@mozilla.org/network/protocol/about;1"
#define NS_ABOUT_MODULE_CONTRACTID_PREFIX NS_ABOUT_MODULE_CONTRACTID "?what="
#define NS_ABOUT_MODULE_CONTRACTID_LENGTH 49      // strlen(NS_ABOUT_MODULE_CONTRACTID_PREFIX)

%}