1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #include
"nsISupports.idl"
9 #include
"mozilla/BasePrincipal.h"
11 native OriginAttributesNativePtr
(const mozilla
::OriginAttributes
*);
13 interface nsILoadContext
;
14 interface nsIDOMWindow
;
17 * Helper interface to carry informatin about the load context
18 * encapsulating origin attributes and IsAnonymous, IsPrivite properties.
19 * It shall be used where nsILoadContext cannot be used or is not
23 [scriptable
, builtinclass
, uuid(555e2f8a
-a1f6
-41dd
-88ca
-ed4ed6b98a22
)]
24 interface nsILoadContextInfo
: nsISupports
27 * Whether the context is in a Private Browsing mode
29 readonly attribute
boolean isPrivate
;
32 * Whether the load is initiated as anonymous
34 readonly attribute
boolean isAnonymous
;
37 * OriginAttributes hiding all the security context attributes
40 readonly attribute jsval originAttributes
;
41 [noscript
, notxpcom
, nostdcall
, binaryname
(OriginAttributesPtr
)]
42 OriginAttributesNativePtr binaryOriginAttributesPtr
();
58 GetIsAnonymous
(&anon
);
62 bool Equals
(nsILoadContextInfo
*aOther
)
64 return IsAnonymous
() == aOther
->IsAnonymous
() &&
65 *OriginAttributesPtr
() == *aOther
->OriginAttributesPtr
();
71 * Since OriginAttributes struct limits the implementation of
72 * nsILoadContextInfo (that needs to be thread safe) to C++,
73 * we need a scriptable factory to create instances of that
76 [scriptable
, uuid(c1c7023d
-4318-4f99
-8307-b5ccf0558793
)]
77 interface nsILoadContextInfoFactory
: nsISupports
79 readonly attribute nsILoadContextInfo
default;
80 readonly attribute nsILoadContextInfo private
;
81 readonly attribute nsILoadContextInfo anonymous
;
83 nsILoadContextInfo
custom(in boolean aAnonymous
, in jsval aOriginAttributes
);
84 nsILoadContextInfo fromLoadContext
(in nsILoadContext aLoadContext
, in boolean aAnonymous
);
85 nsILoadContextInfo fromWindow
(in nsIDOMWindow aWindow
, in boolean aAnonymous
);