Source code

Revision control

Other Tools

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/. */
6
7
#include "nsISupports.idl"
8
9
interface mozIDOMWindowProxy;
10
11
webidl Element;
12
13
[ref] native OriginAttributes(mozilla::OriginAttributes);
14
15
%{C++
16
#ifdef MOZILLA_INTERNAL_API
17
#include "mozilla/BasePrincipal.h" // for OriginAttributes
18
#endif
19
%}
20
21
/**
22
* An nsILoadContext represents the context of a load. This interface
23
* can be queried for various information about where the load is
24
* happening.
25
*/
26
[builtinclass, scriptable, uuid(2813a7a3-d084-4d00-acd0-f76620315c02)]
27
interface nsILoadContext : nsISupports
28
{
29
/**
30
* associatedWindow is the window with which the load is associated, if any.
31
* Note that the load may be triggered by a document which is different from
32
* the document in associatedWindow, and in fact the source of the load need
33
* not be same-origin with the document in associatedWindow. This attribute
34
* may be null if there is no associated window.
35
*/
36
readonly attribute mozIDOMWindowProxy associatedWindow;
37
38
/**
39
* topWindow is the top window which is of same type as associatedWindow.
40
* This is equivalent to associatedWindow.top, but is provided here as a
41
* convenience. All the same caveats as associatedWindow of apply, of
42
* course. This attribute may be null if there is no associated window.
43
*/
44
readonly attribute mozIDOMWindowProxy topWindow;
45
46
/**
47
* topFrameElement is the <iframe>, <frame>, or <browser> element which
48
* contains the topWindow with which the load is associated.
49
*
50
* Note that we may have a topFrameElement even when we don't have an
51
* associatedWindow, if the topFrameElement's content lives out of process.
52
* topFrameElement is available in single-process and multiprocess contexts.
53
* Note that topFrameElement may be in chrome even when the nsILoadContext is
54
* associated with content.
55
*/
56
readonly attribute Element topFrameElement;
57
58
/**
59
* If this LoadContext corresponds to a nested remote iframe, we don't have
60
* access to the topFrameElement. Instead, we must use this id to send
61
* messages. A return value of 0 signifies that this load context is not for
62
* a nested frame.
63
*/
64
readonly attribute unsigned long long nestedFrameId;
65
66
/**
67
* True if the load context is content (as opposed to chrome). This is
68
* determined based on the type of window the load is performed in, NOT based
69
* on any URIs that might be around.
70
*/
71
readonly attribute boolean isContent;
72
73
/*
74
* Attribute that determines if private browsing should be used. May not be
75
* changed after a document has been loaded in this context.
76
*/
77
attribute boolean usePrivateBrowsing;
78
79
/**
80
* Attribute that determines if remote (out-of-process) tabs should be used.
81
*/
82
readonly attribute boolean useRemoteTabs;
83
84
/**
85
* Determines if out-of-process iframes should be used.
86
*/
87
readonly attribute boolean useRemoteSubframes;
88
89
/*
90
* Attribute that determines if tracking protection should be used. May not be
91
* changed after a document has been loaded in this context.
92
*/
93
attribute boolean useTrackingProtection;
94
95
%{C++
96
/**
97
* De-XPCOMed getter to make call-sites cleaner.
98
*/
99
bool UsePrivateBrowsing()
100
{
101
bool usingPB = false;
102
GetUsePrivateBrowsing(&usingPB);
103
return usingPB;
104
}
105
106
bool UseRemoteTabs()
107
{
108
bool usingRT = false;
109
GetUseRemoteTabs(&usingRT);
110
return usingRT;
111
}
112
113
bool UseRemoteSubframes()
114
{
115
bool usingRSF = false;
116
GetUseRemoteSubframes(&usingRSF);
117
return usingRSF;
118
}
119
120
bool UseTrackingProtection()
121
{
122
bool usingTP = false;
123
GetUseTrackingProtection(&usingTP);
124
return usingTP;
125
}
126
%}
127
128
/**
129
* Set the private browsing state of the load context, meant to be used internally.
130
*/
131
[noscript] void SetPrivateBrowsing(in boolean aInPrivateBrowsing);
132
133
/**
134
* Set the remote tabs state of the load context, meant to be used internally.
135
*/
136
[noscript] void SetRemoteTabs(in boolean aUseRemoteTabs);
137
138
/**
139
* Set the remote subframes bit of this load context. Exclusively meant to be used internally.
140
*/
141
[noscript] void SetRemoteSubframes(in boolean aUseRemoteSubframes);
142
143
/**
144
* A dictionary of the non-default origin attributes associated with this
145
* nsILoadContext.
146
*/
147
[binaryname(ScriptableOriginAttributes), implicit_jscontext]
148
readonly attribute jsval originAttributes;
149
150
/**
151
* The C++ getter for origin attributes.
152
*/
153
[noscript, notxpcom] void GetOriginAttributes(out OriginAttributes aAttrs);
154
};