2008-11-24 21:32:04 +03:00
|
|
|
/* -*- 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
|
2012-05-21 15:12:37 +04:00
|
|
|
* 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/. */
|
2008-11-24 21:32:04 +03:00
|
|
|
|
|
|
|
#include "nsISupports.idl"
|
|
|
|
|
2016-01-30 20:05:36 +03:00
|
|
|
interface mozIDOMWindowProxy;
|
2012-08-22 10:47:23 +04:00
|
|
|
interface nsIDOMElement;
|
2008-11-24 21:32:04 +03:00
|
|
|
|
2015-09-23 11:10:21 +03:00
|
|
|
%{C++
|
|
|
|
#ifdef MOZILLA_INTERNAL_API
|
2015-11-03 04:50:54 +03:00
|
|
|
#include "mozilla/BasePrincipal.h" // for DocShellOriginAttributes
|
2015-09-23 11:10:21 +03:00
|
|
|
#endif
|
|
|
|
%}
|
|
|
|
|
2008-11-24 21:32:04 +03:00
|
|
|
/**
|
|
|
|
* An nsILoadContext represents the context of a load. This interface
|
|
|
|
* can be queried for various information about where the load is
|
|
|
|
* happening.
|
|
|
|
*/
|
2016-01-30 20:05:36 +03:00
|
|
|
[scriptable, uuid(2813a7a3-d084-4d00-acd0-f76620315c02)]
|
2008-11-24 21:32:04 +03:00
|
|
|
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.
|
|
|
|
*/
|
2016-01-30 20:05:36 +03:00
|
|
|
readonly attribute mozIDOMWindowProxy associatedWindow;
|
2008-11-24 21:32:04 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* 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.
|
|
|
|
*/
|
2016-01-30 20:05:36 +03:00
|
|
|
readonly attribute mozIDOMWindowProxy topWindow;
|
2008-11-24 21:32:04 +03:00
|
|
|
|
2012-08-22 10:47:23 +04:00
|
|
|
/**
|
2015-01-22 03:19:07 +03:00
|
|
|
* topFrameElement is the <iframe>, <frame>, or <browser> element which
|
|
|
|
* contains the topWindow with which the load is associated.
|
2012-08-22 10:47:23 +04:00
|
|
|
*
|
|
|
|
* Note that we may have a topFrameElement even when we don't have an
|
|
|
|
* associatedWindow, if the topFrameElement's content lives out of process.
|
2015-01-22 03:19:07 +03:00
|
|
|
* topFrameElement is available in single-process and multiprocess contexts.
|
|
|
|
* Note that topFrameElement may be in chrome even when the nsILoadContext is
|
|
|
|
* associated with content.
|
2012-08-22 10:47:23 +04:00
|
|
|
*/
|
|
|
|
readonly attribute nsIDOMElement topFrameElement;
|
|
|
|
|
2014-06-11 09:44:36 +04:00
|
|
|
/**
|
|
|
|
* 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;
|
|
|
|
|
2008-11-24 21:32:04 +03:00
|
|
|
/**
|
|
|
|
* 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;
|
2012-02-02 23:03:46 +04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Attribute that determines if private browsing should be used.
|
|
|
|
*/
|
|
|
|
attribute boolean usePrivateBrowsing;
|
2012-02-21 21:08:22 +04:00
|
|
|
|
2014-02-11 21:00:54 +04:00
|
|
|
/**
|
|
|
|
* Attribute that determines if remote (out-of-process) tabs should be used.
|
|
|
|
*/
|
|
|
|
readonly attribute boolean useRemoteTabs;
|
|
|
|
|
2012-02-21 21:08:22 +04:00
|
|
|
%{C++
|
|
|
|
/**
|
|
|
|
* De-XPCOMed getter to make call-sites cleaner.
|
|
|
|
*/
|
|
|
|
bool UsePrivateBrowsing() {
|
|
|
|
bool usingPB;
|
|
|
|
GetUsePrivateBrowsing(&usingPB);
|
|
|
|
return usingPB;
|
|
|
|
}
|
2014-02-11 21:00:54 +04:00
|
|
|
|
|
|
|
bool UseRemoteTabs() {
|
|
|
|
bool usingRT;
|
|
|
|
GetUseRemoteTabs(&usingRT);
|
|
|
|
return usingRT;
|
|
|
|
}
|
2012-02-21 21:08:22 +04:00
|
|
|
%}
|
2012-07-20 22:38:43 +04:00
|
|
|
|
2012-10-31 08:15:24 +04:00
|
|
|
/**
|
|
|
|
* Set the private browsing state of the load context, meant to be used internally.
|
|
|
|
*/
|
|
|
|
[noscript] void SetPrivateBrowsing(in boolean aInPrivateBrowsing);
|
|
|
|
|
2014-02-11 21:00:54 +04:00
|
|
|
/**
|
|
|
|
* Set the remote tabs state of the load context, meant to be used internally.
|
|
|
|
*/
|
|
|
|
[noscript] void SetRemoteTabs(in boolean aUseRemoteTabs);
|
|
|
|
|
2012-07-20 22:38:43 +04:00
|
|
|
/**
|
2016-02-18 05:55:57 +03:00
|
|
|
* 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.
|
2012-07-20 22:38:43 +04:00
|
|
|
*/
|
2016-02-18 05:55:57 +03:00
|
|
|
readonly attribute boolean isInIsolatedMozBrowserElement;
|
2012-07-20 22:38:43 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* 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;
|
|
|
|
|
2015-09-23 11:10:21 +03:00
|
|
|
/**
|
|
|
|
* 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.
|
2015-10-26 23:05:13 +03:00
|
|
|
*
|
|
|
|
* Defined in LoadContext.cpp
|
2015-09-23 11:10:21 +03:00
|
|
|
*/
|
2015-10-26 23:05:13 +03:00
|
|
|
bool GetOriginAttributes(mozilla::DocShellOriginAttributes& aAttrs);
|
2015-09-23 11:10:21 +03:00
|
|
|
#endif
|
2016-06-02 05:12:39 +03:00
|
|
|
%}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 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;
|
|
|
|
}
|
2015-09-23 11:10:21 +03:00
|
|
|
%}
|
2008-11-24 21:32:04 +03:00
|
|
|
};
|