docshell/base/nsIDocShellTreeItem.idl

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 /* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
     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 nsIDocShellTreeOwner;
    12 /**
    13  * The nsIDocShellTreeItem supplies the methods that are required of any item
    14  * that wishes to be able to live within the docshell tree either as a middle
    15  * node or a leaf. 
    16  */
    18 [scriptable, uuid(f897f4af-f67e-4115-9d37-ce09f71122e2)]
    19 interface nsIDocShellTreeItem : nsISupports
    20 {
    21 	/*
    22 	name of the DocShellTreeItem
    23 	*/
    24 	attribute AString name;
    26         /**
    27          * Compares the provided name against the item's name and
    28          * returns the appropriate result.
    29          *
    30          * @return <CODE>PR_TRUE</CODE> if names match;
    31          *         <CODE>PR_FALSE</CODE> otherwise.
    32          */
    33         boolean nameEquals(in wstring name);
    35 	/*
    36 	Definitions for the item types.
    37 	*/
    38 	const long typeChrome=0;            // typeChrome must equal 0
    39 	const long typeContent=1;           // typeContent must equal 1
    40 	const long typeContentWrapper=2;    // typeContentWrapper must equal 2
    41 	const long typeChromeWrapper=3;     // typeChromeWrapper must equal 3
    43 	const long typeAll=0x7FFFFFFF;
    45 	/*
    46 	The type this item is.  
    47 	*/
    48 	attribute long itemType;
    49 	[noscript,notxpcom,nostdcall] long ItemType();
    51 	/*
    52 	Parent DocShell.
    53 	*/
    54 	readonly attribute nsIDocShellTreeItem parent;
    56 	/*
    57 	This getter returns the same thing parent does however if the parent
    58 	is of a different itemType, or if the parent is an <iframe mozbrowser>
    59 	or <iframe mozapp>, it will instead return nullptr.  This call is a
    60 	convience function for those wishing to not cross the boundaries at
    61 	which item types change.
    62 	*/
    63 	readonly attribute nsIDocShellTreeItem sameTypeParent;
    65 	/*
    66 	Returns the root DocShellTreeItem.  This is a convience equivalent to 
    67 	getting the parent and its parent until there isn't a parent.
    68 	*/
    69 	readonly attribute nsIDocShellTreeItem rootTreeItem;
    71 	/*
    72 	Returns the root DocShellTreeItem of the same type.  This is a convience 
    73 	equivalent to getting the parent of the same type and its parent until 
    74 	there isn't a parent.
    75 	*/
    76 	readonly attribute nsIDocShellTreeItem sameTypeRootTreeItem;
    78 	/*
    79 	Returns the docShellTreeItem with the specified name.  Search order is as 
    80 	follows...
    81 	1.)  Check name of self, if it matches return it.
    82 	2.)  For each immediate child.
    83 		a.) Check name of child and if it matches return it.
    84 		b.)  Ask the child to perform the check
    85 			i.) Do not ask a child if it is the aRequestor
    86 			ii.) Do not ask a child if it is of a different item type.
    87 	3.)  If there is a parent of the same item type ask parent to perform the check
    88 		a.) Do not ask parent if it is the aRequestor
    89 	4.)  If there is a tree owner ask the tree owner to perform the check
    90 		a.)  Do not ask the tree owner if it is the aRequestor
    91 		b.)  This should only be done if there is no parent of the same type.
    93 	Return the child DocShellTreeItem with the specified name.
    94 	name - This is the name of the item that is trying to be found.
    95 	aRequestor - This is the object that is requesting the find.  This
    96 		parameter is used to identify when the child is asking its parent to find
    97 		a child with the specific name.  The parent uses this parameter to ensure
    98 		a resursive state does not occur by not again asking the requestor to find
    99 		a shell by the specified name.  Inversely the child uses it to ensure it
   100 		does not ask its parent to do the search if its parent is the one that
   101 		asked it to search.  Children also use this to test against the treeOwner;
   102 	aOriginalRequestor - The original treeitem that made the request, if any.
   103 		This is used to ensure that we don't run into cross-site issues.
   104 	*/
   105 	nsIDocShellTreeItem findItemWithName(in wstring name,
   106 	                                     in nsISupports aRequestor,
   107 	                                     in nsIDocShellTreeItem aOriginalRequestor);
   109 	/*
   110 	The owner of the DocShell Tree.  This interface will be called upon when
   111 	the docshell has things it needs to tell to the owner of the docshell.
   112 	Note that docShell tree ownership does not cross tree types.  Meaning
   113 	setting ownership on a chrome tree does not set ownership on the content 
   114 	sub-trees.  A given tree's boundaries are identified by the type changes.
   115 	Trees of different types may be connected, but should not be traversed
   116 	for things such as ownership.
   118 	Note implementers of this interface should NOT effect the lifetime of the 
   119 	parent DocShell by holding this reference as it creates a cycle.  Owners
   120 	when releasing this interface should set the treeOwner to nullptr.
   121 	Implementers of this interface are guaranteed that when treeOwner is
   122 	set that the poitner is valid without having to addref.
   124 	Further note however when others try to get the interface it should be 
   125 	addref'd before handing it to them. 
   126 	*/
   127 	readonly attribute nsIDocShellTreeOwner treeOwner;
   128 	[noscript] void setTreeOwner(in nsIDocShellTreeOwner treeOwner);
   130 	/*
   131 	The current number of DocShells which are immediate children of the 
   132 	this object.
   133 	*/
   134 	readonly attribute long childCount;
   136 	/*
   137 	Add a new child DocShellTreeItem.  Adds to the end of the list.
   138 	Note that this does NOT take a reference to the child.  The child stays
   139 	alive only as long as it's referenced from outside the docshell tree.
   140 	@throws NS_ERROR_ILLEGAL_VALUE if child corresponds to the same
   141 	        object as this treenode or an ancestor of this treenode
   142 	@throws NS_ERROR_UNEXPECTED if this node is a leaf in the tree.
   143 	*/
   144 	void addChild(in nsIDocShellTreeItem child);
   146 	/*
   147 	Removes a child DocShellTreeItem.
   148 	@throws NS_ERROR_UNEXPECTED if this node is a leaf in the tree.
   149 	*/
   150 	void removeChild(in nsIDocShellTreeItem child);
   152 	/**
   153 	 * Return the child at the index requested.  This is 0-based.
   154 	 *
   155 	 * @throws NS_ERROR_UNEXPECTED if the index is out of range
   156 	 */
   157 	nsIDocShellTreeItem getChildAt(in long index);
   159 	/*
   160 	Return the child DocShellTreeItem with the specified name.
   161 	aName - This is the name of the item that is trying to be found.
   162 	aRecurse - Is used to tell the function to recurse through children.
   163 		Note, recursion will only happen through items of the same type.
   164 	aSameType - If this is set only children of the same type will be returned.
   165 	aRequestor - This is the docshellTreeItem that is requesting the find.  This
   166 		parameter is used when recursion is being used to avoid searching the same
   167 		tree again when a child has asked a parent to search for children.
   168 	aOriginalRequestor - The original treeitem that made the request, if any.
   169     	This is used to ensure that we don't run into cross-site issues.
   171 	Note the search is depth first when recursing.
   172 	*/
   173 	nsIDocShellTreeItem findChildWithName(in wstring aName,
   174 	                                      in boolean aRecurse,
   175 	                                      in boolean aSameType,
   176 	                                      in nsIDocShellTreeItem aRequestor,
   177 	                                      in nsIDocShellTreeItem aOriginalRequestor);
   178 };

mercurial