2014-07-10 10:56:36 +04: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
|
|
|
|
* 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"
|
2014-07-17 00:16:12 +04:00
|
|
|
#include "nsIContentPolicy.idl"
|
2019-08-05 22:28:00 +03:00
|
|
|
#include "nsIScriptSecurityManager.idl"
|
2022-10-01 01:39:23 +03:00
|
|
|
#include "nsIInterceptionInfo.idl"
|
2014-07-10 10:56:36 +04:00
|
|
|
|
2017-11-03 05:56:27 +03:00
|
|
|
interface nsIChannel;
|
2019-05-22 02:14:27 +03:00
|
|
|
interface nsIContentSecurityPolicy;
|
2020-03-04 11:59:08 +03:00
|
|
|
interface nsICookieJarSettings;
|
2018-10-23 09:17:13 +03:00
|
|
|
interface nsICSPEventListener;
|
2014-07-17 00:16:12 +04:00
|
|
|
interface nsINode;
|
2014-07-10 10:56:36 +04:00
|
|
|
interface nsIPrincipal;
|
2017-05-25 20:42:00 +03:00
|
|
|
interface nsIRedirectHistoryEntry;
|
2017-05-30 19:07:59 +03:00
|
|
|
interface nsIURI;
|
2018-05-11 20:46:15 +03:00
|
|
|
webidl Document;
|
2019-01-24 00:06:59 +03:00
|
|
|
webidl BrowsingContext;
|
2018-03-29 13:16:23 +03:00
|
|
|
native LoadContextRef(already_AddRefed<nsISupports>);
|
2015-07-20 05:11:03 +03:00
|
|
|
%{C++
|
|
|
|
#include "nsTArray.h"
|
2015-10-22 21:07:32 +03:00
|
|
|
#include "mozilla/LoadTainting.h"
|
2020-11-23 19:12:02 +03:00
|
|
|
#include "mozilla/OriginAttributes.h"
|
2017-11-16 21:15:09 +03:00
|
|
|
#include "mozilla/UniquePtr.h"
|
2023-10-18 01:02:27 +03:00
|
|
|
#include "nsRFPService.h"
|
2017-08-17 02:48:52 +03:00
|
|
|
#include "nsStringFwd.h"
|
2017-11-16 21:15:09 +03:00
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
|
|
|
class ClientInfo;
|
|
|
|
class ClientSource;
|
2024-06-20 16:22:41 +03:00
|
|
|
struct FeaturePolicyInfo;
|
2018-01-24 19:17:31 +03:00
|
|
|
class PerformanceStorage;
|
2017-11-16 21:15:09 +03:00
|
|
|
class ServiceWorkerDescriptor;
|
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|
2015-07-20 05:11:03 +03:00
|
|
|
%}
|
|
|
|
|
2017-05-25 20:42:00 +03:00
|
|
|
[ref] native nsIRedirectHistoryEntryArray(const nsTArray<nsCOMPtr<nsIRedirectHistoryEntry>>);
|
2017-01-12 19:38:48 +03:00
|
|
|
native OriginAttributes(mozilla::OriginAttributes);
|
|
|
|
[ref] native const_OriginAttributesRef(const mozilla::OriginAttributes);
|
2018-07-10 11:09:59 +03:00
|
|
|
[ref] native CStringArrayRef(const nsTArray<nsCString>);
|
|
|
|
[ref] native StringArrayRef(const nsTArray<nsString>);
|
2017-10-10 19:54:00 +03:00
|
|
|
[ref] native Uint64ArrayRef(const nsTArray<uint64_t>);
|
|
|
|
[ref] native PrincipalArrayRef(const nsTArray<nsCOMPtr<nsIPrincipal>>);
|
2017-11-16 21:15:09 +03:00
|
|
|
[ref] native const_ClientInfoRef(const mozilla::dom::ClientInfo);
|
|
|
|
native UniqueClientSource(mozilla::UniquePtr<mozilla::dom::ClientSource>);
|
|
|
|
native UniqueClientSourceMove(mozilla::UniquePtr<mozilla::dom::ClientSource>&&);
|
|
|
|
[ref] native const_MaybeClientInfoRef(const mozilla::Maybe<mozilla::dom::ClientInfo>);
|
|
|
|
[ref] native const_ServiceWorkerDescriptorRef(const mozilla::dom::ServiceWorkerDescriptor);
|
|
|
|
[ref] native const_MaybeServiceWorkerDescriptorRef(const mozilla::Maybe<mozilla::dom::ServiceWorkerDescriptor>);
|
2023-10-18 01:02:27 +03:00
|
|
|
[ref] native const_MaybeRFPTarget(const mozilla::Maybe<mozilla::RFPTarget>);
|
|
|
|
native RFPTarget(mozilla::RFPTarget);
|
2018-01-24 19:17:31 +03:00
|
|
|
[ptr] native PerformanceStoragePtr(mozilla::dom::PerformanceStorage);
|
2018-06-11 04:44:38 +03:00
|
|
|
native LoadTainting(mozilla::LoadTainting);
|
2019-05-22 02:14:27 +03:00
|
|
|
native CSPRef(already_AddRefed<nsIContentSecurityPolicy>);
|
2024-06-20 16:22:41 +03:00
|
|
|
native MaybeFeaturePolicyInfo(mozilla::Maybe<mozilla::dom::FeaturePolicyInfo>);
|
|
|
|
[ref] native const_FeaturePolicyInfoRef(const mozilla::dom::FeaturePolicyInfo);
|
2015-07-20 05:11:03 +03:00
|
|
|
|
2014-07-17 00:16:12 +04:00
|
|
|
typedef unsigned long nsSecurityFlags;
|
|
|
|
|
2014-07-10 10:56:36 +04:00
|
|
|
/**
|
2016-09-20 09:34:40 +03:00
|
|
|
* 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.
|
2014-07-10 10:56:36 +04:00
|
|
|
*/
|
2016-01-14 23:38:15 +03:00
|
|
|
[scriptable, builtinclass, uuid(ddc65bf9-2f60-41ab-b22a-4f1ae9efcd36)]
|
2014-07-10 10:56:36 +04:00
|
|
|
interface nsILoadInfo : nsISupports
|
|
|
|
{
|
2015-07-20 05:11:57 +03:00
|
|
|
/**
|
|
|
|
* The following five flags determine the security mode and hence what kind of
|
|
|
|
* security checks should be performed throughout the lifetime of the channel.
|
|
|
|
*
|
2020-07-15 14:20:45 +03:00
|
|
|
* * SEC_REQUIRE_SAME_ORIGIN_INHERITS_SEC_CONTEXT
|
2015-07-20 05:11:57 +03:00
|
|
|
* * SEC_REQUIRE_SAME_ORIGIN_DATA_IS_BLOCKED
|
2020-07-15 14:20:45 +03:00
|
|
|
* * SEC_ALLOW_CROSS_ORIGIN_INHERITS_SEC_CONTEXT
|
|
|
|
* * SEC_ALLOW_CROSS_ORIGIN_SEC_CONTEXT_IS_NULL
|
|
|
|
* * SEC_REQUIRE_CORS_INHERITS_SEC_CONTEXT
|
2015-07-20 05:11:57 +03:00
|
|
|
*
|
|
|
|
* Exactly one of these flags are required to be set in order to allow
|
|
|
|
* the channel to perform the correct security checks (SOP, CORS, ...) and
|
|
|
|
* return the correct result principal. If none or more than one of these
|
2019-02-12 19:08:25 +03:00
|
|
|
* flags are set AsyncOpen will fail.
|
2015-07-20 05:11:57 +03:00
|
|
|
*/
|
|
|
|
|
2018-03-29 13:16:23 +03:00
|
|
|
/**
|
|
|
|
* Warning: Never use this flag when creating a new channel!
|
|
|
|
* Only use this flag if you have to create a temporary LoadInfo
|
|
|
|
* for performing an explicit nsIContentPolicy check, like e.g.
|
|
|
|
* when loading something from the cache that needs an explicit
|
|
|
|
* nsIContentPolicy check. In all other cases pick one of the
|
|
|
|
* security flags underneath.
|
|
|
|
*/
|
|
|
|
const unsigned long SEC_ONLY_FOR_EXPLICIT_CONTENTSEC_CHECK = 0;
|
|
|
|
|
2015-07-20 05:11:57 +03:00
|
|
|
/*
|
2020-07-15 14:20:45 +03:00
|
|
|
* Enforce the same origin policy where loads inherit the principal.
|
2017-01-10 22:46:30 +03:00
|
|
|
* See the documentation for principalToInherit, which describes exactly what
|
|
|
|
* principal is inherited.
|
2015-07-20 05:11:57 +03:00
|
|
|
*/
|
2020-07-15 14:20:45 +03:00
|
|
|
const unsigned long SEC_REQUIRE_SAME_ORIGIN_INHERITS_SEC_CONTEXT = (1<<0);
|
2015-07-20 05:11:57 +03:00
|
|
|
|
|
|
|
/*
|
2020-07-15 14:20:45 +03:00
|
|
|
* Enforce the same origin policy and data: loads are blocked.
|
2015-07-20 05:11:57 +03:00
|
|
|
*/
|
|
|
|
const unsigned long SEC_REQUIRE_SAME_ORIGIN_DATA_IS_BLOCKED = (1<<1);
|
|
|
|
|
|
|
|
/**
|
2020-07-15 14:20:45 +03:00
|
|
|
* Allow loads from other origins. Loads which inherit the principal should
|
|
|
|
* see the documentation for principalToInherit, which describes exactly what
|
|
|
|
* principal is inherited.
|
2017-01-10 22:46:30 +03:00
|
|
|
*
|
2015-07-20 05:11:57 +03:00
|
|
|
* Commonly used by plain <img>, <video>, <link rel=stylesheet> etc.
|
|
|
|
*/
|
2020-07-15 14:20:45 +03:00
|
|
|
const unsigned long SEC_ALLOW_CROSS_ORIGIN_INHERITS_SEC_CONTEXT = (1 << 2);
|
2015-07-20 05:11:57 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Allow loads from other origins. Loads from data: will be allowed,
|
|
|
|
* but the resulting resource will get a null principal.
|
|
|
|
* Used in blink/webkit for <iframe>s. Likely also the mode
|
|
|
|
* that should be used by most Chrome code.
|
|
|
|
*/
|
2020-07-15 14:20:45 +03:00
|
|
|
const unsigned long SEC_ALLOW_CROSS_ORIGIN_SEC_CONTEXT_IS_NULL = (1<<3);
|
2015-07-20 05:11:57 +03:00
|
|
|
|
|
|
|
/**
|
2017-01-10 22:46:30 +03:00
|
|
|
* Allow loads from any origin, but require CORS for cross-origin loads.
|
|
|
|
* See the documentation for principalToInherit, which describes exactly what
|
|
|
|
* principal is inherited.
|
|
|
|
*
|
2015-07-20 05:11:57 +03:00
|
|
|
* Commonly used by <img crossorigin>, <video crossorigin>,
|
|
|
|
* XHR, fetch(), etc.
|
|
|
|
*/
|
2020-07-15 14:20:45 +03:00
|
|
|
const unsigned long SEC_REQUIRE_CORS_INHERITS_SEC_CONTEXT = (1<<4);
|
2015-07-20 05:11:57 +03:00
|
|
|
|
|
|
|
/**
|
2015-12-07 02:33:15 +03:00
|
|
|
* Choose cookie policy. The default policy is equivalent to "INCLUDE" for
|
|
|
|
* SEC_REQUIRE_SAME_ORIGIN_* and SEC_ALLOW_CROSS_ORIGIN_* modes, and
|
2020-07-15 14:20:45 +03:00
|
|
|
* equivalent to "SAME_ORIGIN" for SEC_REQUIRE_CORS_INHERITS_SEC_CONTEXT mode.
|
2015-12-07 02:33:15 +03:00
|
|
|
*
|
|
|
|
* This means that if you want to perform a CORS load with credentials, pass
|
|
|
|
* SEC_COOKIES_INCLUDE.
|
|
|
|
*
|
|
|
|
* Note that these flags are still subject to the user's cookie policies.
|
|
|
|
* For example, if the user is blocking 3rd party cookies, those cookies
|
|
|
|
* will be blocked no matter which of these flags are set.
|
2015-07-20 05:11:57 +03:00
|
|
|
*/
|
2015-12-07 02:33:15 +03:00
|
|
|
const unsigned long SEC_COOKIES_DEFAULT = (0 << 5);
|
|
|
|
const unsigned long SEC_COOKIES_INCLUDE = (1 << 5);
|
|
|
|
const unsigned long SEC_COOKIES_SAME_ORIGIN = (2 << 5);
|
|
|
|
const unsigned long SEC_COOKIES_OMIT = (3 << 5);
|
2015-07-20 05:11:57 +03:00
|
|
|
|
2014-07-17 00:16:12 +04:00
|
|
|
/**
|
2017-01-10 22:46:30 +03:00
|
|
|
* Force inheriting of the principal. See the documentation for
|
|
|
|
* principalToInherit, which describes exactly what principal is inherited.
|
|
|
|
*
|
|
|
|
* Setting this flag will cause GetChannelResultPrincipal to return the
|
|
|
|
* principal to be inherited as the channel principal.
|
2014-07-17 00:16:12 +04:00
|
|
|
*
|
|
|
|
* This will happen independently of the scheme of the URI that the
|
|
|
|
* channel is loading.
|
|
|
|
*
|
2017-01-10 22:46:30 +03:00
|
|
|
* So if the principal that gets inherited is "http://a.com/", and the channel
|
2014-07-17 00:16:12 +04:00
|
|
|
* is loading the URI "http://b.com/whatever", GetChannelResultPrincipal
|
|
|
|
* will return a principal from "http://a.com/".
|
|
|
|
*
|
2020-01-15 11:02:57 +03:00
|
|
|
* This flag can not be used together with SANDBOXED_ORIGIN sandbox flag. If
|
|
|
|
* both are passed to the LoadInfo constructor then this flag will be dropped.
|
|
|
|
* If you need to know whether this flag would have been present but was dropped
|
|
|
|
* due to sandboxing, check for the forceInheritPrincipalDropped flag.
|
2014-07-17 00:16:12 +04:00
|
|
|
*/
|
2015-12-07 02:33:15 +03:00
|
|
|
const unsigned long SEC_FORCE_INHERIT_PRINCIPAL = (1<<7);
|
2014-07-17 00:16:12 +04:00
|
|
|
|
2015-07-20 05:11:57 +03:00
|
|
|
/**
|
|
|
|
* Inherit the Principal for about:blank.
|
|
|
|
*/
|
2015-12-07 02:33:15 +03:00
|
|
|
const unsigned long SEC_ABOUT_BLANK_INHERITS = (1<<9);
|
2014-07-17 00:16:12 +04:00
|
|
|
|
2015-09-15 04:59:35 +03:00
|
|
|
/**
|
2015-11-20 21:55:54 +03:00
|
|
|
* Allow access to chrome: packages that are content accessible.
|
2015-09-15 04:59:35 +03:00
|
|
|
*/
|
2015-12-07 02:33:15 +03:00
|
|
|
const unsigned long SEC_ALLOW_CHROME = (1<<10);
|
2015-09-15 04:59:35 +03:00
|
|
|
|
2016-05-24 00:57:31 +03:00
|
|
|
/**
|
|
|
|
* Disallow access to javascript: uris.
|
|
|
|
*/
|
|
|
|
const unsigned long SEC_DISALLOW_SCRIPT = (1<<11);
|
|
|
|
|
2015-11-24 05:47:10 +03:00
|
|
|
/**
|
|
|
|
* Don't follow redirects. Instead the redirect response is returned
|
|
|
|
* as a successful response for the channel.
|
|
|
|
*
|
|
|
|
* Redirects not initiated by a server response, i.e. REDIRECT_INTERNAL and
|
|
|
|
* REDIRECT_STS_UPGRADE, are still followed.
|
|
|
|
*
|
|
|
|
* Note: If this flag is set and the channel response is a redirect, then
|
|
|
|
* the response body might not be available.
|
|
|
|
* This can happen if the redirect was cached.
|
|
|
|
*/
|
2016-05-24 00:57:31 +03:00
|
|
|
const unsigned long SEC_DONT_FOLLOW_REDIRECTS = (1<<12);
|
2015-11-24 05:47:10 +03:00
|
|
|
|
2016-08-16 04:47:14 +03:00
|
|
|
/**
|
|
|
|
* Load an error page, it should be one of following : about:neterror,
|
2018-05-08 17:31:37 +03:00
|
|
|
* about:certerror, about:blocked, about:tabcrashed or about:restartrequired.
|
2016-08-16 04:47:14 +03:00
|
|
|
*/
|
2016-08-31 00:54:58 +03:00
|
|
|
const unsigned long SEC_LOAD_ERROR_PAGE = (1<<13);
|
2016-08-16 04:47:14 +03:00
|
|
|
|
2016-10-05 22:19:51 +03:00
|
|
|
/**
|
2017-01-10 22:46:30 +03:00
|
|
|
* Force inheriting of the principal, overruling any owner that might be set
|
|
|
|
* on the channel. (Please note that channel.owner is deprecated and will be
|
|
|
|
* removed within Bug 1286838). See the documentation for principalToInherit,
|
|
|
|
* which describes exactly what principal is inherited.
|
|
|
|
*
|
2016-10-05 22:19:51 +03:00
|
|
|
* Setting this flag will cause GetChannelResultPrincipal to return the
|
2017-01-10 22:46:30 +03:00
|
|
|
* principal to be inherited as the channel principal.
|
2016-10-05 22:19:51 +03:00
|
|
|
*
|
|
|
|
* This will happen independently of the scheme of the URI that the
|
|
|
|
* channel is loading.
|
|
|
|
*/
|
|
|
|
const unsigned long SEC_FORCE_INHERIT_PRINCIPAL_OVERRULE_OWNER = (1<<14);
|
|
|
|
|
2014-07-17 00:16:12 +04:00
|
|
|
/**
|
2016-09-20 09:34:40 +03:00
|
|
|
* This 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).
|
2014-07-17 00:16:12 +04:00
|
|
|
*
|
2016-09-20 09:34:40 +03:00
|
|
|
* 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 <iframe> and <frame> loads, the LoadingPrincipal is the
|
|
|
|
* principal of the parent document. For top-level loads, the
|
|
|
|
* LoadingPrincipal is null. For all loads except top-level loads
|
|
|
|
* the LoadingPrincipal is never null.
|
2016-10-04 11:07:08 +03:00
|
|
|
*
|
|
|
|
* 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
|
2019-07-08 19:37:45 +03:00
|
|
|
* content principals, then we will always call into
|
2016-10-04 11:07:08 +03:00
|
|
|
* 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.
|
2014-07-10 10:56:36 +04:00
|
|
|
*/
|
|
|
|
readonly attribute nsIPrincipal loadingPrincipal;
|
|
|
|
|
|
|
|
/**
|
2020-04-06 21:57:36 +03:00
|
|
|
* A C++-friendly version of triggeringPrincipal.
|
|
|
|
*
|
|
|
|
* This is a bit awkward because we can't use
|
|
|
|
* binaryname(GetLoadingPrincipal).
|
2014-07-10 10:56:36 +04:00
|
|
|
*/
|
2020-04-06 21:57:36 +03:00
|
|
|
[noscript, notxpcom, nostdcall]
|
|
|
|
nsIPrincipal virtualGetLoadingPrincipal();
|
|
|
|
|
|
|
|
%{C++
|
|
|
|
nsIPrincipal* GetLoadingPrincipal() {
|
|
|
|
return VirtualGetLoadingPrincipal();
|
|
|
|
}
|
|
|
|
%}
|
2014-07-10 10:56:36 +04:00
|
|
|
|
2014-11-14 19:55:59 +03:00
|
|
|
/**
|
2016-09-20 09:34:40 +03:00
|
|
|
* This 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 <iframe>, the LoadingPrincipal is always
|
2016-10-04 11:07:08 +03:00
|
|
|
* the principal of the parent document. However the triggeringPrincipal
|
2016-09-20 09:34:40 +03:00
|
|
|
* is the principal of the document which provided the URL that the
|
|
|
|
* <iframe> is navigating to. This could be the previous document inside
|
|
|
|
* the <iframe> which set document.location. Or a document elsewhere in
|
|
|
|
* the frame tree which contained a <a target="..."> which targetted the
|
|
|
|
* <iframe>.
|
2014-11-14 19:55:59 +03:00
|
|
|
*
|
2016-09-20 09:34:40 +03:00
|
|
|
* If a stylesheet links to a sub-resource, like an @imported stylesheet,
|
2016-10-04 11:07:08 +03:00
|
|
|
* or a background image, then the triggeringPrincipal is the principal
|
2016-09-20 09:34:40 +03:00
|
|
|
* of the stylesheet, while the LoadingPrincipal is the principal of the
|
|
|
|
* document being styled.
|
|
|
|
*
|
2016-10-04 11:07:08 +03:00
|
|
|
* The triggeringPrincipal is never null.
|
|
|
|
*
|
|
|
|
* If the triggeringPrincipal 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 triggeringPrincipal to the system principal when
|
|
|
|
* the URI to be loaded is controlled by a webpage.
|
|
|
|
* If the loadingPrincipal and triggeringPrincipal are both
|
2019-07-08 19:37:45 +03:00
|
|
|
* content principals, then we will always call into
|
2016-10-04 11:07:08 +03:00
|
|
|
* 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.
|
2014-11-14 19:55:59 +03:00
|
|
|
*/
|
|
|
|
readonly attribute nsIPrincipal triggeringPrincipal;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* A C++-friendly version of triggeringPrincipal.
|
|
|
|
*/
|
|
|
|
[noscript, notxpcom, nostdcall, binaryname(TriggeringPrincipal)]
|
|
|
|
nsIPrincipal binaryTriggeringPrincipal();
|
2014-07-17 00:16:12 +04:00
|
|
|
|
Bug 1538028 - Part 2: Track TriggeringRemoteType through nsDocShellLoadState and LoadInfo, r=smaug,ckerschb,necko-reviewers,valentin
This is done using slightly different mechanisms for each of LoadInfo and
nsDocShellLoadState, and will be used in the next part to validate document
loads based on the RemoteType responsible for the load.
For subresource loads, the TriggeringRemoteType is fairly straightforward - it
is the process which created the channel. We can handle this by getting the
current remote type when creating the channel, and then using the remote type
of the sending process when receiving the LoadInfo over IPC to either replace
the triggering remote type, or validate it.
For document loads, the situation is a bit more complex, as there are at least
3 (potentially-)different processes responsible for different parts of the
navigation:
1. The "Triggering Process" is the process which provided the URI to load.
This is also the process which provides the Triggering Principal. This is
the process being tracked in this patch.
2. The "Loading Process" is the process which actually creates the channel and
starts the load. This may be the same as the triggering process, or may be
a different process starting the navigation on behalf of the triggering
process. In general this is the process hosting the current docshell,
though it may be the parent process in the case of parent-initiated loads.
3. The "Final Process" is the process which receives the response and renders
the final document. This isn't known at channel creation time, and is
determined by the result principal and process isolation policy.
This change uses a serializer and special field on nsDocShellLoadState to track
the "Triggering Process" for the load, even as the load state is serialized
between processes by tracking which loads were sent into which content
processes, and matching them up when the parent process sees them again. The
information is then copied into the LoadInfo before configuring the real
channel, so it can be used for security checks.
The "Triggering Process" is overridden to be the parent process for history
loads, as history loads are often started in processes which wouldn't normally
be able to navigate to those pages. This is OK thanks to the changes in part 1
which validate history loads against the real session history when SHIP is
enabled.
Differential Revision: https://phabricator.services.mozilla.com/D161198
2022-11-29 23:41:45 +03:00
|
|
|
/**
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
attribute AUTF8String triggeringRemoteType;
|
|
|
|
|
2016-09-20 09:35:45 +03:00
|
|
|
/**
|
2016-11-08 09:23:12 +03:00
|
|
|
* 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.
|
2016-09-20 09:35:45 +03:00
|
|
|
*/
|
|
|
|
attribute nsIPrincipal principalToInherit;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* A C++-friendly version of principalToInherit.
|
|
|
|
*/
|
|
|
|
[noscript, notxpcom, nostdcall, binaryname(PrincipalToInherit)]
|
|
|
|
nsIPrincipal binaryPrincipalToInherit();
|
|
|
|
|
2017-11-03 05:56:27 +03:00
|
|
|
/**
|
|
|
|
* Finds the correct principal to inherit for the given channel, based on
|
|
|
|
* the values of PrincipalToInherit and TriggeringPrincipal.
|
|
|
|
*/
|
|
|
|
[noscript, notxpcom, nostdcall]
|
|
|
|
nsIPrincipal FindPrincipalToInherit(in nsIChannel aChannel);
|
|
|
|
|
2014-07-17 00:16:12 +04:00
|
|
|
/**
|
2016-09-20 09:34:40 +03:00
|
|
|
* This is the ownerDocument of the LoadingNode. Unless the LoadingNode
|
|
|
|
* is a Document, in which case the LoadingDocument is the same as the
|
|
|
|
* LoadingNode.
|
2014-07-17 00:16:12 +04:00
|
|
|
*
|
2016-09-20 09:34:40 +03:00
|
|
|
* 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.
|
2014-07-17 00:16:12 +04:00
|
|
|
*/
|
2018-05-11 20:46:15 +03:00
|
|
|
readonly attribute Document loadingDocument;
|
2014-07-17 00:16:12 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* A C++-friendly version of loadingDocument (loadingNode).
|
2016-09-20 09:34:40 +03:00
|
|
|
* 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 <img>/<video> it is the image/video element. For
|
|
|
|
* document loads inside <iframe> and <frame>s, the LoadingNode is the
|
|
|
|
* <iframe>/<frame> element. For an XMLHttpRequest, it is the Document
|
|
|
|
* which contained the JS which initiated the XHR. For a stylesheet, it
|
|
|
|
* is the Document that contains <link rel=stylesheet>.
|
|
|
|
*
|
|
|
|
* 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.
|
2014-07-17 00:16:12 +04:00
|
|
|
*/
|
|
|
|
[noscript, notxpcom, nostdcall, binaryname(LoadingNode)]
|
|
|
|
nsINode binaryLoadingNode();
|
|
|
|
|
2017-09-05 19:01:07 +03:00
|
|
|
/**
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
[noscript, notxpcom, nostdcall, binaryname(ContextForTopLevelLoad)]
|
2018-05-30 22:21:18 +03:00
|
|
|
LoadContextRef binaryContextForTopLevelLoad();
|
2017-09-05 19:01:07 +03:00
|
|
|
|
2018-03-29 13:16:23 +03:00
|
|
|
/**
|
|
|
|
* For 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.
|
|
|
|
*/
|
|
|
|
[binaryname(LoadingContextXPCOM)]
|
|
|
|
readonly attribute nsISupports loadingContext;
|
2019-04-26 13:59:41 +03:00
|
|
|
|
2018-03-29 13:16:23 +03:00
|
|
|
/**
|
|
|
|
* A C++ friendly version of the loadingContext.
|
|
|
|
*/
|
|
|
|
[noscript, notxpcom, nostdcall, binaryname(GetLoadingContext)]
|
|
|
|
LoadContextRef binaryGetLoadingContext();
|
|
|
|
|
2014-07-17 00:16:12 +04:00
|
|
|
/**
|
|
|
|
* The securityFlags of that channel.
|
|
|
|
*/
|
|
|
|
readonly attribute nsSecurityFlags securityFlags;
|
|
|
|
|
2019-08-05 22:28:00 +03:00
|
|
|
%{C++
|
2014-07-17 00:16:12 +04:00
|
|
|
inline nsSecurityFlags GetSecurityFlags()
|
|
|
|
{
|
|
|
|
nsSecurityFlags result;
|
|
|
|
mozilla::DebugOnly<nsresult> rv = GetSecurityFlags(&result);
|
|
|
|
MOZ_ASSERT(NS_SUCCEEDED(rv));
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
%}
|
|
|
|
|
2020-01-15 11:02:57 +03:00
|
|
|
/**
|
|
|
|
* The sandboxFlags of that channel.
|
|
|
|
*/
|
|
|
|
[infallible] readonly attribute unsigned long sandboxFlags;
|
|
|
|
|
2020-07-29 14:43:23 +03:00
|
|
|
/**
|
|
|
|
* The TriggingSandboxFlags are the SandboxFlags of the entity
|
|
|
|
* responsible for causing the load to occur.
|
|
|
|
*/
|
|
|
|
[infallible] attribute unsigned long triggeringSandboxFlags;
|
|
|
|
|
Bug 1835907, part 1 - Add has storage access bit and triggering window id to the LoadInfo - r=smaug,necko-reviewers,kershaw,pbz
In the Storage Access API's latest draft, a few items were added to the user-agent state. Relevant here,
the source snapshot params gained two fields that are initialized from the sourceDocument during
snapshotting source params while navigating: "has storage access" and "environment id".
https://privacycg.github.io/storage-access/#ua-state
These are used to identify self-initiated navigations that come from documents that have obtained storage access.
Combined with a same-origin check, this determines if the destination document of the navigation should start
with storage access.
This is stricter than the current behavior, where if the permission is available, all documents start with storage access.
Instead, now a document will only have storage access if it requests it explicitly or if a same-origin document that has
storage access navigates itself to that document. This is seen as a security win.
Security discussion of this change was here: https://github.com/privacycg/storage-access/issues/113
Artur at Google wrote up a great summary here: https://docs.google.com/document/d/1AsrETl-7XvnZNbG81Zy9BcZfKbqACQYBSrjM3VsIpjY/edit#
Differential Revision: https://phabricator.services.mozilla.com/D184821
2023-08-15 16:04:04 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* The window id and storage access status of the window of the
|
|
|
|
* context that triggered the load. This is used to allow self-initiated
|
|
|
|
* same-origin navigations to propogate their "has storage access" bit
|
|
|
|
* to the next Document.
|
|
|
|
*/
|
|
|
|
[infallible] attribute unsigned long long triggeringWindowId;
|
|
|
|
[infallible] attribute boolean triggeringStorageAccess;
|
|
|
|
|
2015-07-20 05:11:57 +03:00
|
|
|
/**
|
|
|
|
* Allows to query only the security mode bits from above.
|
|
|
|
*/
|
|
|
|
[infallible] readonly attribute unsigned long securityMode;
|
|
|
|
|
2019-07-31 19:59:53 +03:00
|
|
|
/**
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
[infallible] attribute boolean skipContentSniffing;
|
2019-09-27 10:50:17 +03:00
|
|
|
|
2020-03-17 22:24:31 +03:00
|
|
|
/**
|
2020-03-27 20:09:15 +03:00
|
|
|
* (default) If this flag is set, it has not yet been determined if the
|
|
|
|
* HTTPS-Only mode will upgrade the request.
|
2020-03-17 22:24:31 +03:00
|
|
|
*/
|
2020-03-27 20:09:15 +03:00
|
|
|
const unsigned long HTTPS_ONLY_UNINITIALIZED = (1 << 0);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Indicates that this is the first time the request gets upgraded, and thus
|
|
|
|
* the HTTPS-Only StreamListener hasn't been registered yet. Even though there
|
|
|
|
* might be multiple channels per request that have to be upgraded (e.g.,
|
|
|
|
* because of redirects), the StreamListener only has to be attached to one
|
|
|
|
* channel.
|
|
|
|
*/
|
2023-12-21 15:46:52 +03:00
|
|
|
const unsigned long HTTPS_ONLY_UPGRADED_LISTENER_NOT_REGISTERED = (1 << 1);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Indicates that the request will get upgraded, and the HTTPS-Only
|
|
|
|
* StreamListener got registered.
|
|
|
|
*/
|
2020-03-27 20:09:15 +03:00
|
|
|
const unsigned long HTTPS_ONLY_UPGRADED_LISTENER_REGISTERED = (1 << 2);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This flag can be manually set if the HTTPS-Only mode should exempt the
|
|
|
|
* request and not upgrade it. (e.g in the case of OCSP.
|
|
|
|
*/
|
|
|
|
const unsigned long HTTPS_ONLY_EXEMPT = (1 << 3);
|
|
|
|
|
2020-08-12 15:57:22 +03:00
|
|
|
/**
|
|
|
|
* This flag can only ever be set on top-level loads. It indicates
|
|
|
|
* that the top-level https connection succeeded. This flag is mostly
|
|
|
|
* used to counter time-outs which allows to cancel the channel
|
|
|
|
* if the https load has not started.
|
|
|
|
*/
|
|
|
|
const unsigned long HTTPS_ONLY_TOP_LEVEL_LOAD_IN_PROGRESS = (1 << 4);
|
|
|
|
|
2022-01-20 17:14:10 +03:00
|
|
|
/**
|
|
|
|
* This flag can only ever be set on downloads. It indicates
|
|
|
|
* that the download https connection succeeded. This flag is mostly
|
|
|
|
* used to counter time-outs which allows to cancel the channel
|
|
|
|
* if the https load has not started.
|
|
|
|
*/
|
|
|
|
const unsigned long HTTPS_ONLY_DOWNLOAD_IN_PROGRESS = (1 << 5);
|
|
|
|
|
2020-08-14 03:22:59 +03:00
|
|
|
/**
|
|
|
|
* This flag indicates that the request should not be logged to the
|
|
|
|
* console.
|
|
|
|
*/
|
2022-01-20 17:14:10 +03:00
|
|
|
const unsigned long HTTPS_ONLY_DO_NOT_LOG_TO_CONSOLE = (1 << 6);
|
2020-08-14 03:22:59 +03:00
|
|
|
|
2021-04-13 20:43:12 +03:00
|
|
|
/**
|
2023-04-12 15:35:18 +03:00
|
|
|
* This flag indicates that the request was upgraded by https-first mode.
|
2021-04-13 20:43:12 +03:00
|
|
|
*/
|
2022-01-20 17:14:10 +03:00
|
|
|
const unsigned long HTTPS_ONLY_UPGRADED_HTTPS_FIRST = (1 << 7);
|
2021-04-13 20:43:12 +03:00
|
|
|
|
2023-02-28 22:46:11 +03:00
|
|
|
/**
|
|
|
|
* This flag indicates that the request should not be blocked by ORB.
|
|
|
|
*/
|
|
|
|
const unsigned long HTTPS_ONLY_BYPASS_ORB = (1 << 8);
|
|
|
|
|
2023-07-11 14:07:24 +03:00
|
|
|
/**
|
|
|
|
* This flag indicates that HTTPS_ONLY_EXEMPT should be
|
2023-09-11 15:14:30 +03:00
|
|
|
* set the next time HTTPS-Only exemptions are checked
|
|
|
|
* and HTTPS-First is enabled.
|
2023-07-11 14:07:24 +03:00
|
|
|
*/
|
2023-09-11 15:14:30 +03:00
|
|
|
const unsigned long HTTPS_FIRST_EXEMPT_NEXT_LOAD = (1 << 9);
|
2023-07-11 14:07:24 +03:00
|
|
|
|
2020-03-27 20:09:15 +03:00
|
|
|
/**
|
|
|
|
* Upgrade state of HTTPS-Only Mode. The flag HTTPS_ONLY_EXEMPT can get
|
|
|
|
* set on requests that should be excempt from an upgrade.
|
|
|
|
*/
|
|
|
|
[infallible] attribute unsigned long httpsOnlyStatus;
|
2020-03-17 22:24:31 +03:00
|
|
|
|
2023-05-15 12:31:49 +03:00
|
|
|
/**
|
|
|
|
* Reflects whetehr this is an HTTP Strict Transport Security host
|
|
|
|
*/
|
|
|
|
[infallible] attribute boolean hstsStatus;
|
|
|
|
|
2020-04-16 11:04:26 +03:00
|
|
|
/**
|
|
|
|
* 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.)
|
|
|
|
*/
|
|
|
|
[infallible] attribute boolean hasValidUserGestureActivation;
|
|
|
|
|
2020-04-07 14:55:20 +03:00
|
|
|
/**
|
2024-06-26 17:24:31 +03:00
|
|
|
* Returns true if at the time of the loadinfo construction the document that
|
|
|
|
* triggered this load was user activated. This flag is being used to indicate
|
|
|
|
* whether a document load with a text fragment is allowed to scroll to the
|
|
|
|
* first text directive.
|
|
|
|
*/
|
|
|
|
[infallible] attribute boolean textDirectiveUserActivation;
|
|
|
|
|
|
|
|
/**
|
2024-06-26 17:24:32 +03:00
|
|
|
* Returns true if the current load is a same-document navigation.
|
|
|
|
*
|
|
|
|
* Note: There exists no IPC plumbing for this field. If this object crosses
|
|
|
|
* a process boundary, it is not same-document, and the value defaults
|
|
|
|
* to false.
|
|
|
|
* Also note: This flag is only meant to be used for a specific case when
|
|
|
|
* scrolling to a text fragment: If a same-doc load is triggered
|
|
|
|
* during the initial document load, and the target text has not
|
|
|
|
* been parsed.
|
|
|
|
* The flag is not being reset. If you want to use this flag for
|
|
|
|
* another reason, don't. Check Bug 1777171 for a stable solution.
|
|
|
|
*/
|
|
|
|
[infallible] attribute boolean isSameDocumentNavigation;
|
|
|
|
|
|
|
|
/**
|
2020-04-07 14:55:20 +03:00
|
|
|
* We disallow the SystemPrincipal to initiate requests to
|
|
|
|
* the public web. This flag is to allow exceptions.
|
|
|
|
*/
|
|
|
|
[infallible] attribute boolean allowDeprecatedSystemRequests;
|
|
|
|
|
2020-04-10 13:56:57 +03:00
|
|
|
/**
|
|
|
|
* Only ever returns true if the loadinfo is of TYPE_SCRIPT and
|
|
|
|
* the script was created by the HTML parser.
|
|
|
|
*/
|
|
|
|
[infallible] attribute boolean parserCreatedScript;
|
|
|
|
|
2022-06-07 01:23:58 +03:00
|
|
|
/**
|
|
|
|
* True if this request is known to have been triggered by a user
|
|
|
|
* manually requesting the URI to be saved.
|
|
|
|
*/
|
|
|
|
[infallible] attribute boolean isUserTriggeredSave;
|
|
|
|
|
2020-06-29 12:34:54 +03:00
|
|
|
/**
|
|
|
|
* True if this request is from DevTools.
|
|
|
|
*/
|
|
|
|
[infallible] attribute boolean isInDevToolsContext;
|
|
|
|
|
2015-12-01 00:25:29 +03:00
|
|
|
/**
|
|
|
|
* 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.
|
|
|
|
*/
|
2020-06-17 23:18:23 +03:00
|
|
|
[infallible] attribute boolean isInThirdPartyContext;
|
2015-12-01 00:25:29 +03:00
|
|
|
|
2020-05-13 16:38:41 +03:00
|
|
|
/**
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
[infallible] attribute boolean isThirdPartyContextToTopWindow;
|
|
|
|
|
2015-07-20 05:11:57 +03:00
|
|
|
/**
|
2015-12-07 02:33:15 +03:00
|
|
|
* See 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.
|
2015-07-20 05:11:57 +03:00
|
|
|
*/
|
2015-12-07 02:33:15 +03:00
|
|
|
[infallible] readonly attribute unsigned long cookiePolicy;
|
2015-07-20 05:11:57 +03:00
|
|
|
|
2019-03-08 12:00:06 +03:00
|
|
|
/**
|
2020-03-04 11:59:08 +03:00
|
|
|
* The cookie jar settings inherited from the top-level document's loadInfo.
|
2019-03-08 12:00:06 +03:00
|
|
|
* It cannot be null.
|
|
|
|
*/
|
2020-03-04 11:59:08 +03:00
|
|
|
attribute nsICookieJarSettings cookieJarSettings;
|
2019-03-08 12:00:06 +03:00
|
|
|
|
2021-09-28 01:50:41 +03:00
|
|
|
cenum StoragePermissionState : 8 {
|
|
|
|
NoStoragePermission = 0,
|
|
|
|
HasStoragePermission = 1,
|
|
|
|
StoragePermissionAllowListed = 2,
|
|
|
|
};
|
|
|
|
|
2020-03-30 17:10:07 +03:00
|
|
|
/**
|
2021-09-28 01:50:41 +03:00
|
|
|
* The result of the storage permission check of the loading document. This
|
|
|
|
* value would be set during opening the channel.
|
2020-03-30 17:10:07 +03:00
|
|
|
*/
|
2021-09-28 01:50:41 +03:00
|
|
|
[infallible] attribute nsILoadInfo_StoragePermissionState
|
|
|
|
storagePermission;
|
2020-03-30 17:10:07 +03:00
|
|
|
|
2023-10-18 01:02:27 +03:00
|
|
|
/**
|
|
|
|
* Get the granular overrides of fingerprinting protections associated to the
|
|
|
|
* channel, the value will override the default fingerprinting protection
|
|
|
|
* settings. This field will only get populated if these is one that comes
|
|
|
|
* from the local granular overrides pref or WebCompat. Otherwise, a value of
|
|
|
|
* Nothing() indicates no granular overrides are present for this channel.
|
|
|
|
*
|
|
|
|
* The RFPTarget defined in the RFPTargets.inc.
|
|
|
|
*/
|
|
|
|
[noscript, nostdcall, notxpcom]
|
|
|
|
const_MaybeRFPTarget GetOverriddenFingerprintingSettings();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the granular overrides of fingerprinting protections for the channel.
|
|
|
|
*/
|
|
|
|
[noscript, nostdcall, notxpcom]
|
|
|
|
void SetOverriddenFingerprintingSettings(in RFPTarget aTargets);
|
|
|
|
|
2021-03-17 14:42:55 +03:00
|
|
|
/**
|
|
|
|
* True if the load was triggered by a meta refresh.
|
|
|
|
*/
|
|
|
|
[infallible] attribute boolean isMetaRefresh;
|
|
|
|
|
2014-07-10 10:56:36 +04:00
|
|
|
/**
|
|
|
|
* If forceInheritPrincipal is true, the data coming from the channel should
|
2017-01-10 22:46:30 +03:00
|
|
|
* 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.
|
|
|
|
*
|
2014-07-10 10:56:36 +04:00
|
|
|
* This attribute will never be true when loadingSandboxed is true.
|
|
|
|
*/
|
|
|
|
[infallible] readonly attribute boolean forceInheritPrincipal;
|
|
|
|
|
2016-10-05 22:19:51 +03:00
|
|
|
/**
|
|
|
|
* If forceInheritPrincipalOverruleOwner is true, the data coming from the
|
2017-01-10 22:46:30 +03:00
|
|
|
* 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.
|
2016-10-05 22:19:51 +03:00
|
|
|
*/
|
|
|
|
[infallible] readonly attribute boolean forceInheritPrincipalOverruleOwner;
|
|
|
|
|
2014-07-10 10:56:36 +04:00
|
|
|
/**
|
|
|
|
* 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;
|
2014-07-17 00:16:12 +04:00
|
|
|
|
2015-07-20 05:11:57 +03:00
|
|
|
/**
|
|
|
|
* If aboutBlankInherits is true, then about:blank should inherit
|
|
|
|
* the principal.
|
|
|
|
*/
|
|
|
|
[infallible] readonly attribute boolean aboutBlankInherits;
|
|
|
|
|
2015-09-15 04:59:35 +03:00
|
|
|
/**
|
|
|
|
* If allowChrome is true, then use nsIScriptSecurityManager::ALLOW_CHROME
|
|
|
|
* when calling CheckLoadURIWithPrincipal().
|
|
|
|
*/
|
|
|
|
[infallible] readonly attribute boolean allowChrome;
|
|
|
|
|
2016-05-24 00:57:31 +03:00
|
|
|
/**
|
|
|
|
* If disallowScript is true, then use nsIScriptSecurityManager::DISALLOW_SCRIPT
|
|
|
|
* when calling CheckLoadURIWithPrincipal().
|
|
|
|
*/
|
|
|
|
[infallible] readonly attribute boolean disallowScript;
|
|
|
|
|
2019-08-05 22:28:00 +03:00
|
|
|
%{C++
|
|
|
|
uint32_t CheckLoadURIFlags() {
|
|
|
|
uint32_t flags = nsIScriptSecurityManager::STANDARD;
|
|
|
|
if (GetAllowChrome()) {
|
|
|
|
flags |= nsIScriptSecurityManager::ALLOW_CHROME;
|
|
|
|
}
|
|
|
|
if (GetDisallowScript()) {
|
|
|
|
flags |= nsIScriptSecurityManager::DISALLOW_SCRIPT;
|
|
|
|
}
|
|
|
|
return flags;
|
|
|
|
}
|
|
|
|
%}
|
|
|
|
|
2015-11-24 05:47:10 +03:00
|
|
|
/**
|
|
|
|
* Returns true if SEC_DONT_FOLLOW_REDIRECTS is set.
|
|
|
|
*/
|
|
|
|
[infallible] readonly attribute boolean dontFollowRedirects;
|
|
|
|
|
2016-08-16 04:47:14 +03:00
|
|
|
/**
|
|
|
|
* Returns true if SEC_LOAD_ERROR_PAGE is set.
|
|
|
|
*/
|
|
|
|
[infallible] readonly attribute boolean loadErrorPage;
|
|
|
|
|
2019-07-22 16:41:47 +03:00
|
|
|
/**
|
2019-08-08 03:50:24 +03:00
|
|
|
* True if the load was initiated by a form request.
|
2019-07-22 16:41:47 +03:00
|
|
|
*/
|
|
|
|
[infallible] attribute boolean isFormSubmission;
|
|
|
|
|
2024-10-09 10:01:18 +03:00
|
|
|
/**
|
|
|
|
* True if the load will be a get request.
|
|
|
|
*/
|
|
|
|
[infallible] attribute boolean isGETRequest;
|
|
|
|
|
2014-07-17 00:16:12 +04:00
|
|
|
/**
|
2015-06-17 07:18:16 +03:00
|
|
|
* The external contentPolicyType of the channel, used for security checks
|
2014-07-17 00:16:12 +04:00
|
|
|
* like Mixed Content Blocking and Content Security Policy.
|
2015-06-17 07:18:16 +03:00
|
|
|
*
|
|
|
|
* Specifically, content policy types with _INTERNAL_ in their name will
|
|
|
|
* never get returned from this attribute.
|
2014-07-17 00:16:12 +04:00
|
|
|
*/
|
2015-10-19 21:14:54 +03:00
|
|
|
readonly attribute nsContentPolicyType externalContentPolicyType;
|
2014-07-17 00:16:12 +04:00
|
|
|
|
2018-08-01 07:35:24 +03:00
|
|
|
/**
|
|
|
|
* CSP uses this parameter to send or not CSP violation events.
|
|
|
|
* Default value: true.
|
|
|
|
*/
|
|
|
|
[infallible] attribute boolean sendCSPViolationEvents;
|
|
|
|
|
2014-07-17 00:16:12 +04:00
|
|
|
%{ C++
|
2021-01-15 15:07:16 +03:00
|
|
|
inline ExtContentPolicyType GetExternalContentPolicyType()
|
2014-07-17 00:16:12 +04:00
|
|
|
{
|
|
|
|
nsContentPolicyType result;
|
2015-10-19 21:14:54 +03:00
|
|
|
mozilla::DebugOnly<nsresult> rv = GetExternalContentPolicyType(&result);
|
2014-07-17 00:16:12 +04:00
|
|
|
MOZ_ASSERT(NS_SUCCEEDED(rv));
|
2021-01-15 15:07:16 +03:00
|
|
|
return static_cast<ExtContentPolicyType>(result);
|
2014-07-17 00:16:12 +04:00
|
|
|
}
|
2022-10-01 01:39:23 +03:00
|
|
|
|
2014-07-17 00:16:12 +04:00
|
|
|
%}
|
|
|
|
|
2022-10-01 01:39:23 +03:00
|
|
|
|
2015-06-17 07:18:16 +03:00
|
|
|
/**
|
|
|
|
* 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.
|
|
|
|
*/
|
2020-03-25 16:04:35 +03:00
|
|
|
[noscript, notxpcom, nostdcall, binaryname(InternalContentPolicyType)]
|
|
|
|
nsContentPolicyType binaryInternalContentPolicyType();
|
|
|
|
|
|
|
|
readonly attribute nsContentPolicyType internalContentPolicyType;
|
2015-06-17 07:18:16 +03:00
|
|
|
|
2015-07-10 23:57:55 +03:00
|
|
|
/**
|
|
|
|
* Returns true if document or any of the documents ancestors
|
|
|
|
* up to the toplevel document make use of the CSP directive
|
2019-10-01 00:33:28 +03:00
|
|
|
* 'block-all-mixed-content'.
|
|
|
|
*
|
|
|
|
* Warning: If the loadingDocument is null, then the
|
|
|
|
* blockAllMixedContent is false.
|
|
|
|
*/
|
|
|
|
[infallible] readonly attribute boolean blockAllMixedContent;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns true if document or any of the documents ancestors
|
|
|
|
* up to the toplevel document make use of the CSP directive
|
|
|
|
* 'upgrade-insecure-requests'.
|
2015-07-10 23:57:55 +03:00
|
|
|
*
|
|
|
|
* Warning: If the loadingDocument is null, then the
|
|
|
|
* upgradeInsecureRequests is false.
|
|
|
|
*/
|
2015-11-03 18:51:24 +03:00
|
|
|
[infallible] readonly attribute boolean upgradeInsecureRequests;
|
2015-07-10 23:57:55 +03:00
|
|
|
|
2018-02-05 18:37:27 +03:00
|
|
|
/**
|
|
|
|
* Returns 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.
|
|
|
|
*/
|
|
|
|
[infallible] readonly attribute boolean browserUpgradeInsecureRequests;
|
2018-03-04 17:33:33 +03:00
|
|
|
|
2020-11-09 17:40:30 +03:00
|
|
|
/**
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
[infallible] attribute boolean browserDidUpgradeInsecureRequests;
|
|
|
|
|
2018-03-04 17:33:33 +03:00
|
|
|
/**
|
|
|
|
* Returns 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.
|
|
|
|
*/
|
|
|
|
[infallible] readonly attribute boolean browserWouldUpgradeInsecureRequests;
|
2016-03-16 06:13:26 +03:00
|
|
|
|
2017-11-08 22:01:41 +03:00
|
|
|
/**
|
|
|
|
* If true, toplevel data: URI navigation is allowed
|
|
|
|
*/
|
|
|
|
[infallible] attribute boolean forceAllowDataURI;
|
2018-02-18 21:52:52 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* If true, insecure redirects to a data: URI are allowed.
|
|
|
|
*/
|
|
|
|
[infallible] attribute boolean allowInsecureRedirectToDataURI;
|
2017-11-08 22:01:41 +03:00
|
|
|
|
2018-03-29 12:14:35 +03:00
|
|
|
/**
|
|
|
|
* If true, the content policy security check is excluded from web requests.
|
|
|
|
*/
|
|
|
|
[infallible] attribute boolean skipContentPolicyCheckForWebRequest;
|
|
|
|
|
2017-11-05 07:06:20 +03:00
|
|
|
/**
|
|
|
|
* If true, this is the load of a frame's original src attribute
|
|
|
|
*/
|
|
|
|
[infallible] attribute boolean originalFrameSrcLoad;
|
|
|
|
|
2016-07-18 09:35:13 +03:00
|
|
|
/**
|
|
|
|
* The SEC_FORCE_INHERIT_PRINCIPAL flag may be dropped when a load info
|
2020-01-15 11:02:57 +03:00
|
|
|
* 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.
|
2016-07-18 09:35:13 +03:00
|
|
|
*/
|
|
|
|
[infallible] readonly attribute boolean forceInheritPrincipalDropped;
|
|
|
|
|
2015-01-08 02:51:20 +03:00
|
|
|
/**
|
2020-07-17 20:13:26 +03:00
|
|
|
* This is the inner window ID of the window in which the element being
|
|
|
|
* loaded lives.
|
2015-01-08 02:51:20 +03:00
|
|
|
*
|
2020-07-17 20:13:26 +03:00
|
|
|
* Note that this window ID can be 0 if the window is not
|
|
|
|
* available.
|
2015-01-08 02:51:20 +03:00
|
|
|
*/
|
2015-11-03 18:51:24 +03:00
|
|
|
[infallible] readonly attribute unsigned long long innerWindowID;
|
2016-06-27 03:42:00 +03:00
|
|
|
|
2019-01-24 00:06:59 +03:00
|
|
|
/**
|
|
|
|
* The BrowsingContext performing the load for this nsILoadInfo object.
|
|
|
|
*/
|
|
|
|
[infallible] readonly attribute unsigned long long browsingContextID;
|
2020-07-08 00:37:53 +03:00
|
|
|
[infallible] readonly attribute BrowsingContext browsingContext;
|
2019-01-24 00:06:59 +03:00
|
|
|
|
2023-05-05 18:24:09 +03:00
|
|
|
/**
|
|
|
|
* The BrowsingContext which the worker is associated.
|
|
|
|
*
|
|
|
|
* Note that this could be 0 if the load is not triggered in a WorkerScope.
|
|
|
|
* This value is only set and used in the parent process for some sitautions
|
|
|
|
* the channel is created in the parent process for Workers. Such as fetch().
|
|
|
|
* In content process, it is always 0.
|
|
|
|
* This value would not be propagated through IPC.
|
|
|
|
*/
|
|
|
|
[infallible] attribute unsigned long long workerAssociatedBrowsingContextID;
|
|
|
|
[infallible] readonly attribute BrowsingContext workerAssociatedBrowsingContext;
|
|
|
|
|
2019-02-15 22:49:04 +03:00
|
|
|
/**
|
2020-07-17 20:13:26 +03:00
|
|
|
* Only when the element being loaded is <frame src="foo.html">
|
|
|
|
* (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.
|
2019-02-15 22:49:04 +03:00
|
|
|
*/
|
|
|
|
[infallible] readonly attribute unsigned long long frameBrowsingContextID;
|
2020-07-08 00:37:53 +03:00
|
|
|
[infallible] readonly attribute BrowsingContext frameBrowsingContext;
|
2019-02-15 22:49:04 +03:00
|
|
|
|
2020-02-26 02:17:53 +03:00
|
|
|
/**
|
|
|
|
* If 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`).
|
|
|
|
*/
|
|
|
|
[infallible] readonly attribute unsigned long long targetBrowsingContextID;
|
2020-07-08 00:37:53 +03:00
|
|
|
[infallible] readonly attribute BrowsingContext targetBrowsingContext;
|
2020-02-26 02:17:53 +03:00
|
|
|
|
2016-10-05 22:19:51 +03:00
|
|
|
/**
|
2017-04-03 21:06:53 +03:00
|
|
|
* Resets the PrincipalToInherit to a freshly created NullPrincipal
|
|
|
|
* which inherits the origin attributes from the loadInfo.
|
2016-10-05 22:19:51 +03:00
|
|
|
*
|
|
|
|
* WARNING: Please only use that function if you know exactly what
|
|
|
|
* you are doing!!!
|
|
|
|
*/
|
2017-04-03 21:06:53 +03:00
|
|
|
void resetPrincipalToInheritToNullPrincipal();
|
2016-10-05 22:19:51 +03:00
|
|
|
|
2015-10-22 00:47:00 +03:00
|
|
|
/**
|
2017-01-12 19:38:48 +03:00
|
|
|
* Customized OriginAttributes within LoadInfo to allow overwriting of the
|
2015-10-22 00:47:00 +03:00
|
|
|
* default originAttributes from the loadingPrincipal.
|
2016-08-04 09:05:38 +03:00
|
|
|
*
|
|
|
|
* 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.
|
2015-10-22 00:47:00 +03:00
|
|
|
*/
|
|
|
|
[implicit_jscontext, binaryname(ScriptableOriginAttributes)]
|
|
|
|
attribute jsval originAttributes;
|
|
|
|
|
|
|
|
[noscript, nostdcall, binaryname(GetOriginAttributes)]
|
2017-01-12 19:38:48 +03:00
|
|
|
OriginAttributes binaryGetOriginAttributes();
|
2015-10-22 00:47:00 +03:00
|
|
|
|
|
|
|
[noscript, nostdcall, binaryname(SetOriginAttributes)]
|
|
|
|
void binarySetOriginAttributes(in const_OriginAttributesRef aOriginAttrs);
|
|
|
|
|
|
|
|
%{ C++
|
2017-01-12 19:38:48 +03:00
|
|
|
inline mozilla::OriginAttributes GetOriginAttributes()
|
2015-10-22 00:47:00 +03:00
|
|
|
{
|
2017-01-12 19:38:48 +03:00
|
|
|
mozilla::OriginAttributes result;
|
2015-10-22 00:47:00 +03:00
|
|
|
mozilla::DebugOnly<nsresult> rv = GetOriginAttributes(&result);
|
|
|
|
MOZ_ASSERT(NS_SUCCEEDED(rv));
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
%}
|
|
|
|
|
2015-07-20 05:11:57 +03:00
|
|
|
/**
|
|
|
|
* Whenever a channel is evaluated by the ContentSecurityManager
|
|
|
|
* the first time, we set this flag to true to indicate that
|
2019-02-12 19:08:25 +03:00
|
|
|
* subsequent calls of AsyncOpen() do not have to enforce all
|
2015-07-20 05:11:57 +03:00
|
|
|
* 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
|
2015-11-03 18:51:24 +03:00
|
|
|
* to anything else than true will be discarded.
|
2015-07-20 05:11:57 +03:00
|
|
|
*
|
|
|
|
*/
|
2015-11-03 18:51:24 +03:00
|
|
|
[infallible] attribute boolean initialSecurityCheckDone;
|
2015-07-20 05:11:57 +03:00
|
|
|
|
2017-11-03 15:23:11 +03:00
|
|
|
/**
|
|
|
|
* Returns true if the load was triggered from an external application
|
|
|
|
* (e.g. Thunderbird). Please note that this flag will only ever be true
|
2019-04-26 13:59:41 +03:00
|
|
|
* if the load is of TYPE_DOCUMENT.
|
2017-11-03 15:23:11 +03:00
|
|
|
*/
|
|
|
|
[infallible] attribute boolean loadTriggeredFromExternal;
|
|
|
|
|
2017-11-03 10:37:35 +03:00
|
|
|
/**
|
|
|
|
* True if the tainting has been set by the service worker.
|
|
|
|
*/
|
|
|
|
[noscript, infallible] readonly attribute boolean serviceWorkerTaintingSynthesized;
|
|
|
|
|
2015-07-20 05:11:03 +03:00
|
|
|
/**
|
2017-05-25 20:42:00 +03:00
|
|
|
* 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.
|
2021-10-04 16:24:15 +03:00
|
|
|
* @param channelToDeriveFrom the channel being redirected
|
2015-11-01 01:18:59 +03:00
|
|
|
* @param aIsInternalRedirect should be true if the channel is going
|
|
|
|
* through an internal redirect, otherwise false.
|
2015-07-20 05:11:03 +03:00
|
|
|
*/
|
2021-10-04 16:24:15 +03:00
|
|
|
void appendRedirectHistoryEntry(in nsIChannel channelToDeriveFrom,
|
2017-05-25 20:42:00 +03:00
|
|
|
in boolean isInternalRedirect);
|
2015-07-20 05:11:03 +03:00
|
|
|
|
|
|
|
/**
|
2017-05-25 20:42:00 +03:00
|
|
|
* An 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.
|
2015-11-01 01:18:59 +03:00
|
|
|
*/
|
|
|
|
[implicit_jscontext]
|
|
|
|
readonly attribute jsval redirectChainIncludingInternalRedirects;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* A C++-friendly version of redirectChain.
|
|
|
|
* Please note that this array has the same lifetime as the
|
|
|
|
* loadInfo object - use with caution!
|
|
|
|
*/
|
|
|
|
[noscript, notxpcom, nostdcall, binaryname(RedirectChainIncludingInternalRedirects)]
|
2017-05-25 20:42:00 +03:00
|
|
|
nsIRedirectHistoryEntryArray binaryRedirectChainIncludingInternalRedirects();
|
2015-11-01 01:18:59 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Same as RedirectChain but does *not* include internal redirects.
|
2015-07-20 05:11:03 +03:00
|
|
|
*/
|
|
|
|
[implicit_jscontext]
|
|
|
|
readonly attribute jsval redirectChain;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* A C++-friendly version of redirectChain.
|
|
|
|
* Please note that this array has the same lifetime as the
|
|
|
|
* loadInfo object - use with caution!
|
|
|
|
*/
|
|
|
|
[noscript, notxpcom, nostdcall, binaryname(RedirectChain)]
|
2017-05-25 20:42:00 +03:00
|
|
|
nsIRedirectHistoryEntryArray binaryRedirectChain();
|
2015-10-22 21:07:32 +03:00
|
|
|
|
2017-10-10 19:54:00 +03:00
|
|
|
/**
|
Bug 1631859 - Part 1: Fill out ancestor principals and outer window IDs for LoadInfo only in the parent, r=kmag,extension-reviewers
Keeping a list of ancestor principals in a LoadInfo object, that, at times,
exists in the content process, is not secure. Since ancestor principals are
only ever needed to create a list of frameAncestors, which, in turn, are only
ever accessed from the parent process, we can assemble lists of ancestor
principals and outer windowIDs whenever we are in the parent process and are
either 1) creating a LoadInfo object or 2) deserializing a LoadInfoArgs struct,
received from content process, into a LoadInfo object.
Differential Revision: https://phabricator.services.mozilla.com/D78406
2020-06-08 22:58:14 +03:00
|
|
|
* 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!
|
2017-10-10 19:54:00 +03:00
|
|
|
*/
|
|
|
|
[noscript, notxpcom, nostdcall]
|
|
|
|
PrincipalArrayRef AncestorPrincipals();
|
|
|
|
|
|
|
|
/**
|
2020-07-08 00:14:42 +03:00
|
|
|
* An array of BrowsingContext IDs which correspond to nsILoadInfo::AncestorPrincipals
|
|
|
|
* above. AncestorBrowsingContextIDs[0] is the BrowsingContext ID of the frame
|
2017-10-10 19:54:00 +03:00
|
|
|
* 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!
|
|
|
|
*/
|
|
|
|
[noscript, notxpcom, nostdcall]
|
2020-07-08 00:14:42 +03:00
|
|
|
Uint64ArrayRef AncestorBrowsingContextIDs();
|
|
|
|
|
2015-12-07 02:33:14 +03:00
|
|
|
/**
|
|
|
|
* 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.
|
|
|
|
*
|
2020-07-15 14:20:45 +03:00
|
|
|
* Only call this function when using the SEC_REQUIRE_CORS_INHERITS_SEC_CONTEXT mode.
|
2015-12-07 02:33:14 +03:00
|
|
|
*/
|
|
|
|
[noscript, notxpcom, nostdcall]
|
2018-07-10 11:09:59 +03:00
|
|
|
void setCorsPreflightInfo(in CStringArrayRef unsafeHeaders,
|
2015-12-07 02:33:14 +03:00
|
|
|
in boolean forcePreflight);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* A C++-friendly getter for the list of cors-unsafe headers.
|
|
|
|
* Please note that this array has the same lifetime as the
|
|
|
|
* loadInfo object - use with caution!
|
|
|
|
*/
|
|
|
|
[noscript, notxpcom, nostdcall, binaryname(CorsUnsafeHeaders)]
|
2018-07-10 11:09:59 +03:00
|
|
|
CStringArrayRef corsUnsafeHeaders();
|
2015-12-07 02:33:14 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns value set through setCorsPreflightInfo.
|
|
|
|
*/
|
|
|
|
[infallible] readonly attribute boolean forcePreflight;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* A C++ friendly getter for the forcePreflight flag.
|
|
|
|
*/
|
|
|
|
[infallible] readonly attribute boolean isPreflight;
|
|
|
|
|
2015-10-22 21:07:32 +03:00
|
|
|
/**
|
|
|
|
* Constants reflecting the channel tainting. These are mainly defined here
|
|
|
|
* for script. Internal C++ code should use the enum defined in LoadTainting.h.
|
|
|
|
* See LoadTainting.h for documentation.
|
|
|
|
*/
|
|
|
|
const unsigned long TAINTING_BASIC = 0;
|
|
|
|
const unsigned long TAINTING_CORS = 1;
|
|
|
|
const unsigned long TAINTING_OPAQUE = 2;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Determine 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 attribute unsigned long tainting;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
void maybeIncreaseTainting(in unsigned long aTainting);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Various helper code to provide more convenient C++ access to the tainting
|
|
|
|
* attribute and maybeIncreaseTainting().
|
|
|
|
*/
|
|
|
|
%{C++
|
|
|
|
static_assert(TAINTING_BASIC == static_cast<uint32_t>(mozilla::LoadTainting::Basic),
|
|
|
|
"basic tainting enums should match");
|
|
|
|
static_assert(TAINTING_CORS == static_cast<uint32_t>(mozilla::LoadTainting::CORS),
|
|
|
|
"cors tainting enums should match");
|
|
|
|
static_assert(TAINTING_OPAQUE == static_cast<uint32_t>(mozilla::LoadTainting::Opaque),
|
|
|
|
"opaque tainting enums should match");
|
|
|
|
|
|
|
|
mozilla::LoadTainting GetTainting()
|
|
|
|
{
|
|
|
|
uint32_t tainting = TAINTING_BASIC;
|
2016-03-28 20:28:15 +03:00
|
|
|
MOZ_ALWAYS_SUCCEEDS(GetTainting(&tainting));
|
2015-10-22 21:07:32 +03:00
|
|
|
return static_cast<mozilla::LoadTainting>(tainting);
|
|
|
|
}
|
|
|
|
|
|
|
|
void MaybeIncreaseTainting(mozilla::LoadTainting aTainting)
|
|
|
|
{
|
|
|
|
uint32_t tainting = static_cast<uint32_t>(aTainting);
|
2016-03-28 20:28:15 +03:00
|
|
|
MOZ_ALWAYS_SUCCEEDS(MaybeIncreaseTainting(tainting));
|
2015-10-22 21:07:32 +03:00
|
|
|
}
|
|
|
|
%}
|
2016-08-22 04:46:09 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns true if this load is for top level document.
|
|
|
|
* Note that the load for a sub-frame's document will return false here.
|
|
|
|
*/
|
|
|
|
[infallible] readonly attribute boolean isTopLevelLoad;
|
2017-02-01 01:56:15 +03:00
|
|
|
|
2017-05-30 19:07:59 +03:00
|
|
|
/**
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
attribute nsIURI resultPrincipalURI;
|
|
|
|
|
2021-12-21 01:39:29 +03:00
|
|
|
/**
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
attribute nsIURI channelCreationOriginalURI;
|
|
|
|
|
2017-02-01 01:56:15 +03:00
|
|
|
/**
|
2021-07-16 00:09:15 +03:00
|
|
|
* Returns a unique nsID used to construct the null principal for the
|
|
|
|
* resulting resource if the SANDBOXED_ORIGIN flag is set. This is used by
|
|
|
|
* GetChannelResultPrincipal() to ensure that the same null principal is
|
|
|
|
* returned every time.
|
2017-02-01 01:56:15 +03:00
|
|
|
*/
|
2021-07-16 00:09:15 +03:00
|
|
|
[noscript, nostdcall, notxpcom]
|
|
|
|
nsIDRef GetSandboxedNullPrincipalID();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Generates a new nsID to be returned by a future call to
|
|
|
|
* `GetSandboxedNullPrincipalID()`.
|
|
|
|
*/
|
|
|
|
[noscript, nostdcall, notxpcom]
|
|
|
|
void ResetSandboxedNullPrincipalID();
|
2017-11-16 21:15:09 +03:00
|
|
|
|
2018-08-10 21:55:27 +03:00
|
|
|
/**
|
|
|
|
* Return the top-level principal, which is the principal of the top-level
|
|
|
|
* window.
|
|
|
|
*/
|
2018-11-20 04:17:53 +03:00
|
|
|
[notxpcom, nostdcall] readonly attribute nsIPrincipal topLevelPrincipal;
|
2018-08-10 21:55:27 +03:00
|
|
|
|
2017-11-16 21:15:09 +03:00
|
|
|
/**
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
[noscript, nostdcall, notxpcom]
|
|
|
|
void SetClientInfo(in const_ClientInfoRef aClientInfo);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the ClientInfo for the global that initiated the network request,
|
|
|
|
* if it has been set.
|
|
|
|
*/
|
|
|
|
[noscript, nostdcall, notxpcom]
|
|
|
|
const_MaybeClientInfoRef GetClientInfo();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 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().
|
|
|
|
*/
|
|
|
|
[noscript, nostdcall, notxpcom]
|
|
|
|
void GiveReservedClientSource(in UniqueClientSourceMove aClientSource);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This method takes ownership of the reserved ClientSource previously
|
|
|
|
* provided in GiveReservedClientSource(). It may return nullptr if the
|
|
|
|
* nsILoadInfo does not own a ClientSource object.
|
|
|
|
*/
|
|
|
|
[noscript, nostdcall, notxpcom]
|
|
|
|
UniqueClientSource TakeReservedClientSource();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
[noscript, nostdcall, notxpcom]
|
|
|
|
void SetReservedClientInfo(in const_ClientInfoRef aClientInfo);
|
|
|
|
|
2018-06-22 18:09:00 +03:00
|
|
|
/**
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
[noscript, nostdcall, notxpcom]
|
|
|
|
void OverrideReservedClientInfoInParent(in const_ClientInfoRef aClientInfo);
|
|
|
|
|
2017-11-16 21:15:09 +03:00
|
|
|
/**
|
|
|
|
* Return the reserved ClientInfo for this load, if one has been set.
|
|
|
|
*/
|
|
|
|
[noscript, nostdcall, notxpcom]
|
|
|
|
const_MaybeClientInfoRef GetReservedClientInfo();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
[noscript, nostdcall, notxpcom]
|
|
|
|
void SetInitialClientInfo(in const_ClientInfoRef aClientInfo);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return the initial ClientInfo for this load, if one has been set.
|
|
|
|
*/
|
|
|
|
[noscript, nostdcall, notxpcom]
|
|
|
|
const_MaybeClientInfoRef GetInitialClientInfo();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
[noscript, nostdcall, notxpcom]
|
|
|
|
void SetController(in const_ServiceWorkerDescriptorRef aServiceWorker);
|
|
|
|
|
2017-12-06 04:45:23 +03:00
|
|
|
/**
|
|
|
|
* Clear the service worker controller for this channel. This should only
|
|
|
|
* be used for window navigation redirects. By default we want to keep
|
|
|
|
* the controller in all other cases.
|
|
|
|
*/
|
|
|
|
[noscript, nostdcall, notxpcom]
|
|
|
|
void ClearController();
|
|
|
|
|
2017-11-16 21:15:09 +03:00
|
|
|
/**
|
|
|
|
* Get the service worker controlling this network request, if one has
|
|
|
|
* been set.
|
|
|
|
*/
|
|
|
|
[noscript, nostdcall, notxpcom]
|
|
|
|
const_MaybeServiceWorkerDescriptorRef GetController();
|
2018-01-24 19:17:31 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Set a custom performance storage. This is meant to be executed only for
|
|
|
|
* workers. If a PerformanceStorage is not set, the loadingDocument->Window
|
2019-08-08 03:50:24 +03:00
|
|
|
* Performance object will be returned instead.
|
2018-01-24 19:17:31 +03:00
|
|
|
*/
|
|
|
|
[noscript, nostdcall, notxpcom]
|
|
|
|
void SetPerformanceStorage(in PerformanceStoragePtr aPerformanceStorage);
|
|
|
|
|
|
|
|
/**
|
2019-08-08 03:50:24 +03:00
|
|
|
* 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:
|
|
|
|
* - the triggeringPrincipal is the same as the loadingDocument's principal.
|
|
|
|
* - if the external content policy type is TYPE_SUBDOCUMENT then loading
|
|
|
|
* wasn't caused by processing the attributes of the browsing context
|
|
|
|
* container.
|
2018-01-24 19:17:31 +03:00
|
|
|
*/
|
|
|
|
[noscript, nostdcall, notxpcom]
|
|
|
|
PerformanceStoragePtr GetPerformanceStorage();
|
2018-06-11 04:44:38 +03:00
|
|
|
|
2019-05-22 02:14:27 +03:00
|
|
|
/**
|
2019-06-06 23:19:56 +03:00
|
|
|
* Returns the CSP (or Preload CSP for preloads) which should be enforced
|
|
|
|
* when fetching the resource this loadinfo belongs to.
|
2019-08-08 03:50:24 +03:00
|
|
|
*
|
2019-06-06 23:19:56 +03:00
|
|
|
* a) Non-navigations:
|
2022-10-24 23:38:11 +03:00
|
|
|
* For non-navigation loads, GetCsp() returns what the spec refers to as the
|
2019-06-06 23:19:56 +03:00
|
|
|
* "request's client's global object's CSP list". In practice, if this is the
|
2022-10-24 23:38:11 +03:00
|
|
|
* loadinfo of a subresource load (e.g an image load), then GetCsp() or
|
2019-06-06 23:19:56 +03:00
|
|
|
* 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:
|
2022-10-24 23:38:11 +03:00
|
|
|
* For top-level loads (navigations) GetCsp() will return null, unless
|
2019-06-06 23:19:56 +03:00
|
|
|
* 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:
|
2022-10-24 23:38:11 +03:00
|
|
|
* For iframe-loads (navigations) GetCsp() will return the CSP of the
|
2019-06-06 23:19:56 +03:00
|
|
|
* 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.
|
2019-05-22 02:14:27 +03:00
|
|
|
*/
|
|
|
|
[notxpcom,nostdcall] CSPRef GetCsp();
|
|
|
|
[notxpcom,nostdcall] CSPRef GetPreloadCsp();
|
2019-06-06 23:19:56 +03:00
|
|
|
[notxpcom,nostdcall] CSPRef GetCspToInherit();
|
2019-05-22 02:14:27 +03:00
|
|
|
|
2024-06-20 16:22:41 +03:00
|
|
|
/**
|
|
|
|
* The possibly cross-origin container feature policy required to
|
|
|
|
* initialize the feature policy of a document load.
|
|
|
|
*/
|
|
|
|
[noscript, nostdcall, notxpcom]
|
|
|
|
MaybeFeaturePolicyInfo GetContainerFeaturePolicyInfo();
|
|
|
|
[noscript, nostdcall, notxpcom]
|
|
|
|
void SetContainerFeaturePolicyInfo(in const_FeaturePolicyInfoRef aContainerFeaturePolicy);
|
|
|
|
|
2018-06-11 22:54:22 +03:00
|
|
|
/**
|
|
|
|
* 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.
|
2018-06-11 04:44:38 +03:00
|
|
|
*/
|
|
|
|
[noscript, nostdcall, notxpcom]
|
|
|
|
void SynthesizeServiceWorkerTainting(in LoadTainting aTainting);
|
2018-08-16 18:29:22 +03:00
|
|
|
|
2018-08-31 14:21:17 +03:00
|
|
|
/**
|
|
|
|
* The top-level document has been user-interacted.
|
|
|
|
*/
|
|
|
|
[infallible] attribute boolean documentHasUserInteracted;
|
2018-09-28 22:12:10 +03:00
|
|
|
|
2020-01-21 21:18:32 +03:00
|
|
|
/**
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
[infallible] attribute boolean allowListFutureDocumentsCreatedFromThisRedirectChain;
|
|
|
|
|
2021-03-12 11:45:29 +03:00
|
|
|
/**
|
|
|
|
* Indicates that we need to check if we should apply the anti-tracking
|
|
|
|
* heuristic after the channel has been classified.
|
|
|
|
*/
|
|
|
|
[infallible] attribute boolean needForCheckingAntiTrackingHeuristic;
|
|
|
|
|
2019-02-13 22:45:29 +03:00
|
|
|
/**
|
|
|
|
* A snapshot of the nonce at load start time which is used for CSP
|
|
|
|
* checks and only set for:
|
|
|
|
* * TYPE_SCRIPT and
|
|
|
|
* * TYPE_STYLESHEET
|
|
|
|
*/
|
|
|
|
attribute AString cspNonce;
|
|
|
|
|
2023-06-09 21:39:59 +03:00
|
|
|
// Subresource Integrity (SRI) metadata.
|
|
|
|
attribute AString integrityMetadata;
|
|
|
|
|
2019-04-26 13:59:41 +03:00
|
|
|
/**
|
|
|
|
* List of possible reasons the request associated with this load info
|
|
|
|
* may have been blocked, set by various content blocking checkers.
|
|
|
|
*/
|
|
|
|
const uint32_t BLOCKING_REASON_NONE = 0;
|
|
|
|
const uint32_t BLOCKING_REASON_CORSDISABLED = 1001;
|
|
|
|
const uint32_t BLOCKING_REASON_CORSDIDNOTSUCCEED = 1002;
|
|
|
|
const uint32_t BLOCKING_REASON_CORSREQUESTNOTHTTP = 1003;
|
|
|
|
const uint32_t BLOCKING_REASON_CORSMULTIPLEALLOWORIGINNOTALLOWED = 1004;
|
|
|
|
const uint32_t BLOCKING_REASON_CORSMISSINGALLOWORIGIN = 1005;
|
|
|
|
const uint32_t BLOCKING_REASON_CORSNOTSUPPORTINGCREDENTIALS = 1006;
|
|
|
|
const uint32_t BLOCKING_REASON_CORSALLOWORIGINNOTMATCHINGORIGIN = 1007;
|
|
|
|
const uint32_t BLOCKING_REASON_CORSMISSINGALLOWCREDENTIALS = 1008;
|
|
|
|
const uint32_t BLOCKING_REASON_CORSORIGINHEADERNOTADDED = 1009;
|
|
|
|
const uint32_t BLOCKING_REASON_CORSEXTERNALREDIRECTNOTALLOWED = 1010;
|
|
|
|
const uint32_t BLOCKING_REASON_CORSPREFLIGHTDIDNOTSUCCEED = 1011;
|
|
|
|
const uint32_t BLOCKING_REASON_CORSINVALIDALLOWMETHOD = 1012;
|
|
|
|
const uint32_t BLOCKING_REASON_CORSMETHODNOTFOUND = 1013;
|
|
|
|
const uint32_t BLOCKING_REASON_CORSINVALIDALLOWHEADER = 1014;
|
|
|
|
const uint32_t BLOCKING_REASON_CORSMISSINGALLOWHEADERFROMPREFLIGHT = 1015;
|
|
|
|
const uint32_t BLOCKING_REASON_CLASSIFY_MALWARE_URI = 2001;
|
|
|
|
const uint32_t BLOCKING_REASON_CLASSIFY_PHISHING_URI = 2002;
|
|
|
|
const uint32_t BLOCKING_REASON_CLASSIFY_UNWANTED_URI = 2003;
|
|
|
|
const uint32_t BLOCKING_REASON_CLASSIFY_TRACKING_URI = 2004;
|
|
|
|
const uint32_t BLOCKING_REASON_CLASSIFY_BLOCKED_URI = 2005;
|
|
|
|
const uint32_t BLOCKING_REASON_CLASSIFY_HARMFUL_URI = 2006;
|
2019-09-27 10:50:17 +03:00
|
|
|
const uint32_t BLOCKING_REASON_CLASSIFY_CRYPTOMINING_URI = 2007;
|
|
|
|
const uint32_t BLOCKING_REASON_CLASSIFY_FINGERPRINTING_URI = 2008;
|
|
|
|
const uint32_t BLOCKING_REASON_CLASSIFY_SOCIALTRACKING_URI = 2009;
|
2022-07-19 00:48:15 +03:00
|
|
|
const uint32_t BLOCKING_REASON_CLASSIFY_EMAILTRACKING_URI = 2010;
|
2019-04-26 13:59:41 +03:00
|
|
|
const uint32_t BLOCKING_REASON_MIXED_BLOCKED = 3001;
|
|
|
|
// The general reason comes from nsCSPContext::permitsInternal(),
|
|
|
|
// which is way too generic to distinguish an exact reason.
|
|
|
|
const uint32_t BLOCKING_REASON_CONTENT_POLICY_GENERAL = 4000;
|
|
|
|
const uint32_t BLOCKING_REASON_CONTENT_POLICY_NO_DATA_PROTOCOL = 4001;
|
2024-01-05 13:05:37 +03:00
|
|
|
// removed 4002
|
2019-04-26 13:59:41 +03:00
|
|
|
const uint32_t BLOCKING_REASON_CONTENT_POLICY_CONTENT_BLOCKED = 4003;
|
|
|
|
const uint32_t BLOCKING_REASON_CONTENT_POLICY_DATA_DOCUMENT = 4004;
|
|
|
|
const uint32_t BLOCKING_REASON_CONTENT_POLICY_WEB_BROWSER = 4005;
|
|
|
|
const uint32_t BLOCKING_REASON_CONTENT_POLICY_PRELOAD = 4006;
|
2019-12-16 12:36:45 +03:00
|
|
|
// The reason used when SEC_REQUIRE_SAME_ORIGIN_* is set and not satisifed.
|
|
|
|
const uint32_t BLOCKING_REASON_NOT_SAME_ORIGIN = 5000;
|
2020-01-13 23:30:26 +03:00
|
|
|
// The reason used when an extension cancels the request via the WebRequest api.
|
|
|
|
const uint32_t BLOCKING_REASON_EXTENSION_WEBREQUEST = 6000;
|
2024-01-12 14:08:14 +03:00
|
|
|
// The reason used when a request is cancelled via WebDriver BiDi network interception.
|
|
|
|
const uint32_t BLOCKING_REASON_WEBDRIVER_BIDI = 7000;
|
2019-04-26 13:59:41 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
[infallible] attribute unsigned long requestBlockingReason;
|
|
|
|
|
2018-10-23 09:17:13 +03:00
|
|
|
/**
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
attribute nsICSPEventListener cspEventListener;
|
2018-11-21 19:28:20 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* This 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
|
|
|
|
*/
|
|
|
|
[infallible] readonly attribute boolean isFromProcessingFrameAttributes;
|
2019-02-16 01:02:58 +03:00
|
|
|
|
|
|
|
cenum CrossOriginOpenerPolicy : 8 {
|
2020-02-18 19:39:08 +03:00
|
|
|
OPENER_POLICY_UNSAFE_NONE = 0,
|
2019-08-08 22:00:00 +03:00
|
|
|
OPENER_POLICY_SAME_ORIGIN = 1,
|
2020-02-18 19:39:08 +03:00
|
|
|
OPENER_POLICY_SAME_ORIGIN_ALLOW_POPUPS = 2,
|
2019-08-08 22:00:00 +03:00
|
|
|
OPENER_POLICY_EMBEDDER_POLICY_REQUIRE_CORP_FLAG = 0x10,
|
|
|
|
OPENER_POLICY_SAME_ORIGIN_EMBEDDER_POLICY_REQUIRE_CORP =
|
|
|
|
OPENER_POLICY_SAME_ORIGIN |
|
2020-02-18 19:39:08 +03:00
|
|
|
OPENER_POLICY_EMBEDDER_POLICY_REQUIRE_CORP_FLAG
|
2019-02-16 01:02:58 +03:00
|
|
|
};
|
|
|
|
|
2019-08-08 21:38:03 +03:00
|
|
|
cenum CrossOriginEmbedderPolicy : 8 {
|
|
|
|
EMBEDDER_POLICY_NULL = 0,
|
|
|
|
EMBEDDER_POLICY_REQUIRE_CORP = 1,
|
2022-06-27 20:07:15 +03:00
|
|
|
EMBEDDER_POLICY_CREDENTIALLESS = 2,
|
2019-03-12 11:04:01 +03:00
|
|
|
};
|
2020-05-19 15:50:39 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* 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
|
2020-06-29 12:34:54 +03:00
|
|
|
* the workers' scope.
|
2020-05-19 15:50:39 +03:00
|
|
|
*/
|
|
|
|
[infallible] attribute nsILoadInfo_CrossOriginEmbedderPolicy
|
|
|
|
loadingEmbedderPolicy;
|
2021-03-30 03:52:31 +03:00
|
|
|
|
2022-07-27 23:33:19 +03:00
|
|
|
/**
|
|
|
|
* This attribute will be true if the top level document has COEP:
|
|
|
|
* credentialless enabled in Origin Trial.
|
|
|
|
*/
|
|
|
|
[infallible] attribute boolean isOriginTrialCoepCredentiallessEnabledForTopLevel;
|
2021-03-30 03:52:31 +03:00
|
|
|
/**
|
|
|
|
* This attribute will be true if this is a load triggered by a media
|
|
|
|
* element.
|
|
|
|
*/
|
|
|
|
[infallible] attribute boolean isMediaRequest;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This attribute will be true if this is a load triggered by a media
|
|
|
|
* element and it's an initial request.
|
|
|
|
*/
|
|
|
|
[infallible] attribute boolean isMediaInitialRequest;
|
2021-06-02 22:46:19 +03:00
|
|
|
|
2021-07-03 02:11:55 +03:00
|
|
|
/**
|
|
|
|
* This attribute will be true if the fetch request is from object or embed
|
|
|
|
* elements
|
|
|
|
*/
|
|
|
|
[infallible] attribute boolean isFromObjectOrEmbed;
|
2022-07-05 12:18:31 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* This attribute will be true if the URL is known to be possibly broken and
|
|
|
|
* CheckForBrokenChromeURL and RecordZeroLengthEvent should be skipped.
|
|
|
|
*/
|
|
|
|
[infallible] readonly attribute boolean shouldSkipCheckForBrokenURLOrZeroSized;
|
|
|
|
|
2021-06-02 22:46:19 +03:00
|
|
|
/**
|
|
|
|
* If this is non-null, this property holds the URI as it was before query
|
|
|
|
* stripping was performed.
|
|
|
|
*/
|
|
|
|
attribute nsIURI unstrippedURI;
|
2022-10-01 01:39:23 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Propagated information from InterceptedHttpChannel
|
|
|
|
* It should be null when the channel is not created from FetchEvent.request
|
|
|
|
* or ServiceWorker NavigationPreload.
|
|
|
|
* nsIFetchEventInfo is C++ only, so it is not an attribute.
|
|
|
|
*/
|
|
|
|
[noscript, notxpcom, nostdcall, binaryname(InterceptionInfo)]
|
|
|
|
nsIInterceptionInfo binaryInterceptionInfo();
|
|
|
|
|
|
|
|
[noscript, notxpcom, nostdcall, binaryname(SetInterceptionInfo)]
|
|
|
|
void binarySetInterceptionInfo(in nsIInterceptionInfo info);
|
2022-12-16 11:54:51 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Whether nsICookieInjector has injected a cookie for this request to
|
|
|
|
* handle a cookie banner. This is only done for top-level requests.
|
|
|
|
*/
|
|
|
|
[infallible] attribute boolean hasInjectedCookieForCookieBannerHandling;
|
2023-10-11 20:49:42 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Whether the load has gone through the URL bar, where the fixup had to add * the protocol scheme.
|
|
|
|
*/
|
|
|
|
[infallible] attribute boolean wasSchemelessInput;
|
2024-06-24 15:56:31 +03:00
|
|
|
|
|
|
|
cenum HTTPSUpgradeTelemetryType : 32 {
|
2024-07-17 18:29:24 +03:00
|
|
|
NOT_INITIALIZED = 0,
|
|
|
|
NO_UPGRADE = (1 << 0),
|
|
|
|
ALREADY_HTTPS = (1 << 1),
|
|
|
|
HSTS = (1 << 2),
|
|
|
|
HTTPS_ONLY_UPGRADE = (1 << 3),
|
|
|
|
HTTPS_ONLY_UPGRADE_DOWNGRADE = (1 << 4),
|
|
|
|
HTTPS_FIRST_UPGRADE = (1 << 5),
|
|
|
|
HTTPS_FIRST_UPGRADE_DOWNGRADE = (1 << 6),
|
|
|
|
HTTPS_FIRST_SCHEMELESS_UPGRADE = (1 << 7),
|
|
|
|
HTTPS_FIRST_SCHEMELESS_UPGRADE_DOWNGRADE = (1 << 8),
|
2024-07-30 19:20:25 +03:00
|
|
|
CSP_UIR = (1 << 9),
|
|
|
|
HTTPS_RR = (1 << 10),
|
|
|
|
WEB_EXTENSION_UPGRADE = (1 << 11),
|
|
|
|
UPGRADE_EXCEPTION = (1 << 12),
|
2024-10-18 10:52:58 +03:00
|
|
|
SKIP_HTTPS_UPGRADE = (1 << 13),
|
2024-06-24 15:56:31 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Solely for the use of collecting Telemetry for HTTPS upgrades.
|
|
|
|
*/
|
|
|
|
[infallible] attribute nsILoadInfo_HTTPSUpgradeTelemetryType httpsUpgradeTelemetry;
|
|
|
|
|
2024-09-03 19:00:23 +03:00
|
|
|
/**
|
|
|
|
* Is this the first load in a new pop-up window/tab?
|
|
|
|
*/
|
|
|
|
[infallible] attribute boolean isNewWindowTarget;
|
|
|
|
|
2024-10-18 10:52:58 +03:00
|
|
|
/**
|
|
|
|
* When true, this load will never be upgraded to HTTPS.
|
|
|
|
*/
|
|
|
|
[infallible] attribute boolean skipHTTPSUpgrade;
|
2014-07-10 10:56:36 +04:00
|
|
|
};
|