Thu, 15 Jan 2015 21:03:48 +0100
Integrate friendly tips from Tor colleagues to make (or not) 4.5 alpha 3;
This includes removal of overloaded (but unused) methods, and addition of
a overlooked call to DataStruct::SetData(nsISupports, uint32_t, bool.)
michael@0 | 1 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- |
michael@0 | 2 | * |
michael@0 | 3 | * This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 4 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 6 | |
michael@0 | 7 | /* Private "control" methods on the Window Watcher. These are annoying |
michael@0 | 8 | bookkeeping methods, not part of the public (embedding) interface. |
michael@0 | 9 | */ |
michael@0 | 10 | |
michael@0 | 11 | #include "nsISupports.idl" |
michael@0 | 12 | |
michael@0 | 13 | interface nsIDOMWindow; |
michael@0 | 14 | interface nsISimpleEnumerator; |
michael@0 | 15 | interface nsIWebBrowserChrome; |
michael@0 | 16 | interface nsIDocShellTreeItem; |
michael@0 | 17 | interface nsIArray; |
michael@0 | 18 | |
michael@0 | 19 | [uuid(00788A84-152F-4BD8-A814-FD8EB545DB29)] |
michael@0 | 20 | |
michael@0 | 21 | interface nsPIWindowWatcher : nsISupports |
michael@0 | 22 | { |
michael@0 | 23 | /** A window has been created. Add it to our list. |
michael@0 | 24 | @param aWindow the window to add |
michael@0 | 25 | @param aChrome the corresponding chrome window. The DOM window |
michael@0 | 26 | and chrome will be mapped together, and the corresponding |
michael@0 | 27 | chrome can be retrieved using the (not private) |
michael@0 | 28 | method getChromeForWindow. If null, any extant mapping |
michael@0 | 29 | will be cleared. |
michael@0 | 30 | */ |
michael@0 | 31 | void addWindow(in nsIDOMWindow aWindow, in nsIWebBrowserChrome aChrome); |
michael@0 | 32 | |
michael@0 | 33 | /** A window has been closed. Remove it from our list. |
michael@0 | 34 | @param aWindow the window to remove |
michael@0 | 35 | */ |
michael@0 | 36 | void removeWindow(in nsIDOMWindow aWindow); |
michael@0 | 37 | |
michael@0 | 38 | /** Like the public interface's open(), but can handle openDialog-style |
michael@0 | 39 | arguments and calls which shouldn't result in us navigating the window. |
michael@0 | 40 | |
michael@0 | 41 | @param aParent parent window, if any. Null if no parent. If it is |
michael@0 | 42 | impossible to get to an nsIWebBrowserChrome from aParent, this |
michael@0 | 43 | method will effectively act as if aParent were null. |
michael@0 | 44 | @param aURL url to which to open the new window. Must already be |
michael@0 | 45 | escaped, if applicable. can be null. |
michael@0 | 46 | @param aName window name from JS window.open. can be null. If a window |
michael@0 | 47 | with this name already exists, the openWindow call may just load |
michael@0 | 48 | aUrl in it (if aUrl is not null) and return it. |
michael@0 | 49 | @param aFeatures window features from JS window.open. can be null. |
michael@0 | 50 | @param aCalledFromScript true if we were called from script. |
michael@0 | 51 | @param aDialog use dialog defaults (see nsIDOMWindow::openDialog) |
michael@0 | 52 | @param aNavigate true if we should navigate the new window to the |
michael@0 | 53 | specified URL. |
michael@0 | 54 | @param aArgs Window argument |
michael@0 | 55 | @return the new window |
michael@0 | 56 | |
michael@0 | 57 | @note This method may examine the JS context stack for purposes of |
michael@0 | 58 | determining the security context to use for the search for a given |
michael@0 | 59 | window named aName. |
michael@0 | 60 | @note This method should try to set the default charset for the new |
michael@0 | 61 | window to the default charset of the document in the calling window |
michael@0 | 62 | (which is determined based on the JS stack and the value of |
michael@0 | 63 | aParent). This is not guaranteed, however. |
michael@0 | 64 | */ |
michael@0 | 65 | nsIDOMWindow openWindow2(in nsIDOMWindow aParent, in string aUrl, |
michael@0 | 66 | in string aName, in string aFeatures, |
michael@0 | 67 | in boolean aCalledFromScript, in boolean aDialog, |
michael@0 | 68 | in boolean aNavigate, in nsISupports aArgs); |
michael@0 | 69 | |
michael@0 | 70 | /** |
michael@0 | 71 | * Find a named docshell tree item amongst all windows registered |
michael@0 | 72 | * with the window watcher. This may be a subframe in some window, |
michael@0 | 73 | * for example. |
michael@0 | 74 | * |
michael@0 | 75 | * @param aName the name of the window. Must not be null. |
michael@0 | 76 | * @param aRequestor the tree item immediately making the request. |
michael@0 | 77 | * We should make sure to not recurse down into its findItemWithName |
michael@0 | 78 | * method. |
michael@0 | 79 | * @param aOriginalRequestor the original treeitem that made the request. |
michael@0 | 80 | * Used for security checks. |
michael@0 | 81 | * @return the tree item with aName as the name, or null if there |
michael@0 | 82 | * isn't one. "Special" names, like _self, _top, etc, will be |
michael@0 | 83 | * treated specially only if aRequestor is null; in that case they |
michael@0 | 84 | * will be resolved relative to the first window the windowwatcher |
michael@0 | 85 | * knows about. |
michael@0 | 86 | * @see findItemWithName methods on nsIDocShellTreeItem and |
michael@0 | 87 | * nsIDocShellTreeOwner |
michael@0 | 88 | */ |
michael@0 | 89 | nsIDocShellTreeItem findItemWithName(in wstring aName, |
michael@0 | 90 | in nsIDocShellTreeItem aRequestor, |
michael@0 | 91 | in nsIDocShellTreeItem aOriginalRequestor); |
michael@0 | 92 | }; |
michael@0 | 93 |