/* -*- 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; interface nsIURI; typedef unsigned long nsSecurityFlags; /** * An nsILoadOwner represents per-load information about who started the load. */ [scriptable, builtinclass, uuid(768a1f20-57d4-462a-812a-41c04e5d1e19)] 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 triggeringPrincipal is the principal that triggerd the load. * Most likely the triggeringPrincipal and the loadingPrincipal are the same, * in which case triggeringPrincipal returns the loadingPrincipal. * In some cases the loadingPrincipal and the triggeringPrincipal are different * however, e.g. a stylesheet may import a subresource. In that case the * stylesheet principal is the triggeringPrincipal and the document that loads * the stylesheet provides a loadingContext and hence the loadingPrincipal. * * If triggeringPrincipal and loadingPrincipal are the same, then * triggeringPrincipal returns loadingPrincipal. */ readonly attribute nsIPrincipal triggeringPrincipal; /** * A C++-friendly version of triggeringPrincipal. */ [noscript, notxpcom, nostdcall, binaryname(TriggeringPrincipal)] nsIPrincipal binaryTriggeringPrincipal(); /** * 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. * *