tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

nsILoadInfo.idl (67647B)


      1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
      2 * vim: ft=cpp tw=78 sw=2 et ts=2 sts=2 cin
      3 * This Source Code Form is subject to the terms of the Mozilla Public
      4 * License, v. 2.0. If a copy of the MPL was not distributed with this
      5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
      6 
      7 #include "nsISupports.idl"
      8 #include "nsIContentPolicy.idl"
      9 #include "nsIScriptSecurityManager.idl"
     10 #include "nsIInterceptionInfo.idl"
     11 
     12 interface nsIChannel;
     13 interface nsIContentSecurityPolicy;
     14 interface nsIPolicyContainer;
     15 interface nsICookieJarSettings;
     16 interface nsICSPEventListener;
     17 interface nsINode;
     18 interface nsIPrincipal;
     19 interface nsIRedirectHistoryEntry;
     20 interface nsIURI;
     21 webidl Document;
     22 webidl BrowsingContext;
     23 native LoadContextRef(already_AddRefed<nsISupports>);
     24 %{C++
     25 #include "nsTArray.h"
     26 #include "mozilla/dom/UserNavigationInvolvement.h"
     27 #include "mozilla/LoadTainting.h"
     28 #include "mozilla/OriginAttributes.h"
     29 #include "mozilla/UniquePtr.h"
     30 #include "nsRFPService.h"
     31 #include "nsStringFwd.h"
     32 
     33 namespace mozilla {
     34 namespace dom {
     35 class ClientInfo;
     36 class ClientSource;
     37 struct FeaturePolicyInfo;
     38 class PerformanceStorage;
     39 class ServiceWorkerDescriptor;
     40 enum class RequestMode : uint8_t;
     41 enum class ForceMediaDocument : uint8_t;
     42 } // namespace dom
     43 } // namespace mozilla
     44 %}
     45 
     46 [ref] native nsIRedirectHistoryEntryArray(const nsTArray<nsCOMPtr<nsIRedirectHistoryEntry>>);
     47 native OriginAttributes(mozilla::OriginAttributes);
     48 [ref] native const_OriginAttributesRef(const mozilla::OriginAttributes);
     49 [ref] native CStringArrayRef(const nsTArray<nsCString>);
     50 [ref] native StringArrayRef(const nsTArray<nsString>);
     51 [ref] native Uint64ArrayRef(const nsTArray<uint64_t>);
     52 [ref] native PrincipalArrayRef(const nsTArray<nsCOMPtr<nsIPrincipal>>);
     53 [ref] native const_ClientInfoRef(const mozilla::dom::ClientInfo);
     54      native UniqueClientSource(mozilla::UniquePtr<mozilla::dom::ClientSource>);
     55      native UniqueClientSourceMove(mozilla::UniquePtr<mozilla::dom::ClientSource>&&);
     56 [ref] native const_MaybeClientInfoRef(const mozilla::Maybe<mozilla::dom::ClientInfo>);
     57 [ref] native const_ServiceWorkerDescriptorRef(const mozilla::dom::ServiceWorkerDescriptor);
     58 [ref] native const_MaybeServiceWorkerDescriptorRef(const mozilla::Maybe<mozilla::dom::ServiceWorkerDescriptor>);
     59 [ref] native const_MaybeRFPTargetSet(const mozilla::Maybe<mozilla::RFPTargetSet>);
     60      native RFPTargetSet(mozilla::RFPTargetSet);
     61 [ptr] native PerformanceStoragePtr(mozilla::dom::PerformanceStorage);
     62      native LoadTainting(mozilla::LoadTainting);
     63      native CSPRef(already_AddRefed<nsIContentSecurityPolicy>);
     64      native PolicyContainerRef(already_AddRefed<nsIPolicyContainer>);
     65      native MaybeFeaturePolicyInfo(mozilla::Maybe<mozilla::dom::FeaturePolicyInfo>);
     66 [ref] native const_FeaturePolicyInfoRef(const mozilla::dom::FeaturePolicyInfo);
     67      native MaybeRequestMode(mozilla::Maybe<mozilla::dom::RequestMode>);
     68      native ForceMediaDocument(mozilla::dom::ForceMediaDocument);
     69 
     70 typedef unsigned long nsSecurityFlags;
     71 
     72 /**
     73 * The LoadInfo object contains information about a network load, why it
     74 * was started, and how we plan on using the resulting response.
     75 * If a network request is redirected, the new channel will receive a new
     76 * LoadInfo object. The new object will contain mostly the same
     77 * information as the pre-redirect one, but updated as appropriate.
     78 * For detailed information about what parts of LoadInfo are updated on
     79 * redirect, see documentation on individual properties.
     80 */
     81 [scriptable, builtinclass, uuid(ddc65bf9-2f60-41ab-b22a-4f1ae9efcd36)]
     82 interface nsILoadInfo : nsISupports
     83 {
     84  /**
     85   * The following five flags determine the security mode and hence what kind of
     86   * security checks should be performed throughout the lifetime of the channel.
     87   *
     88   *    * SEC_REQUIRE_SAME_ORIGIN_INHERITS_SEC_CONTEXT
     89   *    * SEC_REQUIRE_SAME_ORIGIN_DATA_IS_BLOCKED
     90   *    * SEC_ALLOW_CROSS_ORIGIN_INHERITS_SEC_CONTEXT
     91   *    * SEC_ALLOW_CROSS_ORIGIN_SEC_CONTEXT_IS_NULL
     92   *    * SEC_REQUIRE_CORS_INHERITS_SEC_CONTEXT
     93   *
     94   * Exactly one of these flags are required to be set in order to allow
     95   * the channel to perform the correct security checks (SOP, CORS, ...) and
     96   * return the correct result principal. If none or more than one of these
     97   * flags are set AsyncOpen will fail.
     98   */
     99 
    100   /**
    101    * Warning: Never use this flag when creating a new channel!
    102    * Only use this flag if you have to create a temporary LoadInfo
    103    * for performing an explicit nsIContentPolicy check, like e.g.
    104    * when loading something from the cache that needs an explicit
    105    * nsIContentPolicy check. In all other cases pick one of the
    106    * security flags underneath.
    107    */
    108  const unsigned long SEC_ONLY_FOR_EXPLICIT_CONTENTSEC_CHECK = 0;
    109 
    110  /*
    111   * Enforce the same origin policy where loads inherit the principal.
    112   * See the documentation for principalToInherit, which describes exactly what
    113   * principal is inherited.
    114   */
    115  const unsigned long SEC_REQUIRE_SAME_ORIGIN_INHERITS_SEC_CONTEXT = (1<<0);
    116 
    117  /*
    118   * Enforce the same origin policy and data: loads are blocked.
    119   */
    120  const unsigned long SEC_REQUIRE_SAME_ORIGIN_DATA_IS_BLOCKED = (1<<1);
    121 
    122  /**
    123   * Allow loads from other origins. Loads which inherit the principal should
    124   * see the documentation for principalToInherit, which describes exactly what
    125   * principal is inherited.
    126   *
    127   * Commonly used by plain <img>, <video>, <link rel=stylesheet> etc.
    128   */
    129  const unsigned long SEC_ALLOW_CROSS_ORIGIN_INHERITS_SEC_CONTEXT = (1 << 2);
    130 
    131  /**
    132   * Allow loads from other origins. Loads from data: will be allowed,
    133   * but the resulting resource will get a null principal.
    134   * Used in blink/webkit for <iframe>s. Likely also the mode
    135   * that should be used by most Chrome code.
    136   */
    137  const unsigned long SEC_ALLOW_CROSS_ORIGIN_SEC_CONTEXT_IS_NULL = (1<<3);
    138 
    139  /**
    140   * Allow loads from any origin, but require CORS for cross-origin loads.
    141   * See the documentation for principalToInherit, which describes exactly what
    142   * principal is inherited.
    143   *
    144   * Commonly used by <img crossorigin>, <video crossorigin>,
    145   * XHR, fetch(), etc.
    146   */
    147  const unsigned long SEC_REQUIRE_CORS_INHERITS_SEC_CONTEXT = (1<<4);
    148 
    149  /**
    150   * Choose cookie policy. The default policy is equivalent to "INCLUDE" for
    151   * SEC_REQUIRE_SAME_ORIGIN_* and SEC_ALLOW_CROSS_ORIGIN_* modes, and
    152   * equivalent to "SAME_ORIGIN" for SEC_REQUIRE_CORS_INHERITS_SEC_CONTEXT mode.
    153   *
    154   * This means that if you want to perform a CORS load with credentials, pass
    155   * SEC_COOKIES_INCLUDE.
    156   *
    157   * Note that these flags are still subject to the user's cookie policies.
    158   * For example, if the user is blocking 3rd party cookies, those cookies
    159   * will be blocked no matter which of these flags are set.
    160   */
    161  const unsigned long SEC_COOKIES_DEFAULT = (0 << 5);
    162  const unsigned long SEC_COOKIES_INCLUDE = (1 << 5);
    163  const unsigned long SEC_COOKIES_SAME_ORIGIN = (2 << 5);
    164  const unsigned long SEC_COOKIES_OMIT = (3 << 5);
    165 
    166  /**
    167   * Force inheriting of the principal.  See the documentation for
    168   * principalToInherit, which describes exactly what principal is inherited.
    169   *
    170   * Setting this flag will cause GetChannelResultPrincipal to return the
    171   * principal to be inherited as the channel principal.
    172   *
    173   * This will happen independently of the scheme of the URI that the
    174   * channel is loading.
    175   *
    176   * So if the principal that gets inherited is "http://a.com/", and the channel
    177   * is loading the URI "http://b.com/whatever", GetChannelResultPrincipal
    178   * will return a principal from "http://a.com/".
    179   *
    180   * This flag can not be used together with SANDBOXED_ORIGIN sandbox flag.  If
    181   * both are passed to the LoadInfo constructor then this flag will be dropped.
    182   * If you need to know whether this flag would have been present but was dropped
    183   * due to sandboxing, check for the forceInheritPrincipalDropped flag.
    184   */
    185  const unsigned long SEC_FORCE_INHERIT_PRINCIPAL = (1<<7);
    186 
    187  /**
    188   * Inherit the Principal for about:blank.
    189   */
    190  const unsigned long SEC_ABOUT_BLANK_INHERITS = (1<<9);
    191 
    192  /**
    193   * Allow access to chrome: packages that are content accessible.
    194   */
    195  const unsigned long SEC_ALLOW_CHROME = (1<<10);
    196 
    197  /**
    198   * Disallow access to javascript: uris.
    199   */
    200  const unsigned long SEC_DISALLOW_SCRIPT = (1<<11);
    201 
    202  /**
    203   * Don't follow redirects. Instead the redirect response is returned
    204   * as a successful response for the channel.
    205   *
    206   * Redirects not initiated by a server response, i.e. REDIRECT_INTERNAL and
    207   * REDIRECT_STS_UPGRADE, are still followed.
    208   *
    209   * Note: If this flag is set and the channel response is a redirect, then
    210   * the response body might not be available.
    211   * This can happen if the redirect was cached.
    212   */
    213  const unsigned long SEC_DONT_FOLLOW_REDIRECTS = (1<<12);
    214 
    215  /**
    216   * Load an error page, it should be one of following : about:neterror,
    217   * about:certerror, about:blocked, about:tabcrashed or about:restartrequired.
    218   */
    219  const unsigned long SEC_LOAD_ERROR_PAGE = (1<<13);
    220 
    221  /**
    222   * Force inheriting of the principal, overruling any owner that might be set
    223   * on the channel. (Please note that channel.owner is deprecated and will be
    224   * removed within Bug 1286838).  See the documentation for principalToInherit,
    225   * which describes exactly what principal is inherited.
    226   *
    227   * Setting this flag will cause GetChannelResultPrincipal to return the
    228   * principal to be inherited as the channel principal.
    229   *
    230   * This will happen independently of the scheme of the URI that the
    231   * channel is loading.
    232   */
    233  const unsigned long SEC_FORCE_INHERIT_PRINCIPAL_OVERRULE_OWNER = (1<<14);
    234 
    235  /**
    236   * This is the principal of the network request's caller/requester where
    237   * the resulting resource will be used. I.e. it is the principal which
    238   * will get access to the result of the request. (Where "get access to"
    239   * might simply mean "embed" depending on the type of resource that is
    240   * loaded).
    241   *
    242   * For example for an image, it is the principal of the document where
    243   * the image is rendered. For a stylesheet it is the principal of the
    244   * document where the stylesheet will be applied.
    245   *
    246   * So if document at http://a.com/page.html loads an image from
    247   * http://b.com/pic.jpg, then loadingPrincipal will be
    248   * http://a.com/page.html.
    249   *
    250   * For <iframe> and <frame> loads, the LoadingPrincipal is the
    251   * principal of the parent document. For top-level loads, the
    252   * LoadingPrincipal is null. For all loads except top-level loads
    253   * the LoadingPrincipal is never null.
    254   *
    255   * If the loadingPrincipal is the system principal, no security checks
    256   * will be done at all. There will be no security checks on the initial
    257   * load or any subsequent redirects. This means there will be no
    258   * nsIContentPolicy checks or any CheckLoadURI checks. Because of
    259   * this, never set the loadingPrincipal to the system principal when
    260   * the URI to be loaded is controlled by a webpage.
    261   * If the loadingPrincipal and triggeringPrincipal are both
    262   * content principals, then we will always call into
    263   * nsIContentPolicies and CheckLoadURI. The call to nsIContentPolicies
    264   * and CheckLoadURI happen even if the URI to be loaded is same-origin
    265   * with the loadingPrincipal or triggeringPrincipal.
    266   */
    267  readonly attribute nsIPrincipal loadingPrincipal;
    268 
    269  /**
    270   * A C++-friendly version of triggeringPrincipal.
    271   *
    272   * This is a bit awkward because we can't use
    273   * binaryname(GetLoadingPrincipal).
    274   */
    275  [noscript, notxpcom, nostdcall]
    276  nsIPrincipal virtualGetLoadingPrincipal();
    277 
    278 %{C++
    279  nsIPrincipal* GetLoadingPrincipal() {
    280    return VirtualGetLoadingPrincipal();
    281  }
    282 %}
    283 
    284  /**
    285   * This is the principal which caused the network load to start. I.e.
    286   * this is the principal which provided the URL to be loaded. This is
    287   * often the same as the LoadingPrincipal, but there are a few cases
    288   * where that's not true.
    289   *
    290   * For example for loads into an <iframe>, the LoadingPrincipal is always
    291   * the principal of the parent document. However the triggeringPrincipal
    292   * is the principal of the document which provided the URL that the
    293   * <iframe> is navigating to. This could be the previous document inside
    294   * the <iframe> which set document.location. Or a document elsewhere in
    295   * the frame tree which contained a <a target="..."> which targetted the
    296   * <iframe>.
    297   *
    298   * If a stylesheet links to a sub-resource, like an @imported stylesheet,
    299   * or a background image, then the triggeringPrincipal is the principal
    300   * of the stylesheet, while the LoadingPrincipal is the principal of the
    301   * document being styled.
    302   *
    303   * The triggeringPrincipal is never null.
    304   *
    305   * If the triggeringPrincipal is the system principal, no security checks
    306   * will be done at all. There will be no security checks on the initial
    307   * load or any subsequent redirects. This means there will be no
    308   * nsIContentPolicy checks or any CheckLoadURI checks. Because of
    309   * this, never set the triggeringPrincipal to the system principal when
    310   * the URI to be loaded is controlled by a webpage.
    311   * If the loadingPrincipal and triggeringPrincipal are both
    312   * content principals, then we will always call into
    313   * nsIContentPolicies and CheckLoadURI. The call to nsIContentPolicies
    314   * and CheckLoadURI happen even if the URI to be loaded is same-origin
    315   * with the loadingPrincipal or triggeringPrincipal.
    316   */
    317  readonly attribute nsIPrincipal triggeringPrincipal;
    318 
    319  /**
    320   * This method is intended to override the triggering principal
    321   * in test environments.
    322   */
    323  void setTriggeringPrincipalForTesting(in nsIPrincipal aPrincipal);
    324 
    325  /**
    326   * A C++-friendly version of triggeringPrincipal.
    327   */
    328  [noscript, notxpcom, nostdcall, binaryname(TriggeringPrincipal)]
    329  nsIPrincipal binaryTriggeringPrincipal();
    330 
    331  /**
    332   * The remote type of the process which caused the network load to start. I.e.
    333   * this is the remote type of the process which provided the URL to be loaded.
    334   *
    335   * For subresource loads, this should be the same as the process which will
    336   * handle the response, however for document loads this may both be different
    337   * than the final process, as well as different from the process which starts
    338   * the navigation.
    339   *
    340   * This field is intentionally not perfectly preserved over IPC, and will be
    341   * reset to the remote type of the sending process when sent from a content
    342   * process to the parent process.
    343   */
    344  attribute AUTF8String triggeringRemoteType;
    345 
    346  /**
    347   * For non-document loads the principalToInherit is always null. For
    348   * loads of type TYPE_DOCUMENT or TYPE_SUBDOCUMENT the principalToInherit
    349   * might be null. If it's non null, then this is the principal that is
    350   * inherited if a principal needs to be inherited. If the principalToInherit
    351   * is null but the inherit flag is set, then the triggeringPrincipal is
    352   * the principal that is inherited.
    353   */
    354  attribute nsIPrincipal principalToInherit;
    355 
    356  /**
    357   * A C++-friendly version of principalToInherit.
    358   */
    359  [noscript, notxpcom, nostdcall, binaryname(PrincipalToInherit)]
    360  nsIPrincipal binaryPrincipalToInherit();
    361 
    362  /**
    363   * Finds the correct principal to inherit for the given channel, based on
    364   * the values of PrincipalToInherit and TriggeringPrincipal.
    365   */
    366  [noscript, notxpcom, nostdcall]
    367  nsIPrincipal FindPrincipalToInherit(in nsIChannel aChannel);
    368 
    369  /**
    370   * This is the ownerDocument of the LoadingNode. Unless the LoadingNode
    371   * is a Document, in which case the LoadingDocument is the same as the
    372   * LoadingNode.
    373   *
    374   * For top-level loads, and for loads originating from workers, the
    375   * LoadingDocument is null. When the LoadingDocument is not null, the
    376   * LoadingPrincipal is set to the principal of the LoadingDocument.
    377   */
    378  readonly attribute Document loadingDocument;
    379 
    380  /**
    381   * A C++-friendly version of loadingDocument (loadingNode).
    382   * This is the Node where the resulting resource will be used. I.e. it is
    383   * the Node which will get access to the result of the request. (Where
    384   * "get access to" might simply mean "embed" depending on the type of
    385   * resource that is loaded).
    386   *
    387   * For example for an <img>/<video> it is the image/video element. For
    388   * document loads inside <iframe> and <frame>s, the LoadingNode is the
    389   * <iframe>/<frame> element. For an XMLHttpRequest, it is the Document
    390   * which contained the JS which initiated the XHR. For a stylesheet, it
    391   * is the Document that contains <link rel=stylesheet>.
    392   *
    393   * For loads triggered by the HTML pre-parser, the LoadingNode is the
    394   * Document which is currently being parsed.
    395   *
    396   * For top-level loads, and for loads originating from workers, the
    397   * LoadingNode is null. If the LoadingNode is non-null, then the
    398   * LoadingPrincipal is the principal of the LoadingNode.
    399   */
    400  [noscript, notxpcom, nostdcall, binaryname(LoadingNode)]
    401  nsINode binaryLoadingNode();
    402 
    403  /**
    404   * A C++ friendly version of the loadingContext for toplevel loads.
    405   * Most likely you want to query the ownerDocument or LoadingNode
    406   * and not this context only available for TYPE_DOCUMENT loads.
    407   * Please note that except for loads of TYPE_DOCUMENT, this
    408   * ContextForTopLevelLoad will always return null.
    409   */
    410  [noscript, notxpcom, nostdcall, binaryname(ContextForTopLevelLoad)]
    411  LoadContextRef binaryContextForTopLevelLoad();
    412 
    413  /**
    414   * For all loads except loads of TYPE_DOCUMENT, the loadingContext
    415   * simply returns the loadingNode. For loads of TYPE_DOCUMENT this
    416   * will return the context available for top-level loads which
    417   * do not have a loadingNode.
    418   */
    419  [binaryname(LoadingContextXPCOM)]
    420  readonly attribute nsISupports loadingContext;
    421 
    422  /**
    423   * A C++ friendly version of the loadingContext.
    424   */
    425  [noscript, notxpcom, nostdcall, binaryname(GetLoadingContext)]
    426  LoadContextRef binaryGetLoadingContext();
    427 
    428  /**
    429   * The securityFlags of that channel.
    430   */
    431  readonly attribute nsSecurityFlags securityFlags;
    432 
    433 %{C++
    434  inline nsSecurityFlags GetSecurityFlags()
    435  {
    436    nsSecurityFlags result;
    437    mozilla::DebugOnly<nsresult> rv = GetSecurityFlags(&result);
    438    MOZ_ASSERT(NS_SUCCEEDED(rv));
    439    return result;
    440  }
    441 %}
    442 
    443  /**
    444   * The sandboxFlags of that channel.
    445   */
    446  [infallible] readonly attribute unsigned long sandboxFlags;
    447 
    448  /**
    449  *   The TriggingSandboxFlags are the SandboxFlags of the entity
    450  *   responsible for causing the load to occur.
    451  */
    452  [infallible] attribute unsigned long triggeringSandboxFlags;
    453 
    454 
    455  /**
    456  * The window id and storage access status of the window of the
    457  * context that triggered the load. This is used to allow self-initiated
    458  * same-origin navigations to propogate their "has storage access" bit
    459  * to the next Document.
    460  */
    461  [infallible] attribute unsigned long long triggeringWindowId;
    462  [infallible] attribute boolean triggeringStorageAccess;
    463 
    464  /**
    465   * The classification flags of the first-party context responsible for causing
    466   * the load to start. If the load is not triggered by a first-party context,
    467   * this will be 0.
    468   *
    469   * See nsIClassifiedChannel.idl for the list of flags.
    470   */
    471  [infallible] attribute unsigned long triggeringFirstPartyClassificationFlags;
    472 
    473  /**
    474   * The classification flags of the third-party context responsible for causing
    475   * the load to start. If the load is not triggered by a third-party context,
    476   * this will be 0.
    477   *
    478   * See nsIClassifiedChannel.idl for the list of flags.
    479   */
    480  [infallible] attribute unsigned long triggeringThirdPartyClassificationFlags;
    481 
    482  /**
    483   * Allows to query only the security mode bits from above.
    484   */
    485  [infallible] readonly attribute unsigned long securityMode;
    486 
    487  /**
    488   * This flag is used for any browsing context where we should not sniff
    489   * the content type. E.g if an iframe has the XCTO nosniff header, then
    490   * that flag is set to true so we skip content sniffing for that browsing
    491   * context.
    492   */
    493  [infallible] attribute boolean skipContentSniffing;
    494 
    495  /**
    496   * (default) If this flag is set, it has not yet been determined if the
    497   * HTTPS-Only mode will upgrade the request.
    498   */
    499  const unsigned long HTTPS_ONLY_UNINITIALIZED = (1 << 0);
    500 
    501  /**
    502   * Indicates that this is the first time the request gets upgraded, and thus
    503   * the HTTPS-Only StreamListener hasn't been registered yet. Even though there
    504   * might be multiple channels per request that have to be upgraded (e.g.,
    505   * because of redirects), the StreamListener only has to be attached to one
    506   * channel.
    507   */
    508  const unsigned long HTTPS_ONLY_UPGRADED_LISTENER_NOT_REGISTERED = (1 << 1);
    509 
    510  /**
    511   * Indicates that the request will get upgraded, and the HTTPS-Only
    512   * StreamListener got registered.
    513   */
    514  const unsigned long HTTPS_ONLY_UPGRADED_LISTENER_REGISTERED = (1 << 2);
    515 
    516  /**
    517   * This flag can be manually set if the HTTPS-Only mode should exempt the
    518   * request and not upgrade it. (e.g in the case of OCSP.
    519   */
    520  const unsigned long HTTPS_ONLY_EXEMPT = (1 << 3);
    521 
    522  /**
    523   * This flag can only ever be set on top-level loads. It indicates
    524   * that the top-level https connection succeeded. This flag is mostly
    525   * used to counter time-outs which allows to cancel the channel
    526   * if the https load has not started.
    527   */
    528  const unsigned long HTTPS_ONLY_TOP_LEVEL_LOAD_IN_PROGRESS = (1 << 4);
    529 
    530   /**
    531   * This flag can only ever be set on downloads. It indicates
    532   * that the download https connection succeeded. This flag is mostly
    533   * used to counter time-outs which allows to cancel the channel
    534   * if the https load has not started.
    535   */
    536  const unsigned long HTTPS_ONLY_DOWNLOAD_IN_PROGRESS = (1 << 5);
    537 
    538  /**
    539   * This flag indicates that the request should not be logged to the
    540   * console.
    541   */
    542  const unsigned long HTTPS_ONLY_DO_NOT_LOG_TO_CONSOLE = (1 << 6);
    543 
    544  /**
    545   * This flag indicates that the request was upgraded by https-first mode.
    546   */
    547  const unsigned long HTTPS_ONLY_UPGRADED_HTTPS_FIRST = (1 << 7);
    548 
    549  /**
    550   * This flag indicates that the request should not be blocked by ORB.
    551   */
    552  const unsigned long HTTPS_ONLY_BYPASS_ORB = (1 << 8);
    553 
    554  /**
    555   * Upgrade state of HTTPS-Only Mode. The flag HTTPS_ONLY_EXEMPT can get
    556   * set on requests that should be excempt from an upgrade.
    557   */
    558  [infallible] attribute unsigned long httpsOnlyStatus;
    559 
    560  /**
    561   * Reflects whetehr this is an HTTP Strict Transport Security host
    562   */
    563  [infallible] attribute boolean hstsStatus;
    564 
    565  /**
    566   * Returns true if at the time of the loadinfo construction the document
    567   * that triggered this load has the bit hasValidTransientUserGestureActivation
    568   * set or the load was triggered from External. (Mostly this bool is used
    569   * in the context of Sec-Fetch-User.)
    570   */
    571  [infallible] attribute boolean hasValidUserGestureActivation;
    572 
    573  /**
    574   * Returns true if at the time of the loadinfo construction the document that
    575   * triggered this load was user activated. This flag is being used to indicate
    576   * whether a document load with a text fragment is allowed to scroll to the
    577   * first text directive.
    578   */
    579  [infallible] attribute boolean textDirectiveUserActivation;
    580 
    581  /**
    582   * Returns true if the current load is a same-document navigation.
    583   *
    584   * Note: There exists no IPC plumbing for this field. If this object crosses
    585   *       a process boundary, it is not same-document, and the value defaults
    586   *       to false.
    587   * Also note: This flag is only meant to be used for a specific case when
    588   *            scrolling to a text fragment: If a same-doc load is triggered
    589   *            during the initial document load, and the target text has not
    590   *            been parsed.
    591   *            The flag is not being reset. If you want to use this flag for
    592   *            another reason, don't. Check Bug 1777171 for a stable solution.
    593   */
    594  [infallible] attribute boolean isSameDocumentNavigation;
    595 
    596  /**
    597   * We disallow the SystemPrincipal to initiate requests to
    598   * the public web. This flag is to allow exceptions.
    599   */
    600  [infallible] attribute boolean allowDeprecatedSystemRequests;
    601 
    602  /**
    603   * Only ever returns true if the loadinfo is of TYPE_SCRIPT and
    604   * the script was created by the HTML parser.
    605   */
    606  [infallible] attribute boolean parserCreatedScript;
    607 
    608  /**
    609   * Request mode of the request. This is only set by ScriptLoader
    610   * for script loads.
    611   */
    612  [noscript]
    613  attribute MaybeRequestMode requestMode;
    614 
    615  /**
    616   * True if this request is known to have been triggered by a user
    617   * manually requesting the URI to be saved.
    618   */
    619  [infallible] attribute boolean isUserTriggeredSave;
    620 
    621  /**
    622   * True if this request is from DevTools.
    623   */
    624  [infallible] attribute boolean isInDevToolsContext;
    625 
    626  /**
    627   * True if this request is embedded in a context that can't be third-party
    628   * (i.e. an iframe embedded in a cross-origin parent window). If this is
    629   * false, then this request may be third-party if it's a third-party to
    630   * loadingPrincipal.
    631   */
    632  [infallible] attribute boolean isInThirdPartyContext;
    633 
    634  /**
    635   * True if this request is a third party in respect to the top-level window.
    636   *
    637   * Note that this doesn't consider the parent window. I.e. It will still
    638   * return false even in the case that the parent is cross-origin but the
    639   * top-level is same-origin.
    640   *
    641   * This value would be set during opening the channel in parent and propagate
    642   * to the channel in the content.
    643   */
    644  [infallible] attribute boolean isThirdPartyContextToTopWindow;
    645 
    646  /**
    647   * True if this request is on the third-party cookie blocking exception list.
    648   *
    649   * This value would be set during opening the channel in parent and propagate
    650   * to the channel in the content.
    651   */
    652  [infallible] attribute boolean isOn3PCBExceptionList;
    653 
    654  /**
    655   * See the SEC_COOKIES_* flags above. This attribute will never return
    656   * SEC_COOKIES_DEFAULT, but will instead return what the policy resolves to.
    657   * I.e. SEC_COOKIES_SAME_ORIGIN for CORS mode, and SEC_COOKIES_INCLUDE
    658   * otherwise.
    659   */
    660  [infallible] readonly attribute unsigned long cookiePolicy;
    661 
    662  /**
    663   * The cookie jar settings inherited from the top-level document's loadInfo.
    664   * It cannot be null.
    665   */
    666  attribute nsICookieJarSettings cookieJarSettings;
    667 
    668  cenum StoragePermissionState : 8 {
    669    NoStoragePermission = 0,
    670    HasStoragePermission = 1,
    671    StoragePermissionAllowListed = 2,
    672    // Value for Storage-Access-Headers. Like NoStoragePermission, but on a channel that can potentially
    673    // have access to unpartitioned cookies.
    674    // XXX(Bug 1978856): If this is considered to be not useful, this variant can be removed.
    675    DisabledStoragePermission = 3,
    676    // Value for Storage-Access-Headers. The user has granted storage-access permissions previously,
    677    // but in this request we partition the storage. Website can simply elevate to unpartitioned cookies
    678    // by running document.requestStoragePermission()
    679    InactiveStoragePermission = 4,
    680  };
    681 
    682 /**
    683 * IP AddressSpace - For classifying IP Addresses into different categories based on their vicinity to the user.
    684 * Ref https://wicg.github.io/private-network-access/#ip-address-space
    685 */
    686  cenum IPAddressSpace : 8 {
    687    Unknown = 0,
    688    Local = 1,
    689    Private = 2,
    690    Public = 3,
    691    Invalid,
    692  };
    693 
    694 /**
    695 * IP AddressSpace of the resource being loaded. This will be set after connection to the server has been established.
    696 * This is used to check if the request crosses address boundaries between public to a more private address space.
    697 */
    698  [infallible] attribute nsILoadInfo_IPAddressSpace ipAddressSpace;
    699 
    700 /**
    701 * IP AddressSpace of the document/sub-document that trigeered this request.
    702 * This will be set from the browsing context of the document that triggered this request.
    703 */
    704  [infallible] attribute nsILoadInfo_IPAddressSpace parentIpAddressSpace;
    705 
    706  /**
    707   * The result of the storage permission check of the loading document. This
    708   * value would be set during opening the channel.
    709   */
    710  [infallible] attribute nsILoadInfo_StoragePermissionState
    711        storagePermission;
    712 
    713  /**
    714   * Get the granular overrides of fingerprinting protections associated to the
    715   * channel, the value will override the default fingerprinting protection
    716   * settings. This field will only get populated if these is one that comes
    717   * from the local granular overrides pref or WebCompat. Otherwise, a value of
    718   * Nothing() indicates no granular overrides are present for this channel.
    719   *
    720   * The RFPTarget defined in the RFPTargets.inc.
    721   */
    722  [noscript, nostdcall, notxpcom]
    723  const_MaybeRFPTargetSet GetOverriddenFingerprintingSettings();
    724 
    725  /**
    726   * Set the granular overrides of fingerprinting protections for the channel.
    727   */
    728  [noscript, nostdcall, notxpcom]
    729  void SetOverriddenFingerprintingSettings(in RFPTargetSet aTargets);
    730 
    731  /**
    732   * True if the load was triggered by a meta refresh.
    733   */
    734  [infallible] attribute boolean isMetaRefresh;
    735 
    736  /**
    737   * If forceInheritPrincipal is true, the data coming from the channel should
    738   * inherit its principal, even when the data is loaded over http:// or another
    739   * protocol that would normally use a URI-based principal.
    740   *
    741   * See the documentation for principalToInherit, which describes exactly what
    742   * principal is inherited.
    743   *
    744   * This attribute will never be true when loadingSandboxed is true.
    745   */
    746  [infallible] readonly attribute boolean forceInheritPrincipal;
    747 
    748  /**
    749   * If forceInheritPrincipalOverruleOwner is true, the data coming from the
    750   * channel should inherit the principal, even when the data is loaded over
    751   * http:// or another protocol that would normally use a URI-based principal
    752   * and even if the channel's .owner is not null.  This last is the difference
    753   * between forceInheritPrincipalOverruleOwner and forceInheritPrincipal: the
    754   * latter does _not_ overrule the .owner setting.
    755   *
    756   * See the documentation for principalToInherit, which describes exactly what
    757   * principal is inherited.
    758   */
    759  [infallible] readonly attribute boolean forceInheritPrincipalOverruleOwner;
    760 
    761  /**
    762   * If loadingSandboxed is true, the data coming from the channel is
    763   * being loaded sandboxed, so it should have a nonce origin and
    764   * hence should use a NullPrincipal.
    765   */
    766  [infallible] readonly attribute boolean loadingSandboxed;
    767 
    768  /**
    769   * If aboutBlankInherits is true, then about:blank should inherit
    770   * the principal.
    771   */
    772  [infallible] readonly attribute boolean aboutBlankInherits;
    773 
    774  /**
    775   * If allowChrome is true, then use nsIScriptSecurityManager::ALLOW_CHROME
    776   * when calling CheckLoadURIWithPrincipal().
    777   */
    778  [infallible] readonly attribute boolean allowChrome;
    779 
    780  /**
    781   * If disallowScript is true, then use nsIScriptSecurityManager::DISALLOW_SCRIPT
    782   * when calling CheckLoadURIWithPrincipal().
    783   */
    784  [infallible] readonly attribute boolean disallowScript;
    785 
    786 %{C++
    787  uint32_t CheckLoadURIFlags() {
    788    uint32_t flags = nsIScriptSecurityManager::STANDARD;
    789    if (GetAllowChrome()) {
    790      flags |= nsIScriptSecurityManager::ALLOW_CHROME;
    791    }
    792    if (GetDisallowScript()) {
    793      flags |= nsIScriptSecurityManager::DISALLOW_SCRIPT;
    794    }
    795    return flags;
    796  }
    797 %}
    798 
    799  /**
    800   * Returns true if SEC_DONT_FOLLOW_REDIRECTS is set.
    801   */
    802  [infallible] readonly attribute boolean dontFollowRedirects;
    803 
    804  /**
    805   * Returns true if SEC_LOAD_ERROR_PAGE is set.
    806   */
    807  [infallible] readonly attribute boolean loadErrorPage;
    808 
    809  /**
    810   * True if the load was initiated by a form request.
    811   */
    812  [infallible] attribute boolean isFormSubmission;
    813 
    814  /**
    815   * True if the load will be a get request.
    816   */
    817  [infallible] attribute boolean isGETRequest;
    818 
    819  /**
    820   * The external contentPolicyType of the channel, used for security checks
    821   * like Mixed Content Blocking and Content Security Policy.
    822   *
    823   * Specifically, content policy types with _INTERNAL_ in their name will
    824   * never get returned from this attribute.
    825   */
    826  readonly attribute nsContentPolicyType externalContentPolicyType;
    827 
    828  /**
    829   * CSP uses this parameter to send or not CSP violation events.
    830   * Default value: true.
    831   */
    832  [infallible] attribute boolean sendCSPViolationEvents;
    833 
    834 %{ C++
    835  inline ExtContentPolicyType GetExternalContentPolicyType()
    836  {
    837    nsContentPolicyType result;
    838    mozilla::DebugOnly<nsresult> rv = GetExternalContentPolicyType(&result);
    839    MOZ_ASSERT(NS_SUCCEEDED(rv));
    840    return static_cast<ExtContentPolicyType>(result);
    841  }
    842 
    843 %}
    844 
    845 
    846  /**
    847   * The internal contentPolicyType of the channel, used for constructing
    848   * RequestContext values when creating a fetch event for an intercepted
    849   * channel.
    850   *
    851   * This should not be used for the purposes of security checks, since
    852   * the content policy implementations cannot be expected to deal with
    853   * _INTERNAL_ values.  Please use the contentPolicyType attribute above
    854   * for that purpose.
    855   */
    856  [noscript, notxpcom, nostdcall, binaryname(InternalContentPolicyType)]
    857  nsContentPolicyType binaryInternalContentPolicyType();
    858 
    859  readonly attribute nsContentPolicyType internalContentPolicyType;
    860 
    861  /**
    862   * Returns the internalContentPolicyType converted to a destination
    863   * string matching the fetch specification.
    864   */
    865  readonly attribute ACString fetchDestination;
    866 
    867  /**
    868   * Returns true if document or any of the documents ancestors
    869   * up to the toplevel document make use of the CSP directive
    870   * 'block-all-mixed-content'.
    871   *
    872   * Warning: If the loadingDocument is null, then the
    873   * blockAllMixedContent is false.
    874   */
    875  [infallible] readonly attribute boolean blockAllMixedContent;
    876 
    877  /**
    878   * Returns true if document or any of the documents ancestors
    879   * up to the toplevel document make use of the CSP directive
    880   * 'upgrade-insecure-requests'.
    881   *
    882   * Warning: If the loadingDocument is null, then the
    883   * upgradeInsecureRequests is false.
    884   */
    885  [infallible] readonly attribute boolean upgradeInsecureRequests;
    886 
    887  /**
    888   * Returns true if the the page is https and the content is upgradable from http
    889   * requires 'security.mixed_content.upgrade_display_content' pref to be true.
    890   * Currently this only upgrades display content but might be expanded to other loads.
    891   * This is very similar in implementation to upgradeInsecureRequests but browser set.
    892   */
    893  [infallible] readonly attribute boolean browserUpgradeInsecureRequests;
    894 
    895  /**
    896   * Returns true if the display content was or will get upgraded from http to https.
    897   * Requires 'security.mixed_content.upgrade_display_content' pref to be true.
    898   * Flag is set purely to collect telemetry.
    899   */
    900  [infallible] attribute boolean browserDidUpgradeInsecureRequests;
    901 
    902  /**
    903   * Returns true if the the page is https and the content is upgradable from http
    904   * requires 'security.mixed_content.upgrade_display_content' pref to be false.
    905   * See browserUpgradeInsecureRequests for more details, this only happens
    906   * when *not* upgrading purely for telemetry.
    907   */
    908  [infallible] readonly attribute boolean browserWouldUpgradeInsecureRequests;
    909 
    910  /**
    911   * If true, toplevel data: URI navigation is allowed
    912   */
    913  [infallible] attribute boolean forceAllowDataURI;
    914 
    915  /**
    916   * If true, insecure redirects to a data: URI are allowed.
    917   */
    918  [infallible] attribute boolean allowInsecureRedirectToDataURI;
    919 
    920  /**
    921   * If not NONE, force the resulting document to load as specific kind of MediaDocument.
    922   */
    923  [noscript] attribute ForceMediaDocument forceMediaDocument;
    924 
    925 %{ C++
    926  mozilla::dom::ForceMediaDocument GetForceMediaDocument()
    927  {
    928    mozilla::dom::ForceMediaDocument forceMediaDocument;
    929    MOZ_ALWAYS_SUCCEEDS(GetForceMediaDocument(&forceMediaDocument));
    930    return forceMediaDocument;
    931  }
    932 %}
    933 
    934  /**
    935   * If true, the content policy security check is excluded from web requests.
    936   */
    937  [infallible] attribute boolean skipContentPolicyCheckForWebRequest;
    938 
    939  /**
    940   * If true, this is the load of a frame's original src attribute
    941   */
    942  [infallible] attribute boolean originalFrameSrcLoad;
    943 
    944  /**
    945   * The SEC_FORCE_INHERIT_PRINCIPAL flag may be dropped when a load info
    946   * object is created.  Specifically, it will be dropped if the SANDBOXED_ORIGIN
    947   * sandbox flag is also present.  This flag is set if SEC_FORCE_INHERIT_PRINCIPAL
    948   * was dropped.
    949   */
    950  [infallible] readonly attribute boolean forceInheritPrincipalDropped;
    951 
    952  /**
    953   * This is the inner window ID of the window in which the element being
    954   * loaded lives.
    955   *
    956   * Note that this window ID can be 0 if the window is not
    957   * available.
    958   */
    959  [infallible] readonly attribute unsigned long long innerWindowID;
    960 
    961  /**
    962   * The BrowsingContext performing the load for this nsILoadInfo object.
    963   */
    964  [infallible] readonly attribute unsigned long long browsingContextID;
    965  [infallible] readonly attribute BrowsingContext browsingContext;
    966 
    967  /**
    968   * The BrowsingContext which the worker is associated.
    969   *
    970   * Note that this could be 0 if the load is not triggered in a WorkerScope.
    971   * This value is only set and used in the parent process for some sitautions
    972   * the channel is created in the parent process for Workers. Such as fetch().
    973   * In content process, it is always 0.
    974   * This value would not be propagated through IPC.
    975   */
    976  [infallible] attribute unsigned long long workerAssociatedBrowsingContextID;
    977  [infallible] readonly attribute BrowsingContext workerAssociatedBrowsingContext;
    978 
    979  /**
    980   * Only when the element being loaded is <frame src="foo.html">
    981   * (or, more generally, if the element QIs to nsFrameLoaderOwner),
    982   * the frameBrowsingContext is the browsing context containing the
    983   * foo.html document.
    984   *
    985   * Note: For other cases, frameBrowsingContextID is 0.
    986   */
    987  [infallible] readonly attribute unsigned long long frameBrowsingContextID;
    988  [infallible] readonly attribute BrowsingContext frameBrowsingContext;
    989 
    990  /**
    991   * If the element being loaded is a nsFrameLoaderOwner,
    992   * `targetBrowsingContext` is the Browsing Context which will contain the
    993   * loading document (see `frameBrowsingContext`). Otherwise, it is the
    994   * Browsing Context performing the load (see `browsingContext`).
    995   */
    996  [infallible] readonly attribute unsigned long long targetBrowsingContextID;
    997  [infallible] readonly attribute BrowsingContext targetBrowsingContext;
    998 
    999  /**
   1000   * Resets the PrincipalToInherit to a freshly created NullPrincipal
   1001   * which inherits the origin attributes from the loadInfo.
   1002   *
   1003   * WARNING: Please only use that function if you know exactly what
   1004   * you are doing!!!
   1005   */
   1006  void resetPrincipalToInheritToNullPrincipal();
   1007 
   1008  /**
   1009   * Customized OriginAttributes within LoadInfo to allow overwriting of the
   1010   * default originAttributes from the loadingPrincipal.
   1011   *
   1012   * In chrome side, originAttributes.privateBrowsingId will always be 0 even if
   1013   * the usePrivateBrowsing is true, because chrome docshell won't set
   1014   * privateBrowsingId on origin attributes (See bug 1278664). This is to make
   1015   * sure nsILoadInfo and nsILoadContext have the same origin attributes.
   1016   */
   1017  [implicit_jscontext, binaryname(ScriptableOriginAttributes)]
   1018  attribute jsval originAttributes;
   1019 
   1020  [noscript, nostdcall, binaryname(GetOriginAttributes)]
   1021  OriginAttributes binaryGetOriginAttributes();
   1022 
   1023  [noscript, nostdcall, binaryname(SetOriginAttributes)]
   1024  void binarySetOriginAttributes(in const_OriginAttributesRef aOriginAttrs);
   1025 
   1026 %{ C++
   1027  inline mozilla::OriginAttributes GetOriginAttributes()
   1028  {
   1029    mozilla::OriginAttributes result;
   1030    mozilla::DebugOnly<nsresult> rv = GetOriginAttributes(&result);
   1031    MOZ_ASSERT(NS_SUCCEEDED(rv));
   1032    return result;
   1033  }
   1034 %}
   1035 
   1036  /**
   1037   * Whenever a channel is evaluated by the ContentSecurityManager
   1038   * the first time, we set this flag to true to indicate that
   1039   * subsequent calls of AsyncOpen() do not have to enforce all
   1040   * security checks again. E.g., after a redirect there is no
   1041   * need to set up CORS again. We need this separate flag
   1042   * because the redirectChain might also contain internal
   1043   * redirects which might pollute the redirectChain so we can't
   1044   * rely on the size of the redirectChain-array to query whether
   1045   * a channel got redirected or not.
   1046   *
   1047   * Please note, once the flag is set to true it must remain true
   1048   * throughout the lifetime of the channel. Trying to set it
   1049   * to anything else than true will be discarded.
   1050   *
   1051   */
   1052  [infallible] attribute boolean initialSecurityCheckDone;
   1053 
   1054  /**
   1055   * Returns true if the load was triggered from an external application
   1056   * (e.g. Thunderbird). Please note that this flag will only ever be true
   1057   * if the load is of TYPE_DOCUMENT.
   1058   */
   1059  [infallible] attribute boolean loadTriggeredFromExternal;
   1060 
   1061  /**
   1062   * True if the tainting has been set by the service worker.
   1063   */
   1064  [noscript, infallible] readonly attribute boolean serviceWorkerTaintingSynthesized;
   1065 
   1066  /**
   1067   * Whenever a channel gets redirected, append the redirect history entry of
   1068   * the channel which contains principal referrer and remote address [before
   1069   * the channels got redirected] to the loadinfo, so that at every point this
   1070   * array provides us information about all the redirects this channel went
   1071   * through.
   1072   * @param channelToDeriveFrom the channel being redirected
   1073   * @param aIsInternalRedirect should be true if the channel is going
   1074   *        through an internal redirect, otherwise false.
   1075   */
   1076  void appendRedirectHistoryEntry(in nsIChannel channelToDeriveFrom,
   1077                                  in boolean isInternalRedirect);
   1078 
   1079  /**
   1080   * An array of nsIRedirectHistoryEntry which stores redirects associated
   1081   * with this channel. This array is filled whether or not the channel has
   1082   * ever been opened. The last element of the array is associated with the
   1083   * most recent redirect. Please note, that this array *includes* internal
   1084   * redirects.
   1085   */
   1086  [implicit_jscontext]
   1087  readonly attribute jsval redirectChainIncludingInternalRedirects;
   1088 
   1089  /**
   1090   * A C++-friendly version of redirectChain.
   1091   * Please note that this array has the same lifetime as the
   1092   * loadInfo object - use with caution!
   1093   */
   1094  [noscript, notxpcom, nostdcall, binaryname(RedirectChainIncludingInternalRedirects)]
   1095  nsIRedirectHistoryEntryArray binaryRedirectChainIncludingInternalRedirects();
   1096 
   1097  /**
   1098   * Same as RedirectChain but does *not* include internal redirects.
   1099   */
   1100  [implicit_jscontext]
   1101  readonly attribute jsval redirectChain;
   1102 
   1103  /**
   1104   * A C++-friendly version of redirectChain.
   1105   * Please note that this array has the same lifetime as the
   1106   * loadInfo object - use with caution!
   1107   */
   1108  [noscript, notxpcom, nostdcall, binaryname(RedirectChain)]
   1109  nsIRedirectHistoryEntryArray binaryRedirectChain();
   1110 
   1111  /**
   1112   * This array is only filled out when we are in the parent process and we are
   1113   * creating a loadInfo object or deserializing LoadInfoArgs into LoadInfo,
   1114   * as we ever only need in the parent process.
   1115   *
   1116   * The array is meant to be a list of principals of the documents that the
   1117   * browsing context, corresponding to this loadInfo object, is "nested through" in
   1118   * the sense of
   1119   * <https://html.spec.whatwg.org/multipage/browsers.html#browsing-context-nested-through>.
   1120   * Note that the array does not include the principal corresponding to the frame
   1121   * loading this request. The closest ancestor is at index zero and the top level
   1122   * ancestor is at the last index.
   1123   *
   1124   * If this is a toplevel content browsing context (i.e. toplevel document in spec
   1125   * terms), the list is empty.
   1126   *
   1127   * Otherwise the array is a list for the document we're nested through (again in
   1128   * the spec sense), with the principal of that document prepended. The
   1129   * ancestorPrincipals[0] entry for an iframe load will be the principal of the
   1130   * iframe element's owner document. The ancestorPrincipals[0] entry for an image
   1131   * loaded in an iframe will be the principal of the iframe element's owner
   1132   * document. This matches the ordering specified for Location.ancestorOrigins.
   1133   *
   1134   * Please note that this array has the same lifetime as the loadInfo object - use
   1135   * with caution!
   1136   */
   1137  [noscript, notxpcom, nostdcall]
   1138  PrincipalArrayRef AncestorPrincipals();
   1139 
   1140  /**
   1141   * An array of BrowsingContext IDs which correspond to nsILoadInfo::AncestorPrincipals
   1142   * above.  AncestorBrowsingContextIDs[0] is the BrowsingContext ID of the frame
   1143   * associated with the principal at ancestorPrincipals[0], and so forth.
   1144   *
   1145   * Please note that this array has the same lifetime as the
   1146   * loadInfo object - use with caution!
   1147   */
   1148  [noscript, notxpcom, nostdcall]
   1149  Uint64ArrayRef AncestorBrowsingContextIDs();
   1150 
   1151  /**
   1152   * Sets the list of unsafe headers according to CORS spec, as well as
   1153   * potentially forces a preflight.
   1154   * Note that you do not need to set the Content-Type header. That will be
   1155   * automatically detected as needed.
   1156   *
   1157   * Only call this function when using the SEC_REQUIRE_CORS_INHERITS_SEC_CONTEXT mode.
   1158   */
   1159  [noscript, notxpcom, nostdcall]
   1160  void setCorsPreflightInfo(in CStringArrayRef unsafeHeaders,
   1161                            in boolean forcePreflight);
   1162 
   1163  /**
   1164   * A C++-friendly getter for the list of cors-unsafe headers.
   1165   * Please note that this array has the same lifetime as the
   1166   * loadInfo object - use with caution!
   1167   */
   1168  [noscript, notxpcom, nostdcall, binaryname(CorsUnsafeHeaders)]
   1169  CStringArrayRef corsUnsafeHeaders();
   1170 
   1171  /**
   1172   * Returns value set through setCorsPreflightInfo.
   1173   */
   1174  [infallible] readonly attribute boolean forcePreflight;
   1175 
   1176  /**
   1177   * A C++ friendly getter for the forcePreflight flag.
   1178   */
   1179  [infallible] readonly attribute boolean isPreflight;
   1180 
   1181  /**
   1182  * Constants reflecting the channel tainting.  These are mainly defined here
   1183  * for script.  Internal C++ code should use the enum defined in LoadTainting.h.
   1184  * See LoadTainting.h for documentation.
   1185  */
   1186  const unsigned long TAINTING_BASIC = 0;
   1187  const unsigned long TAINTING_CORS = 1;
   1188  const unsigned long TAINTING_OPAQUE = 2;
   1189 
   1190  /**
   1191   * Determine the associated channel's current tainting.  Note, this can
   1192   * change due to a service worker intercept, so it should be checked after
   1193   * OnStartRequest() fires.
   1194   */
   1195  readonly attribute unsigned long tainting;
   1196 
   1197  /**
   1198   * Note a new tainting level and possibly increase the current tainting
   1199   * to match.  If the tainting level is already greater than the given
   1200   * value, then there is no effect.  It is not possible to reduce the tainting
   1201   * level on an existing channel/loadinfo.
   1202   */
   1203  void maybeIncreaseTainting(in unsigned long aTainting);
   1204 
   1205  /**
   1206   * Various helper code to provide more convenient C++ access to the tainting
   1207   * attribute and maybeIncreaseTainting().
   1208   */
   1209 %{C++
   1210  static_assert(TAINTING_BASIC == static_cast<uint32_t>(mozilla::LoadTainting::Basic),
   1211                "basic tainting enums should match");
   1212  static_assert(TAINTING_CORS == static_cast<uint32_t>(mozilla::LoadTainting::CORS),
   1213                "cors tainting enums should match");
   1214  static_assert(TAINTING_OPAQUE == static_cast<uint32_t>(mozilla::LoadTainting::Opaque),
   1215                "opaque tainting enums should match");
   1216 
   1217  mozilla::LoadTainting GetTainting()
   1218  {
   1219    uint32_t tainting = TAINTING_BASIC;
   1220    MOZ_ALWAYS_SUCCEEDS(GetTainting(&tainting));
   1221    return static_cast<mozilla::LoadTainting>(tainting);
   1222  }
   1223 
   1224  void MaybeIncreaseTainting(mozilla::LoadTainting aTainting)
   1225  {
   1226    uint32_t tainting = static_cast<uint32_t>(aTainting);
   1227    MOZ_ALWAYS_SUCCEEDS(MaybeIncreaseTainting(tainting));
   1228  }
   1229 %}
   1230 
   1231  /**
   1232   * Returns true if this load is for top level document.
   1233   * Note that the load for a sub-frame's document will return false here.
   1234   */
   1235  [infallible] readonly attribute boolean isTopLevelLoad;
   1236 
   1237  /**
   1238   * If this is non-null, this property represents two things: (1) the
   1239   * URI to be used for the principal if the channel with this loadinfo
   1240   * gets a principal based on URI and (2) the URI to use for a document
   1241   * created from the channel with this loadinfo.
   1242   */
   1243  attribute nsIURI resultPrincipalURI;
   1244 
   1245  /**
   1246   * This is the URI used to create the most recent channel in the load's
   1247   * redirect chain, if it's different from channel's `originalURI`.
   1248   * This is always null for loads not handled by DocumentLoadListener. If
   1249   * non-null, channelCreationOriginalURI will be used instead of channel's
   1250   * originalURI to re-create the channel in the final content process selected
   1251   * to perform the load.
   1252   */
   1253  attribute nsIURI channelCreationOriginalURI;
   1254 
   1255  /**
   1256   * Returns a unique nsID used to construct the null principal for the
   1257   * resulting resource if the SANDBOXED_ORIGIN flag is set.  This is used by
   1258   * GetChannelResultPrincipal() to ensure that the same null principal is
   1259   * returned every time.
   1260   */
   1261  [noscript, nostdcall, notxpcom]
   1262  nsIDRef GetSandboxedNullPrincipalID();
   1263 
   1264  /**
   1265   * Generates a new nsID to be returned by a future call to
   1266   * `GetSandboxedNullPrincipalID()`.
   1267   */
   1268  [noscript, nostdcall, notxpcom]
   1269  void ResetSandboxedNullPrincipalID();
   1270 
   1271  /**
   1272   * Return the top-level principal, which is the principal of the top-level
   1273   * window.
   1274   */
   1275  [notxpcom, nostdcall] readonly attribute nsIPrincipal topLevelPrincipal;
   1276 
   1277  /**
   1278   * Note which client (i.e. global) initiated this network request.  All
   1279   * nsGlobalWindow and WorkerPrivate can be converted to a ClientInfo to
   1280   * be set here.  While this is being added to support service worker
   1281   * FetchEvent, it can also be used to communicate other information about
   1282   * the source global context in the future.
   1283   */
   1284  [noscript, nostdcall, notxpcom]
   1285  void SetClientInfo(in const_ClientInfoRef aClientInfo);
   1286 
   1287  /**
   1288   * Get the ClientInfo for the global that initiated the network request,
   1289   * if it has been set.
   1290   */
   1291  [noscript, nostdcall, notxpcom]
   1292  const_MaybeClientInfoRef GetClientInfo();
   1293 
   1294  /**
   1295   * Give a pre-allocated ClientSource to the channel LoadInfo.  This is
   1296   * intended to be used by docshell when loading windows without an
   1297   * initial about:blank document.  The docshell will allocate the ClientSource
   1298   * to represent the client that will be created as a result of the navigation
   1299   * network request.  If the channel succeeds and remains same-origin, then
   1300   * the result nsGlobalWindow will take ownership of the reserved ClientSource.
   1301   *
   1302   * This method is also called when a cross-origin redirect occurs.  A new
   1303   * ClientSource with a different UUID must be created in this case.
   1304   *
   1305   * This method automatically calls SetReservedClientInfo() with the
   1306   * ClientSource::Info().
   1307   */
   1308  [noscript, nostdcall, notxpcom]
   1309  void GiveReservedClientSource(in UniqueClientSourceMove aClientSource);
   1310 
   1311  /**
   1312   * This method takes ownership of the reserved ClientSource previously
   1313   * provided in GiveReservedClientSource().  It may return nullptr if the
   1314   * nsILoadInfo does not own a ClientSource object.
   1315   */
   1316  [noscript, nostdcall, notxpcom]
   1317  UniqueClientSource TakeReservedClientSource();
   1318 
   1319  /**
   1320   * Note the reserved client that be created if this non-subresource
   1321   * network request succeeds.  Depending on the type of client this
   1322   * may be called directly or indirectly via GiveReservedClientSource().
   1323   * For example, web workers do not call give their ClientSource to
   1324   * the nsILoadInfo, but must still call this method to indicate the
   1325   * reserved client for their main script load.
   1326   */
   1327  [noscript, nostdcall, notxpcom]
   1328  void SetReservedClientInfo(in const_ClientInfoRef aClientInfo);
   1329 
   1330  /**
   1331   * This will clear any existing reserved or initial client and override
   1332   * it with the given reserved client.  This is similar to calling
   1333   * TakeReservedClientSource() and then GiveReservedClientSource() with
   1334   * a new client as ClientChannelHelper does.  This method is needed,
   1335   * though, to perform this operation in the parent process where
   1336   * the LoadInfo does not have direct access to a ClientSource.
   1337   *
   1338   * If in doubt, do not call this method.  Its really only needed for
   1339   * a specific redirect case where the child has created a new client on
   1340   * redirect and we need to override the parent side's reserved client
   1341   * to match.
   1342   */
   1343  [noscript, nostdcall, notxpcom]
   1344  void OverrideReservedClientInfoInParent(in const_ClientInfoRef aClientInfo);
   1345 
   1346  /**
   1347   * Return the reserved ClientInfo for this load, if one has been set.
   1348   */
   1349  [noscript, nostdcall, notxpcom]
   1350  const_MaybeClientInfoRef GetReservedClientInfo();
   1351 
   1352  /**
   1353   * Note that this non-subresource network request will result in
   1354   * re-using an existing "initial" active client.  This mainly only
   1355   * happens when an initial about:blank document is replaced with
   1356   * a real load in a window.  In these cases we need to track this
   1357   * initial client so that we may report its existence in a FetchEvent.
   1358   *
   1359   * Note, an nsILoadInfo may only have a reserved client or an
   1360   * initial client.  It should never have both.
   1361   */
   1362  [noscript, nostdcall, notxpcom]
   1363  void SetInitialClientInfo(in const_ClientInfoRef aClientInfo);
   1364 
   1365  /**
   1366   * Return the initial ClientInfo for this load, if one has been set.
   1367   */
   1368  [noscript, nostdcall, notxpcom]
   1369  const_MaybeClientInfoRef GetInitialClientInfo();
   1370 
   1371  /**
   1372   * Note that this network request should be controlled by a service worker.
   1373   * For non-subresource requests this may be set during the load when
   1374   * the first service worker interception occurs.  For subresource requests
   1375   * it may be set by the source client if its already controlled by a
   1376   * service worker.
   1377   */
   1378  [noscript, nostdcall, notxpcom]
   1379  void SetController(in const_ServiceWorkerDescriptorRef aServiceWorker);
   1380 
   1381  /**
   1382   * Clear the service worker controller for this channel.  This should only
   1383   * be used for window navigation redirects.  By default we want to keep
   1384   * the controller in all other cases.
   1385   */
   1386  [noscript, nostdcall, notxpcom]
   1387  void ClearController();
   1388 
   1389  /**
   1390   * Get the service worker controlling this network request, if one has
   1391   * been set.
   1392   */
   1393  [noscript, nostdcall, notxpcom]
   1394  const_MaybeServiceWorkerDescriptorRef GetController();
   1395 
   1396  /**
   1397   * Set a custom performance storage. This is meant to be executed only for
   1398   * workers. If a PerformanceStorage is not set, the loadingDocument->Window
   1399   * Performance object will be returned instead.
   1400   */
   1401  [noscript, nostdcall, notxpcom]
   1402  void SetPerformanceStorage(in PerformanceStoragePtr aPerformanceStorage);
   1403 
   1404  /**
   1405   * Get the custom PerformanceStorage if set by SetPerformanceStorage.
   1406   * Otherwise the loadingDocument->Window Performance object will be returned
   1407   * instead if all the following conditions are met:
   1408   * - the triggeringPrincipal is the same as the loadingDocument's principal.
   1409   * - if the external content policy type is TYPE_SUBDOCUMENT then loading
   1410   *   wasn't caused by processing the attributes of the browsing context
   1411   *   container.
   1412   */
   1413  [noscript, nostdcall, notxpcom]
   1414  PerformanceStoragePtr GetPerformanceStorage();
   1415 
   1416  /**
   1417   * Returns the CSP (or Preload CSP for preloads) which should be enforced
   1418   * when fetching the resource this loadinfo belongs to.
   1419   *
   1420   * a) Non-navigations:
   1421   * For non-navigation loads, GetCsp() returns what the spec refers to as the
   1422   * "request's client's global object's CSP list". In practice, if this is the
   1423   * loadinfo of a subresource load (e.g an image load), then GetCsp() or
   1424   * GetPreloadCSP() returns the CSP of the document which embeds the image.
   1425   * The returned CSP includes any policy delivered through the HTTP header or
   1426   * also through the meta tag (modulo the difference for preloads, e.g. image
   1427   * preloads have to query GetPreloadCsp() because at the time of preloading
   1428   * we are not entirely sure if the Meta CSP will be applied to the document
   1429   * in the end or not). Please note that GetCSPToInherit() called on a
   1430   * loadinfo for any non-navigation always returns null.
   1431   *
   1432   * b) Navigations:
   1433   *   * Top-level loads:
   1434   *     For top-level loads (navigations) GetCsp() will return null, unless
   1435   *     the navigation is started by a WebExtension, in which case it will
   1436   *     return the CSP of the webextension, if any.
   1437   *     If you need to query the CSP that potentially should apply to the
   1438   *     new top-level load, you have to query GetCspToInherit(), which is
   1439   *     the CSP of the request's client's global object, just like GetCsp()
   1440   *     is for non-navigation requests.
   1441   *
   1442   *   * Iframe-loads:
   1443   *     For iframe-loads (navigations) GetCsp() will return the CSP of the
   1444   *     parent document, unless the navigation is started by a WebExtension,
   1445   *     in which case it will return the CSP of the webextension, if any.
   1446   *
   1447   * If you need to query the CSP that should potentially be inherited
   1448   * into the new document, you have to query GetCSPToInherit().
   1449   *
   1450   * TODO Bug 1557114:
   1451   * After evaluating what CSP to use for frame navigations we should
   1452   * update the above documentation to match the outcome of Bug 1557114.
   1453   */
   1454  [notxpcom,nostdcall] CSPRef GetPreloadCsp();
   1455 
   1456  [notxpcom,nostdcall] PolicyContainerRef GetPolicyContainer();
   1457  [notxpcom,nostdcall] PolicyContainerRef GetPolicyContainerToInherit();
   1458 
   1459  /**
   1460    * The possibly cross-origin container feature policy required to
   1461    * initialize the feature policy of a document load.
   1462    */
   1463  [noscript, nostdcall, notxpcom]
   1464  MaybeFeaturePolicyInfo GetContainerFeaturePolicyInfo();
   1465  [noscript, nostdcall, notxpcom]
   1466  void SetContainerFeaturePolicyInfo(in const_FeaturePolicyInfoRef aContainerFeaturePolicy);
   1467 
   1468  /**
   1469    * The service worker and fetch specifications require returning the
   1470    * exact tainting level of the Response passed to FetchEvent.respondWith().
   1471    * This method allows us to override the tainting level in that case.
   1472    *
   1473    * NOTE: This should not be used outside of service worker code! Use
   1474    *       nsILoadInfo::MaybeIncreaseTainting() instead.
   1475   */
   1476  [noscript, nostdcall, notxpcom]
   1477  void SynthesizeServiceWorkerTainting(in LoadTainting aTainting);
   1478 
   1479  /**
   1480    * The top-level document has been user-interacted.
   1481    */
   1482  [infallible] attribute boolean documentHasUserInteracted;
   1483 
   1484  /**
   1485    * During a top-level document channel redirect from tracking to
   1486    * non-tracking resources, our anti-tracking heuristic, grants the storage
   1487    * access permission for a short amount of seconds (See
   1488    * privacy.restrict3rdpartystorage.expiration_redirect pref).
   1489    * We use this flag to remember this decision even if this channel is part
   1490    * of a chain of redirects.
   1491    */
   1492  [infallible] attribute boolean allowListFutureDocumentsCreatedFromThisRedirectChain;
   1493 
   1494  /**
   1495   * Indicates that we need to check if we should apply the anti-tracking
   1496   * heuristic after the channel has been classified.
   1497   */
   1498  [infallible] attribute boolean needForCheckingAntiTrackingHeuristic;
   1499 
   1500  /**
   1501   * A snapshot of the nonce at load start time which is used for CSP
   1502   * checks and only set for:
   1503   *  * TYPE_SCRIPT and
   1504   *  * TYPE_STYLESHEET
   1505   */
   1506  attribute AString cspNonce;
   1507 
   1508  // Subresource Integrity (SRI) metadata.
   1509  attribute AString integrityMetadata;
   1510 
   1511  /**
   1512   * List of possible reasons the request associated with this load info
   1513   * may have been blocked, set by various content blocking checkers.
   1514   */
   1515  const uint32_t BLOCKING_REASON_NONE = 0;
   1516  const uint32_t BLOCKING_REASON_CORSDISABLED = 1001;
   1517  const uint32_t BLOCKING_REASON_CORSDIDNOTSUCCEED = 1002;
   1518  const uint32_t BLOCKING_REASON_CORSREQUESTNOTHTTP = 1003;
   1519  const uint32_t BLOCKING_REASON_CORSMULTIPLEALLOWORIGINNOTALLOWED = 1004;
   1520  const uint32_t BLOCKING_REASON_CORSMISSINGALLOWORIGIN = 1005;
   1521  const uint32_t BLOCKING_REASON_CORSNOTSUPPORTINGCREDENTIALS = 1006;
   1522  const uint32_t BLOCKING_REASON_CORSALLOWORIGINNOTMATCHINGORIGIN = 1007;
   1523  const uint32_t BLOCKING_REASON_CORSMISSINGALLOWCREDENTIALS = 1008;
   1524  const uint32_t BLOCKING_REASON_CORSORIGINHEADERNOTADDED = 1009;
   1525  const uint32_t BLOCKING_REASON_CORSEXTERNALREDIRECTNOTALLOWED = 1010;
   1526  const uint32_t BLOCKING_REASON_CORSPREFLIGHTDIDNOTSUCCEED = 1011;
   1527  const uint32_t BLOCKING_REASON_CORSINVALIDALLOWMETHOD = 1012;
   1528  const uint32_t BLOCKING_REASON_CORSMETHODNOTFOUND = 1013;
   1529  const uint32_t BLOCKING_REASON_CORSINVALIDALLOWHEADER = 1014;
   1530  const uint32_t BLOCKING_REASON_CORSMISSINGALLOWHEADERFROMPREFLIGHT = 1015;
   1531  const uint32_t BLOCKING_REASON_CLASSIFY_MALWARE_URI = 2001;
   1532  const uint32_t BLOCKING_REASON_CLASSIFY_PHISHING_URI = 2002;
   1533  const uint32_t BLOCKING_REASON_CLASSIFY_UNWANTED_URI = 2003;
   1534  const uint32_t BLOCKING_REASON_CLASSIFY_TRACKING_URI = 2004;
   1535  const uint32_t BLOCKING_REASON_CLASSIFY_BLOCKED_URI = 2005;
   1536  const uint32_t BLOCKING_REASON_CLASSIFY_HARMFUL_URI = 2006;
   1537  const uint32_t BLOCKING_REASON_CLASSIFY_CRYPTOMINING_URI = 2007;
   1538  const uint32_t BLOCKING_REASON_CLASSIFY_FINGERPRINTING_URI = 2008;
   1539  const uint32_t BLOCKING_REASON_CLASSIFY_SOCIALTRACKING_URI = 2009;
   1540  const uint32_t BLOCKING_REASON_CLASSIFY_EMAILTRACKING_URI = 2010;
   1541  const uint32_t BLOCKING_REASON_CLASSIFY_HARMFULADDON_URI = 2011;
   1542  const uint32_t BLOCKING_REASON_MIXED_BLOCKED = 3001;
   1543  // The general reason comes from nsCSPContext::permitsInternal(),
   1544  // which is way too generic to distinguish an exact reason.
   1545  const uint32_t BLOCKING_REASON_CONTENT_POLICY_GENERAL = 4000;
   1546  const uint32_t BLOCKING_REASON_CONTENT_POLICY_NO_DATA_PROTOCOL = 4001;
   1547  // removed 4002
   1548  const uint32_t BLOCKING_REASON_CONTENT_POLICY_CONTENT_BLOCKED = 4003;
   1549  const uint32_t BLOCKING_REASON_CONTENT_POLICY_DATA_DOCUMENT = 4004;
   1550  const uint32_t BLOCKING_REASON_CONTENT_POLICY_WEB_BROWSER = 4005;
   1551  const uint32_t BLOCKING_REASON_CONTENT_POLICY_PRELOAD = 4006;
   1552  // The reason used when SEC_REQUIRE_SAME_ORIGIN_* is set and not satisifed.
   1553  const uint32_t BLOCKING_REASON_NOT_SAME_ORIGIN = 5000;
   1554  // The reason used when an extension cancels the request via the WebRequest api.
   1555  const uint32_t BLOCKING_REASON_EXTENSION_WEBREQUEST = 6000;
   1556  // The reason used when a request is cancelled via WebDriver BiDi network interception.
   1557  const uint32_t BLOCKING_REASON_WEBDRIVER_BIDI = 7000;
   1558 
   1559  /**
   1560   * If the request associated with this load info was blocked by some of
   1561   * our content or load blockers, the reason can be found here.
   1562   * Note that setting this attribute has NO EFFECT on blocking the request.
   1563   * This attribute is only informative!
   1564   *
   1565   * By default the value is '0' - NONE.
   1566   * Each write rewrites the last value.
   1567   * Can be accessed only on a single thread.
   1568   */
   1569  [infallible] attribute unsigned long requestBlockingReason;
   1570 
   1571  /**
   1572    * The object in charged to receive CSP violation events. It can be null.
   1573    * This attribute will be merged into the CSP object eventually.
   1574    * See bug 1500908.
   1575    */
   1576  attribute nsICSPEventListener cspEventListener;
   1577 
   1578  /**
   1579   * This attribute will be true if this is a load triggered by
   1580   * https://html.spec.whatwg.org/multipage/iframe-embed-object.html#process-the-iframe-attributes
   1581   * or https://html.spec.whatwg.org/multipage/obsolete.html#process-the-frame-attributes
   1582   */
   1583  [infallible] readonly attribute boolean isFromProcessingFrameAttributes;
   1584 
   1585  cenum CrossOriginOpenerPolicy : 8 {
   1586    OPENER_POLICY_UNSAFE_NONE = 0,
   1587    OPENER_POLICY_SAME_ORIGIN = 1,
   1588    OPENER_POLICY_SAME_ORIGIN_ALLOW_POPUPS = 2,
   1589    OPENER_POLICY_EMBEDDER_POLICY_REQUIRE_CORP_FLAG = 0x10,
   1590    OPENER_POLICY_SAME_ORIGIN_EMBEDDER_POLICY_REQUIRE_CORP =
   1591        OPENER_POLICY_SAME_ORIGIN |
   1592        OPENER_POLICY_EMBEDDER_POLICY_REQUIRE_CORP_FLAG
   1593  };
   1594 
   1595  cenum CrossOriginEmbedderPolicy : 8 {
   1596    EMBEDDER_POLICY_NULL = 0,
   1597    EMBEDDER_POLICY_REQUIRE_CORP = 1,
   1598    EMBEDDER_POLICY_CREDENTIALLESS = 2,
   1599  };
   1600 
   1601  /**
   1602   * This attribute is the loading context's cross origin embedder policy.
   1603   * The value is initialized with corresponding WindowContext which get by
   1604   * innerWindowIID in the nsILoadInfo.
   1605   * It also could be set by workers when fetch is called under
   1606   * the workers' scope.
   1607   *
   1608   * If the value is nsILoadInfo::EMBEDDER_POLICY_REQUIRE_CORP, CORP checking
   1609   * must be performed for the loading.
   1610   * See https://wicg.github.io/cross-origin-embedder-policy/#corp-check.
   1611   */
   1612  [infallible] attribute nsILoadInfo_CrossOriginEmbedderPolicy
   1613        loadingEmbedderPolicy;
   1614 
   1615  /**
   1616   * This attribute will be true if the top level document has COEP:
   1617   * credentialless enabled in Origin Trial.
   1618   */
   1619  [infallible] attribute boolean isOriginTrialCoepCredentiallessEnabledForTopLevel;
   1620  /**
   1621   * This attribute will be true if this is a load triggered by a media
   1622   * element.
   1623   */
   1624  [infallible] attribute boolean isMediaRequest;
   1625 
   1626  /**
   1627   * This attribute will be true if this is a load triggered by a media
   1628   * element and it's an initial request.
   1629   */
   1630  [infallible] attribute boolean isMediaInitialRequest;
   1631 
   1632  /**
   1633   * This attribute will be true if the fetch request is from object or embed
   1634   * elements
   1635   */
   1636  [infallible] attribute boolean isFromObjectOrEmbed;
   1637 
   1638  /**
   1639   * If this is non-null, this property holds the URI as it was before query
   1640   * stripping was performed.
   1641   */
   1642  attribute nsIURI unstrippedURI;
   1643 
   1644  /**
   1645   * Propagated information from InterceptedHttpChannel
   1646   * It should be null when the channel is not created from FetchEvent.request
   1647   * or ServiceWorker NavigationPreload.
   1648   * nsIFetchEventInfo is C++ only, so it is not an attribute.
   1649   */
   1650  [noscript, notxpcom, nostdcall, binaryname(InterceptionInfo)]
   1651  nsIInterceptionInfo binaryInterceptionInfo();
   1652 
   1653  [noscript, notxpcom, nostdcall, binaryname(SetInterceptionInfo)]
   1654  void binarySetInterceptionInfo(in nsIInterceptionInfo info);
   1655 
   1656  /**
   1657   * Whether nsICookieInjector has injected a cookie for this request to
   1658   * handle a cookie banner. This is only done for top-level requests.
   1659   */
   1660  [infallible] attribute boolean hasInjectedCookieForCookieBannerHandling;
   1661 
   1662  cenum SchemelessInputType : 8 {
   1663    SchemelessInputTypeUnset = 0,
   1664    SchemelessInputTypeSchemeful = 1,
   1665    SchemelessInputTypeSchemeless = 2,
   1666  };
   1667  /**
   1668   * Whether the load has gone through the URL bar, where the fixup had to add * the protocol scheme.
   1669   */
   1670   [infallible] attribute nsILoadInfo_SchemelessInputType schemelessInput;
   1671 
   1672  cenum HTTPSUpgradeTelemetryType : 32 {
   1673    NOT_INITIALIZED = 0,
   1674    NO_UPGRADE = (1 << 0),
   1675    ALREADY_HTTPS = (1 << 1),
   1676    HSTS = (1 << 2),
   1677    HTTPS_ONLY_UPGRADE = (1 << 3),
   1678    HTTPS_ONLY_UPGRADE_DOWNGRADE = (1 << 4),
   1679    HTTPS_FIRST_UPGRADE = (1 << 5),
   1680    HTTPS_FIRST_UPGRADE_DOWNGRADE = (1 << 6),
   1681    HTTPS_FIRST_SCHEMELESS_UPGRADE = (1 << 7),
   1682    HTTPS_FIRST_SCHEMELESS_UPGRADE_DOWNGRADE = (1 << 8),
   1683    CSP_UIR = (1 << 9),
   1684    HTTPS_RR = (1 << 10),
   1685    WEB_EXTENSION_UPGRADE = (1 << 11),
   1686    UPGRADE_EXCEPTION = (1 << 12),
   1687    SKIP_HTTPS_UPGRADE = (1 << 13),
   1688  };
   1689 
   1690  /**
   1691   * Solely for the use of collecting Telemetry for HTTPS upgrades.
   1692   */
   1693  [infallible] attribute nsILoadInfo_HTTPSUpgradeTelemetryType httpsUpgradeTelemetry;
   1694 
   1695  /**
   1696   * Is this the first load in a new pop-up window/tab?
   1697   */
   1698  [infallible] attribute boolean isNewWindowTarget;
   1699 
   1700  /**
   1701   * When true, this load will never be upgraded to HTTPS.
   1702   */
   1703  [infallible] attribute boolean skipHTTPSUpgrade;
   1704 
   1705  /**
   1706   * see https://html.spec.whatwg.org/#user-navigation-involvement
   1707   */
   1708  attribute uint8_t userNavigationInvolvement;
   1709 %{C++
   1710    mozilla::dom::UserNavigationInvolvement GetUserNavigationInvolvement() {
   1711      uint8_t userNavigationInvolvement = 0;
   1712      mozilla::DebugOnly<nsresult> rv = GetUserNavigationInvolvement(&userNavigationInvolvement);
   1713      MOZ_ASSERT(NS_SUCCEEDED(rv));
   1714      MOZ_DIAGNOSTIC_ASSERT(userNavigationInvolvement < 3);
   1715      return static_cast<mozilla::dom::UserNavigationInvolvement>(userNavigationInvolvement);
   1716    }
   1717 %}
   1718 };