Bug 1885337 - Part 2: Implement to/from base64 methods. r=dminor
[gecko.git] / docshell / base / nsIDocShellTreeItem.idl
bloba80373832faf29aa25b11f48f07f6d8d1f419a3b
1 /* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
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;
10 interface nsIDocShellTreeOwner;
11 interface nsPIDOMWindowOuter;
13 webidl Document;
14 webidl BrowsingContext;
16 /**
17 * The nsIDocShellTreeItem supplies the methods that are required of any item
18 * that wishes to be able to live within the docshell tree either as a middle
19 * node or a leaf.
22 [scriptable, builtinclass, uuid(9b7c586f-9214-480c-a2c4-49b526fff1a6)]
23 interface nsIDocShellTreeItem : nsISupports
26 name of the DocShellTreeItem
28 attribute AString name;
30 /**
31 * Compares the provided name against the item's name and
32 * returns the appropriate result.
34 * @return <CODE>PR_TRUE</CODE> if names match;
35 * <CODE>PR_FALSE</CODE> otherwise.
37 boolean nameEquals(in AString name);
40 Definitions for the item types.
42 const long typeChrome=0; // typeChrome must equal 0
43 const long typeContent=1; // typeContent must equal 1
44 const long typeContentWrapper=2; // typeContentWrapper must equal 2
45 const long typeChromeWrapper=3; // typeChromeWrapper must equal 3
47 const long typeAll=0x7FFFFFFF;
50 The type this item is.
52 readonly attribute long itemType;
53 [noscript,notxpcom,nostdcall] long ItemType();
56 Parent DocShell.
58 @deprecated: Use `BrowsingContext::GetParent()` instead.
59 (NOTE: `BrowsingContext::GetParent()` will not cross isolation boundaries)
61 [binaryname(InProcessParent)]
62 readonly attribute nsIDocShellTreeItem parent;
65 This getter returns the same thing parent does however if the parent
66 is of a different itemType, or if the parent is an <iframe mozbrowser>.
67 It will instead return nullptr. This call is a convience function for
68 Ithose wishing to not cross the boundaries at which item types change.
70 @deprecated: Use `BrowsingContext::GetParent()` instead.
72 [binaryname(InProcessSameTypeParent)]
73 readonly attribute nsIDocShellTreeItem sameTypeParent;
76 Returns the root DocShellTreeItem. This is a convience equivalent to
77 getting the parent and its parent until there isn't a parent.
79 @deprecated: Use `BrowsingContext::Top()` instead.
80 (NOTE: `BrowsingContext::Top()` will not cross isolation boundaries)
82 [binaryname(InProcessRootTreeItem)]
83 readonly attribute nsIDocShellTreeItem rootTreeItem;
86 Returns the root DocShellTreeItem of the same type. This is a convience
87 equivalent to getting the parent of the same type and its parent until
88 there isn't a parent.
90 @deprecated: Use `BrowsingContext::Top()` instead.
92 [binaryname(InProcessSameTypeRootTreeItem)]
93 readonly attribute nsIDocShellTreeItem sameTypeRootTreeItem;
96 The owner of the DocShell Tree. This interface will be called upon when
97 the docshell has things it needs to tell to the owner of the docshell.
98 Note that docShell tree ownership does not cross tree types. Meaning
99 setting ownership on a chrome tree does not set ownership on the content
100 sub-trees. A given tree's boundaries are identified by the type changes.
101 Trees of different types may be connected, but should not be traversed
102 for things such as ownership.
104 Note implementers of this interface should NOT effect the lifetime of the
105 parent DocShell by holding this reference as it creates a cycle. Owners
106 when releasing this interface should set the treeOwner to nullptr.
107 Implementers of this interface are guaranteed that when treeOwner is
108 set that the poitner is valid without having to addref.
110 Further note however when others try to get the interface it should be
111 addref'd before handing it to them.
113 readonly attribute nsIDocShellTreeOwner treeOwner;
114 [noscript] void setTreeOwner(in nsIDocShellTreeOwner treeOwner);
117 The current number of DocShells which are immediate children of the
118 this object.
121 @deprecated: Prefer using `BrowsingContext::Children()`, as this count will
122 not include out-of-process iframes.
124 [binaryname(InProcessChildCount), infallible]
125 readonly attribute long childCount;
128 Add a new child DocShellTreeItem. Adds to the end of the list.
129 Note that this does NOT take a reference to the child. The child stays
130 alive only as long as it's referenced from outside the docshell tree.
132 @throws NS_ERROR_ILLEGAL_VALUE if child corresponds to the same
133 object as this treenode or an ancestor of this treenode
134 @throws NS_ERROR_UNEXPECTED if this node is a leaf in the tree.
136 [noscript] void addChild(in nsIDocShellTreeItem child);
139 Removes a child DocShellTreeItem.
141 @throws NS_ERROR_UNEXPECTED if this node is a leaf in the tree.
143 [noscript] void removeChild(in nsIDocShellTreeItem child);
146 * Return the child at the index requested. This is 0-based.
148 * @deprecated: Prefer using `BrowsingContext::Children()`, as this will not
149 * include out-of-process iframes.
151 * @throws NS_ERROR_UNEXPECTED if the index is out of range
153 [binaryname(GetInProcessChildAt)]
154 nsIDocShellTreeItem getChildAt(in long index);
157 * BrowsingContext associated with the DocShell.
159 [binaryname(BrowsingContextXPCOM)]
160 readonly attribute BrowsingContext browsingContext;
162 [noscript,notxpcom,nostdcall] BrowsingContext getBrowsingContext();
165 * Returns the DOM outer window for the content viewer.
167 readonly attribute mozIDOMWindowProxy domWindow;
169 [noscript,nostdcall,notxpcom] Document getDocument();
170 [noscript,nostdcall,notxpcom] nsPIDOMWindowOuter getWindow();