2001-09-26 02:43:09 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2005-08-15 22:16:42 +04:00
|
|
|
/* vim: set ts=2 sw=2 et tw=80: */
|
2001-09-26 02:43:09 +04:00
|
|
|
/* ***** BEGIN LICENSE BLOCK *****
|
2004-04-18 01:52:36 +04:00
|
|
|
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
1998-07-24 09:05:42 +04:00
|
|
|
*
|
2004-04-18 01:52:36 +04: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 09:05:42 +04:00
|
|
|
*
|
2001-09-26 02:43:09 +04: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 09:05:42 +04:00
|
|
|
*
|
1999-11-06 06:40:37 +03:00
|
|
|
* The Original Code is mozilla.org code.
|
|
|
|
*
|
2004-04-18 01:52:36 +04:00
|
|
|
* The Initial Developer of the Original Code is
|
2001-09-26 02:43:09 +04:00
|
|
|
* Netscape Communications Corporation.
|
|
|
|
* Portions created by the Initial Developer are Copyright (C) 1998
|
|
|
|
* the Initial Developer. All Rights Reserved.
|
1999-11-06 06:40:37 +03:00
|
|
|
*
|
2000-02-08 16:40:10 +03:00
|
|
|
* Contributor(s):
|
2001-04-18 10:06:31 +04: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 21:42:36 +04:00
|
|
|
* Vidur Apparao <vidur@netscape.com>
|
|
|
|
* Johnny Stenback <jst@netscape.com>
|
2001-09-26 02:43:09 +04:00
|
|
|
*
|
|
|
|
* Alternatively, the contents of this file may be used under the terms of
|
2004-04-18 01:52:36 +04: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-26 02:43:09 +04: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-18 01:52:36 +04:00
|
|
|
* use your version of this file under the terms of the MPL, indicate your
|
2001-09-26 02:43:09 +04: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-18 01:52:36 +04:00
|
|
|
* the terms of any one of the MPL, the GPL or the LGPL.
|
2001-09-26 02:43:09 +04:00
|
|
|
*
|
|
|
|
* ***** END LICENSE BLOCK ***** */
|
2001-04-18 10:06:31 +04:00
|
|
|
|
1998-07-24 09:05:42 +04:00
|
|
|
#ifndef nsGlobalWindow_h___
|
|
|
|
#define nsGlobalWindow_h___
|
|
|
|
|
2000-02-08 16:40:10 +03:00
|
|
|
// Local Includes
|
|
|
|
// Helper Classes
|
1999-10-14 14:58:25 +04:00
|
|
|
#include "nsCOMPtr.h"
|
2003-06-21 03:51:46 +04:00
|
|
|
#include "nsAutoPtr.h"
|
2000-05-14 09:26:06 +04:00
|
|
|
#include "nsWeakReference.h"
|
2000-03-24 03:11:48 +03:00
|
|
|
#include "nsHashtable.h"
|
2006-05-19 09:57:36 +04:00
|
|
|
#include "nsDataHashtable.h"
|
2007-01-05 01:31:26 +03:00
|
|
|
#include "nsCycleCollectionParticipant.h"
|
2008-02-13 07:17:18 +03:00
|
|
|
#include "nsDOMScriptObjectHolder.h"
|
2000-02-08 16:40:10 +03:00
|
|
|
|
|
|
|
// Interfaces Needed
|
|
|
|
#include "nsDOMWindowList.h"
|
|
|
|
#include "nsIBaseWindow.h"
|
2004-12-07 19:09:23 +03:00
|
|
|
#include "nsIBrowserDOMWindow.h"
|
2000-02-08 16:40:10 +03:00
|
|
|
#include "nsIDocShellTreeOwner.h"
|
|
|
|
#include "nsIDocShellTreeItem.h"
|
2006-06-29 04:56:52 +04:00
|
|
|
#include "nsIDOMClientInformation.h"
|
2000-05-03 17:03:17 +04:00
|
|
|
#include "nsIDOMViewCSS.h"
|
2007-05-14 13:11:38 +04:00
|
|
|
#include "nsIDOMEventTarget.h"
|
2002-11-09 03:25:25 +03:00
|
|
|
#include "nsIDOM3EventTarget.h"
|
2005-04-29 03:48:28 +04:00
|
|
|
#include "nsIDOMNSEventTarget.h"
|
2000-02-08 16:40:10 +03:00
|
|
|
#include "nsIDOMNavigator.h"
|
2008-08-14 20:35:49 +04:00
|
|
|
#include "nsIDOMNavigatorGeolocation.h"
|
2008-09-06 01:54:53 +04:00
|
|
|
#include "nsIDOMLocation.h"
|
2000-09-01 05:54:35 +04:00
|
|
|
#include "nsIDOMWindowInternal.h"
|
2001-05-17 06:15:27 +04:00
|
|
|
#include "nsIInterfaceRequestor.h"
|
2001-09-06 01:28:38 +04: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 21:42:36 +04:00
|
|
|
#include "nsIDOMJSWindow.h"
|
2002-02-09 06:36:55 +03:00
|
|
|
#include "nsIDOMChromeWindow.h"
|
2000-02-08 16:40:10 +03:00
|
|
|
#include "nsIScriptGlobalObject.h"
|
2005-07-31 00:57:07 +04: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 21:42:36 +04:00
|
|
|
#include "nsIScriptObjectPrincipal.h"
|
2006-06-13 07:07:47 +04:00
|
|
|
#include "nsIScriptTimeoutHandler.h"
|
2000-02-08 16:40:10 +03:00
|
|
|
#include "nsITimer.h"
|
|
|
|
#include "nsIWebBrowserChrome.h"
|
1999-10-14 14:58:25 +04:00
|
|
|
#include "nsPIDOMWindow.h"
|
2007-07-26 21:52:26 +04:00
|
|
|
#include "nsIDOMModalContentWindow.h"
|
2003-06-26 04:41:23 +04:00
|
|
|
#include "nsIScriptSecurityManager.h"
|
2000-02-09 08:26:02 +03:00
|
|
|
#include "nsIEventListenerManager.h"
|
|
|
|
#include "nsIDOMDocument.h"
|
2000-05-11 23:17:07 +04:00
|
|
|
#include "nsIDOMCrypto.h"
|
2000-07-14 01:48:25 +04:00
|
|
|
#include "nsIPrincipal.h"
|
2001-01-24 01:29:41 +03:00
|
|
|
#include "nsPluginArray.h"
|
2001-07-23 09:36:52 +04: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 21:42:36 +04:00
|
|
|
#include "nsIXPCScriptable.h"
|
2002-02-20 06:33:52 +03:00
|
|
|
#include "nsPoint.h"
|
|
|
|
#include "nsSize.h"
|
2009-07-30 07:16:44 +04:00
|
|
|
#include "nsRect.h"
|
2004-05-28 02:08:42 +04:00
|
|
|
#include "mozFlushType.h"
|
2005-07-31 00:57:07 +04:00
|
|
|
#include "prclist.h"
|
2009-05-16 17:59:30 +04:00
|
|
|
#include "nsIDOMStorageObsolete.h"
|
2006-05-19 09:57:36 +04:00
|
|
|
#include "nsIDOMStorageList.h"
|
|
|
|
#include "nsIDOMStorageWindow.h"
|
2010-01-28 17:53:53 +03:00
|
|
|
#include "nsIDOMStorageEvent.h"
|
2007-05-29 13:45:30 +04:00
|
|
|
#include "nsIDOMOfflineResourceList.h"
|
2007-02-16 02:04:33 +03:00
|
|
|
#include "nsPIDOMEventTarget.h"
|
2007-07-26 21:52:26 +04:00
|
|
|
#include "nsIArray.h"
|
Bug 178324, refactor focus by moving all focus handling into one place and simplifying it, add many tests, fixes many other bugs too numerous to mention in this small checkin comment, r=josh,smichaud,ere,dbaron,marco,neil,gavin,smaug,sr=smaug (CLOSED TREE)
2009-06-10 22:00:39 +04:00
|
|
|
#include "nsIContent.h"
|
1998-07-24 09:05:42 +04:00
|
|
|
|
1999-04-29 00:33:43 +04:00
|
|
|
#define DEFAULT_HOME_PAGE "www.mozilla.org"
|
|
|
|
#define PREF_BROWSER_STARTUP_HOMEPAGE "browser.startup.homepage"
|
|
|
|
|
1999-06-09 23:04:18 +04:00
|
|
|
class nsIDOMBarProp;
|
1999-05-28 01:06:51 +04:00
|
|
|
class nsIDocument;
|
2004-08-01 03:15:21 +04:00
|
|
|
class nsPresContext;
|
1998-07-24 09:05:42 +04:00
|
|
|
class nsIDOMEvent;
|
2009-09-03 07:57:46 +04:00
|
|
|
class nsIScrollableFrame;
|
2007-10-13 20:42:44 +04:00
|
|
|
class nsIControllers;
|
1998-07-24 09:05:42 +04:00
|
|
|
|
2004-12-10 22:48:22 +03:00
|
|
|
class nsBarProp;
|
|
|
|
class nsLocation;
|
|
|
|
class nsNavigator;
|
|
|
|
class nsScreen;
|
|
|
|
class nsHistory;
|
2000-08-11 08:31:08 +04:00
|
|
|
class nsIDocShellLoadInfo;
|
2005-05-05 00:22:32 +04:00
|
|
|
class WindowStateHolder;
|
2006-05-04 01:53:08 +04:00
|
|
|
class nsGlobalWindowObserver;
|
2006-09-21 07:46:46 +04:00
|
|
|
class nsGlobalWindow;
|
2007-10-10 05:24:28 +04:00
|
|
|
class nsDummyJavaPluginOwner;
|
2008-05-02 23:26:47 +04:00
|
|
|
class PostMessageEvent;
|
2009-11-20 02:11:44 +03:00
|
|
|
class nsRunnable;
|
2007-05-29 13:45:34 +04:00
|
|
|
|
2007-05-29 13:45:30 +04:00
|
|
|
class nsDOMOfflineResourceList;
|
2008-08-14 20:35:49 +04:00
|
|
|
class nsGeolocation;
|
2007-05-29 13:45:30 +04:00
|
|
|
|
2006-06-13 07:07:47 +04:00
|
|
|
extern nsresult
|
2008-01-30 05:11:48 +03:00
|
|
|
NS_CreateJSTimeoutHandler(nsGlobalWindow *aWindow,
|
2007-07-04 02:38:04 +04:00
|
|
|
PRBool *aIsInterval,
|
2006-06-13 07:07:47 +04:00
|
|
|
PRInt32 *aInterval,
|
|
|
|
nsIScriptTimeoutHandler **aRet);
|
|
|
|
|
2006-09-21 07:46:46 +04: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();
|
|
|
|
|
2009-01-25 17:34:26 +03:00
|
|
|
NS_DECL_CYCLE_COLLECTION_NATIVE_CLASS(nsTimeout)
|
|
|
|
|
2006-09-21 07:46:46 +04:00
|
|
|
nsrefcnt Release();
|
|
|
|
nsrefcnt AddRef();
|
|
|
|
|
|
|
|
nsTimeout* Next() {
|
|
|
|
// Note: might not actually return an nsTimeout. Use IsTimeout to check.
|
2007-07-08 11:08:04 +04:00
|
|
|
return static_cast<nsTimeout*>(PR_NEXT_LINK(this));
|
2006-09-21 07:46:46 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
nsTimeout* Prev() {
|
|
|
|
// Note: might not actually return an nsTimeout. Use IsTimeout to check.
|
2007-07-08 11:08:04 +04:00
|
|
|
return static_cast<nsTimeout*>(PR_PREV_LINK(this));
|
2006-09-21 07:46:46 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
// 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;
|
|
|
|
|
2009-08-26 22:07:39 +04:00
|
|
|
//
|
|
|
|
PRUint32 mNestingLevel;
|
|
|
|
|
2006-09-21 07:46:46 +04:00
|
|
|
// 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
|
2009-01-25 17:34:26 +03:00
|
|
|
nsAutoRefCnt mRefCnt;
|
2006-09-21 07:46:46 +04:00
|
|
|
};
|
|
|
|
|
2000-02-08 16:40:10 +03:00
|
|
|
//*****************************************************************************
|
2004-12-10 22:48:22 +03: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 21:42:36 +04:00
|
|
|
//*****************************************************************************
|
2001-07-25 02:39:11 +04:00
|
|
|
// Beware that all scriptable interfaces implemented by
|
2004-12-10 22:48:22 +03:00
|
|
|
// nsGlobalWindow will be reachable from JS, if you make this class
|
2001-07-25 02:39:11 +04:00
|
|
|
// implement new interfaces you better know what you're
|
|
|
|
// doing. Security wise this is very sensitive code. --
|
|
|
|
// jst@netscape.com
|
|
|
|
|
2005-08-12 08:11:00 +04:00
|
|
|
// nsGlobalWindow inherits PRCList for maintaining a list of all inner
|
2008-01-30 04:31:29 +03:00
|
|
|
// windows still in memory for any given outer window. This list is
|
2005-08-12 08:11:00 +04:00
|
|
|
// 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 21:42:36 +04:00
|
|
|
|
2005-07-31 23:43:27 +04:00
|
|
|
class nsGlobalWindow : public nsPIDOMWindow,
|
|
|
|
public nsIScriptGlobalObject,
|
2004-12-10 22:48:22 +03:00
|
|
|
public nsIDOMJSWindow,
|
|
|
|
public nsIScriptObjectPrincipal,
|
2007-05-14 13:11:38 +04:00
|
|
|
public nsIDOMEventTarget,
|
2007-02-16 02:04:33 +03:00
|
|
|
public nsPIDOMEventTarget,
|
2004-12-10 22:48:22 +03:00
|
|
|
public nsIDOM3EventTarget,
|
2005-04-29 03:48:28 +04:00
|
|
|
public nsIDOMNSEventTarget,
|
2004-12-10 22:48:22 +03:00
|
|
|
public nsIDOMViewCSS,
|
2006-05-19 09:57:36 +04:00
|
|
|
public nsIDOMStorageWindow,
|
2004-12-10 22:48:22 +03:00
|
|
|
public nsSupportsWeakReference,
|
2005-07-31 00:57:07 +04:00
|
|
|
public nsIInterfaceRequestor,
|
|
|
|
public PRCListStr
|
1998-07-24 09:05:42 +04:00
|
|
|
{
|
|
|
|
public:
|
2004-05-04 01:48:36 +04:00
|
|
|
// public methods
|
|
|
|
nsPIDOMWindow* GetPrivateParent();
|
|
|
|
// callback for close event
|
|
|
|
void ReallyCloseWindow();
|
2009-11-20 02:11:44 +03:00
|
|
|
void ReallyClearScope(nsRunnable *aRunnable);
|
2004-05-04 01:48:36 +04:00
|
|
|
|
2001-01-18 10:44:29 +03:00
|
|
|
// nsISupports
|
2007-01-05 01:31:26 +03:00
|
|
|
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
2001-01-18 10:44:29 +03:00
|
|
|
|
|
|
|
// nsIScriptGlobalObject
|
2004-02-10 01:48:53 +03:00
|
|
|
virtual nsIScriptContext *GetContext();
|
2006-06-13 07:07:47 +04: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);
|
|
|
|
|
|
|
|
virtual void OnFinalize(PRUint32 aLangID, void *aScriptGlobal);
|
2004-02-10 01:48:53 +03:00
|
|
|
virtual void SetScriptsEnabled(PRBool aEnabled, PRBool aFireTimeouts);
|
2001-01-18 10:44:29 +03:00
|
|
|
|
|
|
|
// nsIScriptObjectPrincipal
|
2004-04-18 04:28:47 +04:00
|
|
|
virtual nsIPrincipal* GetPrincipal();
|
2001-01-18 10:44:29 +03: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 21:42:36 +04:00
|
|
|
NS_DECL_NSIDOMWINDOW
|
2001-01-18 10:44:29 +03:00
|
|
|
|
2004-05-26 22:10:47 +04:00
|
|
|
// nsIDOMWindow2
|
|
|
|
NS_DECL_NSIDOMWINDOW2
|
|
|
|
|
2001-01-18 10:44:29 +03: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 21:42:36 +04:00
|
|
|
NS_DECL_NSIDOMWINDOWINTERNAL
|
|
|
|
|
|
|
|
// nsIDOMJSWindow
|
|
|
|
NS_DECL_NSIDOMJSWINDOW
|
2001-01-18 10:44:29 +03:00
|
|
|
|
|
|
|
// nsIDOMEventTarget
|
2002-11-09 03:25:25 +03:00
|
|
|
NS_DECL_NSIDOMEVENTTARGET
|
|
|
|
|
|
|
|
// nsIDOM3EventTarget
|
|
|
|
NS_DECL_NSIDOM3EVENTTARGET
|
2001-01-18 10:44:29 +03:00
|
|
|
|
2005-04-29 03:48:28 +04:00
|
|
|
// nsIDOMNSEventTarget
|
|
|
|
NS_DECL_NSIDOMNSEVENTTARGET
|
|
|
|
|
2001-01-18 10:44:29 +03:00
|
|
|
// nsPIDOMWindow
|
2004-05-04 01:48:36 +04:00
|
|
|
virtual NS_HIDDEN_(nsPIDOMWindow*) GetPrivateRoot();
|
Bug 178324, refactor focus by moving all focus handling into one place and simplifying it, add many tests, fixes many other bugs too numerous to mention in this small checkin comment, r=josh,smichaud,ere,dbaron,marco,neil,gavin,smaug,sr=smaug (CLOSED TREE)
2009-06-10 22:00:39 +04:00
|
|
|
virtual NS_HIDDEN_(void) ActivateOrDeactivate(PRBool aActivate);
|
2008-08-11 12:38:43 +04:00
|
|
|
virtual NS_HIDDEN_(void) SetChromeEventHandler(nsPIDOMEventTarget* aChromeEventHandler);
|
2004-05-04 01:48:36 +04:00
|
|
|
|
2006-02-20 21:52:42 +03:00
|
|
|
virtual NS_HIDDEN_(void) SetOpenerScriptPrincipal(nsIPrincipal* aPrincipal);
|
2006-08-15 21:31:16 +04:00
|
|
|
virtual NS_HIDDEN_(nsIPrincipal*) GetOpenerScriptPrincipal();
|
2002-04-17 08:17:16 +04:00
|
|
|
|
2005-06-18 10:06:45 +04:00
|
|
|
virtual NS_HIDDEN_(PopupControlState) PushPopupControlState(PopupControlState state, PRBool aForce) const;
|
2004-09-04 23:28:46 +04:00
|
|
|
virtual NS_HIDDEN_(void) PopPopupControlState(PopupControlState state) const;
|
|
|
|
virtual NS_HIDDEN_(PopupControlState) GetPopupControlState() const;
|
|
|
|
|
2005-05-05 00:22:32 +04:00
|
|
|
virtual NS_HIDDEN_(nsresult) SaveWindowState(nsISupports **aState);
|
|
|
|
virtual NS_HIDDEN_(nsresult) RestoreWindowState(nsISupports *aState);
|
2009-03-03 23:18:00 +03:00
|
|
|
virtual NS_HIDDEN_(void) SuspendTimeouts(PRUint32 aIncrease = 1,
|
|
|
|
PRBool aFreezeChildren = PR_TRUE);
|
|
|
|
virtual NS_HIDDEN_(nsresult) ResumeTimeouts(PRBool aThawChildren = PR_TRUE);
|
|
|
|
virtual NS_HIDDEN_(PRUint32) TimeoutSuspendCount();
|
2006-05-04 01:53:08 +04:00
|
|
|
virtual NS_HIDDEN_(nsresult) FireDelayedDOMEvents();
|
2008-01-17 00:54:33 +03:00
|
|
|
virtual NS_HIDDEN_(PRBool) IsFrozen() const
|
|
|
|
{
|
|
|
|
return mIsFrozen;
|
|
|
|
}
|
2005-07-31 00:57:07 +04:00
|
|
|
|
2005-08-23 04:24:57 +04:00
|
|
|
virtual NS_HIDDEN_(PRBool) WouldReuseInnerWindow(nsIDocument *aNewDocument);
|
2006-03-07 20:08:51 +03:00
|
|
|
|
2007-04-17 13:18:36 +04:00
|
|
|
virtual NS_HIDDEN_(nsPIDOMEventTarget*) GetTargetForDOMEvent()
|
|
|
|
{
|
2007-07-08 11:08:04 +04:00
|
|
|
return static_cast<nsPIDOMEventTarget*>(GetOuterWindowInternal());
|
2007-04-17 13:18:36 +04:00
|
|
|
}
|
|
|
|
virtual NS_HIDDEN_(nsPIDOMEventTarget*) GetTargetForEventTargetChain()
|
|
|
|
{
|
2007-07-08 11:08:04 +04:00
|
|
|
return static_cast<nsPIDOMEventTarget*>(GetCurrentInnerWindowInternal());
|
2007-04-17 13:18:36 +04:00
|
|
|
}
|
2006-03-07 20:08:51 +03: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);
|
2009-06-23 15:23:52 +04:00
|
|
|
virtual NS_HIDDEN_(nsIEventListenerManager*) GetListenerManager(PRBool aCreateIfNotFound);
|
2007-05-14 13:11:38 +04:00
|
|
|
virtual NS_HIDDEN_(nsresult) AddEventListenerByIID(nsIDOMEventListener *aListener,
|
|
|
|
const nsIID& aIID);
|
|
|
|
virtual NS_HIDDEN_(nsresult) RemoveEventListenerByIID(nsIDOMEventListener *aListener,
|
|
|
|
const nsIID& aIID);
|
|
|
|
virtual NS_HIDDEN_(nsresult) GetSystemEventGroup(nsIDOMEventGroup** aGroup);
|
2009-04-24 13:18:37 +04:00
|
|
|
virtual NS_HIDDEN_(nsIScriptContext*) GetContextForEventHandlers(nsresult* aRv);
|
2006-03-07 20:08:51 +03:00
|
|
|
|
2005-12-01 22:35:27 +03:00
|
|
|
virtual NS_HIDDEN_(void) SetDocShell(nsIDocShell* aDocShell);
|
|
|
|
virtual NS_HIDDEN_(nsresult) SetNewDocument(nsIDocument *aDocument,
|
2010-03-13 03:59:18 +03:00
|
|
|
nsISupports *aState);
|
2006-02-15 06:22:17 +03:00
|
|
|
virtual NS_HIDDEN_(void) SetOpenerWindow(nsIDOMWindowInternal *aOpener,
|
|
|
|
PRBool aOriginalOpener);
|
2006-04-08 07:23:37 +04:00
|
|
|
virtual NS_HIDDEN_(void) EnsureSizeUpToDate();
|
2005-08-23 04:24:57 +04:00
|
|
|
|
2006-07-06 02:48:04 +04:00
|
|
|
virtual NS_HIDDEN_(void) EnterModalState();
|
|
|
|
virtual NS_HIDDEN_(void) LeaveModalState();
|
|
|
|
|
2010-01-28 21:35:20 +03:00
|
|
|
virtual NS_HIDDEN_(PRBool) CanClose();
|
|
|
|
virtual NS_HIDDEN_(nsresult) ForceClose();
|
|
|
|
|
2009-08-21 18:42:37 +04:00
|
|
|
virtual NS_HIDDEN_(void) SetHasOrientationEventListener();
|
|
|
|
|
2001-01-18 10:44:29 +03: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 21:42:36 +04:00
|
|
|
NS_DECL_NSIDOMVIEWCSS
|
2000-05-03 17:03:17 +04:00
|
|
|
|
2001-01-18 10:44:29 +03: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 21:42:36 +04:00
|
|
|
NS_DECL_NSIDOMABSTRACTVIEW
|
2000-02-08 16:40:10 +03:00
|
|
|
|
2006-05-19 09:57:36 +04:00
|
|
|
// nsIDOMStorageWindow
|
|
|
|
NS_DECL_NSIDOMSTORAGEWINDOW
|
|
|
|
|
2001-05-17 06:15:27 +04:00
|
|
|
// nsIInterfaceRequestor
|
|
|
|
NS_DECL_NSIINTERFACEREQUESTOR
|
|
|
|
|
2001-01-18 10:44:29 +03:00
|
|
|
// Object Management
|
2005-07-31 00:57:07 +04:00
|
|
|
nsGlobalWindow(nsGlobalWindow *aOuterWindow);
|
|
|
|
|
2009-05-13 00:20:42 +04:00
|
|
|
static nsGlobalWindow *FromSupports(nsISupports *supports)
|
2005-07-31 00:57:07 +04:00
|
|
|
{
|
|
|
|
// Make sure this matches the casts we do in QueryInterface().
|
2009-05-13 00:20:42 +04:00
|
|
|
return (nsGlobalWindow *)(nsIScriptGlobalObject *)supports;
|
|
|
|
}
|
|
|
|
static nsGlobalWindow *FromWrapper(nsIXPConnectWrappedNative *wrapper)
|
|
|
|
{
|
|
|
|
return FromSupports(wrapper->Native());
|
2005-07-31 00:57:07 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
nsIScriptContext *GetContextInternal()
|
|
|
|
{
|
2005-08-12 08:11:00 +04:00
|
|
|
if (mOuterWindow) {
|
2005-07-31 00:57:07 +04:00
|
|
|
return GetOuterWindowInternal()->mContext;
|
|
|
|
}
|
|
|
|
|
|
|
|
return mContext;
|
|
|
|
}
|
|
|
|
|
2006-06-13 07:07:47 +04: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-31 00:57:07 +04:00
|
|
|
nsGlobalWindow *GetOuterWindowInternal()
|
|
|
|
{
|
2007-07-08 11:08:04 +04:00
|
|
|
return static_cast<nsGlobalWindow *>(GetOuterWindow());
|
2005-07-31 00:57:07 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
nsGlobalWindow *GetCurrentInnerWindowInternal()
|
|
|
|
{
|
2007-07-08 11:08:04 +04:00
|
|
|
return static_cast<nsGlobalWindow *>(mInnerWindow);
|
2005-07-31 00:57:07 +04:00
|
|
|
}
|
|
|
|
|
2005-12-11 23:38:29 +03:00
|
|
|
nsGlobalWindow *EnsureInnerWindowInternal()
|
|
|
|
{
|
2007-07-08 11:08:04 +04:00
|
|
|
return static_cast<nsGlobalWindow *>(EnsureInnerWindow());
|
2005-12-11 23:38:29 +03:00
|
|
|
}
|
|
|
|
|
2007-03-23 02:01:14 +03:00
|
|
|
PRBool IsCreatingInnerWindow() const
|
2007-08-03 03:34:38 +04:00
|
|
|
{
|
2007-03-23 02:01:14 +03:00
|
|
|
return mCreatingInnerWindow;
|
2007-08-03 03:34:38 +04:00
|
|
|
}
|
|
|
|
|
2007-08-03 03:34:38 +04:00
|
|
|
PRBool IsChromeWindow() const
|
|
|
|
{
|
|
|
|
return mIsChrome;
|
|
|
|
}
|
|
|
|
|
2006-05-19 09:57:36 +04:00
|
|
|
nsresult Observe(nsISupports* aSubject, const char* aTopic,
|
|
|
|
const PRUnichar* aData);
|
2005-08-20 00:09:38 +04: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 21:42:36 +04:00
|
|
|
static void ShutDown();
|
2008-02-13 07:17:18 +03:00
|
|
|
static void CleanupCachedXBLHandlers(nsGlobalWindow* aWindow);
|
2002-06-19 08:09:57 +04:00
|
|
|
static PRBool IsCallerChrome();
|
2006-08-30 02:25:12 +04: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 21:42:36 +04:00
|
|
|
|
2006-10-05 21:29:47 +04:00
|
|
|
static void RunPendingTimeoutsRecursive(nsGlobalWindow *aTopWindow,
|
|
|
|
nsGlobalWindow *aWindow);
|
|
|
|
|
2005-05-05 00:22:32 +04:00
|
|
|
friend class WindowStateHolder;
|
|
|
|
|
2008-02-13 07:17:18 +03:00
|
|
|
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_AMBIGUOUS(nsGlobalWindow,
|
|
|
|
nsIScriptGlobalObject)
|
2008-02-13 07:17:19 +03:00
|
|
|
|
2007-10-10 05:24:28 +04:00
|
|
|
void InitJavaProperties();
|
|
|
|
|
2008-02-13 07:17:18 +03:00
|
|
|
virtual NS_HIDDEN_(void*)
|
|
|
|
GetCachedXBLPrototypeHandler(nsXBLPrototypeHandler* aKey);
|
|
|
|
|
|
|
|
virtual NS_HIDDEN_(void)
|
|
|
|
CacheXBLPrototypeHandler(nsXBLPrototypeHandler* aKey,
|
|
|
|
nsScriptObjectHolder& aHandler);
|
|
|
|
|
Bug 178324, refactor focus by moving all focus handling into one place and simplifying it, add many tests, fixes many other bugs too numerous to mention in this small checkin comment, r=josh,smichaud,ere,dbaron,marco,neil,gavin,smaug,sr=smaug (CLOSED TREE)
2009-06-10 22:00:39 +04:00
|
|
|
virtual PRBool TakeFocus(PRBool aFocus, PRUint32 aFocusMethod);
|
|
|
|
virtual void SetReadyForFocus();
|
|
|
|
virtual void PageHidden();
|
2009-11-27 08:01:43 +03:00
|
|
|
virtual nsresult DispatchSyncHashchange();
|
2009-09-01 20:45:05 +04:00
|
|
|
virtual nsresult DispatchSyncPopState();
|
|
|
|
|
2009-10-07 04:09:16 +04:00
|
|
|
virtual nsresult SetArguments(nsIArray *aArguments, nsIPrincipal *aOrigin);
|
Bug 178324, refactor focus by moving all focus handling into one place and simplifying it, add many tests, fixes many other bugs too numerous to mention in this small checkin comment, r=josh,smichaud,ere,dbaron,marco,neil,gavin,smaug,sr=smaug (CLOSED TREE)
2009-06-10 22:00:39 +04:00
|
|
|
|
2008-11-06 09:41:52 +03:00
|
|
|
static PRBool DOMWindowDumpEnabled();
|
2008-02-13 07:17:18 +03:00
|
|
|
|
2010-03-12 07:42:05 +03:00
|
|
|
void MaybeForgiveSpamCount();
|
|
|
|
PRBool IsClosedOrClosing() {
|
|
|
|
return (mIsClosed ||
|
|
|
|
mInClose ||
|
|
|
|
mHavePendingClose ||
|
|
|
|
mCleanedUp);
|
|
|
|
}
|
|
|
|
|
2000-02-08 16:40:10 +03:00
|
|
|
protected:
|
2001-01-18 10:44:29 +03:00
|
|
|
// Object Management
|
2004-12-10 22:48:22 +03:00
|
|
|
virtual ~nsGlobalWindow();
|
2010-03-12 07:42:05 +03:00
|
|
|
void CleanUp(PRBool aIgnoreModalDialog);
|
2002-12-20 11:00:08 +03:00
|
|
|
void ClearControllers();
|
2010-01-28 21:35:20 +03:00
|
|
|
nsresult FinalClose();
|
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 21:42:36 +04:00
|
|
|
|
2006-09-22 05:01:04 +04:00
|
|
|
void FreeInnerObjects(PRBool aClearScope);
|
2008-01-30 08:30:11 +03:00
|
|
|
nsGlobalWindow *CallerInnerWindow();
|
2005-08-15 22:16:42 +04:00
|
|
|
|
2010-03-13 03:59:18 +03:00
|
|
|
nsresult InnerWindowSetNewDocument(nsIDocument* aDocument);
|
|
|
|
|
2009-10-07 04:09:16 +04:00
|
|
|
nsresult DefineArgumentsProperty(nsIArray *aArguments);
|
2005-07-31 00:57:07 +04:00
|
|
|
|
2001-11-01 02:52:52 +03:00
|
|
|
// Get the parent, returns null if this is a toplevel window
|
2004-02-10 01:48:53 +03:00
|
|
|
nsIDOMWindowInternal *GetParentInternal();
|
2001-11-01 02:52:52 +03:00
|
|
|
|
2004-05-04 01:48:36 +04:00
|
|
|
// popup tracking
|
2005-07-31 00:57:07 +04:00
|
|
|
PRBool IsPopupSpamWindow()
|
|
|
|
{
|
2005-08-12 08:11:00 +04:00
|
|
|
if (IsInnerWindow() && !mOuterWindow) {
|
|
|
|
return PR_FALSE;
|
|
|
|
}
|
|
|
|
|
2005-07-31 00:57:07 +04:00
|
|
|
return GetOuterWindowInternal()->mIsPopupSpam;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SetPopupSpamWindow(PRBool aPopup)
|
|
|
|
{
|
2005-08-12 08:11:00 +04:00
|
|
|
if (IsInnerWindow() && !mOuterWindow) {
|
|
|
|
NS_ERROR("SetPopupSpamWindow() called on inner window w/o an outer!");
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2005-07-31 00:57:07 +04:00
|
|
|
GetOuterWindowInternal()->mIsPopupSpam = aPopup;
|
|
|
|
}
|
2004-05-04 01:48:36 +04:00
|
|
|
|
2001-01-18 10:44:29 +03:00
|
|
|
// Window Control Functions
|
2006-02-07 23:46:39 +03: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-30 02:25:12 +04:00
|
|
|
* @param aJSCallerContext The calling script's context. This must be nsnull
|
|
|
|
* when aCalledNoScript is true.
|
2006-02-07 23:46:39 +03: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,
|
2007-09-08 00:30:15 +04:00
|
|
|
PRBool aContentModal,
|
2006-02-07 23:46:39 +03:00
|
|
|
PRBool aCalledNoScript,
|
|
|
|
PRBool aDoJSFixups,
|
2006-06-13 07:07:47 +04:00
|
|
|
nsIArray *argv,
|
2006-02-07 23:46:39 +03:00
|
|
|
nsISupports *aExtraArgument,
|
2006-07-11 04:27:05 +04:00
|
|
|
nsIPrincipal *aCalleePrincipal,
|
2006-08-30 02:25:12 +04:00
|
|
|
JSContext *aJSCallerContext,
|
2006-02-07 23:46:39 +03:00
|
|
|
nsIDOMWindow **aReturn);
|
|
|
|
|
2001-01-18 10:44:29 +03:00
|
|
|
static void CloseWindow(nsISupports* aWindow);
|
2005-07-31 00:57:07 +04:00
|
|
|
static void ClearWindowScope(nsISupports* aWindow);
|
2001-01-18 10:44:29 +03:00
|
|
|
|
|
|
|
// Timeout Functions
|
2006-06-13 07:07:47 +04: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 21:42:36 +04:00
|
|
|
nsresult SetTimeoutOrInterval(PRBool aIsInterval, PRInt32* aReturn);
|
2002-03-27 03:55:57 +03:00
|
|
|
nsresult ClearTimeoutOrInterval();
|
2006-06-13 07:07:47 +04:00
|
|
|
|
|
|
|
// The timeout implementation functions.
|
|
|
|
void RunTimeout(nsTimeout *aTimeout);
|
|
|
|
|
2005-05-09 01:44:16 +04:00
|
|
|
void ClearAllTimeouts();
|
2006-09-21 07:46:46 +04: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 10:58:11 +04:00
|
|
|
static void TimerCallback(nsITimer *aTimer, void *aClosure);
|
2001-01-18 10:44:29 +03: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 21:42:36 +04:00
|
|
|
nsresult GetTreeOwner(nsIDocShellTreeOwner** aTreeOwner);
|
|
|
|
nsresult GetTreeOwner(nsIBaseWindow** aTreeOwner);
|
|
|
|
nsresult GetWebBrowserChrome(nsIWebBrowserChrome** aBrowserChrome);
|
2009-09-03 07:57:46 +04:00
|
|
|
// GetScrollFrame does not flush. Callers should do it themselves as needed,
|
|
|
|
// depending on which info they actually want off the scrollable frame.
|
|
|
|
nsIScrollableFrame *GetScrollFrame();
|
2001-06-20 05:25:09 +04:00
|
|
|
nsresult SecurityCheckURL(const char *aURL);
|
2004-12-07 19:09:23 +03:00
|
|
|
nsresult BuildURIfromBase(const char *aURL,
|
|
|
|
nsIURI **aBuiltURI,
|
|
|
|
PRBool *aFreeSecurityPass, JSContext **aCXused);
|
2009-09-16 22:46:05 +04:00
|
|
|
PRBool PopupWhitelisted();
|
|
|
|
PopupControlState RevisePopupAbuseLevel(PopupControlState);
|
2003-06-26 03:38:45 +04:00
|
|
|
void FireAbuseEvents(PRBool aBlocked, PRBool aWindow,
|
2004-02-10 21:22:23 +03:00
|
|
|
const nsAString &aPopupURL,
|
2005-11-01 04:41:00 +03:00
|
|
|
const nsAString &aPopupWindowName,
|
2004-02-10 21:22:23 +03:00
|
|
|
const nsAString &aPopupWindowFeatures);
|
2006-05-04 01:53:08 +04:00
|
|
|
void FireOfflineStatusEvent();
|
2009-11-27 08:01:43 +03:00
|
|
|
|
2004-05-28 02:08:42 +04:00
|
|
|
void FlushPendingNotifications(mozFlushType aType);
|
2002-02-05 08:47:22 +03:00
|
|
|
void EnsureReflowFlushAndPaint();
|
2001-01-18 10:44:29 +03:00
|
|
|
nsresult CheckSecurityWidthAndHeight(PRInt32* width, PRInt32* height);
|
|
|
|
nsresult CheckSecurityLeftAndTop(PRInt32* left, PRInt32* top);
|
2002-11-26 02:21:25 +03:00
|
|
|
static PRBool CanSetProperty(const char *aPrefName);
|
2002-05-18 02:24:06 +04:00
|
|
|
|
2006-07-29 02:06:39 +04:00
|
|
|
static void MakeScriptDialogTitle(nsAString &aOutTitle);
|
2000-02-08 16:40:10 +03:00
|
|
|
|
2008-03-19 23:27:34 +03:00
|
|
|
static PRBool CanMoveResizeWindows();
|
|
|
|
|
2003-02-24 23:15:59 +03:00
|
|
|
PRBool GetBlurSuppression();
|
|
|
|
|
2004-08-08 21:39:20 +04: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 17:40:46 +04:00
|
|
|
nsresult GetScrollMaxXY(PRInt32* aScrollMaxX, PRInt32* aScrollMaxY);
|
2008-04-02 02:20:45 +04:00
|
|
|
|
|
|
|
nsresult GetOuterSize(nsIntSize* aSizeCSSPixels);
|
|
|
|
nsresult SetOuterSize(PRInt32 aLengthCSSPixels, PRBool aIsWidth);
|
2009-07-30 07:16:44 +04:00
|
|
|
nsRect GetInnerScreenRect();
|
2003-04-15 17:40:46 +04:00
|
|
|
|
2004-07-05 19:51:31 +04:00
|
|
|
PRBool IsFrame()
|
|
|
|
{
|
|
|
|
return GetParentInternal() != nsnull;
|
|
|
|
}
|
|
|
|
|
2004-11-03 20:06:21 +03:00
|
|
|
PRBool DispatchCustomEvent(const char *aEventName);
|
|
|
|
|
2006-02-07 23:46:39 +03: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 22:36:40 +03:00
|
|
|
|
2005-03-06 21:43:07 +03:00
|
|
|
already_AddRefed<nsIWidget> GetMainWidget();
|
2009-07-15 13:54:30 +04:00
|
|
|
nsIWidget* GetNearestWidget();
|
2005-03-06 21:43:07 +03:00
|
|
|
|
2005-08-15 22:16:42 +04:00
|
|
|
void Freeze()
|
|
|
|
{
|
2005-09-28 06:44:16 +04:00
|
|
|
NS_ASSERTION(!IsFrozen(), "Double-freezing?");
|
2005-08-15 22:16:42 +04:00
|
|
|
mIsFrozen = PR_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Thaw()
|
|
|
|
{
|
|
|
|
mIsFrozen = PR_FALSE;
|
|
|
|
}
|
|
|
|
|
2006-07-06 02:48:04 +04:00
|
|
|
PRBool IsInModalState();
|
|
|
|
|
2006-09-21 07:46:46 +04:00
|
|
|
nsTimeout* FirstTimeout() {
|
|
|
|
// Note: might not actually return an nsTimeout. Use IsTimeout to check.
|
2007-07-08 11:08:04 +04:00
|
|
|
return static_cast<nsTimeout*>(PR_LIST_HEAD(&mTimeouts));
|
2006-09-21 07:46:46 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
nsTimeout* LastTimeout() {
|
|
|
|
// Note: might not actually return an nsTimeout. Use IsTimeout to check.
|
2007-07-08 11:08:04 +04:00
|
|
|
return static_cast<nsTimeout*>(PR_LIST_TAIL(&mTimeouts));
|
2006-09-21 07:46:46 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
PRBool IsTimeout(PRCList* aList) {
|
|
|
|
return aList != &mTimeouts;
|
|
|
|
}
|
|
|
|
|
2009-02-10 11:29:53 +03:00
|
|
|
// Convenience functions for the many methods that need to scale
|
|
|
|
// from device to CSS pixels or vice versa. Note: if a presentation
|
|
|
|
// context is not available, they will assume a 1:1 ratio.
|
|
|
|
PRInt32 DevToCSSIntPixels(PRInt32 px);
|
|
|
|
PRInt32 CSSToDevIntPixels(PRInt32 px);
|
|
|
|
nsIntSize DevToCSSIntPixels(nsIntSize px);
|
|
|
|
nsIntSize CSSToDevIntPixels(nsIntSize px);
|
|
|
|
|
Bug 178324, refactor focus by moving all focus handling into one place and simplifying it, add many tests, fixes many other bugs too numerous to mention in this small checkin comment, r=josh,smichaud,ere,dbaron,marco,neil,gavin,smaug,sr=smaug (CLOSED TREE)
2009-06-10 22:00:39 +04:00
|
|
|
virtual nsIContent* GetFocusedNode();
|
|
|
|
virtual void SetFocusedNode(nsIContent* aNode,
|
|
|
|
PRUint32 aFocusMethod = 0,
|
|
|
|
PRBool aNeedsFocus = PR_FALSE);
|
|
|
|
|
|
|
|
virtual PRUint32 GetFocusMethod();
|
|
|
|
|
|
|
|
void UpdateCanvasFocus(PRBool aFocusChanged, nsIContent* aNewContent);
|
|
|
|
|
2010-02-20 19:07:03 +03:00
|
|
|
already_AddRefed<nsPIWindowRoot> GetTopWindowRoot();
|
|
|
|
|
2008-02-14 02:41:17 +03:00
|
|
|
static void NotifyDOMWindowDestroyed(nsGlobalWindow* aWindow);
|
|
|
|
|
2001-02-17 22:02:25 +03: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-31 00:57:07 +04:00
|
|
|
|
2005-08-20 00:09:38 +04: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-15 01:56:21 +04:00
|
|
|
PRPackedBool mIsFrozen : 1;
|
2005-08-20 00:09:38 +04:00
|
|
|
|
2007-10-10 05:24:28 +04:00
|
|
|
// True if the Java properties have been initialized on this
|
|
|
|
// window. Only used on inner windows.
|
|
|
|
PRPackedBool mDidInitJavaProperties : 1;
|
|
|
|
|
2005-07-31 00:57:07 +04:00
|
|
|
// These members are only used on outer window objects. Make sure
|
|
|
|
// you never set any of these on an inner object!
|
2009-07-06 09:24:56 +04:00
|
|
|
PRPackedBool mFullScreen : 1;
|
2005-10-15 01:56:21 +04:00
|
|
|
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 06:22:17 +03:00
|
|
|
PRPackedBool mHadOriginalOpener : 1;
|
2005-10-15 01:56:21 +04:00
|
|
|
PRPackedBool mIsPopupSpam : 1;
|
2005-07-31 00:57:07 +04:00
|
|
|
|
2006-08-30 02:25:12 +04:00
|
|
|
// Indicates whether scripts are allowed to close this window.
|
|
|
|
PRPackedBool mBlockScriptedClosingFlag : 1;
|
|
|
|
|
2006-05-04 01:53:08 +04:00
|
|
|
// Track what sorts of events we need to fire when thawed
|
|
|
|
PRPackedBool mFireOfflineStatusChangeEventOnThaw : 1;
|
2006-11-17 04:06:41 +03:00
|
|
|
|
|
|
|
// Indicates whether we're in the middle of creating an initializing
|
|
|
|
// a new inner window object.
|
|
|
|
PRPackedBool mCreatingInnerWindow : 1;
|
2007-08-03 03:34:38 +04:00
|
|
|
|
|
|
|
// Fast way to tell if this is a chrome window (without having to QI).
|
|
|
|
PRPackedBool mIsChrome : 1;
|
|
|
|
|
Bug 178324, refactor focus by moving all focus handling into one place and simplifying it, add many tests, fixes many other bugs too numerous to mention in this small checkin comment, r=josh,smichaud,ere,dbaron,marco,neil,gavin,smaug,sr=smaug (CLOSED TREE)
2009-06-10 22:00:39 +04:00
|
|
|
// Indicates that the current document has never received a document focus
|
|
|
|
// event.
|
|
|
|
PRPackedBool mNeedsFocus : 1;
|
|
|
|
PRPackedBool mHasFocus : 1;
|
|
|
|
|
2009-08-21 18:42:37 +04:00
|
|
|
// Indicates whether this window is getting acceleration change events
|
|
|
|
PRPackedBool mHasAcceleration : 1;
|
|
|
|
|
2001-01-18 10:44:29 +03:00
|
|
|
nsCOMPtr<nsIScriptContext> mContext;
|
2008-02-09 00:09:36 +03:00
|
|
|
nsWeakPtr mOpener;
|
2001-01-18 10:44:29 +03:00
|
|
|
nsCOMPtr<nsIControllers> mControllers;
|
2006-06-13 07:07:47 +04:00
|
|
|
nsCOMPtr<nsIArray> mArguments;
|
|
|
|
nsCOMPtr<nsIArray> mArgumentsLast;
|
2009-10-07 04:09:16 +04:00
|
|
|
nsCOMPtr<nsIPrincipal> mArgumentsOrigin;
|
2004-12-10 22:48:22 +03:00
|
|
|
nsRefPtr<nsNavigator> mNavigator;
|
|
|
|
nsRefPtr<nsScreen> mScreen;
|
|
|
|
nsRefPtr<nsHistory> mHistory;
|
2003-06-21 03:51:46 +04:00
|
|
|
nsRefPtr<nsDOMWindowList> mFrames;
|
2004-12-10 22:48:22 +03:00
|
|
|
nsRefPtr<nsBarProp> mMenubar;
|
|
|
|
nsRefPtr<nsBarProp> mToolbar;
|
|
|
|
nsRefPtr<nsBarProp> mLocationbar;
|
|
|
|
nsRefPtr<nsBarProp> mPersonalbar;
|
|
|
|
nsRefPtr<nsBarProp> mStatusbar;
|
|
|
|
nsRefPtr<nsBarProp> mScrollbars;
|
2004-06-20 20:42:13 +04:00
|
|
|
nsCOMPtr<nsIWeakReference> mWindowUtils;
|
2005-08-23 05:42:49 +04:00
|
|
|
nsRefPtr<nsLocation> mLocation;
|
2001-01-18 10:44:29 +03:00
|
|
|
nsString mStatus;
|
|
|
|
nsString mDefaultStatus;
|
2006-06-13 07:07:47 +04: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-04 01:53:08 +04:00
|
|
|
nsGlobalWindowObserver* mObserver;
|
2001-01-18 10:44:29 +03:00
|
|
|
|
|
|
|
nsCOMPtr<nsIDOMCrypto> mCrypto;
|
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 21:42:36 +04:00
|
|
|
|
2009-05-16 17:59:30 +04:00
|
|
|
nsCOMPtr<nsIDOMStorage> mLocalStorage;
|
2010-01-28 17:53:53 +03:00
|
|
|
nsCOMPtr<nsIDOMStorage> mSessionStorage;
|
2009-03-19 02:43:45 +03:00
|
|
|
|
2006-06-13 07:07:47 +04:00
|
|
|
nsCOMPtr<nsISupports> mInnerWindowHolders[NS_STID_ARRAY_UBOUND];
|
2006-02-20 21:52:42 +03:00
|
|
|
nsCOMPtr<nsIPrincipal> mOpenerScriptPrincipal; // strong; used to determine
|
|
|
|
// whether to clear scope
|
2005-07-31 00:57:07 +04:00
|
|
|
|
2005-08-12 08:11:00 +04:00
|
|
|
// These member variable are used only on inner windows.
|
2005-07-31 00:57:07 +04:00
|
|
|
nsCOMPtr<nsIEventListenerManager> mListenerManager;
|
2006-09-21 07:46:46 +04:00
|
|
|
PRCList mTimeouts;
|
|
|
|
// If mTimeoutInsertionPoint is non-null, insertions should happen after it.
|
|
|
|
nsTimeout* mTimeoutInsertionPoint;
|
2005-08-12 08:11:00 +04:00
|
|
|
PRUint32 mTimeoutPublicIdCounter;
|
|
|
|
PRUint32 mTimeoutFiringDepth;
|
2003-06-19 03:48:57 +04:00
|
|
|
|
2008-07-12 01:28:12 +04:00
|
|
|
// Holder of the dummy java plugin, used to expose window.java and
|
|
|
|
// window.packages.
|
2007-10-10 05:24:28 +04:00
|
|
|
nsRefPtr<nsDummyJavaPluginOwner> mDummyJavaPluginOwner;
|
|
|
|
|
2005-08-12 08:11:00 +04:00
|
|
|
// These member variables are used on both inner and the outer windows.
|
2005-07-31 20:44:28 +04:00
|
|
|
nsCOMPtr<nsIPrincipal> mDocumentPrincipal;
|
2005-10-21 03:32:54 +04:00
|
|
|
nsCOMPtr<nsIDocument> mDoc; // For fast access to principals
|
2005-08-12 08:11:00 +04:00
|
|
|
JSObject* mJSObject;
|
2005-07-31 20:44:28 +04:00
|
|
|
|
2010-01-28 17:53:53 +03:00
|
|
|
typedef nsTArray<nsCOMPtr<nsIDOMStorageEvent> > nsDOMStorageEventArray;
|
|
|
|
nsDOMStorageEventArray mPendingStorageEvents;
|
|
|
|
nsDataHashtable<nsStringHashKey, PRBool> *mPendingStorageEventsObsolete;
|
2006-05-19 09:57:36 +04:00
|
|
|
|
2009-02-17 23:07:39 +03:00
|
|
|
PRUint32 mTimeoutsSuspendDepth;
|
|
|
|
|
Bug 178324, refactor focus by moving all focus handling into one place and simplifying it, add many tests, fixes many other bugs too numerous to mention in this small checkin comment, r=josh,smichaud,ere,dbaron,marco,neil,gavin,smaug,sr=smaug (CLOSED TREE)
2009-06-10 22:00:39 +04:00
|
|
|
// the element within the document that is currently focused when this
|
|
|
|
// window is active
|
|
|
|
nsCOMPtr<nsIContent> mFocusedNode;
|
|
|
|
|
|
|
|
// the method that was used to focus mFocusedNode
|
|
|
|
PRUint32 mFocusMethod;
|
|
|
|
|
2006-02-15 06:22:17 +03:00
|
|
|
#ifdef DEBUG
|
|
|
|
PRBool mSetOpenerWindowCalled;
|
2008-02-14 02:41:17 +03:00
|
|
|
PRUint32 mSerial;
|
2008-04-29 01:51:11 +04:00
|
|
|
nsCOMPtr<nsIURI> mLastOpenedURI;
|
2006-02-15 06:22:17 +03:00
|
|
|
#endif
|
|
|
|
|
2010-03-12 07:42:05 +03:00
|
|
|
PRBool mCleanedUp, mCallCleanUpAfterModalDialogCloses;
|
|
|
|
|
2008-01-17 00:54:33 +03:00
|
|
|
nsCOMPtr<nsIDOMOfflineResourceList> mApplicationCache;
|
|
|
|
|
2008-02-13 07:17:18 +03:00
|
|
|
nsDataHashtable<nsVoidPtrHashKey, void*> mCachedXBLPrototypeHandlers;
|
|
|
|
|
2009-03-03 23:11:14 +03:00
|
|
|
nsCOMPtr<nsIDocument> mSuspendedDoc;
|
|
|
|
|
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 21:42:36 +04:00
|
|
|
friend class nsDOMScriptableHelper;
|
2004-06-20 20:42:13 +04:00
|
|
|
friend class nsDOMWindowUtils;
|
2008-05-02 23:26:47 +04:00
|
|
|
friend class PostMessageEvent;
|
2008-12-10 18:19:17 +03:00
|
|
|
static nsIDOMStorageList* sGlobalStorageList;
|
1998-07-24 09:05:42 +04:00
|
|
|
};
|
|
|
|
|
2002-02-09 06:36:55 +03:00
|
|
|
/*
|
2004-12-10 22:48:22 +03:00
|
|
|
* nsGlobalChromeWindow inherits from nsGlobalWindow. It is the global
|
2002-02-09 06:36:55 +03:00
|
|
|
* object created for a Chrome Window only.
|
|
|
|
*/
|
2004-12-10 22:48:22 +03:00
|
|
|
class nsGlobalChromeWindow : public nsGlobalWindow,
|
2002-02-09 06:36:55 +03:00
|
|
|
public nsIDOMChromeWindow
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
// nsISupports
|
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
|
|
|
|
|
|
|
// nsIDOMChromeWindow interface
|
|
|
|
NS_DECL_NSIDOMCHROMEWINDOW
|
|
|
|
|
2005-07-31 00:57:07 +04:00
|
|
|
nsGlobalChromeWindow(nsGlobalWindow *aOuterWindow)
|
|
|
|
: nsGlobalWindow(aOuterWindow)
|
|
|
|
{
|
2007-08-03 03:34:38 +04:00
|
|
|
mIsChrome = PR_TRUE;
|
2005-07-31 00:57:07 +04:00
|
|
|
}
|
|
|
|
|
2007-03-08 14:17:16 +03:00
|
|
|
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED_NO_UNLINK(nsGlobalChromeWindow,
|
|
|
|
nsGlobalWindow)
|
|
|
|
|
2002-02-09 06:36:55 +03:00
|
|
|
protected:
|
2004-12-07 19:09:23 +03:00
|
|
|
nsCOMPtr<nsIBrowserDOMWindow> mBrowserDOMWindow;
|
2002-02-09 06:36:55 +03:00
|
|
|
};
|
|
|
|
|
2007-07-26 21:52:26 +04:00
|
|
|
/*
|
|
|
|
* nsGlobalModalWindow inherits from nsGlobalWindow. It is the global
|
|
|
|
* object created for a modal content windows only (i.e. not modal
|
|
|
|
* chrome dialogs).
|
|
|
|
*/
|
|
|
|
class nsGlobalModalWindow : public nsGlobalWindow,
|
|
|
|
public nsIDOMModalContentWindow
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
nsGlobalModalWindow(nsGlobalWindow *aOuterWindow)
|
|
|
|
: nsGlobalWindow(aOuterWindow)
|
|
|
|
{
|
|
|
|
mIsModalContentWindow = PR_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
|
|
|
NS_DECL_NSIDOMMODALCONTENTWINDOW
|
|
|
|
|
|
|
|
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsGlobalModalWindow, nsGlobalWindow)
|
|
|
|
|
2009-10-07 04:09:16 +04:00
|
|
|
virtual NS_HIDDEN_(nsresult) SetNewDocument(nsIDocument *aDocument,
|
2010-03-13 03:59:18 +03:00
|
|
|
nsISupports *aState);
|
2009-10-07 04:09:16 +04:00
|
|
|
|
2007-07-26 21:52:26 +04:00
|
|
|
protected:
|
|
|
|
nsCOMPtr<nsIVariant> mReturnValue;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2000-02-08 16:40:10 +03:00
|
|
|
//*****************************************************************************
|
2004-12-10 22:48:22 +03: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 21:42:36 +04:00
|
|
|
//*****************************************************************************
|
1998-07-24 09:05:42 +04:00
|
|
|
|
2004-12-10 22:48:22 +03:00
|
|
|
class nsNavigator : public nsIDOMNavigator,
|
2006-06-29 04:56:52 +04:00
|
|
|
public nsIDOMJSNavigator,
|
2008-07-16 03:37:48 +04:00
|
|
|
public nsIDOMClientInformation,
|
2008-08-14 20:35:49 +04:00
|
|
|
public nsIDOMNavigatorGeolocation
|
2000-02-08 16:40:10 +03:00
|
|
|
{
|
1998-07-24 09:05:42 +04:00
|
|
|
public:
|
2004-12-10 22:48:22 +03:00
|
|
|
nsNavigator(nsIDocShell *aDocShell);
|
|
|
|
virtual ~nsNavigator();
|
2000-02-08 16:40:10 +03:00
|
|
|
|
2001-01-18 10:44:29 +03: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 21:42:36 +04:00
|
|
|
NS_DECL_NSIDOMNAVIGATOR
|
|
|
|
NS_DECL_NSIDOMJSNAVIGATOR
|
2006-06-29 04:56:52 +04:00
|
|
|
NS_DECL_NSIDOMCLIENTINFORMATION
|
2008-08-14 20:35:49 +04:00
|
|
|
NS_DECL_NSIDOMNAVIGATORGEOLOCATION
|
2001-07-23 09:36:52 +04:00
|
|
|
|
2001-01-24 01:29:41 +03:00
|
|
|
void SetDocShell(nsIDocShell *aDocShell);
|
2005-07-31 00:57:07 +04:00
|
|
|
nsIDocShell *GetDocShell()
|
|
|
|
{
|
|
|
|
return mDocShell;
|
|
|
|
}
|
|
|
|
|
2003-06-19 03:48:57 +04:00
|
|
|
void LoadingNewDocument();
|
2001-07-23 09:36:52 +04:00
|
|
|
nsresult RefreshMIMEArray();
|
2001-01-24 01:29:41 +03:00
|
|
|
|
1998-07-24 09:05:42 +04:00
|
|
|
protected:
|
2004-12-10 22:48:22 +03:00
|
|
|
nsRefPtr<nsMimeTypeArray> mMimeTypes;
|
|
|
|
nsRefPtr<nsPluginArray> mPlugins;
|
2008-08-14 20:35:49 +04:00
|
|
|
nsRefPtr<nsGeolocation> mGeolocation;
|
2001-01-24 01:29:41 +03:00
|
|
|
nsIDocShell* mDocShell; // weak reference
|
2002-02-13 07:20:46 +03:00
|
|
|
|
|
|
|
static jsval sPrefInternal_id;
|
1998-07-24 09:05:42 +04:00
|
|
|
};
|
|
|
|
|
1999-06-23 07:29:44 +04:00
|
|
|
class nsIURI;
|
1998-12-16 08:40:20 +03:00
|
|
|
|
2000-02-08 16:40:10 +03:00
|
|
|
//*****************************************************************************
|
2004-12-10 22:48:22 +03: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 21:42:36 +04:00
|
|
|
//*****************************************************************************
|
2000-02-08 16:40:10 +03:00
|
|
|
|
2008-09-06 01:54:53 +04:00
|
|
|
class nsLocation : public nsIDOMLocation
|
1999-08-04 03:16:48 +04:00
|
|
|
{
|
1998-08-13 08:34:53 +04:00
|
|
|
public:
|
2004-12-10 22:48:22 +03:00
|
|
|
nsLocation(nsIDocShell *aDocShell);
|
|
|
|
virtual ~nsLocation();
|
2001-01-18 10:44:29 +03:00
|
|
|
|
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
|
2004-02-10 01:48:53 +03:00
|
|
|
void SetDocShell(nsIDocShell *aDocShell);
|
2006-06-20 22:56:03 +04:00
|
|
|
nsIDocShell *GetDocShell();
|
2001-01-18 10:44:29 +03: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 21:42:36 +04:00
|
|
|
NS_DECL_NSIDOMLOCATION
|
2001-01-18 10:44:29 +03:00
|
|
|
|
1998-08-13 08:34:53 +04:00
|
|
|
protected:
|
2004-04-24 20:09:31 +04: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 10:48:55 +03:00
|
|
|
nsresult GetWritableURI(nsIURI** aURL);
|
2005-01-20 19:57:04 +03:00
|
|
|
nsresult SetURI(nsIURI* aURL, PRBool aReplace = PR_FALSE);
|
2002-03-24 03:16:18 +03:00
|
|
|
nsresult SetHrefWithBase(const nsAString& aHref, nsIURI* aBase,
|
1999-08-04 03:16:48 +04:00
|
|
|
PRBool aReplace);
|
2002-03-24 03:16:18 +03:00
|
|
|
nsresult SetHrefWithContext(JSContext* cx, const nsAString& aHref,
|
2001-05-16 00:58:31 +04:00
|
|
|
PRBool aReplace);
|
|
|
|
|
2001-11-17 20:26:18 +03:00
|
|
|
nsresult GetSourceBaseURL(JSContext* cx, nsIURI** sourceURL);
|
|
|
|
nsresult GetSourceDocument(JSContext* cx, nsIDocument** aDocument);
|
|
|
|
|
2001-01-18 10:44:29 +03:00
|
|
|
nsresult CheckURL(nsIURI *url, nsIDocShellLoadInfo** aLoadInfo);
|
1998-08-13 08:34:53 +04:00
|
|
|
|
2006-06-20 22:56:03 +04:00
|
|
|
nsWeakPtr mDocShell;
|
1998-08-13 08:34:53 +04:00
|
|
|
};
|
|
|
|
|
2004-02-24 06:22:35 +03:00
|
|
|
/* factory function */
|
2007-07-26 21:52:26 +04:00
|
|
|
nsresult
|
|
|
|
NS_NewScriptGlobalObject(PRBool aIsChrome, PRBool aIsModalContentWindow,
|
|
|
|
nsIScriptGlobalObject **aResult);
|
2004-02-24 06:22:35 +03:00
|
|
|
|
1998-07-24 09:05:42 +04:00
|
|
|
#endif /* nsGlobalWindow_h___ */
|