Bug 1925561 - Use a quicker radius calculation for ArcParams. r=aosmond
[gecko.git] / netwerk / base / nsILoadContextInfo.idl
blobb735a5ace11038b009ddc675238616a616b0e862
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"
8 %{ C++
9 #include "mozilla/BasePrincipal.h"
11 native OriginAttributesNativePtr(const mozilla::OriginAttributes*);
13 interface nsILoadContext;
14 interface nsIDOMWindow;
16 /**
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
20 * available.
23 [scriptable, builtinclass, uuid(555e2f8a-a1f6-41dd-88ca-ed4ed6b98a22)]
24 interface nsILoadContextInfo : nsISupports
26 /**
27 * Whether the context is in a Private Browsing mode
29 readonly attribute boolean isPrivate;
31 /**
32 * Whether the load is initiated as anonymous
34 readonly attribute boolean isAnonymous;
36 /**
37 * OriginAttributes hiding all the security context attributes
39 [implicit_jscontext]
40 readonly attribute jsval originAttributes;
41 [noscript, notxpcom, nostdcall, binaryname(OriginAttributesPtr)]
42 OriginAttributesNativePtr binaryOriginAttributesPtr();
44 %{C++
45 /**
46 * De-XPCOMed getters
48 bool IsPrivate()
50 bool pb;
51 GetIsPrivate(&pb);
52 return pb;
55 bool IsAnonymous()
57 bool anon;
58 GetIsAnonymous(&anon);
59 return anon;
62 bool Equals(nsILoadContextInfo *aOther)
64 return IsAnonymous() == aOther->IsAnonymous() &&
65 *OriginAttributesPtr() == *aOther->OriginAttributesPtr();
68 bool EqualsIgnoringFPD(nsILoadContextInfo *aOther)
70 return IsAnonymous() == aOther->IsAnonymous() &&
71 OriginAttributesPtr()->EqualsIgnoringFPD(*aOther->OriginAttributesPtr());
76 /**
77 * Since OriginAttributes struct limits the implementation of
78 * nsILoadContextInfo (that needs to be thread safe) to C++,
79 * we need a scriptable factory to create instances of that
80 * interface from JS.
82 [scriptable, uuid(c1c7023d-4318-4f99-8307-b5ccf0558793)]
83 interface nsILoadContextInfoFactory : nsISupports
85 readonly attribute nsILoadContextInfo default;
86 readonly attribute nsILoadContextInfo private;
87 readonly attribute nsILoadContextInfo anonymous;
88 [implicit_jscontext]
89 nsILoadContextInfo custom(in boolean aAnonymous, in jsval aOriginAttributes);
90 nsILoadContextInfo fromLoadContext(in nsILoadContext aLoadContext, in boolean aAnonymous);
91 nsILoadContextInfo fromWindow(in nsIDOMWindow aWindow, in boolean aAnonymous);