2001-09-25 22:43:09 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2005-08-15 18:16:42 +00:00
|
|
|
/* vim: set ts=2 sw=2 et tw=80: */
|
2001-09-25 22:43:09 +00:00
|
|
|
/* ***** BEGIN LICENSE BLOCK *****
|
2004-04-17 21:52:36 +00:00
|
|
|
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
1998-07-24 05:05:42 +00:00
|
|
|
*
|
2004-04-17 21:52:36 +00:00
|
|
|
* The contents of this file are subject to the Mozilla Public License Version
|
|
|
|
* 1.1 (the "License"); you may not use this file except in compliance with
|
|
|
|
* the License. You may obtain a copy of the License at
|
|
|
|
* http://www.mozilla.org/MPL/
|
1998-07-24 05:05:42 +00:00
|
|
|
*
|
2001-09-25 22:43:09 +00:00
|
|
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
|
|
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
|
|
|
* for the specific language governing rights and limitations under the
|
|
|
|
* License.
|
1998-07-24 05:05:42 +00:00
|
|
|
*
|
1999-11-06 03:40:37 +00:00
|
|
|
* The Original Code is mozilla.org code.
|
|
|
|
*
|
2004-04-17 21:52:36 +00:00
|
|
|
* The Initial Developer of the Original Code is
|
2001-09-25 22:43:09 +00:00
|
|
|
* Netscape Communications Corporation.
|
|
|
|
* Portions created by the Initial Developer are Copyright (C) 1998
|
|
|
|
* the Initial Developer. All Rights Reserved.
|
1999-11-06 03:40:37 +00:00
|
|
|
*
|
2000-02-08 13:40:10 +00:00
|
|
|
* Contributor(s):
|
2001-04-18 06:06:31 +00:00
|
|
|
* Travis Bogard <travis@netscape.com>
|
|
|
|
* Dan Rosen <dr@netscape.com>
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 17:42:36 +00:00
|
|
|
* Vidur Apparao <vidur@netscape.com>
|
|
|
|
* Johnny Stenback <jst@netscape.com>
|
2001-09-25 22:43:09 +00:00
|
|
|
*
|
|
|
|
* Alternatively, the contents of this file may be used under the terms of
|
2004-04-17 21:52:36 +00:00
|
|
|
* either of the GNU General Public License Version 2 or later (the "GPL"),
|
|
|
|
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
2001-09-25 22:43:09 +00:00
|
|
|
* in which case the provisions of the GPL or the LGPL are applicable instead
|
|
|
|
* of those above. If you wish to allow use of your version of this file only
|
|
|
|
* under the terms of either the GPL or the LGPL, and not to allow others to
|
2004-04-17 21:52:36 +00:00
|
|
|
* use your version of this file under the terms of the MPL, indicate your
|
2001-09-25 22:43:09 +00:00
|
|
|
* decision by deleting the provisions above and replace them with the notice
|
|
|
|
* and other provisions required by the GPL or the LGPL. If you do not delete
|
|
|
|
* the provisions above, a recipient may use your version of this file under
|
2004-04-17 21:52:36 +00:00
|
|
|
* the terms of any one of the MPL, the GPL or the LGPL.
|
2001-09-25 22:43:09 +00:00
|
|
|
*
|
|
|
|
* ***** END LICENSE BLOCK ***** */
|
2001-04-18 06:06:31 +00:00
|
|
|
|
1998-07-24 05:05:42 +00:00
|
|
|
#ifndef nsGlobalWindow_h___
|
|
|
|
#define nsGlobalWindow_h___
|
|
|
|
|
2000-02-08 13:40:10 +00:00
|
|
|
// Local Includes
|
|
|
|
// Helper Classes
|
1999-10-14 10:58:25 +00:00
|
|
|
#include "nsCOMPtr.h"
|
2003-06-20 23:51:46 +00:00
|
|
|
#include "nsAutoPtr.h"
|
2000-05-14 05:26:06 +00:00
|
|
|
#include "nsWeakReference.h"
|
2000-03-24 00:11:48 +00:00
|
|
|
#include "nsHashtable.h"
|
2006-05-19 05:57:36 +00:00
|
|
|
#include "nsDataHashtable.h"
|
2007-01-04 22:31:26 +00:00
|
|
|
#include "nsCycleCollectionParticipant.h"
|
2000-02-08 13:40:10 +00:00
|
|
|
|
|
|
|
// Interfaces Needed
|
|
|
|
#include "nsDOMWindowList.h"
|
|
|
|
#include "nsIBaseWindow.h"
|
2004-12-07 16:09:23 +00:00
|
|
|
#include "nsIBrowserDOMWindow.h"
|
2000-02-08 13:40:10 +00:00
|
|
|
#include "nsIChromeEventHandler.h"
|
|
|
|
#include "nsIControllers.h"
|
|
|
|
#include "nsIDocShellTreeOwner.h"
|
|
|
|
#include "nsIDocShellTreeItem.h"
|
2006-06-29 00:56:52 +00:00
|
|
|
#include "nsIDOMClientInformation.h"
|
2000-05-03 13:03:17 +00:00
|
|
|
#include "nsIDOMViewCSS.h"
|
1999-09-21 14:18:52 +00:00
|
|
|
#include "nsIDOMEventReceiver.h"
|
2002-11-09 00:25:25 +00:00
|
|
|
#include "nsIDOM3EventTarget.h"
|
2005-04-28 23:48:28 +00:00
|
|
|
#include "nsIDOMNSEventTarget.h"
|
2000-02-08 13:40:10 +00:00
|
|
|
#include "nsIDOMNavigator.h"
|
1999-08-03 23:16:48 +00:00
|
|
|
#include "nsIDOMNSLocation.h"
|
2000-09-01 01:54:35 +00:00
|
|
|
#include "nsIDOMWindowInternal.h"
|
2001-05-17 02:15:27 +00:00
|
|
|
#include "nsIInterfaceRequestor.h"
|
2001-09-05 21:28:38 +00:00
|
|
|
#include "nsIInterfaceRequestorUtils.h"
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 17:42:36 +00:00
|
|
|
#include "nsIDOMJSWindow.h"
|
2002-02-09 03:36:55 +00:00
|
|
|
#include "nsIDOMChromeWindow.h"
|
2000-02-08 13:40:10 +00:00
|
|
|
#include "nsIScriptGlobalObject.h"
|
2005-07-30 20:57:07 +00:00
|
|
|
#include "nsIScriptContext.h"
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 17:42:36 +00:00
|
|
|
#include "nsIScriptObjectPrincipal.h"
|
2006-06-13 03:07:47 +00:00
|
|
|
#include "nsIScriptTimeoutHandler.h"
|
2000-02-08 13:40:10 +00:00
|
|
|
#include "nsITimer.h"
|
|
|
|
#include "nsIWebBrowserChrome.h"
|
1999-10-14 10:58:25 +00:00
|
|
|
#include "nsPIDOMWindow.h"
|
2003-06-26 00:41:23 +00:00
|
|
|
#include "nsIScriptSecurityManager.h"
|
2000-02-09 05:26:02 +00:00
|
|
|
#include "nsIEventListenerManager.h"
|
|
|
|
#include "nsIDOMDocument.h"
|
2000-05-11 19:17:07 +00:00
|
|
|
#include "nsIDOMCrypto.h"
|
|
|
|
#include "nsIDOMPkcs11.h"
|
2000-07-13 21:48:25 +00:00
|
|
|
#include "nsIPrincipal.h"
|
2001-01-23 22:29:41 +00:00
|
|
|
#include "nsPluginArray.h"
|
2001-07-23 05:36:52 +00:00
|
|
|
#include "nsMimeTypeArray.h"
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 17:42:36 +00:00
|
|
|
#include "nsIXPCScriptable.h"
|
2002-02-20 03:33:52 +00:00
|
|
|
#include "nsPoint.h"
|
|
|
|
#include "nsSize.h"
|
2004-05-27 22:08:42 +00:00
|
|
|
#include "mozFlushType.h"
|
2005-07-30 20:57:07 +00:00
|
|
|
#include "prclist.h"
|
2006-05-19 05:57:36 +00:00
|
|
|
#include "nsIDOMStorage.h"
|
|
|
|
#include "nsIDOMStorageList.h"
|
|
|
|
#include "nsIDOMStorageWindow.h"
|
1998-07-24 05:05:42 +00:00
|
|
|
|
1999-04-28 20:33:43 +00:00
|
|
|
#define DEFAULT_HOME_PAGE "www.mozilla.org"
|
|
|
|
#define PREF_BROWSER_STARTUP_HOMEPAGE "browser.startup.homepage"
|
|
|
|
|
1999-06-09 19:04:18 +00:00
|
|
|
class nsIDOMBarProp;
|
1999-05-27 21:06:51 +00:00
|
|
|
class nsIDocument;
|
1999-09-21 01:05:01 +00:00
|
|
|
class nsIContent;
|
2004-07-31 23:15:21 +00:00
|
|
|
class nsPresContext;
|
1998-07-24 05:05:42 +00:00
|
|
|
class nsIDOMEvent;
|
1999-10-06 22:07:42 +00:00
|
|
|
class nsIScrollableView;
|
2006-06-13 03:07:47 +00:00
|
|
|
class nsIArray;
|
1998-07-24 05:05:42 +00:00
|
|
|
|
2004-12-10 19:48:22 +00:00
|
|
|
class nsBarProp;
|
|
|
|
class nsLocation;
|
|
|
|
class nsNavigator;
|
|
|
|
class nsScreen;
|
|
|
|
class nsHistory;
|
2000-08-11 04:31:08 +00:00
|
|
|
class nsIDocShellLoadInfo;
|
2005-05-04 20:22:32 +00:00
|
|
|
class WindowStateHolder;
|
2006-05-03 21:53:08 +00:00
|
|
|
class nsGlobalWindowObserver;
|
2006-09-21 03:46:46 +00:00
|
|
|
class nsGlobalWindow;
|
1998-08-13 04:34:53 +00:00
|
|
|
|
2006-02-23 03:24:33 +00:00
|
|
|
// permissible values for CheckOpenAllow
|
|
|
|
enum OpenAllowValue {
|
|
|
|
allowNot = 0, // the window opening is denied
|
|
|
|
allowNoAbuse, // allowed: not a popup
|
|
|
|
allowWhitelisted // allowed: it's whitelisted or popup blocking is disabled
|
|
|
|
};
|
|
|
|
|
2006-06-13 03:07:47 +00:00
|
|
|
extern nsresult
|
|
|
|
NS_CreateJSTimeoutHandler(nsIScriptContext *aContext,
|
|
|
|
PRBool aIsInterval,
|
|
|
|
PRInt32 *aInterval,
|
|
|
|
nsIScriptTimeoutHandler **aRet);
|
|
|
|
|
2006-09-21 03:46:46 +00:00
|
|
|
/*
|
|
|
|
* Timeout struct that holds information about each script
|
|
|
|
* timeout. Holds a strong reference to an nsIScriptTimeoutHandler, which
|
|
|
|
* abstracts the language specific cruft.
|
|
|
|
*/
|
|
|
|
struct nsTimeout : PRCList
|
|
|
|
{
|
|
|
|
nsTimeout();
|
|
|
|
~nsTimeout();
|
|
|
|
|
|
|
|
nsrefcnt Release();
|
|
|
|
nsrefcnt AddRef();
|
|
|
|
|
|
|
|
nsTimeout* Next() {
|
|
|
|
// Note: might not actually return an nsTimeout. Use IsTimeout to check.
|
|
|
|
return NS_STATIC_CAST(nsTimeout*, PR_NEXT_LINK(this));
|
|
|
|
}
|
|
|
|
|
|
|
|
nsTimeout* Prev() {
|
|
|
|
// Note: might not actually return an nsTimeout. Use IsTimeout to check.
|
|
|
|
return NS_STATIC_CAST(nsTimeout*, PR_PREV_LINK(this));
|
|
|
|
}
|
|
|
|
|
|
|
|
// Window for which this timeout fires
|
|
|
|
nsRefPtr<nsGlobalWindow> mWindow;
|
|
|
|
|
|
|
|
// The actual timer object
|
|
|
|
nsCOMPtr<nsITimer> mTimer;
|
|
|
|
|
|
|
|
// True if the timeout was cleared
|
|
|
|
PRPackedBool mCleared;
|
|
|
|
|
|
|
|
// True if this is one of the timeouts that are currently running
|
|
|
|
PRPackedBool mRunning;
|
|
|
|
|
|
|
|
// Returned as value of setTimeout()
|
|
|
|
PRUint32 mPublicId;
|
|
|
|
|
|
|
|
// Non-zero interval in milliseconds if repetitive timeout
|
|
|
|
PRUint32 mInterval;
|
|
|
|
|
|
|
|
// Nominal time (in microseconds since the epoch) to run this
|
|
|
|
// timeout
|
|
|
|
PRTime mWhen;
|
|
|
|
|
|
|
|
// Principal with which to execute
|
|
|
|
nsCOMPtr<nsIPrincipal> mPrincipal;
|
|
|
|
|
|
|
|
// stack depth at which timeout is firing
|
|
|
|
PRUint32 mFiringDepth;
|
|
|
|
|
|
|
|
// The popup state at timeout creation time if not created from
|
|
|
|
// another timeout
|
|
|
|
PopupControlState mPopupState;
|
|
|
|
|
|
|
|
// The language-specific information about the callback.
|
|
|
|
nsCOMPtr<nsIScriptTimeoutHandler> mScriptHandler;
|
|
|
|
|
|
|
|
private:
|
|
|
|
// reference count for shared usage
|
|
|
|
PRInt32 mRefCnt;
|
|
|
|
};
|
|
|
|
|
2000-02-08 13:40:10 +00:00
|
|
|
//*****************************************************************************
|
2004-12-10 19:48:22 +00:00
|
|
|
// nsGlobalWindow: Global Object for Scripting
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 17:42:36 +00:00
|
|
|
//*****************************************************************************
|
2001-07-24 22:39:11 +00:00
|
|
|
// Beware that all scriptable interfaces implemented by
|
2004-12-10 19:48:22 +00:00
|
|
|
// nsGlobalWindow will be reachable from JS, if you make this class
|
2001-07-24 22:39:11 +00:00
|
|
|
// implement new interfaces you better know what you're
|
|
|
|
// doing. Security wise this is very sensitive code. --
|
|
|
|
// jst@netscape.com
|
|
|
|
|
2005-08-12 04:11:00 +00:00
|
|
|
// nsGlobalWindow inherits PRCList for maintaining a list of all inner
|
|
|
|
// widows still in memory for any given outer window. This list is
|
|
|
|
// needed to ensure that mOuterWindow doesn't end up dangling. The
|
|
|
|
// nature of PRCList means that the window itself is always in the
|
|
|
|
// list, and an outer window's list will also contain all inner window
|
|
|
|
// objects that are still in memory (and in reality all inner window
|
|
|
|
// object's lists also contain its outer and all other inner windows
|
|
|
|
// belonging to the same outer window, but that's an unimportant
|
|
|
|
// side effect of inheriting PRCList).
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 17:42:36 +00:00
|
|
|
|
2005-07-31 19:43:27 +00:00
|
|
|
class nsGlobalWindow : public nsPIDOMWindow,
|
|
|
|
public nsIScriptGlobalObject,
|
2004-12-10 19:48:22 +00:00
|
|
|
public nsIDOMJSWindow,
|
|
|
|
public nsIScriptObjectPrincipal,
|
|
|
|
public nsIDOMEventReceiver,
|
|
|
|
public nsIDOM3EventTarget,
|
2005-04-28 23:48:28 +00:00
|
|
|
public nsIDOMNSEventTarget,
|
2004-12-10 19:48:22 +00:00
|
|
|
public nsIDOMViewCSS,
|
2006-05-19 05:57:36 +00:00
|
|
|
public nsIDOMStorageWindow,
|
2004-12-10 19:48:22 +00:00
|
|
|
public nsSupportsWeakReference,
|
2005-07-30 20:57:07 +00:00
|
|
|
public nsIInterfaceRequestor,
|
|
|
|
public PRCListStr
|
1998-07-24 05:05:42 +00:00
|
|
|
{
|
|
|
|
public:
|
2004-05-03 21:48:36 +00:00
|
|
|
// public methods
|
|
|
|
nsPIDOMWindow* GetPrivateParent();
|
|
|
|
// callback for close event
|
|
|
|
void ReallyCloseWindow();
|
|
|
|
|
2001-01-18 07:44:29 +00:00
|
|
|
// nsISupports
|
2007-01-04 22:31:26 +00:00
|
|
|
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
2001-01-18 07:44:29 +00:00
|
|
|
|
|
|
|
// nsIScriptGlobalObject
|
2004-02-09 22:48:53 +00:00
|
|
|
virtual nsIScriptContext *GetContext();
|
2006-06-13 03:07:47 +00:00
|
|
|
virtual JSObject *GetGlobalJSObject();
|
|
|
|
|
|
|
|
virtual nsresult EnsureScriptEnvironment(PRUint32 aLangID);
|
|
|
|
|
|
|
|
virtual nsIScriptContext *GetScriptContext(PRUint32 lang);
|
|
|
|
virtual void *GetScriptGlobal(PRUint32 lang);
|
|
|
|
|
|
|
|
// Set a new script language context for this global. The native global
|
|
|
|
// for the context is created by the context's GetNativeGlobal() method.
|
|
|
|
virtual nsresult SetScriptContext(PRUint32 lang, nsIScriptContext *aContext);
|
|
|
|
|
2004-02-09 22:48:53 +00:00
|
|
|
virtual void SetGlobalObjectOwner(nsIScriptGlobalObjectOwner* aOwner);
|
|
|
|
virtual nsIScriptGlobalObjectOwner *GetGlobalObjectOwner();
|
2006-06-13 03:07:47 +00:00
|
|
|
virtual void OnFinalize(PRUint32 aLangID, void *aScriptGlobal);
|
2004-02-09 22:48:53 +00:00
|
|
|
virtual void SetScriptsEnabled(PRBool aEnabled, PRBool aFireTimeouts);
|
2006-06-13 03:07:47 +00:00
|
|
|
virtual nsresult SetNewArguments(nsIArray *aArguments);
|
2001-01-18 07:44:29 +00:00
|
|
|
|
|
|
|
// nsIScriptObjectPrincipal
|
2004-04-18 00:28:47 +00:00
|
|
|
virtual nsIPrincipal* GetPrincipal();
|
2001-01-18 07:44:29 +00:00
|
|
|
|
|
|
|
// nsIDOMWindow
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 17:42:36 +00:00
|
|
|
NS_DECL_NSIDOMWINDOW
|
2001-01-18 07:44:29 +00:00
|
|
|
|
2004-05-26 18:10:47 +00:00
|
|
|
// nsIDOMWindow2
|
|
|
|
NS_DECL_NSIDOMWINDOW2
|
|
|
|
|
2001-01-18 07:44:29 +00:00
|
|
|
// nsIDOMWindowInternal
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 17:42:36 +00:00
|
|
|
NS_DECL_NSIDOMWINDOWINTERNAL
|
|
|
|
|
|
|
|
// nsIDOMJSWindow
|
|
|
|
NS_DECL_NSIDOMJSWINDOW
|
2001-01-18 07:44:29 +00:00
|
|
|
|
|
|
|
// nsIDOMEventTarget
|
2002-11-09 00:25:25 +00:00
|
|
|
NS_DECL_NSIDOMEVENTTARGET
|
|
|
|
|
|
|
|
// nsIDOM3EventTarget
|
|
|
|
NS_DECL_NSIDOM3EVENTTARGET
|
2001-01-18 07:44:29 +00:00
|
|
|
|
2005-04-28 23:48:28 +00:00
|
|
|
// nsIDOMNSEventTarget
|
|
|
|
NS_DECL_NSIDOMNSEVENTTARGET
|
|
|
|
|
2001-01-18 07:44:29 +00:00
|
|
|
// nsIDOMEventReceiver
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 17:42:36 +00:00
|
|
|
NS_IMETHOD AddEventListenerByIID(nsIDOMEventListener *aListener,
|
2001-01-18 07:44:29 +00:00
|
|
|
const nsIID& aIID);
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 17:42:36 +00:00
|
|
|
NS_IMETHOD RemoveEventListenerByIID(nsIDOMEventListener *aListener,
|
2001-01-18 07:44:29 +00:00
|
|
|
const nsIID& aIID);
|
2006-03-07 17:08:51 +00:00
|
|
|
NS_IMETHOD GetListenerManager(PRBool aCreateIfNotFound,
|
|
|
|
nsIEventListenerManager** aResult);
|
2001-01-18 07:44:29 +00:00
|
|
|
NS_IMETHOD HandleEvent(nsIDOMEvent *aEvent);
|
2002-11-09 00:25:25 +00:00
|
|
|
NS_IMETHOD GetSystemEventGroup(nsIDOMEventGroup** aGroup);
|
2001-01-18 07:44:29 +00:00
|
|
|
|
|
|
|
// nsPIDOMWindow
|
2004-05-03 21:48:36 +00:00
|
|
|
virtual NS_HIDDEN_(nsPIDOMWindow*) GetPrivateRoot();
|
|
|
|
virtual NS_HIDDEN_(nsresult) Activate();
|
|
|
|
virtual NS_HIDDEN_(nsresult) Deactivate();
|
|
|
|
virtual NS_HIDDEN_(nsIFocusController*) GetRootFocusController();
|
|
|
|
|
2006-02-20 18:52:42 +00:00
|
|
|
virtual NS_HIDDEN_(void) SetOpenerScriptPrincipal(nsIPrincipal* aPrincipal);
|
2006-08-15 17:31:16 +00:00
|
|
|
virtual NS_HIDDEN_(nsIPrincipal*) GetOpenerScriptPrincipal();
|
2002-04-17 04:17:16 +00:00
|
|
|
|
2005-06-18 06:06:45 +00:00
|
|
|
virtual NS_HIDDEN_(PopupControlState) PushPopupControlState(PopupControlState state, PRBool aForce) const;
|
2004-09-04 19:28:46 +00:00
|
|
|
virtual NS_HIDDEN_(void) PopPopupControlState(PopupControlState state) const;
|
|
|
|
virtual NS_HIDDEN_(PopupControlState) GetPopupControlState() const;
|
|
|
|
|
2005-05-04 20:22:32 +00:00
|
|
|
virtual NS_HIDDEN_(nsresult) SaveWindowState(nsISupports **aState);
|
|
|
|
virtual NS_HIDDEN_(nsresult) RestoreWindowState(nsISupports *aState);
|
2005-12-01 19:35:27 +00:00
|
|
|
virtual NS_HIDDEN_(nsresult) ResumeTimeouts();
|
2006-05-03 21:53:08 +00:00
|
|
|
virtual NS_HIDDEN_(nsresult) FireDelayedDOMEvents();
|
2005-07-30 20:57:07 +00:00
|
|
|
|
2005-08-23 00:24:57 +00:00
|
|
|
virtual NS_HIDDEN_(PRBool) WouldReuseInnerWindow(nsIDocument *aNewDocument);
|
2006-03-07 17:08:51 +00:00
|
|
|
|
|
|
|
virtual NS_HIDDEN_(nsresult) PreHandleEvent(nsEventChainPreVisitor& aVisitor);
|
|
|
|
virtual NS_HIDDEN_(nsresult) PostHandleEvent(nsEventChainPostVisitor& aVisitor);
|
|
|
|
virtual NS_HIDDEN_(nsresult) DispatchDOMEvent(nsEvent* aEvent,
|
|
|
|
nsIDOMEvent* aDOMEvent,
|
|
|
|
nsPresContext* aPresContext,
|
|
|
|
nsEventStatus* aEventStatus);
|
|
|
|
|
2005-12-01 19:35:27 +00:00
|
|
|
virtual NS_HIDDEN_(void) SetDocShell(nsIDocShell* aDocShell);
|
|
|
|
virtual NS_HIDDEN_(nsresult) SetNewDocument(nsIDocument *aDocument,
|
|
|
|
nsISupports *aState,
|
|
|
|
PRBool aClearScopeHint);
|
2006-02-15 03:22:17 +00:00
|
|
|
virtual NS_HIDDEN_(void) SetOpenerWindow(nsIDOMWindowInternal *aOpener,
|
|
|
|
PRBool aOriginalOpener);
|
2006-04-08 03:23:37 +00:00
|
|
|
virtual NS_HIDDEN_(void) EnsureSizeUpToDate();
|
2005-08-23 00:24:57 +00:00
|
|
|
|
2006-07-05 22:48:04 +00:00
|
|
|
virtual NS_HIDDEN_(void) EnterModalState();
|
|
|
|
virtual NS_HIDDEN_(void) LeaveModalState();
|
|
|
|
|
2001-01-18 07:44:29 +00:00
|
|
|
// nsIDOMViewCSS
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 17:42:36 +00:00
|
|
|
NS_DECL_NSIDOMVIEWCSS
|
2000-05-03 13:03:17 +00:00
|
|
|
|
2001-01-18 07:44:29 +00:00
|
|
|
// nsIDOMAbstractView
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 17:42:36 +00:00
|
|
|
NS_DECL_NSIDOMABSTRACTVIEW
|
2000-02-08 13:40:10 +00:00
|
|
|
|
2006-05-19 05:57:36 +00:00
|
|
|
// nsIDOMStorageWindow
|
|
|
|
NS_DECL_NSIDOMSTORAGEWINDOW
|
|
|
|
|
2001-05-17 02:15:27 +00:00
|
|
|
// nsIInterfaceRequestor
|
|
|
|
NS_DECL_NSIINTERFACEREQUESTOR
|
|
|
|
|
2001-01-18 07:44:29 +00:00
|
|
|
// Object Management
|
2005-07-30 20:57:07 +00:00
|
|
|
nsGlobalWindow(nsGlobalWindow *aOuterWindow);
|
|
|
|
|
|
|
|
static nsGlobalWindow *FromWrapper(nsIXPConnectWrappedNative *wrapper)
|
|
|
|
{
|
|
|
|
// Make sure this matches the casts we do in QueryInterface().
|
|
|
|
return (nsGlobalWindow *)(nsIScriptGlobalObject *)wrapper->Native();
|
|
|
|
}
|
|
|
|
|
|
|
|
nsIScriptContext *GetContextInternal()
|
|
|
|
{
|
2005-08-12 04:11:00 +00:00
|
|
|
if (mOuterWindow) {
|
2005-07-30 20:57:07 +00:00
|
|
|
return GetOuterWindowInternal()->mContext;
|
|
|
|
}
|
|
|
|
|
|
|
|
return mContext;
|
|
|
|
}
|
|
|
|
|
2006-06-13 03:07:47 +00:00
|
|
|
nsIScriptContext *GetScriptContextInternal(PRUint32 aLangID)
|
|
|
|
{
|
|
|
|
NS_ASSERTION(NS_STID_VALID(aLangID), "Invalid language");
|
|
|
|
if (mOuterWindow) {
|
|
|
|
return GetOuterWindowInternal()->mScriptContexts[NS_STID_INDEX(aLangID)];
|
|
|
|
}
|
|
|
|
|
|
|
|
return mScriptContexts[NS_STID_INDEX(aLangID)];
|
|
|
|
}
|
|
|
|
|
2005-07-30 20:57:07 +00:00
|
|
|
nsGlobalWindow *GetOuterWindowInternal()
|
|
|
|
{
|
|
|
|
return NS_STATIC_CAST(nsGlobalWindow *, GetOuterWindow());
|
|
|
|
}
|
|
|
|
|
|
|
|
nsGlobalWindow *GetCurrentInnerWindowInternal()
|
|
|
|
{
|
|
|
|
return NS_STATIC_CAST(nsGlobalWindow *, mInnerWindow);
|
|
|
|
}
|
|
|
|
|
2005-12-11 20:38:29 +00:00
|
|
|
nsGlobalWindow *EnsureInnerWindowInternal()
|
|
|
|
{
|
|
|
|
return NS_STATIC_CAST(nsGlobalWindow *, EnsureInnerWindow());
|
|
|
|
}
|
|
|
|
|
2005-08-19 20:09:38 +00:00
|
|
|
PRBool IsFrozen() const
|
|
|
|
{
|
|
|
|
return mIsFrozen;
|
|
|
|
}
|
2006-05-19 05:57:36 +00:00
|
|
|
|
2006-11-17 01:06:41 +00:00
|
|
|
PRBool IsCreatingInnerWindow() const
|
|
|
|
{
|
|
|
|
return mCreatingInnerWindow;
|
|
|
|
}
|
|
|
|
|
2006-05-19 05:57:36 +00:00
|
|
|
nsresult Observe(nsISupports* aSubject, const char* aTopic,
|
|
|
|
const PRUnichar* aData);
|
2005-08-19 20:09:38 +00:00
|
|
|
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 17:42:36 +00:00
|
|
|
static void ShutDown();
|
2002-06-19 04:09:57 +00:00
|
|
|
static PRBool IsCallerChrome();
|
2006-08-29 22:25:12 +00:00
|
|
|
static void CloseBlockScriptTerminationFunc(nsISupports *aRef);
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 17:42:36 +00:00
|
|
|
|
2006-10-05 17:29:47 +00:00
|
|
|
static void RunPendingTimeoutsRecursive(nsGlobalWindow *aTopWindow,
|
|
|
|
nsGlobalWindow *aWindow);
|
|
|
|
|
2005-05-04 20:22:32 +00:00
|
|
|
friend class WindowStateHolder;
|
|
|
|
|
2007-01-04 22:31:26 +00:00
|
|
|
NS_DECL_CYCLE_COLLECTION_CLASS(nsGlobalWindow)
|
|
|
|
|
2000-02-08 13:40:10 +00:00
|
|
|
protected:
|
2001-01-18 07:44:29 +00:00
|
|
|
// Object Management
|
2004-12-10 19:48:22 +00:00
|
|
|
virtual ~nsGlobalWindow();
|
2001-01-18 07:44:29 +00:00
|
|
|
void CleanUp();
|
2002-12-20 08:00:08 +00:00
|
|
|
void ClearControllers();
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 17:42:36 +00:00
|
|
|
|
2006-09-22 01:01:04 +00:00
|
|
|
void FreeInnerObjects(PRBool aClearScope);
|
2005-08-15 18:16:42 +00:00
|
|
|
|
2005-12-01 19:35:27 +00:00
|
|
|
nsresult SetNewDocument(nsIDocument *aDocument,
|
2005-08-15 18:16:42 +00:00
|
|
|
nsISupports *aState,
|
2005-07-30 20:57:07 +00:00
|
|
|
PRBool aClearScopeHint,
|
|
|
|
PRBool aIsInternalCall);
|
|
|
|
|
2001-10-31 23:52:52 +00:00
|
|
|
// Get the parent, returns null if this is a toplevel window
|
2004-02-09 22:48:53 +00:00
|
|
|
nsIDOMWindowInternal *GetParentInternal();
|
2001-10-31 23:52:52 +00:00
|
|
|
|
2004-05-03 21:48:36 +00:00
|
|
|
// popup tracking
|
2005-07-30 20:57:07 +00:00
|
|
|
PRBool IsPopupSpamWindow()
|
|
|
|
{
|
2005-08-12 04:11:00 +00:00
|
|
|
if (IsInnerWindow() && !mOuterWindow) {
|
|
|
|
return PR_FALSE;
|
|
|
|
}
|
|
|
|
|
2005-07-30 20:57:07 +00:00
|
|
|
return GetOuterWindowInternal()->mIsPopupSpam;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SetPopupSpamWindow(PRBool aPopup)
|
|
|
|
{
|
2005-08-12 04:11:00 +00:00
|
|
|
if (IsInnerWindow() && !mOuterWindow) {
|
|
|
|
NS_ERROR("SetPopupSpamWindow() called on inner window w/o an outer!");
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2005-07-30 20:57:07 +00:00
|
|
|
GetOuterWindowInternal()->mIsPopupSpam = aPopup;
|
|
|
|
}
|
2004-05-03 21:48:36 +00:00
|
|
|
|
2001-01-18 07:44:29 +00:00
|
|
|
// Window Control Functions
|
2006-02-07 20:46:39 +00:00
|
|
|
/**
|
|
|
|
* @param aURL the URL to load in the new window
|
|
|
|
* @param aName the name to use for the new window
|
|
|
|
* @param aOptions the window options to use for the new window
|
|
|
|
* @param aDialog true when called from variants of OpenDialog. If this is
|
|
|
|
* true, this method will skip popup blocking checks. The
|
|
|
|
* aDialog argument is passed on to the window watcher.
|
|
|
|
* @param aCalledNoScript true when called via the [noscript] open()
|
|
|
|
* and openDialog() methods. When this is true, we do
|
|
|
|
* NOT want to use the JS stack for things like caller
|
|
|
|
* determination.
|
|
|
|
* @param aDoJSFixups true when this is the content-accessible JS version of
|
|
|
|
* window opening. When true, popups do not cause us to
|
|
|
|
* throw, we save the caller's principal in the new window
|
|
|
|
* for later consumption, and we make sure that there is a
|
|
|
|
* document in the newly-opened window. Note that this
|
|
|
|
* last will only be done if the newly-opened window is
|
|
|
|
* non-chrome.
|
|
|
|
* @param argv The arguments to pass to the new window. The first
|
|
|
|
* three args, if present, will be aURL, aName, and aOptions. So
|
|
|
|
* this param only matters if there are more than 3 arguments.
|
|
|
|
* @param argc The number of arguments in argv.
|
|
|
|
* @param aExtraArgument Another way to pass arguments in. This is mutually
|
|
|
|
* exclusive with the argv/argc approach.
|
2006-08-29 22:25:12 +00:00
|
|
|
* @param aJSCallerContext The calling script's context. This must be nsnull
|
|
|
|
* when aCalledNoScript is true.
|
2006-02-07 20:46:39 +00:00
|
|
|
* @param aReturn [out] The window that was opened, if any.
|
|
|
|
*
|
|
|
|
* @note that the boolean args are const because the function shouldn't be
|
|
|
|
* messing with them. That also makes it easier for the compiler to sort out
|
|
|
|
* its build warning stuff.
|
|
|
|
*/
|
|
|
|
NS_HIDDEN_(nsresult) OpenInternal(const nsAString& aUrl,
|
|
|
|
const nsAString& aName,
|
|
|
|
const nsAString& aOptions,
|
|
|
|
PRBool aDialog,
|
|
|
|
PRBool aCalledNoScript,
|
|
|
|
PRBool aDoJSFixups,
|
2006-06-13 03:07:47 +00:00
|
|
|
nsIArray *argv,
|
2006-02-07 20:46:39 +00:00
|
|
|
nsISupports *aExtraArgument,
|
2006-07-11 00:27:05 +00:00
|
|
|
nsIPrincipal *aCalleePrincipal,
|
2006-08-29 22:25:12 +00:00
|
|
|
JSContext *aJSCallerContext,
|
2006-02-07 20:46:39 +00:00
|
|
|
nsIDOMWindow **aReturn);
|
|
|
|
|
2001-01-18 07:44:29 +00:00
|
|
|
static void CloseWindow(nsISupports* aWindow);
|
2005-07-30 20:57:07 +00:00
|
|
|
static void ClearWindowScope(nsISupports* aWindow);
|
2001-01-18 07:44:29 +00:00
|
|
|
|
|
|
|
// Timeout Functions
|
2006-06-13 03:07:47 +00:00
|
|
|
// Language agnostic timeout function (all args passed)
|
|
|
|
nsresult SetTimeoutOrInterval(nsIScriptTimeoutHandler *aHandler,
|
|
|
|
PRInt32 interval,
|
|
|
|
PRBool aIsInterval, PRInt32 *aReturn);
|
|
|
|
nsresult ClearTimeoutOrInterval(PRInt32 aTimerID);
|
|
|
|
|
|
|
|
// JS specific timeout functions (JS args grabbed from context).
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 17:42:36 +00:00
|
|
|
nsresult SetTimeoutOrInterval(PRBool aIsInterval, PRInt32* aReturn);
|
2002-03-27 00:55:57 +00:00
|
|
|
nsresult ClearTimeoutOrInterval();
|
2006-06-13 03:07:47 +00:00
|
|
|
|
|
|
|
// The timeout implementation functions.
|
|
|
|
void RunTimeout(nsTimeout *aTimeout);
|
|
|
|
|
2005-05-08 21:44:16 +00:00
|
|
|
void ClearAllTimeouts();
|
2006-09-21 03:46:46 +00:00
|
|
|
// Insert aTimeout into the list, before all timeouts that would
|
|
|
|
// fire after it, but no earlier than mTimeoutInsertionPoint, if any.
|
|
|
|
void InsertTimeoutIntoList(nsTimeout *aTimeout);
|
2001-10-24 06:58:11 +00:00
|
|
|
static void TimerCallback(nsITimer *aTimer, void *aClosure);
|
2001-01-18 07:44:29 +00:00
|
|
|
|
|
|
|
// Helper Functions
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 17:42:36 +00:00
|
|
|
nsresult GetTreeOwner(nsIDocShellTreeOwner** aTreeOwner);
|
|
|
|
nsresult GetTreeOwner(nsIBaseWindow** aTreeOwner);
|
|
|
|
nsresult GetWebBrowserChrome(nsIWebBrowserChrome** aBrowserChrome);
|
2004-08-08 17:39:20 +00:00
|
|
|
// GetScrollInfo does not flush. Callers should do it themselves as needed,
|
|
|
|
// depending on which info they actually want off the scrollable view.
|
2007-02-07 07:46:44 +00:00
|
|
|
nsresult GetScrollInfo(nsIScrollableView** aScrollableView);
|
2001-06-20 01:25:09 +00:00
|
|
|
nsresult SecurityCheckURL(const char *aURL);
|
2004-12-07 16:09:23 +00:00
|
|
|
nsresult BuildURIfromBase(const char *aURL,
|
|
|
|
nsIURI **aBuiltURI,
|
|
|
|
PRBool *aFreeSecurityPass, JSContext **aCXused);
|
2004-09-04 19:28:46 +00:00
|
|
|
PopupControlState CheckForAbusePoint();
|
2006-02-07 20:46:39 +00:00
|
|
|
OpenAllowValue CheckOpenAllow(PopupControlState aAbuseLevel);
|
2003-06-25 23:38:45 +00:00
|
|
|
void FireAbuseEvents(PRBool aBlocked, PRBool aWindow,
|
2004-02-10 18:22:23 +00:00
|
|
|
const nsAString &aPopupURL,
|
2005-11-01 01:41:00 +00:00
|
|
|
const nsAString &aPopupWindowName,
|
2004-02-10 18:22:23 +00:00
|
|
|
const nsAString &aPopupWindowFeatures);
|
2006-05-03 21:53:08 +00:00
|
|
|
void FireOfflineStatusEvent();
|
|
|
|
|
2004-05-27 22:08:42 +00:00
|
|
|
void FlushPendingNotifications(mozFlushType aType);
|
2002-02-05 05:47:22 +00:00
|
|
|
void EnsureReflowFlushAndPaint();
|
2001-01-18 07:44:29 +00:00
|
|
|
nsresult CheckSecurityWidthAndHeight(PRInt32* width, PRInt32* height);
|
|
|
|
nsresult CheckSecurityLeftAndTop(PRInt32* left, PRInt32* top);
|
2002-11-25 23:21:25 +00:00
|
|
|
static PRBool CanSetProperty(const char *aPrefName);
|
2002-05-17 22:24:06 +00:00
|
|
|
|
2006-07-28 22:06:39 +00:00
|
|
|
static void MakeScriptDialogTitle(nsAString &aOutTitle);
|
2000-02-08 13:40:10 +00:00
|
|
|
|
2001-09-30 19:56:32 +00:00
|
|
|
// Helper for window.find()
|
2002-03-24 00:16:18 +00:00
|
|
|
nsresult FindInternal(const nsAString& aStr, PRBool caseSensitive,
|
2001-09-30 19:56:32 +00:00
|
|
|
PRBool backwards, PRBool wrapAround, PRBool wholeWord,
|
|
|
|
PRBool searchInFrames, PRBool showDialog,
|
|
|
|
PRBool *aReturn);
|
|
|
|
|
2003-01-27 22:02:44 +00:00
|
|
|
nsresult ConvertCharset(const nsAString& aStr, char** aDest);
|
|
|
|
|
2003-02-24 20:15:59 +00:00
|
|
|
PRBool GetBlurSuppression();
|
|
|
|
|
2004-08-08 17:39:20 +00:00
|
|
|
// If aDoFlush is true, we'll flush our own layout; otherwise we'll try to
|
|
|
|
// just flush our parent and only flush ourselves if we think we need to.
|
|
|
|
nsresult GetScrollXY(PRInt32* aScrollX, PRInt32* aScrollY,
|
|
|
|
PRBool aDoFlush);
|
2003-04-15 13:40:46 +00:00
|
|
|
nsresult GetScrollMaxXY(PRInt32* aScrollMaxX, PRInt32* aScrollMaxY);
|
|
|
|
|
2004-07-05 15:51:31 +00:00
|
|
|
PRBool IsFrame()
|
|
|
|
{
|
|
|
|
return GetParentInternal() != nsnull;
|
|
|
|
}
|
|
|
|
|
2004-11-03 17:06:21 +00:00
|
|
|
PRBool DispatchCustomEvent(const char *aEventName);
|
|
|
|
|
2006-02-07 20:46:39 +00:00
|
|
|
// If aLookForCallerOnJSStack is true, this method will look at the JS stack
|
|
|
|
// to determine who the caller is. If it's false, it'll use |this| as the
|
|
|
|
// caller.
|
|
|
|
PRBool WindowExists(const nsAString& aName, PRBool aLookForCallerOnJSStack);
|
2005-01-11 19:36:40 +00:00
|
|
|
|
2005-03-06 18:43:07 +00:00
|
|
|
already_AddRefed<nsIWidget> GetMainWidget();
|
|
|
|
|
2005-05-04 20:22:32 +00:00
|
|
|
void SuspendTimeouts();
|
|
|
|
|
2005-08-15 18:16:42 +00:00
|
|
|
void Freeze()
|
|
|
|
{
|
2005-09-28 02:44:16 +00:00
|
|
|
NS_ASSERTION(!IsFrozen(), "Double-freezing?");
|
2005-08-15 18:16:42 +00:00
|
|
|
mIsFrozen = PR_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Thaw()
|
|
|
|
{
|
|
|
|
mIsFrozen = PR_FALSE;
|
|
|
|
}
|
|
|
|
|
2006-07-05 22:48:04 +00:00
|
|
|
PRBool IsInModalState();
|
|
|
|
|
2006-09-21 03:46:46 +00:00
|
|
|
nsTimeout* FirstTimeout() {
|
|
|
|
// Note: might not actually return an nsTimeout. Use IsTimeout to check.
|
|
|
|
return NS_STATIC_CAST(nsTimeout*, PR_LIST_HEAD(&mTimeouts));
|
|
|
|
}
|
|
|
|
|
|
|
|
nsTimeout* LastTimeout() {
|
|
|
|
// Note: might not actually return an nsTimeout. Use IsTimeout to check.
|
|
|
|
return NS_STATIC_CAST(nsTimeout*, PR_LIST_TAIL(&mTimeouts));
|
|
|
|
}
|
|
|
|
|
|
|
|
PRBool IsTimeout(PRCList* aList) {
|
|
|
|
return aList != &mTimeouts;
|
|
|
|
}
|
|
|
|
|
2001-02-17 19:02:25 +00:00
|
|
|
// When adding new member variables, be careful not to create cycles
|
|
|
|
// through JavaScript. If there is any chance that a member variable
|
|
|
|
// could own objects that are implemented in JavaScript, then those
|
|
|
|
// objects will keep the global object (this object) alive. To prevent
|
|
|
|
// these cycles, ownership of such members must be released in
|
|
|
|
// |CleanUp| and |SetDocShell|.
|
2005-07-30 20:57:07 +00:00
|
|
|
|
2005-08-19 20:09:38 +00:00
|
|
|
// This member is also used on both inner and outer windows, but
|
|
|
|
// for slightly different purposes. On inner windows it means the
|
|
|
|
// inner window is held onto by session history and should not
|
|
|
|
// change. On outer windows it means that the window is in a state
|
|
|
|
// where we don't want to force creation of a new inner window since
|
|
|
|
// we're in the middle of doing just that.
|
2005-10-14 21:56:21 +00:00
|
|
|
PRPackedBool mIsFrozen : 1;
|
2005-08-19 20:09:38 +00:00
|
|
|
|
2005-07-30 20:57:07 +00:00
|
|
|
// These members are only used on outer window objects. Make sure
|
|
|
|
// you never set any of these on an inner object!
|
2005-10-14 21:56:21 +00:00
|
|
|
PRPackedBool mFullScreen : 1;
|
|
|
|
PRPackedBool mIsClosed : 1;
|
|
|
|
PRPackedBool mInClose : 1;
|
|
|
|
// mHavePendingClose means we've got a termination function set to
|
|
|
|
// close us when the JS stops executing or that we have a close
|
|
|
|
// event posted. If this is set, just ignore window.close() calls.
|
|
|
|
PRPackedBool mHavePendingClose : 1;
|
2006-02-15 03:22:17 +00:00
|
|
|
PRPackedBool mHadOriginalOpener : 1;
|
2005-10-14 21:56:21 +00:00
|
|
|
PRPackedBool mIsPopupSpam : 1;
|
2005-07-30 20:57:07 +00:00
|
|
|
|
2006-08-29 22:25:12 +00:00
|
|
|
// Indicates whether scripts are allowed to close this window.
|
|
|
|
PRPackedBool mBlockScriptedClosingFlag : 1;
|
|
|
|
|
2006-05-03 21:53:08 +00:00
|
|
|
// Track what sorts of events we need to fire when thawed
|
|
|
|
PRPackedBool mFireOfflineStatusChangeEventOnThaw : 1;
|
2006-11-17 01:06:41 +00:00
|
|
|
|
|
|
|
// Indicates whether we're in the middle of creating an initializing
|
|
|
|
// a new inner window object.
|
|
|
|
PRPackedBool mCreatingInnerWindow : 1;
|
2006-05-03 21:53:08 +00:00
|
|
|
|
2001-01-18 07:44:29 +00:00
|
|
|
nsCOMPtr<nsIScriptContext> mContext;
|
|
|
|
nsCOMPtr<nsIDOMWindowInternal> mOpener;
|
|
|
|
nsCOMPtr<nsIControllers> mControllers;
|
2006-06-13 03:07:47 +00:00
|
|
|
nsCOMPtr<nsIArray> mArguments;
|
|
|
|
nsCOMPtr<nsIArray> mArgumentsLast;
|
2004-12-10 19:48:22 +00:00
|
|
|
nsRefPtr<nsNavigator> mNavigator;
|
|
|
|
nsRefPtr<nsScreen> mScreen;
|
|
|
|
nsRefPtr<nsHistory> mHistory;
|
2003-06-20 23:51:46 +00:00
|
|
|
nsRefPtr<nsDOMWindowList> mFrames;
|
2004-12-10 19:48:22 +00:00
|
|
|
nsRefPtr<nsBarProp> mMenubar;
|
|
|
|
nsRefPtr<nsBarProp> mToolbar;
|
|
|
|
nsRefPtr<nsBarProp> mLocationbar;
|
|
|
|
nsRefPtr<nsBarProp> mPersonalbar;
|
|
|
|
nsRefPtr<nsBarProp> mStatusbar;
|
|
|
|
nsRefPtr<nsBarProp> mScrollbars;
|
2004-06-20 16:42:13 +00:00
|
|
|
nsCOMPtr<nsIWeakReference> mWindowUtils;
|
2005-08-23 01:42:49 +00:00
|
|
|
nsRefPtr<nsLocation> mLocation;
|
2001-01-18 07:44:29 +00:00
|
|
|
nsString mStatus;
|
|
|
|
nsString mDefaultStatus;
|
2006-06-13 03:07:47 +00:00
|
|
|
// index 0->language_id 1, so index MAX-1 == language_id MAX
|
|
|
|
nsCOMPtr<nsIScriptContext> mScriptContexts[NS_STID_ARRAY_UBOUND];
|
|
|
|
void * mScriptGlobals[NS_STID_ARRAY_UBOUND];
|
2006-05-03 21:53:08 +00:00
|
|
|
nsGlobalWindowObserver* mObserver;
|
2001-01-18 07:44:29 +00:00
|
|
|
|
|
|
|
nsIScriptGlobalObjectOwner* mGlobalObjectOwner; // Weak Reference
|
|
|
|
nsCOMPtr<nsIDOMCrypto> mCrypto;
|
|
|
|
nsCOMPtr<nsIDOMPkcs11> mPkcs11;
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 17:42:36 +00:00
|
|
|
|
2006-06-13 03:07:47 +00:00
|
|
|
|
2006-05-19 05:57:36 +00:00
|
|
|
nsCOMPtr<nsIDOMStorageList> gGlobalStorageList;
|
|
|
|
|
2006-06-13 03:07:47 +00:00
|
|
|
nsCOMPtr<nsISupports> mInnerWindowHolders[NS_STID_ARRAY_UBOUND];
|
2006-02-20 18:52:42 +00:00
|
|
|
nsCOMPtr<nsIPrincipal> mOpenerScriptPrincipal; // strong; used to determine
|
|
|
|
// whether to clear scope
|
2005-07-30 20:57:07 +00:00
|
|
|
|
2005-08-12 04:11:00 +00:00
|
|
|
// These member variable are used only on inner windows.
|
2005-07-30 20:57:07 +00:00
|
|
|
nsCOMPtr<nsIEventListenerManager> mListenerManager;
|
2006-09-21 03:46:46 +00:00
|
|
|
PRCList mTimeouts;
|
|
|
|
// If mTimeoutInsertionPoint is non-null, insertions should happen after it.
|
|
|
|
nsTimeout* mTimeoutInsertionPoint;
|
2005-08-12 04:11:00 +00:00
|
|
|
PRUint32 mTimeoutPublicIdCounter;
|
|
|
|
PRUint32 mTimeoutFiringDepth;
|
2006-05-19 05:57:36 +00:00
|
|
|
nsCOMPtr<nsIDOMStorage> mSessionStorage;
|
2003-06-18 23:48:57 +00:00
|
|
|
|
2005-08-12 04:11:00 +00:00
|
|
|
// These member variables are used on both inner and the outer windows.
|
2005-07-31 16:44:28 +00:00
|
|
|
nsCOMPtr<nsIPrincipal> mDocumentPrincipal;
|
2005-10-20 23:32:54 +00:00
|
|
|
nsCOMPtr<nsIDocument> mDoc; // For fast access to principals
|
2005-08-12 04:11:00 +00:00
|
|
|
JSObject* mJSObject;
|
2005-07-31 16:44:28 +00:00
|
|
|
|
2006-05-19 05:57:36 +00:00
|
|
|
nsDataHashtable<nsStringHashKey, PRBool> *mPendingStorageEvents;
|
|
|
|
|
2006-02-15 03:22:17 +00:00
|
|
|
#ifdef DEBUG
|
|
|
|
PRBool mSetOpenerWindowCalled;
|
|
|
|
#endif
|
|
|
|
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 17:42:36 +00:00
|
|
|
friend class nsDOMScriptableHelper;
|
2004-06-20 16:42:13 +00:00
|
|
|
friend class nsDOMWindowUtils;
|
2002-07-08 07:11:59 +00:00
|
|
|
static nsIFactory *sComputedDOMStyleFactory;
|
1998-07-24 05:05:42 +00:00
|
|
|
};
|
|
|
|
|
2002-02-09 03:36:55 +00:00
|
|
|
/*
|
2004-12-10 19:48:22 +00:00
|
|
|
* nsGlobalChromeWindow inherits from nsGlobalWindow. It is the global
|
2002-02-09 03:36:55 +00:00
|
|
|
* object created for a Chrome Window only.
|
|
|
|
*/
|
2004-12-10 19:48:22 +00:00
|
|
|
class nsGlobalChromeWindow : public nsGlobalWindow,
|
2002-02-09 03:36:55 +00:00
|
|
|
public nsIDOMChromeWindow
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
// nsISupports
|
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
|
|
|
|
|
|
|
// nsIDOMChromeWindow interface
|
|
|
|
NS_DECL_NSIDOMCHROMEWINDOW
|
|
|
|
|
2005-07-30 20:57:07 +00:00
|
|
|
nsGlobalChromeWindow(nsGlobalWindow *aOuterWindow)
|
|
|
|
: nsGlobalWindow(aOuterWindow)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2002-02-09 03:36:55 +00:00
|
|
|
protected:
|
2004-12-07 16:09:23 +00:00
|
|
|
nsCOMPtr<nsIBrowserDOMWindow> mBrowserDOMWindow;
|
2002-02-09 03:36:55 +00:00
|
|
|
};
|
|
|
|
|
2000-02-08 13:40:10 +00:00
|
|
|
//*****************************************************************************
|
2004-12-10 19:48:22 +00:00
|
|
|
// nsNavigator: Script "navigator" object
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 17:42:36 +00:00
|
|
|
//*****************************************************************************
|
1998-07-24 05:05:42 +00:00
|
|
|
|
2004-12-10 19:48:22 +00:00
|
|
|
class nsNavigator : public nsIDOMNavigator,
|
2006-06-29 00:56:52 +00:00
|
|
|
public nsIDOMJSNavigator,
|
|
|
|
public nsIDOMClientInformation
|
2000-02-08 13:40:10 +00:00
|
|
|
{
|
1998-07-24 05:05:42 +00:00
|
|
|
public:
|
2004-12-10 19:48:22 +00:00
|
|
|
nsNavigator(nsIDocShell *aDocShell);
|
|
|
|
virtual ~nsNavigator();
|
2000-02-08 13:40:10 +00:00
|
|
|
|
2001-01-18 07:44:29 +00:00
|
|
|
NS_DECL_ISUPPORTS
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 17:42:36 +00:00
|
|
|
NS_DECL_NSIDOMNAVIGATOR
|
|
|
|
NS_DECL_NSIDOMJSNAVIGATOR
|
2006-06-29 00:56:52 +00:00
|
|
|
NS_DECL_NSIDOMCLIENTINFORMATION
|
2001-07-23 05:36:52 +00:00
|
|
|
|
2001-01-23 22:29:41 +00:00
|
|
|
void SetDocShell(nsIDocShell *aDocShell);
|
2005-07-30 20:57:07 +00:00
|
|
|
nsIDocShell *GetDocShell()
|
|
|
|
{
|
|
|
|
return mDocShell;
|
|
|
|
}
|
|
|
|
|
2003-06-18 23:48:57 +00:00
|
|
|
void LoadingNewDocument();
|
2001-07-23 05:36:52 +00:00
|
|
|
nsresult RefreshMIMEArray();
|
2001-01-23 22:29:41 +00:00
|
|
|
|
1998-07-24 05:05:42 +00:00
|
|
|
protected:
|
2004-12-10 19:48:22 +00:00
|
|
|
nsRefPtr<nsMimeTypeArray> mMimeTypes;
|
|
|
|
nsRefPtr<nsPluginArray> mPlugins;
|
2001-01-23 22:29:41 +00:00
|
|
|
nsIDocShell* mDocShell; // weak reference
|
2002-02-13 04:20:46 +00:00
|
|
|
|
|
|
|
static jsval sPrefInternal_id;
|
1998-07-24 05:05:42 +00:00
|
|
|
};
|
|
|
|
|
1999-06-23 03:29:44 +00:00
|
|
|
class nsIURI;
|
1998-12-16 05:40:20 +00:00
|
|
|
|
2000-02-08 13:40:10 +00:00
|
|
|
//*****************************************************************************
|
2004-12-10 19:48:22 +00:00
|
|
|
// nsLocation: Script "location" object
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 17:42:36 +00:00
|
|
|
//*****************************************************************************
|
2000-02-08 13:40:10 +00:00
|
|
|
|
2004-12-10 19:48:22 +00:00
|
|
|
class nsLocation : public nsIDOMLocation,
|
|
|
|
public nsIDOMNSLocation
|
1999-08-03 23:16:48 +00:00
|
|
|
{
|
1998-08-13 04:34:53 +00:00
|
|
|
public:
|
2004-12-10 19:48:22 +00:00
|
|
|
nsLocation(nsIDocShell *aDocShell);
|
|
|
|
virtual ~nsLocation();
|
2001-01-18 07:44:29 +00:00
|
|
|
|
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
|
2004-02-09 22:48:53 +00:00
|
|
|
void SetDocShell(nsIDocShell *aDocShell);
|
2006-06-20 18:56:03 +00:00
|
|
|
nsIDocShell *GetDocShell();
|
2001-01-18 07:44:29 +00:00
|
|
|
|
|
|
|
// nsIDOMLocation
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 17:42:36 +00:00
|
|
|
NS_DECL_NSIDOMLOCATION
|
2001-01-18 07:44:29 +00:00
|
|
|
|
|
|
|
// nsIDOMNSLocation
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 17:42:36 +00:00
|
|
|
NS_DECL_NSIDOMNSLOCATION
|
2001-01-18 07:44:29 +00:00
|
|
|
|
1998-08-13 04:34:53 +00:00
|
|
|
protected:
|
2004-04-24 16:09:31 +00:00
|
|
|
// In the case of jar: uris, we sometimes want the place the jar was
|
|
|
|
// fetched from as the URI instead of the jar: uri itself. Pass in
|
|
|
|
// PR_TRUE for aGetInnermostURI when that's the case.
|
|
|
|
nsresult GetURI(nsIURI** aURL, PRBool aGetInnermostURI = PR_FALSE);
|
2002-03-06 07:48:55 +00:00
|
|
|
nsresult GetWritableURI(nsIURI** aURL);
|
2005-01-20 16:57:04 +00:00
|
|
|
nsresult SetURI(nsIURI* aURL, PRBool aReplace = PR_FALSE);
|
2002-03-24 00:16:18 +00:00
|
|
|
nsresult SetHrefWithBase(const nsAString& aHref, nsIURI* aBase,
|
1999-08-03 23:16:48 +00:00
|
|
|
PRBool aReplace);
|
2002-03-24 00:16:18 +00:00
|
|
|
nsresult SetHrefWithContext(JSContext* cx, const nsAString& aHref,
|
2001-05-15 20:58:31 +00:00
|
|
|
PRBool aReplace);
|
|
|
|
|
2001-11-17 17:26:18 +00:00
|
|
|
nsresult GetSourceURL(JSContext* cx, nsIURI** sourceURL);
|
|
|
|
nsresult GetSourceBaseURL(JSContext* cx, nsIURI** sourceURL);
|
|
|
|
nsresult GetSourceDocument(JSContext* cx, nsIDocument** aDocument);
|
|
|
|
|
2001-01-18 07:44:29 +00:00
|
|
|
nsresult CheckURL(nsIURI *url, nsIDocShellLoadInfo** aLoadInfo);
|
2003-03-05 22:23:47 +00:00
|
|
|
nsresult FindUsableBaseURI(nsIURI * aBaseURI, nsIDocShell * aParent, nsIURI ** aUsableURI);
|
1998-08-13 04:34:53 +00:00
|
|
|
|
2006-06-20 18:56:03 +00:00
|
|
|
nsWeakPtr mDocShell;
|
1998-08-13 04:34:53 +00:00
|
|
|
};
|
|
|
|
|
2004-02-24 03:22:35 +00:00
|
|
|
/* factory function */
|
|
|
|
nsresult NS_NewScriptGlobalObject(PRBool aIsChrome,
|
|
|
|
nsIScriptGlobalObject **aResult);
|
|
|
|
|
1998-07-24 05:05:42 +00:00
|
|
|
#endif /* nsGlobalWindow_h___ */
|