Bug 1845134 - Part 4: Update existing ui-icons to use the latest source from acorn...
[gecko.git] / netwerk / base / nsILoadContextInfo.idl
blobbbf2b5d48ac5ed15b84b5e25b96f59a48dd72d7e
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();
70 /**
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
74 * interface from JS.
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;
82 [implicit_jscontext]
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);