Backed out changeset cfe0bbc666b8 (bug 1784757) in order to wait some more for a...
[gecko.git] / docshell / base / nsILoadContext.idl
blobaf71b96b347d8516eb7bf22c64b0b94367ead3a8
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/. */
7 #include "nsISupports.idl"
9 interface mozIDOMWindowProxy;
11 webidl Element;
13 [ref] native OriginAttributes(mozilla::OriginAttributes);
15 %{C++
16 #ifdef MOZILLA_INTERNAL_API
17 namespace mozilla {
18 class OriginAttributes;
20 #endif
23 /**
24 * An nsILoadContext represents the context of a load. This interface
25 * can be queried for various information about where the load is
26 * happening.
28 [builtinclass, scriptable, uuid(2813a7a3-d084-4d00-acd0-f76620315c02)]
29 interface nsILoadContext : nsISupports
31 /**
32 * associatedWindow is the window with which the load is associated, if any.
33 * Note that the load may be triggered by a document which is different from
34 * the document in associatedWindow, and in fact the source of the load need
35 * not be same-origin with the document in associatedWindow. This attribute
36 * may be null if there is no associated window.
38 readonly attribute mozIDOMWindowProxy associatedWindow;
40 /**
41 * topWindow is the top window which is of same type as associatedWindow.
42 * This is equivalent to associatedWindow.top, but is provided here as a
43 * convenience. All the same caveats as associatedWindow of apply, of
44 * course. This attribute may be null if there is no associated window.
46 readonly attribute mozIDOMWindowProxy topWindow;
48 /**
49 * topFrameElement is the <iframe>, <frame>, or <browser> element which
50 * contains the topWindow with which the load is associated.
52 * Note that we may have a topFrameElement even when we don't have an
53 * associatedWindow, if the topFrameElement's content lives out of process.
54 * topFrameElement is available in single-process and multiprocess contexts.
55 * Note that topFrameElement may be in chrome even when the nsILoadContext is
56 * associated with content.
58 readonly attribute Element topFrameElement;
60 /**
61 * True if the load context is content (as opposed to chrome). This is
62 * determined based on the type of window the load is performed in, NOT based
63 * on any URIs that might be around.
65 readonly attribute boolean isContent;
68 * Attribute that determines if private browsing should be used. May not be
69 * changed after a document has been loaded in this context.
71 attribute boolean usePrivateBrowsing;
73 /**
74 * Attribute that determines if remote (out-of-process) tabs should be used.
76 readonly attribute boolean useRemoteTabs;
78 /**
79 * Determines if out-of-process iframes should be used.
81 readonly attribute boolean useRemoteSubframes;
84 * Attribute that determines if tracking protection should be used. May not be
85 * changed after a document has been loaded in this context.
87 attribute boolean useTrackingProtection;
89 %{C++
90 /**
91 * De-XPCOMed getter to make call-sites cleaner.
93 bool UsePrivateBrowsing()
95 bool usingPB = false;
96 GetUsePrivateBrowsing(&usingPB);
97 return usingPB;
100 bool UseRemoteTabs()
102 bool usingRT = false;
103 GetUseRemoteTabs(&usingRT);
104 return usingRT;
107 bool UseRemoteSubframes()
109 bool usingRSF = false;
110 GetUseRemoteSubframes(&usingRSF);
111 return usingRSF;
114 bool UseTrackingProtection()
116 bool usingTP = false;
117 GetUseTrackingProtection(&usingTP);
118 return usingTP;
123 * Set the private browsing state of the load context, meant to be used internally.
125 [noscript] void SetPrivateBrowsing(in boolean aInPrivateBrowsing);
128 * Set the remote tabs state of the load context, meant to be used internally.
130 [noscript] void SetRemoteTabs(in boolean aUseRemoteTabs);
133 * Set the remote subframes bit of this load context. Exclusively meant to be used internally.
135 [noscript] void SetRemoteSubframes(in boolean aUseRemoteSubframes);
138 * A dictionary of the non-default origin attributes associated with this
139 * nsILoadContext.
141 [binaryname(ScriptableOriginAttributes), implicit_jscontext]
142 readonly attribute jsval originAttributes;
145 * The C++ getter for origin attributes.
147 [noscript, notxpcom] void GetOriginAttributes(out OriginAttributes aAttrs);