mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-01 17:23:59 +00:00
bc977362f2
* * * Updating comments for loadingNode, loadingPrincipal, and loadingDocument
152 lines
5.2 KiB
C++
152 lines
5.2 KiB
C++
/* -*- 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"
|
|
#include "nsIContentPolicy.idl"
|
|
|
|
interface nsIDOMDocument;
|
|
interface nsINode;
|
|
interface nsIPrincipal;
|
|
|
|
typedef unsigned long nsSecurityFlags;
|
|
|
|
/**
|
|
* An nsILoadOwner represents per-load information about who started the load.
|
|
*/
|
|
[scriptable, builtinclass, uuid(046db047-a1c1-4519-8ec7-99f3054bc9ac)]
|
|
interface nsILoadInfo : nsISupports
|
|
{
|
|
/**
|
|
* No special security flags:
|
|
*/
|
|
const unsigned long SEC_NORMAL = 0;
|
|
|
|
/**
|
|
* Force inheriting of the Principal. The resulting resource will use the
|
|
* principal of the document which is doing the load. Setting this flag
|
|
* will cause GetChannelResultPrincipal to return the same principal as
|
|
* the loading principal that's passed in when creating the channel.
|
|
*
|
|
* This will happen independently of the scheme of the URI that the
|
|
* channel is loading.
|
|
*
|
|
* So if the loading document comes from "http://a.com/", and the channel
|
|
* is loading the URI "http://b.com/whatever", GetChannelResultPrincipal
|
|
* will return a principal from "http://a.com/".
|
|
*
|
|
* This flag can not be used together with SEC_SANDBOXED.
|
|
*/
|
|
const unsigned long SEC_FORCE_INHERIT_PRINCIPAL = 0x01;
|
|
|
|
/**
|
|
* Sandbox the load. The resulting resource will use a freshly created
|
|
* null principal. So GetChannelResultPrincipal will always return a
|
|
* null principal whenever this flag is set.
|
|
*
|
|
* This will happen independently of the scheme of the URI that the
|
|
* channel is loading.
|
|
*
|
|
* This flag can not be used together with SEC_FORCE_INHERIT_PRINCIPAL.
|
|
*/
|
|
const unsigned long SEC_SANDBOXED = 0x02;
|
|
|
|
/**
|
|
* The loadingPrincipal is the principal that is responsible for the load.
|
|
* It is *NOT* the principal tied to the resource/URI that this
|
|
* channel is loading, it's the principal of the resource's
|
|
* caller or requester. For example, if this channel is loading
|
|
* an image from http://b.com that is embedded in a document
|
|
* who's origin is http://a.com, the loadingPrincipal is http://a.com.
|
|
*
|
|
* The loadingPrincipal will never be null.
|
|
*/
|
|
readonly attribute nsIPrincipal loadingPrincipal;
|
|
|
|
/**
|
|
* A C++-friendly version of loadingPrincipal.
|
|
*/
|
|
[noscript, notxpcom, nostdcall, binaryname(LoadingPrincipal)]
|
|
nsIPrincipal binaryLoadingPrincipal();
|
|
|
|
|
|
/**
|
|
* The loadingDocument of the channel.
|
|
*
|
|
* The loadingDocument of a channel is the document that requested the
|
|
* load of the resource. It is *not* the resource itself, it's the
|
|
* resource's caller or requester in which the load is happening.
|
|
*
|
|
* <script> example: Assume a document who's origin is http://a.com embeds
|
|
* a script from http://b.com. The loadingDocument for the channel
|
|
* associated with the http://b.com script load is the document with origin
|
|
* http://a.com
|
|
*
|
|
* <iframe> example: Assume a document with origin http://a.com embeds
|
|
* <iframe src="http://b.com">. The loadingDocument for the channel associated
|
|
* with the http://b.com network request is the document who's origin is
|
|
* http://a.com. Now assume the iframe to http://b.com then further embeds
|
|
* <script src="http://c.com">. The loadingDocument for the channel associated
|
|
* with the http://c.com network request is the iframe with origin http://b.com.
|
|
*
|
|
* Warning: The loadingDocument can be null!
|
|
*/
|
|
readonly attribute nsIDOMDocument loadingDocument;
|
|
|
|
/**
|
|
* A C++-friendly version of loadingDocument (loadingNode).
|
|
* This is the node most proximally responsible for the load.
|
|
*/
|
|
[noscript, notxpcom, nostdcall, binaryname(LoadingNode)]
|
|
nsINode binaryLoadingNode();
|
|
|
|
/**
|
|
* The securityFlags of that channel.
|
|
*/
|
|
readonly attribute nsSecurityFlags securityFlags;
|
|
|
|
%{ C++
|
|
inline nsSecurityFlags GetSecurityFlags()
|
|
{
|
|
nsSecurityFlags result;
|
|
mozilla::DebugOnly<nsresult> rv = GetSecurityFlags(&result);
|
|
MOZ_ASSERT(NS_SUCCEEDED(rv));
|
|
return result;
|
|
}
|
|
%}
|
|
|
|
/**
|
|
* If forceInheritPrincipal is true, the data coming from the channel should
|
|
* use loadingPrincipal for its principal, even when the data is loaded over
|
|
* http:// or another protocol that would normally use a URI-based principal.
|
|
* This attribute will never be true when loadingSandboxed is true.
|
|
*/
|
|
[infallible] readonly attribute boolean forceInheritPrincipal;
|
|
|
|
/**
|
|
* If loadingSandboxed is true, the data coming from the channel is
|
|
* being loaded sandboxed, so it should have a nonce origin and
|
|
* hence should use a NullPrincipal.
|
|
*/
|
|
[infallible] readonly attribute boolean loadingSandboxed;
|
|
|
|
/**
|
|
* The contentPolicyType of the channel, used for security checks
|
|
* like Mixed Content Blocking and Content Security Policy.
|
|
*/
|
|
readonly attribute nsContentPolicyType contentPolicyType;
|
|
|
|
%{ C++
|
|
inline nsContentPolicyType GetContentPolicyType()
|
|
{
|
|
nsContentPolicyType result;
|
|
mozilla::DebugOnly<nsresult> rv = GetContentPolicyType(&result);
|
|
MOZ_ASSERT(NS_SUCCEEDED(rv));
|
|
return result;
|
|
}
|
|
%}
|
|
|
|
};
|