author Paul Rouget <>
Mon, 15 Sep 2014 16:23:04 +0200
changeset 205412 4a953a406eaa6999b55091673dd2133494638846
parent 188073 96ddd6ea6abd60f775438e232e3161940ed92c01
child 224979 a629bc251c8167827149af1a66ea3f9ff4ae44d8
permissions -rw-r--r--
Backed out changeset a6d02cff43d3 (bug 1037235) for breaking WebIDE (bug 1067331)

/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
 * vim: ft=cpp tw=78 sw=2 et ts=2 sts=2 cin
 * 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 */

#include "nsISupports.idl"

interface nsIDOMWindow;
interface nsIDOMElement;

 * An nsILoadContext represents the context of a load.  This interface
 * can be queried for various information about where the load is
 * happening.
[scriptable, uuid(6ec837fa-af93-4350-bbb8-0985d54c74ca)]
interface nsILoadContext : nsISupports
   * associatedWindow is the window with which the load is associated, if any.
   * Note that the load may be triggered by a document which is different from
   * the document in associatedWindow, and in fact the source of the load need
   * not be same-origin with the document in associatedWindow.  This attribute
   * may be null if there is no associated window.
  readonly attribute nsIDOMWindow associatedWindow;

   * topWindow is the top window which is of same type as associatedWindow.
   * This is equivalent to, but is provided here as a
   * convenience.  All the same caveats as associatedWindow of apply, of
   * course.  This attribute may be null if there is no associated window.
  readonly attribute nsIDOMWindow topWindow;

   * topFrameElement is the <iframe> or <frame> element which contains the
   * topWindow with which the load is associated.
   * Note that we may have a topFrameElement even when we don't have an
   * associatedWindow, if the topFrameElement's content lives out of process.
  readonly attribute nsIDOMElement topFrameElement;

   * If this LoadContext corresponds to a nested remote iframe, we don't have
   * access to the topFrameElement.  Instead, we must use this id to send
   * messages. A return value of 0 signifies that this load context is not for
   * a nested frame.
  readonly attribute unsigned long long nestedFrameId;

   * Check whether the load is happening in a particular type of application.
   * @param an application type.  For now, the constants to be passed here are
   *        the nsIDocShell APP_TYPE_* constants.
   * @return whether there is some ancestor of the associatedWindow that is of
   *         the given app type.
  boolean isAppOfType(in unsigned long appType);

   * True if the load context is content (as opposed to chrome).  This is
   * determined based on the type of window the load is performed in, NOT based
   * on any URIs that might be around.
  readonly attribute boolean isContent;

   * Attribute that determines if private browsing should be used.
  attribute boolean usePrivateBrowsing;

   * Attribute that determines if remote (out-of-process) tabs should be used.
  readonly attribute boolean useRemoteTabs;

   * De-XPCOMed getter to make call-sites cleaner.
  bool UsePrivateBrowsing() {
    bool usingPB;
    return usingPB;

  bool UseRemoteTabs() {
    bool usingRT;
    return usingRT;

   * Set the private browsing state of the load context, meant to be used internally.
  [noscript] void SetPrivateBrowsing(in boolean aInPrivateBrowsing);

   * Set the remote tabs state of the load context, meant to be used internally.
  [noscript] void SetRemoteTabs(in boolean aUseRemoteTabs);

   * Returns true iff the load is occurring inside a browser element.
  readonly attribute boolean isInBrowserElement;

   * Returns the app id of the app the load is occurring is in. Returns
   * nsIScriptSecurityManager::NO_APP_ID if the load is not part of an app.
  readonly attribute unsigned long appId;