123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156 |
- /* -*- 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 http://mozilla.org/MPL/2.0/. */
- #include "nsISupports.idl"
- interface mozIDOMWindowProxy;
- interface nsIDOMElement;
- %{C++
- #ifdef MOZILLA_INTERNAL_API
- #include "mozilla/BasePrincipal.h" // for DocShellOriginAttributes
- #endif
- %}
- /**
- * An nsILoadContext represents the context of a load. This interface
- * can be queried for various information about where the load is
- * happening.
- */
- [scriptable, uuid(2813a7a3-d084-4d00-acd0-f76620315c02)]
- 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 mozIDOMWindowProxy associatedWindow;
- /**
- * topWindow is the top window which is of same type as associatedWindow.
- * This is equivalent to associatedWindow.top, 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 mozIDOMWindowProxy topWindow;
- /**
- * topFrameElement is the <iframe>, <frame>, or <browser> 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.
- * topFrameElement is available in single-process and multiprocess contexts.
- * Note that topFrameElement may be in chrome even when the nsILoadContext is
- * associated with content.
- */
- 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;
- /**
- * 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. May not be
- * changed after a document has been loaded in this context.
- */
- attribute boolean usePrivateBrowsing;
- /**
- * Attribute that determines if remote (out-of-process) tabs should be used.
- */
- readonly attribute boolean useRemoteTabs;
- %{C++
- /**
- * De-XPCOMed getter to make call-sites cleaner.
- */
- bool UsePrivateBrowsing() {
- bool usingPB;
- GetUsePrivateBrowsing(&usingPB);
- return usingPB;
- }
- bool UseRemoteTabs() {
- bool usingRT;
- GetUseRemoteTabs(&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 an isolated mozbrowser
- * element. <iframe mozbrowser mozapp> and <xul:browser> are not considered to
- * be mozbrowser elements. <iframe mozbrowser noisolation> does not count as
- * isolated since isolation is disabled. Isolation can only be disabled if
- * the containing document is chrome.
- */
- readonly attribute boolean isInIsolatedMozBrowserElement;
- /**
- * 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;
- /**
- * A dictionary of the non-default origin attributes associated with this
- * nsILoadContext.
- */
- readonly attribute jsval originAttributes;
- %{C++
- #ifdef MOZILLA_INTERNAL_API
- /**
- * The C++ getter for origin attributes.
- *
- * Defined in LoadContext.cpp
- */
- bool GetOriginAttributes(mozilla::DocShellOriginAttributes& aAttrs);
- #endif
- %}
- /**
- * Returns true if tracking protection is enabled for the load context.
- */
- boolean IsTrackingProtectionOn();
- %{C++
- /**
- * De-XPCOMed getter to make call-sites cleaner.
- */
- bool UseTrackingProtection() {
- bool usingTP;
- IsTrackingProtectionOn(&usingTP);
- return usingTP;
- }
- %}
- };
|