Readonly
aboutIf aboutBlankInherits is true, then about:blank should inherit the principal.
Readonly
allowIf allowChrome is true, then use nsIScriptSecurityManager::ALLOW_CHROME when calling CheckLoadURIWithPrincipal().
We disallow the SystemPrincipal to initiate requests to the public web. This flag is to allow exceptions.
If true, insecure redirects to a data: URI are allowed.
During a top-level document channel redirect from tracking to non-tracking resources, our anti-tracking heuristic, grants the storage access permission for a short amount of seconds (See privacy.restrict3rdpartystorage.expiration_redirect pref). We use this flag to remember this decision even if this channel is part of a chain of redirects.
Readonly
blockReturns true if document or any of the documents ancestors up to the toplevel document make use of the CSP directive 'block-all-mixed-content'.
Warning: If the loadingDocument is null, then the blockAllMixedContent is false.
Returns true if the display content was or will get upgraded from http to https. Requires 'security.mixed_content.upgrade_display_content' pref to be true. Flag is set purely to collect telemetry.
Readonly
browserReturns true if the the page is https and the content is upgradable from http requires 'security.mixed_content.upgrade_display_content' pref to be true. Currently this only upgrades display content but might be expanded to other loads. This is very similar in implementation to upgradeInsecureRequests but browser set.
Readonly
browserReturns true if the the page is https and the content is upgradable from http requires 'security.mixed_content.upgrade_display_content' pref to be false. See browserUpgradeInsecureRequests for more details, this only happens when not upgrading purely for telemetry.
Readonly
browsingReadonly
browsingThe BrowsingContext performing the load for this nsILoadInfo object.
This is the URI used to create the most recent channel in the load's
redirect chain, if it's different from channel's originalURI
.
This is always null for loads not handled by DocumentLoadListener. If
non-null, channelCreationOriginalURI will be used instead of channel's
originalURI to re-create the channel in the final content process selected
to perform the load.
The cookie jar settings inherited from the top-level document's loadInfo. It cannot be null.
Readonly
cookieSee the SEC_COOKIES_* flags above. This attribute will never return SEC_COOKIES_DEFAULT, but will instead return what the policy resolves to. I.e. SEC_COOKIES_SAME_ORIGIN for CORS mode, and SEC_COOKIES_INCLUDE otherwise.
The object in charged to receive CSP violation events. It can be null. This attribute will be merged into the CSP object eventually. See bug 1500908.
A snapshot of the nonce at load start time which is used for CSP checks and only set for:
Readonly
disallowIf disallowScript is true, then use nsIScriptSecurityManager::DISALLOW_SCRIPT when calling CheckLoadURIWithPrincipal().
The top-level document has been user-interacted.
Readonly
dontReturns true if SEC_DONT_FOLLOW_REDIRECTS is set.
Readonly
externalThe external contentPolicyType of the channel, used for security checks like Mixed Content Blocking and Content Security Policy.
Specifically, content policy types with INTERNAL in their name will never get returned from this attribute.
If true, toplevel data: URI navigation is allowed
Readonly
forceIf forceInheritPrincipal is true, the data coming from the channel should inherit its principal, even when the data is loaded over http:// or another protocol that would normally use a URI-based principal.
See the documentation for principalToInherit, which describes exactly what principal is inherited.
This attribute will never be true when loadingSandboxed is true.
Readonly
forceThe SEC_FORCE_INHERIT_PRINCIPAL flag may be dropped when a load info object is created. Specifically, it will be dropped if the SANDBOXED_ORIGIN sandbox flag is also present. This flag is set if SEC_FORCE_INHERIT_PRINCIPAL was dropped.
Readonly
forceIf forceInheritPrincipalOverruleOwner is true, the data coming from the channel should inherit the principal, even when the data is loaded over http:// or another protocol that would normally use a URI-based principal and even if the channel's .owner is not null. This last is the difference between forceInheritPrincipalOverruleOwner and forceInheritPrincipal: the latter does not overrule the .owner setting.
See the documentation for principalToInherit, which describes exactly what principal is inherited.
Readonly
forceReturns value set through setCorsPreflightInfo.
Readonly
frameReadonly
frameOnly when the element being loaded is (or, more generally, if the element QIs to nsFrameLoaderOwner), the frameBrowsingContext is the browsing context containing the foo.html document.
Note: For other cases, frameBrowsingContextID is 0.
Whether nsICookieInjector has injected a cookie for this request to handle a cookie banner. This is only done for top-level requests.
Returns true if at the time of the loadinfo construction the document that triggered this load has the bit hasValidTransientUserGestureActivation set or the load was triggered from External. (Mostly this bool is used in the context of Sec-Fetch-User.)
Upgrade state of HTTPS-Only Mode. The flag HTTPS_ONLY_EXEMPT can get set on requests that should be excempt from an upgrade.
Whenever a channel is evaluated by the ContentSecurityManager the first time, we set this flag to true to indicate that subsequent calls of AsyncOpen() do not have to enforce all security checks again. E.g., after a redirect there is no need to set up CORS again. We need this separate flag because the redirectChain might also contain internal redirects which might pollute the redirectChain so we can't rely on the size of the redirectChain-array to query whether a channel got redirected or not.
Please note, once the flag is set to true it must remain true throughout the lifetime of the channel. Trying to set it to anything else than true will be discarded.
Readonly
innerThis is the inner window ID of the window in which the element being loaded lives.
Note that this window ID can be 0 if the window is not available.
Readonly
internalTrue if the load was initiated by a form request. This is important to know to handle the CSP directive navigate-to.
This attribute will be true if the fetch request is from object or embed elements
Readonly
isThis attribute will be true if this is a load triggered by https://html.spec.whatwg.org/multipage/iframe-embed-object.html#process-the-iframe-attributes or https://html.spec.whatwg.org/multipage/obsolete.html#process-the-frame-attributes
True if this request is from DevTools.
True if this request is embedded in a context that can't be third-party (i.e. an iframe embedded in a cross-origin parent window). If this is false, then this request may be third-party if it's a third-party to loadingPrincipal.
This attribute will be true if this is a load triggered by a media element and it's an initial request.
This attribute will be true if this is a load triggered by a media element.
True if the load was triggered by a meta refresh.
This attribute will be true if the top level document has COEP: credentialless enabled in Origin Trial.
Readonly
isA C++ friendly getter for the forcePreflight flag.
True if this request is a third party in respect to the top-level window.
Note that this doesn't consider the parent window. I.e. It will still return false even in the case that the parent is cross-origin but the top-level is same-origin.
This value would be set during opening the channel in parent and propagate to the channel in the content.
Readonly
isReturns true if this load is for top level document. Note that the load for a sub-frame's document will return false here.
True if this request is known to have been triggered by a user manually requesting the URI to be saved.
Readonly
loadReturns true if SEC_LOAD_ERROR_PAGE is set.
Returns true if the load was triggered from an external application (e.g. Thunderbird). Please note that this flag will only ever be true if the load is of TYPE_DOCUMENT.
Readonly
loadingFor all loads except loads of TYPE_DOCUMENT, the loadingContext simply returns the loadingNode. For loads of TYPE_DOCUMENT this will return the context available for top-level loads which do not have a loadingNode.
Readonly
loadingThis is the ownerDocument of the LoadingNode. Unless the LoadingNode is a Document, in which case the LoadingDocument is the same as the LoadingNode.
For top-level loads, and for loads originating from workers, the LoadingDocument is null. When the LoadingDocument is not null, the LoadingPrincipal is set to the principal of the LoadingDocument.
This attribute is the loading context's cross origin embedder policy. The value is initialized with corresponding WindowContext which get by innerWindowIID in the nsILoadInfo. It also could be set by workers when fetch is called under the workers' scope.
Readonly
loadingThis is the principal of the network request's caller/requester where the resulting resource will be used. I.e. it is the principal which will get access to the result of the request. (Where "get access to" might simply mean "embed" depending on the type of resource that is loaded).
For example for an image, it is the principal of the document where the image is rendered. For a stylesheet it is the principal of the document where the stylesheet will be applied.
So if document at http://a.com/page.html loads an image from http://b.com/pic.jpg, then loadingPrincipal will be http://a.com/page.html.
For
If the loadingPrincipal is the system principal, no security checks will be done at all. There will be no security checks on the initial load or any subsequent redirects. This means there will be no nsIContentPolicy checks or any CheckLoadURI checks. Because of this, never set the loadingPrincipal to the system principal when the URI to be loaded is controlled by a webpage. If the loadingPrincipal and triggeringPrincipal are both content principals, then we will always call into nsIContentPolicies and CheckLoadURI. The call to nsIContentPolicies and CheckLoadURI happen even if the URI to be loaded is same-origin with the loadingPrincipal or triggeringPrincipal.
Readonly
loadingIf 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.
Indicates that we need to check if we should apply the anti-tracking heuristic after the channel has been classified.
Customized OriginAttributes within LoadInfo to allow overwriting of the default originAttributes from the loadingPrincipal.
In chrome side, originAttributes.privateBrowsingId will always be 0 even if the usePrivateBrowsing is true, because chrome docshell won't set privateBrowsingId on origin attributes (See bug 1278664). This is to make sure nsILoadInfo and nsILoadContext have the same origin attributes.
If true, this is the load of a frame's original src attribute
Only ever returns true if the loadinfo is of TYPE_SCRIPT and the script was created by the HTML parser.
For non-document loads the principalToInherit is always null. For loads of type TYPE_DOCUMENT or TYPE_SUBDOCUMENT the principalToInherit might be null. If it's non null, then this is the principal that is inherited if a principal needs to be inherited. If the principalToInherit is null but the inherit flag is set, then the triggeringPrincipal is the principal that is inherited.
Readonly
redirectSame as RedirectChain but does not include internal redirects.
Readonly
redirectAn array of nsIRedirectHistoryEntry which stores redirects associated with this channel. This array is filled whether or not the channel has ever been opened. The last element of the array is associated with the most recent redirect. Please note, that this array includes internal redirects.
If the request associated with this load info was blocked by some of our content or load blockers, the reason can be found here. Note that setting this attribute has NO EFFECT on blocking the request. This attribute is only informative!
By default the value is '0' - NONE. Each write rewrites the last value. Can be accessed only on a single thread.
If this is non-null, this property represents two things: (1) the URI to be used for the principal if the channel with this loadinfo gets a principal based on URI and (2) the URI to use for a document created from the channel with this loadinfo.
Readonly
sandboxThe sandboxFlags of that channel.
Readonly
securityThe securityFlags of that channel.
Readonly
securityAllows to query only the security mode bits from above.
CSP uses this parameter to send or not CSP violation events. Default value: true.
Readonly
serviceTrue if the tainting has been set by the service worker.
Readonly
shouldThis attribute will be true if the URL is known to be possibly broken and CheckForBrokenChromeURL and RecordZeroLengthEvent should be skipped.
If true, the content policy security check is excluded from web requests.
This flag is used for any browsing context where we should not sniff the content type. E.g if an iframe has the XCTO nosniff header, then that flag is set to true so we skip content sniffing for that browsing context.
The result of the storage permission check of the loading document. This value would be set during opening the channel.
Readonly
taintingDetermine the associated channel's current tainting. Note, this can change due to a service worker intercept, so it should be checked after OnStartRequest() fires.
Readonly
targetReadonly
targetIf the element being loaded is a nsFrameLoaderOwner,
targetBrowsingContext
is the Browsing Context which will contain the
loading document (see frameBrowsingContext
). Otherwise, it is the
Browsing Context performing the load (see browsingContext
).
Readonly
topReturn the top-level principal, which is the principal of the top-level window.
Readonly
triggeringThis is the principal which caused the network load to start. I.e. this is the principal which provided the URL to be loaded. This is often the same as the LoadingPrincipal, but there are a few cases where that's not true.
For example for loads into an
The remote type of the process which caused the network load to start. I.e. this is the remote type of the process which provided the URL to be loaded.
For subresource loads, this should be the same as the process which will handle the response, however for document loads this may both be different than the final process, as well as different from the process which starts the navigation.
This field is intentionally not perfectly preserved over IPC, and will be reset to the remote type of the sending process when sent from a content process to the parent process.
The TriggingSandboxFlags are the SandboxFlags of the entity responsible for causing the load to occur.
If this is non-null, this property holds the URI as it was before query stripping was performed.
Readonly
upgradeReturns true if document or any of the documents ancestors up to the toplevel document make use of the CSP directive 'upgrade-insecure-requests'.
Warning: If the loadingDocument is null, then the upgradeInsecureRequests is false.
An array of BrowsingContext IDs which correspond to nsILoadInfo::AncestorPrincipals above. AncestorBrowsingContextIDs[0] is the BrowsingContext ID of the frame associated with the principal at ancestorPrincipals[0], and so forth.
Please note that this array has the same lifetime as the loadInfo object - use with caution!
This array is only filled out when we are in the parent process and we are creating a loadInfo object or deserializing LoadInfoArgs into LoadInfo, as we ever only need in the parent process.
The array is meant to be a list of principals of the documents that the browsing context, corresponding to this loadInfo object, is "nested through" in the sense of https://html.spec.whatwg.org/multipage/browsers.html#browsing-context-nested-through. Note that the array does not include the principal corresponding to the frame loading this request. The closest ancestor is at index zero and the top level ancestor is at the last index.
If this is a toplevel content browsing context (i.e. toplevel document in spec terms), the list is empty.
Otherwise the array is a list for the document we're nested through (again in the spec sense), with the principal of that document prepended. The ancestorPrincipals[0] entry for an iframe load will be the principal of the iframe element's owner document. The ancestorPrincipals[0] entry for an image loaded in an iframe will be the principal of the iframe element's owner document. This matches the ordering specified for Location.ancestorOrigins.
Please note that this array has the same lifetime as the loadInfo object - use with caution!
Returns the CSP (or Preload CSP for preloads) which should be enforced when fetching the resource this loadinfo belongs to.
a) Non-navigations: For non-navigation loads, GetCsp() returns what the spec refers to as the "request's client's global object's CSP list". In practice, if this is the loadinfo of a subresource load (e.g an image load), then GetCsp() or GetPreloadCSP() returns the CSP of the document which embeds the image. The returned CSP includes any policy delivered through the HTTP header or also through the meta tag (modulo the difference for preloads, e.g. image preloads have to query GetPreloadCsp() because at the time of preloading we are not entirely sure if the Meta CSP will be applied to the document in the end or not). Please note that GetCSPToInherit() called on a loadinfo for any non-navigation always returns null.
b) Navigations:
Top-level loads: For top-level loads (navigations) GetCsp() will return null, unless the navigation is started by a WebExtension, in which case it will return the CSP of the webextension, if any. If you need to query the CSP that potentially should apply to the new top-level load, you have to query GetCspToInherit(), which is the CSP of the request's client's global object, just like GetCsp() is for non-navigation requests.
Iframe-loads: For iframe-loads (navigations) GetCsp() will return the CSP of the parent document, unless the navigation is started by a WebExtension, in which case it will return the CSP of the webextension, if any.
If you need to query the CSP that should potentially be inherited into the new document, you have to query GetCSPToInherit().
TODO Bug 1557114: After evaluating what CSP to use for frame navigations we should update the above documentation to match the outcome of Bug 1557114.
Get the custom PerformanceStorage if set by SetPerformanceStorage. Otherwise the loadingDocument->Window Performance object will be returned instead if all the following conditions are met:
Give a pre-allocated ClientSource to the channel LoadInfo. This is intended to be used by docshell when loading windows without an initial about:blank document. The docshell will allocate the ClientSource to represent the client that will be created as a result of the navigation network request. If the channel succeeds and remains same-origin, then the result nsGlobalWindow will take ownership of the reserved ClientSource.
This method is also called when a cross-origin redirect occurs. A new ClientSource with a different UUID must be created in this case.
This method automatically calls SetReservedClientInfo() with the ClientSource::Info().
This will clear any existing reserved or initial client and override it with the given reserved client. This is similar to calling TakeReservedClientSource() and then GiveReservedClientSource() with a new client as ClientChannelHelper does. This method is needed, though, to perform this operation in the parent process where the LoadInfo does not have direct access to a ClientSource.
If in doubt, do not call this method. Its really only needed for a specific redirect case where the child has created a new client on redirect and we need to override the parent side's reserved client to match.
Optional
aInstancePtr: objectA run time mechanism for interface discovery.
NS_OK if the interface is supported by the associated instance, NS_NOINTERFACE if it is not.
aInstancePtr must not be null.
[in] A requested interface IID
[out] A pointer to an interface pointer to receive the result.
Note which client (i.e. global) initiated this network request. All nsGlobalWindow and WorkerPrivate can be converted to a ClientInfo to be set here. While this is being added to support service worker FetchEvent, it can also be used to communicate other information about the source global context in the future.
Note that this network request should be controlled by a service worker. For non-subresource requests this may be set during the load when the first service worker interception occurs. For subresource requests it may be set by the source client if its already controlled by a service worker.
Note that this non-subresource network request will result in re-using an existing "initial" active client. This mainly only happens when an initial about:blank document is replaced with a real load in a window. In these cases we need to track this initial client so that we may report its existence in a FetchEvent.
Note, an nsILoadInfo may only have a reserved client or an initial client. It should never have both.
Set a custom performance storage. This is meant to be executed only for workers. If a PerformanceStorage is not set, the loadingDocument->Window Performance object will be returned instead.
Note the reserved client that be created if this non-subresource network request succeeds. Depending on the type of client this may be called directly or indirectly via GiveReservedClientSource(). For example, web workers do not call give their ClientSource to the nsILoadInfo, but must still call this method to indicate the reserved client for their main script load.
The service worker and fetch specifications require returning the exact tainting level of the Response passed to FetchEvent.respondWith(). This method allows us to override the tainting level in that case.
NOTE: This should not be used outside of service worker code! Use nsILoadInfo::MaybeIncreaseTainting() instead.
Whenever a channel gets redirected, append the redirect history entry of the channel which contains principal referrer and remote address [before the channels got redirected] to the loadinfo, so that at every point this array provides us information about all the redirects this channel went through.
the channel being redirected
A C++ friendly version of the loadingContext for toplevel loads. Most likely you want to query the ownerDocument or LoadingNode and not this context only available for TYPE_DOCUMENT loads. Please note that except for loads of TYPE_DOCUMENT, this ContextForTopLevelLoad will always return null.
The internal contentPolicyType of the channel, used for constructing RequestContext values when creating a fetch event for an intercepted channel.
This should not be used for the purposes of security checks, since the content policy implementations cannot be expected to deal with INTERNAL values. Please use the contentPolicyType attribute above for that purpose.
A C++-friendly version of loadingDocument (loadingNode). This is the Node where the resulting resource will be used. I.e. it is the Node which will get access to the result of the request. (Where "get access to" might simply mean "embed" depending on the type of resource that is loaded).
For example for an /
For loads triggered by the HTML pre-parser, the LoadingNode is the Document which is currently being parsed.
For top-level loads, and for loads originating from workers, the LoadingNode is null. If the LoadingNode is non-null, then the LoadingPrincipal is the principal of the LoadingNode.
Note a new tainting level and possibly increase the current tainting to match. If the tainting level is already greater than the given value, then there is no effect. It is not possible to reduce the tainting level on an existing channel/loadinfo.
Sets the list of unsafe headers according to CORS spec, as well as potentially forces a preflight. Note that you do not need to set the Content-Type header. That will be automatically detected as needed.
Only call this function when using the SEC_REQUIRE_CORS_INHERITS_SEC_CONTEXT mode.
Generated using TypeDoc
The LoadInfo object contains information about a network load, why it was started, and how we plan on using the resulting response. If a network request is redirected, the new channel will receive a new LoadInfo object. The new object will contain mostly the same information as the pre-redirect one, but updated as appropriate. For detailed information about what parts of LoadInfo are updated on redirect, see documentation on individual properties.