1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
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/. */
10 #include "SerializedLoadContext.h"
11 #include "mozilla/Attributes.h"
12 #include "mozilla/BasePrincipal.h"
13 #include "nsIWeakReferenceUtils.h"
14 #include "nsIInterfaceRequestor.h"
15 #include "nsILoadContext.h"
17 namespace mozilla::dom
{
24 * Class that provides nsILoadContext info in Parent process. Typically copied
25 * from Child via SerializedLoadContext.
27 * Note: this is not the "normal" or "original" nsILoadContext. That is
28 * typically provided by BrowsingContext. This is only used when the original
29 * docshell is in a different process and we need to copy certain values from
33 class LoadContext final
: public nsILoadContext
, public nsIInterfaceRequestor
{
36 NS_DECL_NSILOADCONTEXT
37 NS_DECL_NSIINTERFACEREQUESTOR
39 LoadContext(const IPC::SerializedLoadContext
& aToCopy
,
40 dom::Element
* aTopFrameElement
, OriginAttributes
& aAttrs
);
42 // Constructor taking reserved origin attributes.
43 explicit LoadContext(OriginAttributes
& aAttrs
);
45 // Constructor for creating a LoadContext with a given browser flag.
46 explicit LoadContext(nsIPrincipal
* aPrincipal
,
47 nsILoadContext
* aOptionalBase
= nullptr);
52 nsWeakPtr mTopFrameElement
;
55 bool mUseRemoteSubframes
;
56 bool mUseTrackingProtection
;
60 OriginAttributes mOriginAttributes
;
63 already_AddRefed
<nsILoadContext
> CreateLoadContext();
64 already_AddRefed
<nsILoadContext
> CreatePrivateLoadContext();
66 } // namespace mozilla
68 #endif // LoadContext_h