2007-03-22 10:30:00 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=2 sw=2 et tw=80: */
|
|
|
|
/* ***** BEGIN LICENSE BLOCK *****
|
|
|
|
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
|
|
|
*
|
|
|
|
* 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/
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
* The Original Code is mozilla.org code.
|
|
|
|
*
|
|
|
|
* The Initial Developer of the Original Code is
|
|
|
|
* Netscape Communications Corporation.
|
|
|
|
* Portions created by the Initial Developer are Copyright (C) 1998
|
|
|
|
* the Initial Developer. All Rights Reserved.
|
|
|
|
*
|
|
|
|
* Contributor(s):
|
|
|
|
* Travis Bogard <travis@netscape.com>
|
|
|
|
* Dan Rosen <dr@netscape.com>
|
|
|
|
* Vidur Apparao <vidur@netscape.com>
|
|
|
|
* Johnny Stenback <jst@netscape.com>
|
|
|
|
*
|
|
|
|
* Alternatively, the contents of this file may be used under the terms of
|
|
|
|
* 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"),
|
|
|
|
* 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
|
|
|
|
* use your version of this file under the terms of the MPL, indicate your
|
|
|
|
* 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
|
|
|
|
* the terms of any one of the MPL, the GPL or the LGPL.
|
|
|
|
*
|
|
|
|
* ***** END LICENSE BLOCK ***** */
|
|
|
|
|
|
|
|
#ifndef nsGlobalWindow_h___
|
|
|
|
#define nsGlobalWindow_h___
|
|
|
|
|
2010-09-16 18:24:14 -07:00
|
|
|
#include "mozilla/XPCOM.h" // for TimeStamp/TimeDuration
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
// Local Includes
|
|
|
|
// Helper Classes
|
|
|
|
#include "nsCOMPtr.h"
|
|
|
|
#include "nsAutoPtr.h"
|
|
|
|
#include "nsWeakReference.h"
|
|
|
|
#include "nsHashtable.h"
|
|
|
|
#include "nsDataHashtable.h"
|
|
|
|
#include "nsCycleCollectionParticipant.h"
|
2008-02-12 20:17:18 -08:00
|
|
|
#include "nsDOMScriptObjectHolder.h"
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
// Interfaces Needed
|
|
|
|
#include "nsDOMWindowList.h"
|
|
|
|
#include "nsIBaseWindow.h"
|
|
|
|
#include "nsIBrowserDOMWindow.h"
|
|
|
|
#include "nsIDocShellTreeOwner.h"
|
|
|
|
#include "nsIDocShellTreeItem.h"
|
2007-05-14 02:11:38 -07:00
|
|
|
#include "nsIDOMEventTarget.h"
|
2007-03-22 10:30:00 -07:00
|
|
|
#include "nsIInterfaceRequestor.h"
|
|
|
|
#include "nsIInterfaceRequestorUtils.h"
|
|
|
|
#include "nsIDOMJSWindow.h"
|
|
|
|
#include "nsIDOMChromeWindow.h"
|
|
|
|
#include "nsIScriptGlobalObject.h"
|
|
|
|
#include "nsIScriptContext.h"
|
|
|
|
#include "nsIScriptObjectPrincipal.h"
|
|
|
|
#include "nsIScriptTimeoutHandler.h"
|
|
|
|
#include "nsITimer.h"
|
|
|
|
#include "nsIWebBrowserChrome.h"
|
|
|
|
#include "nsPIDOMWindow.h"
|
2007-07-26 10:52:26 -07:00
|
|
|
#include "nsIDOMModalContentWindow.h"
|
2007-03-22 10:30:00 -07:00
|
|
|
#include "nsIScriptSecurityManager.h"
|
2011-06-23 19:18:01 -07:00
|
|
|
#include "nsEventListenerManager.h"
|
2007-03-22 10:30:00 -07:00
|
|
|
#include "nsIDOMDocument.h"
|
2010-09-29 09:56:46 -07:00
|
|
|
#ifndef MOZ_DISABLE_DOMCRYPTO
|
2007-03-22 10:30:00 -07:00
|
|
|
#include "nsIDOMCrypto.h"
|
2010-09-29 09:56:46 -07:00
|
|
|
#endif
|
2007-03-22 10:30:00 -07:00
|
|
|
#include "nsIPrincipal.h"
|
|
|
|
#include "nsIXPCScriptable.h"
|
|
|
|
#include "nsPoint.h"
|
|
|
|
#include "nsSize.h"
|
2009-07-29 20:16:44 -07:00
|
|
|
#include "nsRect.h"
|
2007-03-22 10:30:00 -07:00
|
|
|
#include "mozFlushType.h"
|
|
|
|
#include "prclist.h"
|
2009-05-16 06:59:30 -07:00
|
|
|
#include "nsIDOMStorageObsolete.h"
|
2007-03-22 10:30:00 -07:00
|
|
|
#include "nsIDOMStorageList.h"
|
2010-01-28 06:53:53 -08:00
|
|
|
#include "nsIDOMStorageEvent.h"
|
2011-01-12 09:35:31 -08:00
|
|
|
#include "nsIDOMStorageIndexedDB.h"
|
2007-05-29 02:45:30 -07:00
|
|
|
#include "nsIDOMOfflineResourceList.h"
|
2007-07-26 10:52:26 -07: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 11:00:39 -07:00
|
|
|
#include "nsIContent.h"
|
2010-06-28 09:44:30 -07:00
|
|
|
#include "nsIIDBFactory.h"
|
2010-05-18 05:28:37 -07:00
|
|
|
#include "nsFrameMessageManager.h"
|
2010-07-15 06:59:24 -07:00
|
|
|
#include "mozilla/TimeStamp.h"
|
2011-08-24 12:49:25 -07:00
|
|
|
#include "nsIDOMTouchEvent.h"
|
2011-08-24 12:49:25 -07:00
|
|
|
#include "nsIInlineEventHandlers.h"
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2010-09-17 14:54:40 -07:00
|
|
|
// JS includes
|
|
|
|
#include "jsapi.h"
|
|
|
|
#include "jswrapper.h"
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
#define DEFAULT_HOME_PAGE "www.mozilla.org"
|
|
|
|
#define PREF_BROWSER_STARTUP_HOMEPAGE "browser.startup.homepage"
|
|
|
|
|
2010-09-16 18:24:14 -07:00
|
|
|
// Amount of time allowed between alert/prompt/confirm before enabling
|
|
|
|
// the stop dialog checkbox.
|
|
|
|
#define SUCCESSIVE_DIALOG_TIME_LIMIT 3 // 3 sec
|
|
|
|
|
|
|
|
// During click or mousedown events (and others, see nsDOMEvent) we allow modal
|
|
|
|
// dialogs up to this limit, even if they were disabled.
|
|
|
|
#define MAX_DIALOG_COUNT 10
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
class nsIDOMBarProp;
|
|
|
|
class nsIDocument;
|
|
|
|
class nsPresContext;
|
|
|
|
class nsIDOMEvent;
|
2009-09-02 20:57:46 -07:00
|
|
|
class nsIScrollableFrame;
|
2007-10-13 09:42:44 -07:00
|
|
|
class nsIControllers;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
class nsBarProp;
|
|
|
|
class nsLocation;
|
|
|
|
class nsScreen;
|
|
|
|
class nsHistory;
|
2011-06-23 03:39:48 -07:00
|
|
|
class nsPerformance;
|
2007-03-22 10:30:00 -07:00
|
|
|
class nsIDocShellLoadInfo;
|
|
|
|
class WindowStateHolder;
|
|
|
|
class nsGlobalWindowObserver;
|
|
|
|
class nsGlobalWindow;
|
2007-10-09 18:24:28 -07:00
|
|
|
class nsDummyJavaPluginOwner;
|
2008-05-02 12:26:47 -07:00
|
|
|
class PostMessageEvent;
|
2009-11-19 15:11:44 -08:00
|
|
|
class nsRunnable;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2007-05-29 02:45:30 -07:00
|
|
|
class nsDOMOfflineResourceList;
|
2010-11-23 00:50:55 -08:00
|
|
|
class nsDOMMozURLProperty;
|
2007-05-29 02:45:30 -07:00
|
|
|
|
2010-09-29 09:56:46 -07:00
|
|
|
#ifdef MOZ_DISABLE_DOMCRYPTO
|
|
|
|
class nsIDOMCrypto;
|
|
|
|
#endif
|
|
|
|
|
2012-02-01 13:58:01 -08:00
|
|
|
class nsWindowSizes;
|
|
|
|
|
2011-11-02 06:44:16 -07:00
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
|
|
|
class Navigator;
|
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
extern nsresult
|
2008-01-29 18:11:48 -08:00
|
|
|
NS_CreateJSTimeoutHandler(nsGlobalWindow *aWindow,
|
2011-09-28 23:19:26 -07:00
|
|
|
bool *aIsInterval,
|
2007-03-22 10:30:00 -07:00
|
|
|
PRInt32 *aInterval,
|
|
|
|
nsIScriptTimeoutHandler **aRet);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* 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 06:34:26 -08:00
|
|
|
NS_DECL_CYCLE_COLLECTION_NATIVE_CLASS(nsTimeout)
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
nsrefcnt Release();
|
|
|
|
nsrefcnt AddRef();
|
|
|
|
|
|
|
|
nsTimeout* Next() {
|
|
|
|
// Note: might not actually return an nsTimeout. Use IsTimeout to check.
|
2007-07-08 00:08:04 -07:00
|
|
|
return static_cast<nsTimeout*>(PR_NEXT_LINK(this));
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
nsTimeout* Prev() {
|
|
|
|
// Note: might not actually return an nsTimeout. Use IsTimeout to check.
|
2007-07-08 00:08:04 -07:00
|
|
|
return static_cast<nsTimeout*>(PR_PREV_LINK(this));
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
// Window for which this timeout fires
|
|
|
|
nsRefPtr<nsGlobalWindow> mWindow;
|
|
|
|
|
|
|
|
// The actual timer object
|
|
|
|
nsCOMPtr<nsITimer> mTimer;
|
|
|
|
|
|
|
|
// True if the timeout was cleared
|
2011-09-28 23:19:26 -07:00
|
|
|
bool mCleared;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
// True if this is one of the timeouts that are currently running
|
2011-09-28 23:19:26 -07:00
|
|
|
bool mRunning;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2011-06-29 12:49:42 -07:00
|
|
|
// True if this is a repeating/interval timer
|
2011-09-28 23:19:26 -07:00
|
|
|
bool mIsInterval;
|
2011-06-29 12:49:42 -07:00
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
// Returned as value of setTimeout()
|
|
|
|
PRUint32 mPublicId;
|
|
|
|
|
2011-06-29 12:49:42 -07:00
|
|
|
// Interval in milliseconds
|
2007-03-22 10:30:00 -07:00
|
|
|
PRUint32 mInterval;
|
|
|
|
|
2010-07-15 06:59:24 -07:00
|
|
|
// mWhen and mTimeRemaining can't be in a union, sadly, because they
|
|
|
|
// have constructors.
|
|
|
|
// Nominal time to run this timeout. Use only when timeouts are not
|
|
|
|
// suspended.
|
|
|
|
mozilla::TimeStamp mWhen;
|
|
|
|
// Remaining time to wait. Used only when timeouts are suspended.
|
|
|
|
mozilla::TimeDuration mTimeRemaining;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
// Principal with which to execute
|
|
|
|
nsCOMPtr<nsIPrincipal> mPrincipal;
|
|
|
|
|
|
|
|
// stack depth at which timeout is firing
|
|
|
|
PRUint32 mFiringDepth;
|
|
|
|
|
2009-08-26 11:07:39 -07:00
|
|
|
//
|
|
|
|
PRUint32 mNestingLevel;
|
|
|
|
|
2007-03-22 10:30:00 -07: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 06:34:26 -08:00
|
|
|
nsAutoRefCnt mRefCnt;
|
2007-03-22 10:30:00 -07:00
|
|
|
};
|
|
|
|
|
2010-09-17 14:54:40 -07:00
|
|
|
//*****************************************************************************
|
|
|
|
// nsOuterWindow: Outer Window Proxy
|
|
|
|
//*****************************************************************************
|
|
|
|
|
2011-09-08 20:29:15 -07:00
|
|
|
class nsOuterWindowProxy : public js::Wrapper
|
2010-09-17 14:54:40 -07:00
|
|
|
{
|
|
|
|
public:
|
2012-02-28 15:11:11 -08:00
|
|
|
nsOuterWindowProxy() : js::Wrapper((unsigned)0) {}
|
2010-09-17 14:54:40 -07:00
|
|
|
|
|
|
|
virtual bool isOuterWindow() {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
JSString *obj_toString(JSContext *cx, JSObject *wrapper);
|
2011-10-13 06:36:09 -07:00
|
|
|
void finalize(JSContext *cx, JSObject *proxy);
|
2010-09-17 14:54:40 -07:00
|
|
|
|
|
|
|
static nsOuterWindowProxy singleton;
|
|
|
|
};
|
|
|
|
|
|
|
|
JSObject *NS_NewOuterWindowProxy(JSContext *cx, JSObject *parent);
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
//*****************************************************************************
|
|
|
|
// nsGlobalWindow: Global Object for Scripting
|
|
|
|
//*****************************************************************************
|
|
|
|
// Beware that all scriptable interfaces implemented by
|
|
|
|
// nsGlobalWindow will be reachable from JS, if you make this class
|
|
|
|
// implement new interfaces you better know what you're
|
|
|
|
// doing. Security wise this is very sensitive code. --
|
|
|
|
// jst@netscape.com
|
|
|
|
|
|
|
|
// nsGlobalWindow inherits PRCList for maintaining a list of all inner
|
2008-01-29 17:31:29 -08:00
|
|
|
// windows still in memory for any given outer window. This list is
|
2007-03-22 10:30:00 -07: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).
|
|
|
|
|
|
|
|
class nsGlobalWindow : public nsPIDOMWindow,
|
|
|
|
public nsIScriptGlobalObject,
|
|
|
|
public nsIDOMJSWindow,
|
|
|
|
public nsIScriptObjectPrincipal,
|
2007-05-14 02:11:38 -07:00
|
|
|
public nsIDOMEventTarget,
|
2011-01-12 09:35:31 -08:00
|
|
|
public nsIDOMStorageIndexedDB,
|
2007-03-22 10:30:00 -07:00
|
|
|
public nsSupportsWeakReference,
|
|
|
|
public nsIInterfaceRequestor,
|
2010-09-17 14:54:40 -07:00
|
|
|
public nsWrapperCache,
|
2011-06-23 03:39:48 -07:00
|
|
|
public PRCListStr,
|
2011-08-24 12:49:25 -07:00
|
|
|
public nsIDOMWindowPerformance,
|
2011-08-24 12:49:25 -07:00
|
|
|
public nsITouchEventReceiver,
|
|
|
|
public nsIInlineEventHandlers
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
|
|
|
public:
|
2010-11-23 00:50:55 -08:00
|
|
|
friend class nsDOMMozURLProperty;
|
|
|
|
|
2010-09-16 18:24:14 -07:00
|
|
|
typedef mozilla::TimeStamp TimeStamp;
|
|
|
|
typedef mozilla::TimeDuration TimeDuration;
|
2011-11-02 06:44:16 -07:00
|
|
|
typedef mozilla::dom::Navigator Navigator;
|
2011-06-29 04:06:43 -07:00
|
|
|
typedef nsDataHashtable<nsUint64HashKey, nsGlobalWindow*> WindowByIdTable;
|
2010-09-16 18:24:14 -07:00
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
// public methods
|
|
|
|
nsPIDOMWindow* GetPrivateParent();
|
|
|
|
// callback for close event
|
|
|
|
void ReallyCloseWindow();
|
|
|
|
|
|
|
|
// nsISupports
|
|
|
|
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
|
|
|
|
2011-08-20 06:53:34 -07:00
|
|
|
// nsWrapperCache
|
|
|
|
JSObject *WrapObject(JSContext *cx, XPCWrappedNativeScope *scope,
|
|
|
|
bool *triedToWrap)
|
|
|
|
{
|
|
|
|
NS_ASSERTION(IsOuterWindow(),
|
|
|
|
"Inner window supports nsWrapperCache, fix WrapObject!");
|
|
|
|
*triedToWrap = true;
|
|
|
|
return EnsureInnerWindow() ? GetWrapper() : nsnull;
|
|
|
|
}
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
// nsIScriptGlobalObject
|
|
|
|
virtual nsIScriptContext *GetContext();
|
|
|
|
virtual JSObject *GetGlobalJSObject();
|
2010-06-08 09:13:08 -07:00
|
|
|
JSObject *FastGetGlobalJSObject()
|
|
|
|
{
|
|
|
|
return mJSObject;
|
|
|
|
}
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
virtual nsresult EnsureScriptEnvironment(PRUint32 aLangID);
|
|
|
|
|
|
|
|
virtual nsIScriptContext *GetScriptContext(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);
|
|
|
|
|
2011-04-14 05:04:08 -07:00
|
|
|
virtual void OnFinalize(JSObject* aObject);
|
2011-09-28 23:19:26 -07:00
|
|
|
virtual void SetScriptsEnabled(bool aEnabled, bool aFireTimeouts);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2012-01-26 07:03:21 -08:00
|
|
|
virtual bool IsBlackForCC();
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
// nsIScriptObjectPrincipal
|
|
|
|
virtual nsIPrincipal* GetPrincipal();
|
|
|
|
|
|
|
|
// nsIDOMWindow
|
|
|
|
NS_DECL_NSIDOMWINDOW
|
|
|
|
|
2011-06-23 03:39:48 -07:00
|
|
|
// nsIDOMWindowPerformance
|
|
|
|
NS_DECL_NSIDOMWINDOWPERFORMANCE
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
// nsIDOMJSWindow
|
|
|
|
NS_DECL_NSIDOMJSWINDOW
|
|
|
|
|
|
|
|
// nsIDOMEventTarget
|
|
|
|
NS_DECL_NSIDOMEVENTTARGET
|
|
|
|
|
2011-08-24 12:49:25 -07:00
|
|
|
// nsITouchEventReceiver
|
|
|
|
NS_DECL_NSITOUCHEVENTRECEIVER
|
|
|
|
|
2011-08-24 12:49:25 -07:00
|
|
|
// nsIInlineEventHandlers
|
|
|
|
NS_DECL_NSIINLINEEVENTHANDLERS
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
// nsPIDOMWindow
|
|
|
|
virtual NS_HIDDEN_(nsPIDOMWindow*) GetPrivateRoot();
|
2011-09-28 23:19:26 -07:00
|
|
|
virtual NS_HIDDEN_(void) ActivateOrDeactivate(bool aActivate);
|
|
|
|
virtual NS_HIDDEN_(void) SetActive(bool aActive);
|
|
|
|
virtual NS_HIDDEN_(void) SetIsBackground(bool aIsBackground);
|
2011-06-23 19:18:00 -07:00
|
|
|
virtual NS_HIDDEN_(void) SetChromeEventHandler(nsIDOMEventTarget* aChromeEventHandler);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
virtual NS_HIDDEN_(void) SetOpenerScriptPrincipal(nsIPrincipal* aPrincipal);
|
|
|
|
virtual NS_HIDDEN_(nsIPrincipal*) GetOpenerScriptPrincipal();
|
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
virtual NS_HIDDEN_(PopupControlState) PushPopupControlState(PopupControlState state, bool aForce) const;
|
2007-03-22 10:30:00 -07:00
|
|
|
virtual NS_HIDDEN_(void) PopPopupControlState(PopupControlState state) const;
|
|
|
|
virtual NS_HIDDEN_(PopupControlState) GetPopupControlState() const;
|
|
|
|
|
|
|
|
virtual NS_HIDDEN_(nsresult) SaveWindowState(nsISupports **aState);
|
|
|
|
virtual NS_HIDDEN_(nsresult) RestoreWindowState(nsISupports *aState);
|
2009-03-03 12:18:00 -08:00
|
|
|
virtual NS_HIDDEN_(void) SuspendTimeouts(PRUint32 aIncrease = 1,
|
2011-09-28 23:19:26 -07:00
|
|
|
bool aFreezeChildren = true);
|
|
|
|
virtual NS_HIDDEN_(nsresult) ResumeTimeouts(bool aThawChildren = true);
|
2009-03-03 12:18:00 -08:00
|
|
|
virtual NS_HIDDEN_(PRUint32) TimeoutSuspendCount();
|
2007-03-22 10:30:00 -07:00
|
|
|
virtual NS_HIDDEN_(nsresult) FireDelayedDOMEvents();
|
2011-09-28 23:19:26 -07:00
|
|
|
virtual NS_HIDDEN_(bool) IsFrozen() const
|
2008-01-16 13:54:33 -08:00
|
|
|
{
|
|
|
|
return mIsFrozen;
|
|
|
|
}
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
virtual NS_HIDDEN_(bool) WouldReuseInnerWindow(nsIDocument *aNewDocument);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
virtual NS_HIDDEN_(void) SetDocShell(nsIDocShell* aDocShell);
|
|
|
|
virtual NS_HIDDEN_(nsresult) SetNewDocument(nsIDocument *aDocument,
|
2010-09-15 15:54:00 -07:00
|
|
|
nsISupports *aState,
|
2011-09-28 23:19:26 -07:00
|
|
|
bool aForceReuseInnerWindow);
|
2010-06-10 09:23:40 -07:00
|
|
|
void DispatchDOMWindowCreated();
|
2011-07-15 03:31:34 -07:00
|
|
|
virtual NS_HIDDEN_(void) SetOpenerWindow(nsIDOMWindow* aOpener,
|
2011-09-28 23:19:26 -07:00
|
|
|
bool aOriginalOpener);
|
2007-03-22 10:30:00 -07:00
|
|
|
virtual NS_HIDDEN_(void) EnsureSizeUpToDate();
|
|
|
|
|
2011-07-15 03:31:34 -07:00
|
|
|
virtual NS_HIDDEN_(nsIDOMWindow*) EnterModalState();
|
|
|
|
virtual NS_HIDDEN_(void) LeaveModalState(nsIDOMWindow* aWindow);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
virtual NS_HIDDEN_(bool) CanClose();
|
2010-01-28 10:35:20 -08:00
|
|
|
virtual NS_HIDDEN_(nsresult) ForceClose();
|
|
|
|
|
2009-08-21 07:42:37 -07:00
|
|
|
virtual NS_HIDDEN_(void) SetHasOrientationEventListener();
|
2011-10-06 10:27:41 -07:00
|
|
|
virtual NS_HIDDEN_(void) RemoveOrientationEventListener();
|
2010-08-02 06:34:54 -07:00
|
|
|
virtual NS_HIDDEN_(void) MaybeUpdateTouchState();
|
|
|
|
virtual NS_HIDDEN_(void) UpdateTouchState();
|
2011-09-28 23:19:26 -07:00
|
|
|
virtual NS_HIDDEN_(bool) DispatchCustomEvent(const char *aEventName);
|
2012-02-19 13:02:08 -08:00
|
|
|
virtual NS_HIDDEN_(nsresult) SetFullScreenInternal(bool aIsFullScreen, bool aRequireTrust);
|
2009-08-21 07:42:37 -07:00
|
|
|
|
2011-07-15 03:32:37 -07:00
|
|
|
// nsIDOMStorageIndexedDB
|
|
|
|
NS_DECL_NSIDOMSTORAGEINDEXEDDB
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
// nsIInterfaceRequestor
|
|
|
|
NS_DECL_NSIINTERFACEREQUESTOR
|
|
|
|
|
|
|
|
// Object Management
|
|
|
|
nsGlobalWindow(nsGlobalWindow *aOuterWindow);
|
|
|
|
|
2009-05-12 13:20:42 -07:00
|
|
|
static nsGlobalWindow *FromSupports(nsISupports *supports)
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
|
|
|
// Make sure this matches the casts we do in QueryInterface().
|
2009-05-12 13:20:42 -07:00
|
|
|
return (nsGlobalWindow *)(nsIScriptGlobalObject *)supports;
|
|
|
|
}
|
2010-08-10 15:00:26 -07:00
|
|
|
static nsISupports *ToSupports(nsGlobalWindow *win)
|
|
|
|
{
|
|
|
|
// Make sure this matches the casts we do in QueryInterface().
|
|
|
|
return (nsISupports *)(nsIScriptGlobalObject *)win;
|
|
|
|
}
|
2009-05-12 13:20:42 -07:00
|
|
|
static nsGlobalWindow *FromWrapper(nsIXPConnectWrappedNative *wrapper)
|
|
|
|
{
|
|
|
|
return FromSupports(wrapper->Native());
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
|
2012-03-04 08:02:00 -08:00
|
|
|
/**
|
|
|
|
* Wrap nsIDOMWindow::GetTop so we can overload the inline GetTop()
|
|
|
|
* implementation below. (nsIDOMWindow::GetTop simply calls
|
|
|
|
* nsIDOMWindow::GetRealTop().)
|
|
|
|
*/
|
|
|
|
nsresult GetTop(nsIDOMWindow **aWindow)
|
|
|
|
{
|
|
|
|
return nsIDOMWindow::GetTop(aWindow);
|
|
|
|
}
|
|
|
|
|
2010-09-16 18:24:14 -07:00
|
|
|
inline nsGlobalWindow *GetTop()
|
|
|
|
{
|
|
|
|
nsCOMPtr<nsIDOMWindow> top;
|
|
|
|
GetTop(getter_AddRefs(top));
|
|
|
|
if (top)
|
|
|
|
return static_cast<nsGlobalWindow *>(static_cast<nsIDOMWindow *>(top.get()));
|
|
|
|
return nsnull;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Call this when a modal dialog is about to be opened. Returns
|
|
|
|
// true if we've reached the state in this top level window where we
|
|
|
|
// ask the user if further dialogs should be blocked.
|
|
|
|
bool DialogOpenAttempted();
|
|
|
|
|
|
|
|
// Returns true if dialogs have already been blocked for this
|
|
|
|
// window.
|
|
|
|
bool AreDialogsBlocked();
|
|
|
|
|
|
|
|
// Ask the user if further dialogs should be blocked. This is used
|
|
|
|
// in the cases where we have no modifiable UI to show, in that case
|
|
|
|
// we show a separate dialog when asking this question.
|
|
|
|
bool ConfirmDialogAllowed();
|
|
|
|
|
|
|
|
// Prevent further dialogs in this (top level) window
|
|
|
|
void PreventFurtherDialogs();
|
|
|
|
|
2011-11-21 16:34:21 -08:00
|
|
|
virtual void SetHasAudioAvailableEventListeners();
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
nsIScriptContext *GetContextInternal()
|
|
|
|
{
|
|
|
|
if (mOuterWindow) {
|
|
|
|
return GetOuterWindowInternal()->mContext;
|
|
|
|
}
|
|
|
|
|
|
|
|
return mContext;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsIScriptContext *GetScriptContextInternal(PRUint32 aLangID)
|
|
|
|
{
|
2010-06-29 11:46:39 -07:00
|
|
|
NS_ASSERTION(aLangID == nsIProgrammingLanguage::JAVASCRIPT,
|
|
|
|
"We don't support this language ID");
|
2007-03-22 10:30:00 -07:00
|
|
|
if (mOuterWindow) {
|
2010-06-29 11:46:39 -07:00
|
|
|
return GetOuterWindowInternal()->mContext;
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
|
2010-06-29 11:46:39 -07:00
|
|
|
return mContext;
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
nsGlobalWindow *GetOuterWindowInternal()
|
|
|
|
{
|
2007-07-08 00:08:04 -07:00
|
|
|
return static_cast<nsGlobalWindow *>(GetOuterWindow());
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
nsGlobalWindow *GetCurrentInnerWindowInternal()
|
|
|
|
{
|
2007-07-08 00:08:04 -07:00
|
|
|
return static_cast<nsGlobalWindow *>(mInnerWindow);
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
nsGlobalWindow *EnsureInnerWindowInternal()
|
|
|
|
{
|
2007-07-08 00:08:04 -07:00
|
|
|
return static_cast<nsGlobalWindow *>(EnsureInnerWindow());
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
bool IsCreatingInnerWindow() const
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
|
|
|
return mCreatingInnerWindow;
|
|
|
|
}
|
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
bool IsChromeWindow() const
|
2007-08-02 16:34:38 -07:00
|
|
|
{
|
|
|
|
return mIsChrome;
|
|
|
|
}
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
nsresult Observe(nsISupports* aSubject, const char* aTopic,
|
|
|
|
const PRUnichar* aData);
|
|
|
|
|
2011-08-31 07:54:39 -07:00
|
|
|
static void Init();
|
2007-03-22 10:30:00 -07:00
|
|
|
static void ShutDown();
|
2008-02-12 20:17:18 -08:00
|
|
|
static void CleanupCachedXBLHandlers(nsGlobalWindow* aWindow);
|
2011-09-28 23:19:26 -07:00
|
|
|
static bool IsCallerChrome();
|
2007-03-22 10:30:00 -07:00
|
|
|
static void CloseBlockScriptTerminationFunc(nsISupports *aRef);
|
|
|
|
|
|
|
|
static void RunPendingTimeoutsRecursive(nsGlobalWindow *aTopWindow,
|
|
|
|
nsGlobalWindow *aWindow);
|
|
|
|
|
|
|
|
friend class WindowStateHolder;
|
|
|
|
|
2012-01-26 07:03:21 -08:00
|
|
|
NS_DECL_CYCLE_COLLECTION_SKIPPABLE_SCRIPT_HOLDER_CLASS_AMBIGUOUS(nsGlobalWindow,
|
|
|
|
nsIScriptGlobalObject)
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2007-10-09 18:24:28 -07:00
|
|
|
void InitJavaProperties();
|
|
|
|
|
2011-11-26 02:14:29 -08:00
|
|
|
virtual NS_HIDDEN_(JSObject*)
|
2008-02-12 20:17:18 -08:00
|
|
|
GetCachedXBLPrototypeHandler(nsXBLPrototypeHandler* aKey);
|
|
|
|
|
|
|
|
virtual NS_HIDDEN_(void)
|
|
|
|
CacheXBLPrototypeHandler(nsXBLPrototypeHandler* aKey,
|
2011-12-18 02:05:12 -08:00
|
|
|
nsScriptObjectHolder<JSObject>& aHandler);
|
2008-02-12 20:17:18 -08:00
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
virtual bool TakeFocus(bool aFocus, PRUint32 aFocusMethod);
|
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 11:00:39 -07:00
|
|
|
virtual void SetReadyForFocus();
|
|
|
|
virtual void PageHidden();
|
2011-03-31 13:30:32 -07:00
|
|
|
virtual nsresult DispatchAsyncHashchange(nsIURI *aOldURI, nsIURI *aNewURI);
|
2011-02-28 23:08:56 -08:00
|
|
|
virtual nsresult DispatchSyncPopState();
|
2009-09-01 09:45:05 -07:00
|
|
|
|
2009-10-06 17:09:16 -07: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 11:00:39 -07:00
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
static bool DOMWindowDumpEnabled();
|
2008-02-12 20:17:18 -08:00
|
|
|
|
2010-03-11 20:42:05 -08:00
|
|
|
void MaybeForgiveSpamCount();
|
2011-09-28 23:19:26 -07:00
|
|
|
bool IsClosedOrClosing() {
|
2010-03-11 20:42:05 -08:00
|
|
|
return (mIsClosed ||
|
|
|
|
mInClose ||
|
|
|
|
mHavePendingClose ||
|
|
|
|
mCleanedUp);
|
|
|
|
}
|
|
|
|
|
2010-08-27 08:49:08 -07:00
|
|
|
static void FirePopupBlockedEvent(nsIDOMDocument* aDoc,
|
|
|
|
nsIDOMWindow *aRequestingWindow, nsIURI *aPopupURI,
|
|
|
|
const nsAString &aPopupWindowName,
|
|
|
|
const nsAString &aPopupWindowFeatures);
|
|
|
|
|
2010-09-09 15:15:40 -07:00
|
|
|
virtual PRUint32 GetSerial() {
|
|
|
|
return mSerial;
|
|
|
|
}
|
|
|
|
|
2010-10-20 17:24:16 -07:00
|
|
|
static nsGlobalWindow* GetOuterWindowWithId(PRUint64 aWindowID) {
|
2011-09-03 16:43:22 -07:00
|
|
|
if (!sWindowsById) {
|
|
|
|
return nsnull;
|
|
|
|
}
|
|
|
|
|
2011-06-29 04:03:54 -07:00
|
|
|
nsGlobalWindow* outerWindow = sWindowsById->Get(aWindowID);
|
|
|
|
return outerWindow && !outerWindow->IsInnerWindow() ? outerWindow : nsnull;
|
2010-10-20 17:24:16 -07:00
|
|
|
}
|
|
|
|
|
2011-08-24 13:44:35 -07:00
|
|
|
static nsGlobalWindow* GetInnerWindowWithId(PRUint64 aInnerWindowID) {
|
2011-09-02 16:49:08 -07:00
|
|
|
if (!sWindowsById) {
|
|
|
|
return nsnull;
|
|
|
|
}
|
|
|
|
|
2011-08-24 13:44:35 -07:00
|
|
|
nsGlobalWindow* innerWindow = sWindowsById->Get(aInnerWindowID);
|
|
|
|
return innerWindow && innerWindow->IsInnerWindow() ? innerWindow : nsnull;
|
|
|
|
}
|
|
|
|
|
2011-05-24 23:31:59 -07:00
|
|
|
static bool HasIndexedDBSupport();
|
2011-01-12 09:35:31 -08:00
|
|
|
|
2011-06-23 03:39:48 -07:00
|
|
|
static bool HasPerformanceSupport();
|
|
|
|
|
2011-06-29 04:06:43 -07:00
|
|
|
static WindowByIdTable* GetWindowsTable() {
|
|
|
|
return sWindowsById;
|
|
|
|
}
|
|
|
|
|
2012-02-01 13:58:01 -08:00
|
|
|
void SizeOfIncludingThis(nsWindowSizes* aWindowSizes) const;
|
2011-06-29 04:06:43 -07:00
|
|
|
|
2012-01-26 07:03:21 -08:00
|
|
|
void UnmarkGrayTimers();
|
2011-01-03 17:52:00 -08:00
|
|
|
private:
|
|
|
|
// Enable updates for the accelerometer.
|
2011-06-19 22:36:17 -07:00
|
|
|
void EnableDeviceMotionUpdates();
|
2011-01-03 17:52:00 -08:00
|
|
|
|
|
|
|
// Disables updates for the accelerometer.
|
2011-06-19 22:36:17 -07:00
|
|
|
void DisableDeviceMotionUpdates();
|
2011-01-03 17:52:00 -08:00
|
|
|
|
2012-03-04 08:02:00 -08:00
|
|
|
// Implements Get{Real,Scriptable}Top.
|
|
|
|
nsresult GetTopImpl(nsIDOMWindow **aWindow, bool aScriptable);
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
protected:
|
2011-03-31 13:30:32 -07:00
|
|
|
friend class HashchangeCallback;
|
2011-04-27 13:54:07 -07:00
|
|
|
friend class nsBarProp;
|
2011-03-31 13:30:32 -07:00
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
// Object Management
|
|
|
|
virtual ~nsGlobalWindow();
|
2011-09-28 23:19:26 -07:00
|
|
|
void CleanUp(bool aIgnoreModalDialog);
|
2007-03-22 10:30:00 -07:00
|
|
|
void ClearControllers();
|
2010-01-28 10:35:20 -08:00
|
|
|
nsresult FinalClose();
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2011-03-15 04:06:39 -07:00
|
|
|
void FreeInnerObjects();
|
2008-01-29 21:30:11 -08:00
|
|
|
nsGlobalWindow *CallerInnerWindow();
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2010-03-13 12:39:36 -08:00
|
|
|
nsresult InnerSetNewDocument(nsIDocument* aDocument);
|
2010-03-12 16:59:18 -08:00
|
|
|
|
2009-10-06 17:09:16 -07:00
|
|
|
nsresult DefineArgumentsProperty(nsIArray *aArguments);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
// Get the parent, returns null if this is a toplevel window
|
2011-07-15 03:31:34 -07:00
|
|
|
nsIDOMWindow* GetParentInternal();
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
// popup tracking
|
2011-09-28 23:19:26 -07:00
|
|
|
bool IsPopupSpamWindow()
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
|
|
|
if (IsInnerWindow() && !mOuterWindow) {
|
2011-10-17 07:59:28 -07:00
|
|
|
return false;
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
return GetOuterWindowInternal()->mIsPopupSpam;
|
|
|
|
}
|
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
void SetPopupSpamWindow(bool aPopup)
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
|
|
|
if (IsInnerWindow() && !mOuterWindow) {
|
|
|
|
NS_ERROR("SetPopupSpamWindow() called on inner window w/o an outer!");
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
GetOuterWindowInternal()->mIsPopupSpam = aPopup;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Window Control Functions
|
|
|
|
/**
|
|
|
|
* @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.
|
|
|
|
* @param aJSCallerContext The calling script's context. This must be nsnull
|
|
|
|
* when aCalledNoScript is true.
|
|
|
|
* @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,
|
2011-09-28 23:19:26 -07:00
|
|
|
bool aDialog,
|
|
|
|
bool aContentModal,
|
|
|
|
bool aCalledNoScript,
|
|
|
|
bool aDoJSFixups,
|
2007-03-22 10:30:00 -07:00
|
|
|
nsIArray *argv,
|
|
|
|
nsISupports *aExtraArgument,
|
|
|
|
nsIPrincipal *aCalleePrincipal,
|
|
|
|
JSContext *aJSCallerContext,
|
|
|
|
nsIDOMWindow **aReturn);
|
|
|
|
|
|
|
|
static void CloseWindow(nsISupports* aWindow);
|
|
|
|
|
|
|
|
// Timeout Functions
|
2010-07-15 06:59:24 -07:00
|
|
|
// Language agnostic timeout function (all args passed).
|
|
|
|
// |interval| is in milliseconds.
|
2007-03-22 10:30:00 -07:00
|
|
|
nsresult SetTimeoutOrInterval(nsIScriptTimeoutHandler *aHandler,
|
|
|
|
PRInt32 interval,
|
2011-09-28 23:19:26 -07:00
|
|
|
bool aIsInterval, PRInt32 *aReturn);
|
2007-03-22 10:30:00 -07:00
|
|
|
nsresult ClearTimeoutOrInterval(PRInt32 aTimerID);
|
|
|
|
|
|
|
|
// JS specific timeout functions (JS args grabbed from context).
|
2011-09-28 23:19:26 -07:00
|
|
|
nsresult SetTimeoutOrInterval(bool aIsInterval, PRInt32* aReturn);
|
2011-06-29 12:49:42 -07:00
|
|
|
nsresult ResetTimersForNonBackgroundWindow();
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
// The timeout implementation functions.
|
|
|
|
void RunTimeout(nsTimeout *aTimeout);
|
2010-03-23 15:35:15 -07:00
|
|
|
void RunTimeout() { RunTimeout(nsnull); }
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
void ClearAllTimeouts();
|
|
|
|
// Insert aTimeout into the list, before all timeouts that would
|
|
|
|
// fire after it, but no earlier than mTimeoutInsertionPoint, if any.
|
|
|
|
void InsertTimeoutIntoList(nsTimeout *aTimeout);
|
|
|
|
static void TimerCallback(nsITimer *aTimer, void *aClosure);
|
|
|
|
|
|
|
|
// Helper Functions
|
|
|
|
nsresult GetTreeOwner(nsIDocShellTreeOwner** aTreeOwner);
|
|
|
|
nsresult GetTreeOwner(nsIBaseWindow** aTreeOwner);
|
|
|
|
nsresult GetWebBrowserChrome(nsIWebBrowserChrome** aBrowserChrome);
|
2009-09-02 20:57:46 -07: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();
|
2007-03-22 10:30:00 -07:00
|
|
|
nsresult SecurityCheckURL(const char *aURL);
|
|
|
|
nsresult BuildURIfromBase(const char *aURL,
|
|
|
|
nsIURI **aBuiltURI,
|
2011-09-28 23:19:26 -07:00
|
|
|
bool *aFreeSecurityPass, JSContext **aCXused);
|
|
|
|
bool PopupWhitelisted();
|
2009-09-16 11:46:05 -07:00
|
|
|
PopupControlState RevisePopupAbuseLevel(PopupControlState);
|
2011-09-28 23:19:26 -07:00
|
|
|
void FireAbuseEvents(bool aBlocked, bool aWindow,
|
2007-03-22 10:30:00 -07:00
|
|
|
const nsAString &aPopupURL,
|
|
|
|
const nsAString &aPopupWindowName,
|
|
|
|
const nsAString &aPopupWindowFeatures);
|
|
|
|
void FireOfflineStatusEvent();
|
2011-03-31 13:30:32 -07:00
|
|
|
nsresult FireHashchange(const nsAString &aOldURL, const nsAString &aNewURL);
|
2009-11-26 21:01:43 -08:00
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
void FlushPendingNotifications(mozFlushType aType);
|
|
|
|
void EnsureReflowFlushAndPaint();
|
|
|
|
nsresult CheckSecurityWidthAndHeight(PRInt32* width, PRInt32* height);
|
|
|
|
nsresult CheckSecurityLeftAndTop(PRInt32* left, PRInt32* top);
|
2010-12-21 14:35:09 -08:00
|
|
|
|
|
|
|
// Arguments to this function should have values in app units
|
|
|
|
nsresult SetCSSViewportWidthAndHeight(nscoord width, nscoord height);
|
|
|
|
// Arguments to this function should have values in device pixels
|
|
|
|
nsresult SetDocShellWidthAndHeight(PRInt32 width, PRInt32 height);
|
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
static bool CanSetProperty(const char *aPrefName);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
static void MakeScriptDialogTitle(nsAString &aOutTitle);
|
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
bool CanMoveResizeWindows();
|
2008-03-19 13:27:34 -07:00
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
bool GetBlurSuppression();
|
2007-03-22 10:30:00 -07: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,
|
2011-09-28 23:19:26 -07:00
|
|
|
bool aDoFlush);
|
2007-03-22 10:30:00 -07:00
|
|
|
nsresult GetScrollMaxXY(PRInt32* aScrollMaxX, PRInt32* aScrollMaxY);
|
2008-04-01 15:20:45 -07:00
|
|
|
|
|
|
|
nsresult GetOuterSize(nsIntSize* aSizeCSSPixels);
|
2011-09-28 23:19:26 -07:00
|
|
|
nsresult SetOuterSize(PRInt32 aLengthCSSPixels, bool aIsWidth);
|
2009-07-29 20:16:44 -07:00
|
|
|
nsRect GetInnerScreenRect();
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
bool IsFrame()
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
|
|
|
return GetParentInternal() != nsnull;
|
|
|
|
}
|
|
|
|
|
|
|
|
// 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.
|
2011-09-28 23:19:26 -07:00
|
|
|
bool WindowExists(const nsAString& aName, bool aLookForCallerOnJSStack);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
already_AddRefed<nsIWidget> GetMainWidget();
|
2009-07-15 02:54:30 -07:00
|
|
|
nsIWidget* GetNearestWidget();
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
void Freeze()
|
|
|
|
{
|
|
|
|
NS_ASSERTION(!IsFrozen(), "Double-freezing?");
|
2011-10-17 07:59:28 -07:00
|
|
|
mIsFrozen = true;
|
2011-05-22 14:30:07 -07:00
|
|
|
NotifyDOMWindowFrozen(this);
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
void Thaw()
|
|
|
|
{
|
2011-10-17 07:59:28 -07:00
|
|
|
mIsFrozen = false;
|
2011-05-22 14:30:07 -07:00
|
|
|
NotifyDOMWindowThawed(this);
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
bool IsInModalState();
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
nsTimeout* FirstTimeout() {
|
|
|
|
// Note: might not actually return an nsTimeout. Use IsTimeout to check.
|
2007-07-08 00:08:04 -07:00
|
|
|
return static_cast<nsTimeout*>(PR_LIST_HEAD(&mTimeouts));
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
nsTimeout* LastTimeout() {
|
|
|
|
// Note: might not actually return an nsTimeout. Use IsTimeout to check.
|
2007-07-08 00:08:04 -07:00
|
|
|
return static_cast<nsTimeout*>(PR_LIST_TAIL(&mTimeouts));
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
bool IsTimeout(PRCList* aList) {
|
2007-03-22 10:30:00 -07:00
|
|
|
return aList != &mTimeouts;
|
|
|
|
}
|
|
|
|
|
2009-02-10 00:29:53 -08: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 11:00:39 -07:00
|
|
|
virtual void SetFocusedNode(nsIContent* aNode,
|
|
|
|
PRUint32 aFocusMethod = 0,
|
2011-09-28 23:19:26 -07:00
|
|
|
bool aNeedsFocus = false);
|
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 11:00:39 -07:00
|
|
|
|
|
|
|
virtual PRUint32 GetFocusMethod();
|
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
virtual bool ShouldShowFocusRing();
|
2010-04-21 07:53:42 -07:00
|
|
|
|
|
|
|
virtual void SetKeyboardIndicators(UIStateChangeType aShowAccelerators,
|
|
|
|
UIStateChangeType aShowFocusRings);
|
2011-09-28 23:19:26 -07:00
|
|
|
virtual void GetKeyboardIndicators(bool* aShowAccelerators,
|
|
|
|
bool* aShowFocusRings);
|
2010-04-21 07:53:42 -07:00
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
void UpdateCanvasFocus(bool aFocusChanged, nsIContent* aNewContent);
|
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 11:00:39 -07:00
|
|
|
|
2010-02-20 08:07:03 -08:00
|
|
|
already_AddRefed<nsPIWindowRoot> GetTopWindowRoot();
|
|
|
|
|
2008-02-13 15:41:17 -08:00
|
|
|
static void NotifyDOMWindowDestroyed(nsGlobalWindow* aWindow);
|
2010-05-14 14:17:52 -07:00
|
|
|
void NotifyWindowIDDestroyed(const char* aTopic);
|
2011-05-22 14:30:07 -07:00
|
|
|
|
|
|
|
static void NotifyDOMWindowFrozen(nsGlobalWindow* aWindow);
|
|
|
|
static void NotifyDOMWindowThawed(nsGlobalWindow* aWindow);
|
2010-06-01 13:36:16 -07:00
|
|
|
|
|
|
|
void ClearStatus();
|
2008-02-13 15:41:17 -08:00
|
|
|
|
2010-06-16 04:43:36 -07:00
|
|
|
virtual void UpdateParentTarget();
|
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
bool GetIsTabModalPromptAllowed();
|
2011-02-16 10:27:25 -08:00
|
|
|
|
2011-03-25 18:05:55 -07:00
|
|
|
inline PRInt32 DOMMinTimeoutValue() const;
|
|
|
|
|
2007-03-22 10:30:00 -07: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|.
|
|
|
|
|
|
|
|
// 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.
|
2011-09-28 23:19:26 -07:00
|
|
|
bool mIsFrozen : 1;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2007-10-09 18:24:28 -07:00
|
|
|
// True if the Java properties have been initialized on this
|
|
|
|
// window. Only used on inner windows.
|
2011-09-28 23:19:26 -07:00
|
|
|
bool mDidInitJavaProperties : 1;
|
2007-10-09 18:24:28 -07:00
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
// These members are only used on outer window objects. Make sure
|
|
|
|
// you never set any of these on an inner object!
|
2011-09-28 23:19:26 -07:00
|
|
|
bool mFullScreen : 1;
|
|
|
|
bool mIsClosed : 1;
|
|
|
|
bool mInClose : 1;
|
2007-03-22 10:30:00 -07:00
|
|
|
// 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.
|
2011-09-28 23:19:26 -07:00
|
|
|
bool mHavePendingClose : 1;
|
|
|
|
bool mHadOriginalOpener : 1;
|
|
|
|
bool mIsPopupSpam : 1;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
// Indicates whether scripts are allowed to close this window.
|
2011-09-28 23:19:26 -07:00
|
|
|
bool mBlockScriptedClosingFlag : 1;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
// Track what sorts of events we need to fire when thawed
|
2011-09-28 23:19:26 -07:00
|
|
|
bool mFireOfflineStatusChangeEventOnThaw : 1;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
// Indicates whether we're in the middle of creating an initializing
|
|
|
|
// a new inner window object.
|
2011-09-28 23:19:26 -07:00
|
|
|
bool mCreatingInnerWindow : 1;
|
2007-08-02 16:34:38 -07:00
|
|
|
|
|
|
|
// Fast way to tell if this is a chrome window (without having to QI).
|
2011-09-28 23:19:26 -07:00
|
|
|
bool mIsChrome : 1;
|
2007-08-02 16:34:38 -07:00
|
|
|
|
2011-01-23 11:51:00 -08:00
|
|
|
// Hack to indicate whether a chrome window needs its message manager
|
|
|
|
// to be disconnected, since clean up code is shared in the global
|
|
|
|
// window superclass.
|
2011-09-28 23:19:26 -07:00
|
|
|
bool mCleanMessageManager : 1;
|
2011-01-23 11:51:00 -08:00
|
|
|
|
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 11:00:39 -07:00
|
|
|
// Indicates that the current document has never received a document focus
|
|
|
|
// event.
|
2011-09-28 23:19:26 -07:00
|
|
|
bool mNeedsFocus : 1;
|
|
|
|
bool mHasFocus : 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 11:00:39 -07:00
|
|
|
|
2010-04-21 07:53:42 -07:00
|
|
|
// whether to show keyboard accelerators
|
2011-09-28 23:19:26 -07:00
|
|
|
bool mShowAccelerators : 1;
|
2010-04-21 07:53:42 -07:00
|
|
|
|
|
|
|
// whether to show focus rings
|
2011-09-28 23:19:26 -07:00
|
|
|
bool mShowFocusRings : 1;
|
2010-04-21 07:53:42 -07:00
|
|
|
|
|
|
|
// when true, show focus rings for the current focused content only.
|
|
|
|
// This will be reset when another element is focused
|
2011-09-28 23:19:26 -07:00
|
|
|
bool mShowFocusRingForContent : 1;
|
2010-04-21 07:53:42 -07:00
|
|
|
|
2010-05-13 05:19:50 -07:00
|
|
|
// true if tab navigation has occurred for this window. Focus rings
|
2010-04-21 07:53:42 -07:00
|
|
|
// should be displayed.
|
2011-09-28 23:19:26 -07:00
|
|
|
bool mFocusByKeyOccurred : 1;
|
2010-04-21 07:53:42 -07:00
|
|
|
|
2011-06-19 22:36:17 -07:00
|
|
|
// Indicates whether this window is getting device motion change events
|
2011-09-28 23:19:26 -07:00
|
|
|
bool mHasDeviceMotion : 1;
|
2009-08-21 07:42:37 -07:00
|
|
|
|
2010-05-14 14:17:52 -07:00
|
|
|
// whether we've sent the destroy notification for our window id
|
2011-09-28 23:19:26 -07:00
|
|
|
bool mNotifiedIDDestroyed : 1;
|
2010-05-14 14:17:52 -07:00
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
nsCOMPtr<nsIScriptContext> mContext;
|
2008-02-08 13:09:36 -08:00
|
|
|
nsWeakPtr mOpener;
|
2007-03-22 10:30:00 -07:00
|
|
|
nsCOMPtr<nsIControllers> mControllers;
|
|
|
|
nsCOMPtr<nsIArray> mArguments;
|
|
|
|
nsCOMPtr<nsIArray> mArgumentsLast;
|
2009-10-06 17:09:16 -07:00
|
|
|
nsCOMPtr<nsIPrincipal> mArgumentsOrigin;
|
2011-11-02 06:44:16 -07:00
|
|
|
nsRefPtr<Navigator> mNavigator;
|
2007-03-22 10:30:00 -07:00
|
|
|
nsRefPtr<nsScreen> mScreen;
|
2011-06-23 03:39:48 -07:00
|
|
|
nsRefPtr<nsPerformance> mPerformance;
|
2007-03-22 10:30:00 -07:00
|
|
|
nsRefPtr<nsDOMWindowList> mFrames;
|
|
|
|
nsRefPtr<nsBarProp> mMenubar;
|
|
|
|
nsRefPtr<nsBarProp> mToolbar;
|
|
|
|
nsRefPtr<nsBarProp> mLocationbar;
|
|
|
|
nsRefPtr<nsBarProp> mPersonalbar;
|
|
|
|
nsRefPtr<nsBarProp> mStatusbar;
|
|
|
|
nsRefPtr<nsBarProp> mScrollbars;
|
|
|
|
nsCOMPtr<nsIWeakReference> mWindowUtils;
|
|
|
|
nsString mStatus;
|
|
|
|
nsString mDefaultStatus;
|
|
|
|
// index 0->language_id 1, so index MAX-1 == language_id MAX
|
|
|
|
nsGlobalWindowObserver* mObserver;
|
2010-09-29 09:56:46 -07:00
|
|
|
#ifndef MOZ_DISABLE_DOMCRYPTO
|
2007-03-22 10:30:00 -07:00
|
|
|
nsCOMPtr<nsIDOMCrypto> mCrypto;
|
2010-09-29 09:56:46 -07:00
|
|
|
#endif
|
2009-05-16 06:59:30 -07:00
|
|
|
nsCOMPtr<nsIDOMStorage> mLocalStorage;
|
2010-01-28 06:53:53 -08:00
|
|
|
nsCOMPtr<nsIDOMStorage> mSessionStorage;
|
2009-03-18 16:43:45 -07:00
|
|
|
|
2010-06-29 11:46:39 -07:00
|
|
|
nsCOMPtr<nsIXPConnectJSObjectHolder> mInnerWindowHolder;
|
2007-03-22 10:30:00 -07:00
|
|
|
nsCOMPtr<nsIPrincipal> mOpenerScriptPrincipal; // strong; used to determine
|
|
|
|
// whether to clear scope
|
|
|
|
|
|
|
|
// These member variable are used only on inner windows.
|
2011-06-23 19:18:01 -07:00
|
|
|
nsRefPtr<nsEventListenerManager> mListenerManager;
|
2011-07-08 11:04:25 -07:00
|
|
|
// mTimeouts is generally sorted by mWhen, unless mTimeoutInsertionPoint is
|
|
|
|
// non-null. In that case, the dummy timeout pointed to by
|
|
|
|
// mTimeoutInsertionPoint may have a later mWhen than some of the timeouts
|
|
|
|
// that come after it.
|
2007-03-22 10:30:00 -07:00
|
|
|
PRCList mTimeouts;
|
|
|
|
// If mTimeoutInsertionPoint is non-null, insertions should happen after it.
|
2011-07-08 11:04:25 -07:00
|
|
|
// This is a dummy timeout at the moment; if that ever changes, the logic in
|
|
|
|
// ResetTimersForNonBackgroundWindow needs to change.
|
2007-03-22 10:30:00 -07:00
|
|
|
nsTimeout* mTimeoutInsertionPoint;
|
|
|
|
PRUint32 mTimeoutPublicIdCounter;
|
|
|
|
PRUint32 mTimeoutFiringDepth;
|
2010-08-06 17:17:33 -07:00
|
|
|
nsRefPtr<nsLocation> mLocation;
|
2011-02-01 09:19:35 -08:00
|
|
|
nsRefPtr<nsHistory> mHistory;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2008-07-11 14:28:12 -07:00
|
|
|
// Holder of the dummy java plugin, used to expose window.java and
|
|
|
|
// window.packages.
|
2007-10-09 18:24:28 -07:00
|
|
|
nsRefPtr<nsDummyJavaPluginOwner> mDummyJavaPluginOwner;
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
// These member variables are used on both inner and the outer windows.
|
|
|
|
nsCOMPtr<nsIPrincipal> mDocumentPrincipal;
|
|
|
|
nsCOMPtr<nsIDocument> mDoc; // For fast access to principals
|
|
|
|
JSObject* mJSObject;
|
|
|
|
|
2011-01-14 06:39:21 -08:00
|
|
|
typedef nsCOMArray<nsIDOMStorageEvent> nsDOMStorageEventArray;
|
2010-01-28 06:53:53 -08:00
|
|
|
nsDOMStorageEventArray mPendingStorageEvents;
|
2011-09-28 23:19:26 -07:00
|
|
|
nsAutoPtr< nsDataHashtable<nsStringHashKey, bool> > mPendingStorageEventsObsolete;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2009-02-17 12:07:39 -08: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 11:00:39 -07:00
|
|
|
// the method that was used to focus mFocusedNode
|
|
|
|
PRUint32 mFocusMethod;
|
|
|
|
|
2010-09-09 15:15:40 -07:00
|
|
|
PRUint32 mSerial;
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
#ifdef DEBUG
|
2011-09-28 23:19:26 -07:00
|
|
|
bool mSetOpenerWindowCalled;
|
2008-04-28 14:51:11 -07:00
|
|
|
nsCOMPtr<nsIURI> mLastOpenedURI;
|
2007-03-22 10:30:00 -07:00
|
|
|
#endif
|
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
bool mCleanedUp, mCallCleanUpAfterModalDialogCloses;
|
2010-03-11 20:42:05 -08:00
|
|
|
|
2008-01-16 13:54:33 -08:00
|
|
|
nsCOMPtr<nsIDOMOfflineResourceList> mApplicationCache;
|
|
|
|
|
2011-11-26 02:14:47 -08:00
|
|
|
nsDataHashtable<nsVoidPtrHashKey, JSObject*> mCachedXBLPrototypeHandlers;
|
2008-02-12 20:17:18 -08:00
|
|
|
|
2009-03-03 12:11:14 -08:00
|
|
|
nsCOMPtr<nsIDocument> mSuspendedDoc;
|
|
|
|
|
2010-06-28 09:44:30 -07:00
|
|
|
nsCOMPtr<nsIIDBFactory> mIndexedDB;
|
2010-06-23 12:46:08 -07:00
|
|
|
|
2010-09-16 18:24:14 -07:00
|
|
|
// In the case of a "trusted" dialog (@see PopupControlState), we
|
|
|
|
// set this counter to ensure a max of MAX_DIALOG_LIMIT
|
|
|
|
PRUint32 mDialogAbuseCount;
|
|
|
|
|
|
|
|
// This holds the time when the last modal dialog was shown, if two
|
|
|
|
// dialogs are shown within CONCURRENT_DIALOG_TIME_LIMIT the
|
|
|
|
// checkbox is shown. In the case of ShowModalDialog another Confirm
|
|
|
|
// dialog will be shown, the result of the checkbox/confirm dialog
|
|
|
|
// will be stored in mDialogDisabled variable.
|
|
|
|
TimeStamp mLastDialogQuitTime;
|
2011-09-28 23:19:26 -07:00
|
|
|
bool mDialogDisabled;
|
2010-09-16 18:24:14 -07:00
|
|
|
|
2010-11-23 00:50:55 -08:00
|
|
|
nsRefPtr<nsDOMMozURLProperty> mURLProperty;
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
friend class nsDOMScriptableHelper;
|
|
|
|
friend class nsDOMWindowUtils;
|
2008-05-02 12:26:47 -07:00
|
|
|
friend class PostMessageEvent;
|
2010-10-20 17:24:16 -07:00
|
|
|
|
2011-06-29 04:03:54 -07:00
|
|
|
static WindowByIdTable* sWindowsById;
|
2011-08-14 10:22:29 -07:00
|
|
|
static bool sWarnedAboutWindowInternal;
|
2007-03-22 10:30:00 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* nsGlobalChromeWindow inherits from nsGlobalWindow. It is the global
|
|
|
|
* object created for a Chrome Window only.
|
|
|
|
*/
|
|
|
|
class nsGlobalChromeWindow : public nsGlobalWindow,
|
|
|
|
public nsIDOMChromeWindow
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
// nsISupports
|
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
|
|
|
|
|
|
|
// nsIDOMChromeWindow interface
|
|
|
|
NS_DECL_NSIDOMCHROMEWINDOW
|
|
|
|
|
|
|
|
nsGlobalChromeWindow(nsGlobalWindow *aOuterWindow)
|
|
|
|
: nsGlobalWindow(aOuterWindow)
|
|
|
|
{
|
2011-10-17 07:59:28 -07:00
|
|
|
mIsChrome = true;
|
|
|
|
mCleanMessageManager = true;
|
2011-01-23 11:51:00 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
~nsGlobalChromeWindow()
|
|
|
|
{
|
|
|
|
NS_ABORT_IF_FALSE(mCleanMessageManager,
|
|
|
|
"chrome windows may always disconnect the msg manager");
|
|
|
|
if (mMessageManager) {
|
|
|
|
static_cast<nsFrameMessageManager *>(
|
|
|
|
mMessageManager.get())->Disconnect();
|
|
|
|
}
|
|
|
|
|
2011-10-17 07:59:28 -07:00
|
|
|
mCleanMessageManager = false;
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
|
2011-06-21 07:51:49 -07:00
|
|
|
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsGlobalChromeWindow,
|
|
|
|
nsGlobalWindow)
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
nsCOMPtr<nsIBrowserDOMWindow> mBrowserDOMWindow;
|
2010-05-18 05:28:37 -07:00
|
|
|
nsCOMPtr<nsIChromeFrameMessageManager> mMessageManager;
|
2007-03-22 10:30:00 -07:00
|
|
|
};
|
|
|
|
|
2007-07-26 10:52:26 -07: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)
|
|
|
|
{
|
2011-10-17 07:59:28 -07:00
|
|
|
mIsModalContentWindow = true;
|
2007-07-26 10:52:26 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
|
|
|
NS_DECL_NSIDOMMODALCONTENTWINDOW
|
|
|
|
|
|
|
|
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsGlobalModalWindow, nsGlobalWindow)
|
|
|
|
|
2009-10-06 17:09:16 -07:00
|
|
|
virtual NS_HIDDEN_(nsresult) SetNewDocument(nsIDocument *aDocument,
|
2010-09-15 15:54:00 -07:00
|
|
|
nsISupports *aState,
|
2011-09-28 23:19:26 -07:00
|
|
|
bool aForceReuseInnerWindow);
|
2009-10-06 17:09:16 -07:00
|
|
|
|
2007-07-26 10:52:26 -07:00
|
|
|
protected:
|
|
|
|
nsCOMPtr<nsIVariant> mReturnValue;
|
|
|
|
};
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
/* factory function */
|
2007-07-26 10:52:26 -07:00
|
|
|
nsresult
|
2011-09-28 23:19:26 -07:00
|
|
|
NS_NewScriptGlobalObject(bool aIsChrome, bool aIsModalContentWindow,
|
2007-07-26 10:52:26 -07:00
|
|
|
nsIScriptGlobalObject **aResult);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
#endif /* nsGlobalWindow_h___ */
|