docshell/base/nsILoadContext.idl

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
     2  * vim: ft=cpp tw=78 sw=2 et ts=2 sts=2 cin
     3  * This Source Code Form is subject to the terms of the Mozilla Public
     4  * License, v. 2.0. If a copy of the MPL was not distributed with this
     5  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     7 #include "nsISupports.idl"
     9 interface nsIDOMWindow;
    10 interface nsIDOMElement;
    12 /**
    13  * An nsILoadContext represents the context of a load.  This interface
    14  * can be queried for various information about where the load is
    15  * happening.
    16  */
    17 [scriptable, uuid(852ed1f0-8ec0-11e3-baa8-0800200c9a66)]
    18 interface nsILoadContext : nsISupports
    19 {
    20   /**
    21    * associatedWindow is the window with which the load is associated, if any.
    22    * Note that the load may be triggered by a document which is different from
    23    * the document in associatedWindow, and in fact the source of the load need
    24    * not be same-origin with the document in associatedWindow.  This attribute
    25    * may be null if there is no associated window.
    26    */
    27   readonly attribute nsIDOMWindow associatedWindow;
    29   /**
    30    * topWindow is the top window which is of same type as associatedWindow.
    31    * This is equivalent to associatedWindow.top, but is provided here as a
    32    * convenience.  All the same caveats as associatedWindow of apply, of
    33    * course.  This attribute may be null if there is no associated window.
    34    */
    35   readonly attribute nsIDOMWindow topWindow;
    37   /**
    38    * topFrameElement is the <iframe> or <frame> element which contains the
    39    * topWindow with which the load is associated.
    40    *
    41    * Note that we may have a topFrameElement even when we don't have an
    42    * associatedWindow, if the topFrameElement's content lives out of process.
    43    */
    44   readonly attribute nsIDOMElement topFrameElement;
    46   /**
    47    * Check whether the load is happening in a particular type of application.
    48    *
    49    * @param an application type.  For now, the constants to be passed here are
    50    *        the nsIDocShell APP_TYPE_* constants.
    51    *
    52    * @return whether there is some ancestor of the associatedWindow that is of
    53    *         the given app type.
    54    */
    55   boolean isAppOfType(in unsigned long appType);
    57   /**
    58    * True if the load context is content (as opposed to chrome).  This is
    59    * determined based on the type of window the load is performed in, NOT based
    60    * on any URIs that might be around.
    61    */
    62   readonly attribute boolean isContent;
    64   /*
    65    * Attribute that determines if private browsing should be used.
    66    */
    67   attribute boolean usePrivateBrowsing;
    69   /**
    70    * Attribute that determines if remote (out-of-process) tabs should be used.
    71    */
    72   readonly attribute boolean useRemoteTabs;
    74 %{C++
    75   /**
    76    * De-XPCOMed getter to make call-sites cleaner.
    77    */
    78   bool UsePrivateBrowsing() {
    79     bool usingPB;
    80     GetUsePrivateBrowsing(&usingPB);
    81     return usingPB;
    82   }
    84   bool UseRemoteTabs() {
    85     bool usingRT;
    86     GetUseRemoteTabs(&usingRT);
    87     return usingRT;
    88   }
    89 %}
    91   /**
    92    * Set the private browsing state of the load context, meant to be used internally.
    93    */
    94   [noscript] void SetPrivateBrowsing(in boolean aInPrivateBrowsing);
    96   /**
    97    * Set the remote tabs state of the load context, meant to be used internally.
    98    */
    99   [noscript] void SetRemoteTabs(in boolean aUseRemoteTabs);
   101   /**
   102    * Returns true iff the load is occurring inside a browser element.
   103    */
   104   readonly attribute boolean isInBrowserElement;
   106   /**
   107    * Returns the app id of the app the load is occurring is in. Returns
   108    * nsIScriptSecurityManager::NO_APP_ID if the load is not part of an app.
   109    */
   110   readonly attribute unsigned long appId;
   112 };

mercurial