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: */
|
2012-05-21 15:12:37 +04:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2001-04-18 10:06:31 +04:00
|
|
|
|
1998-07-24 09:05:42 +04:00
|
|
|
#ifndef nsGlobalWindow_h___
|
|
|
|
#define nsGlobalWindow_h___
|
|
|
|
|
2010-09-17 05:24:14 +04:00
|
|
|
#include "mozilla/XPCOM.h" // for TimeStamp/TimeDuration
|
|
|
|
|
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"
|
2007-05-14 13:11:38 +04:00
|
|
|
#include "nsIDOMEventTarget.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"
|
2011-06-24 06:18:01 +04:00
|
|
|
#include "nsEventListenerManager.h"
|
2000-02-09 08:26:02 +03:00
|
|
|
#include "nsIDOMDocument.h"
|
2000-07-14 01:48:25 +04:00
|
|
|
#include "nsIPrincipal.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"
|
2010-01-28 17:53:53 +03:00
|
|
|
#include "nsIDOMStorageEvent.h"
|
2011-01-12 20:35:31 +03:00
|
|
|
#include "nsIDOMStorageIndexedDB.h"
|
2007-05-29 13:45:30 +04:00
|
|
|
#include "nsIDOMOfflineResourceList.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"
|
2010-06-28 20:44:30 +04:00
|
|
|
#include "nsIIDBFactory.h"
|
2010-05-18 16:28:37 +04:00
|
|
|
#include "nsFrameMessageManager.h"
|
2012-11-01 18:06:22 +04:00
|
|
|
#include "mozilla/LinkedList.h"
|
2010-07-15 17:59:24 +04:00
|
|
|
#include "mozilla/TimeStamp.h"
|
2011-08-24 23:49:25 +04:00
|
|
|
#include "nsIDOMTouchEvent.h"
|
2011-08-24 23:49:25 +04:00
|
|
|
#include "nsIInlineEventHandlers.h"
|
2012-04-21 00:43:48 +04:00
|
|
|
#include "nsWrapperCacheInlines.h"
|
2012-06-29 12:32:21 +04:00
|
|
|
#include "nsIIdleObserver.h"
|
2012-11-01 16:40:11 +04:00
|
|
|
#include "nsIDOMWakeLock.h"
|
1998-07-24 09:05:42 +04:00
|
|
|
|
2013-01-29 17:44:01 +04:00
|
|
|
#include "mozilla/dom/EventTarget.h"
|
|
|
|
|
2010-09-18 01:54:40 +04:00
|
|
|
// JS includes
|
|
|
|
#include "jsapi.h"
|
|
|
|
|
2012-11-07 22:10:40 +04:00
|
|
|
#ifdef MOZ_B2G
|
|
|
|
#include "nsIDOMWindowB2G.h"
|
|
|
|
#endif // MOZ_B2G
|
|
|
|
|
1999-04-29 00:33:43 +04:00
|
|
|
#define DEFAULT_HOME_PAGE "www.mozilla.org"
|
|
|
|
#define PREF_BROWSER_STARTUP_HOMEPAGE "browser.startup.homepage"
|
|
|
|
|
2010-09-17 05:24:14 +04:00
|
|
|
// Amount of time allowed between alert/prompt/confirm before enabling
|
|
|
|
// the stop dialog checkbox.
|
2012-08-13 23:03:59 +04:00
|
|
|
#define DEFAULT_SUCCESSIVE_DIALOG_TIME_LIMIT 3 // 3 sec
|
2010-09-17 05:24:14 +04:00
|
|
|
|
2012-08-13 23:03:59 +04:00
|
|
|
// Maximum number of successive dialogs before we prompt users to disable
|
|
|
|
// dialogs for this window.
|
|
|
|
#define MAX_SUCCESSIVE_DIALOG_COUNT 5
|
2010-09-17 05:24:14 +04:00
|
|
|
|
2012-06-29 12:32:21 +04:00
|
|
|
// Idle fuzz time upper limit
|
|
|
|
#define MAX_IDLE_FUZZ_TIME_MS 90000
|
|
|
|
|
|
|
|
// Min idle notification time in seconds.
|
|
|
|
#define MIN_IDLE_NOTIFICATION_TIME_S 1
|
|
|
|
|
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;
|
2013-02-17 08:43:16 +04:00
|
|
|
class nsIDOMCrypto;
|
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 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;
|
2008-05-02 23:26:47 +04:00
|
|
|
class PostMessageEvent;
|
2009-11-20 02:11:44 +03:00
|
|
|
class nsRunnable;
|
2012-03-13 04:56:07 +04:00
|
|
|
class nsDOMEventTargetHelper;
|
2007-05-29 13:45:30 +04:00
|
|
|
class nsDOMOfflineResourceList;
|
2012-04-02 06:23:51 +04:00
|
|
|
class nsDOMWindowUtils;
|
2012-06-29 12:32:21 +04:00
|
|
|
class nsIIdleService;
|
2007-05-29 13:45:30 +04:00
|
|
|
|
2012-02-02 01:58:01 +04:00
|
|
|
class nsWindowSizes;
|
|
|
|
|
2011-11-02 17:44:16 +04:00
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
|
|
|
class Navigator;
|
2012-09-25 07:24:43 +04:00
|
|
|
class URL;
|
2011-11-02 17:44:16 +04:00
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|
|
|
|
|
2006-06-13 07:07:47 +04:00
|
|
|
extern nsresult
|
2008-01-30 05:11:48 +03:00
|
|
|
NS_CreateJSTimeoutHandler(nsGlobalWindow *aWindow,
|
2011-09-29 10:19:26 +04:00
|
|
|
bool *aIsInterval,
|
2012-08-22 19:56:38 +04:00
|
|
|
int32_t *aInterval,
|
2006-06-13 07:07:47 +04:00
|
|
|
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.
|
|
|
|
*/
|
2012-11-01 18:06:22 +04:00
|
|
|
struct nsTimeout : mozilla::LinkedListElement<nsTimeout>
|
2006-09-21 07:46:46 +04:00
|
|
|
{
|
|
|
|
nsTimeout();
|
|
|
|
~nsTimeout();
|
|
|
|
|
2012-08-24 20:50:06 +04:00
|
|
|
NS_DECL_CYCLE_COLLECTION_LEGACY_NATIVE_CLASS(nsTimeout)
|
2009-01-25 17:34:26 +03:00
|
|
|
|
2006-09-21 07:46:46 +04:00
|
|
|
nsrefcnt Release();
|
|
|
|
nsrefcnt AddRef();
|
|
|
|
|
2013-01-04 01:48:01 +04:00
|
|
|
nsresult InitTimer(nsTimerCallbackFunc aFunc, uint32_t aDelay)
|
|
|
|
{
|
|
|
|
return mTimer->InitWithFuncCallback(aFunc, this, aDelay,
|
2012-07-24 21:50:45 +04:00
|
|
|
nsITimer::TYPE_ONE_SHOT);
|
|
|
|
}
|
|
|
|
|
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
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mCleared;
|
2006-09-21 07:46:46 +04:00
|
|
|
|
|
|
|
// True if this is one of the timeouts that are currently running
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mRunning;
|
2006-09-21 07:46:46 +04:00
|
|
|
|
2011-06-29 23:49:42 +04:00
|
|
|
// True if this is a repeating/interval timer
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mIsInterval;
|
2011-06-29 23:49:42 +04:00
|
|
|
|
2006-09-21 07:46:46 +04:00
|
|
|
// Returned as value of setTimeout()
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t mPublicId;
|
2006-09-21 07:46:46 +04:00
|
|
|
|
2011-06-29 23:49:42 +04:00
|
|
|
// Interval in milliseconds
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t mInterval;
|
2006-09-21 07:46:46 +04:00
|
|
|
|
2010-07-15 17:59:24 +04: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;
|
2006-09-21 07:46:46 +04:00
|
|
|
|
|
|
|
// Principal with which to execute
|
|
|
|
nsCOMPtr<nsIPrincipal> mPrincipal;
|
|
|
|
|
|
|
|
// stack depth at which timeout is firing
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t mFiringDepth;
|
2006-09-21 07:46:46 +04:00
|
|
|
|
2009-08-26 22:07:39 +04:00
|
|
|
//
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t mNestingLevel;
|
2009-08-26 22:07:39 +04:00
|
|
|
|
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
|
|
|
};
|
|
|
|
|
2012-06-29 12:32:21 +04:00
|
|
|
struct IdleObserverHolder
|
|
|
|
{
|
|
|
|
nsCOMPtr<nsIIdleObserver> mIdleObserver;
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t mTimeInS;
|
2012-07-14 02:39:46 +04:00
|
|
|
bool mPrevNotificationIdle;
|
2012-06-29 12:32:21 +04:00
|
|
|
|
|
|
|
IdleObserverHolder()
|
2012-07-14 02:39:46 +04:00
|
|
|
: mTimeInS(0), mPrevNotificationIdle(false)
|
2012-06-29 12:32:21 +04:00
|
|
|
{
|
|
|
|
MOZ_COUNT_CTOR(IdleObserverHolder);
|
|
|
|
}
|
|
|
|
|
2012-07-14 02:39:46 +04:00
|
|
|
IdleObserverHolder(const IdleObserverHolder& aOther)
|
|
|
|
: mIdleObserver(aOther.mIdleObserver), mTimeInS(aOther.mTimeInS),
|
|
|
|
mPrevNotificationIdle(aOther.mPrevNotificationIdle)
|
2012-06-29 12:32:21 +04:00
|
|
|
{
|
|
|
|
MOZ_COUNT_CTOR(IdleObserverHolder);
|
|
|
|
}
|
|
|
|
|
2012-07-14 02:39:46 +04:00
|
|
|
bool operator==(const IdleObserverHolder& aOther) const {
|
2012-06-29 12:32:21 +04:00
|
|
|
return
|
2012-07-14 02:39:46 +04:00
|
|
|
mIdleObserver == aOther.mIdleObserver &&
|
|
|
|
mTimeInS == aOther.mTimeInS;
|
2012-06-29 12:32:21 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
~IdleObserverHolder()
|
|
|
|
{
|
|
|
|
MOZ_COUNT_DTOR(IdleObserverHolder);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
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
|
|
|
|
2013-01-29 17:44:01 +04:00
|
|
|
class nsGlobalWindow : public mozilla::dom::EventTarget,
|
|
|
|
public nsPIDOMWindow,
|
2005-07-31 23:43:27 +04:00
|
|
|
public nsIScriptGlobalObject,
|
2004-12-10 22:48:22 +03:00
|
|
|
public nsIDOMJSWindow,
|
|
|
|
public nsIScriptObjectPrincipal,
|
2011-01-12 20:35:31 +03:00
|
|
|
public nsIDOMStorageIndexedDB,
|
2004-12-10 22:48:22 +03:00
|
|
|
public nsSupportsWeakReference,
|
2005-07-31 00:57:07 +04:00
|
|
|
public nsIInterfaceRequestor,
|
2011-06-23 14:39:48 +04:00
|
|
|
public PRCListStr,
|
2011-08-24 23:49:25 +04:00
|
|
|
public nsIDOMWindowPerformance,
|
2011-08-24 23:49:25 +04:00
|
|
|
public nsITouchEventReceiver,
|
2013-02-17 08:43:19 +04:00
|
|
|
public nsIInlineEventHandlers
|
2012-11-07 22:10:40 +04:00
|
|
|
#ifdef MOZ_B2G
|
|
|
|
, public nsIDOMWindowB2G
|
|
|
|
#endif // MOZ_B2G
|
1998-07-24 09:05:42 +04:00
|
|
|
{
|
|
|
|
public:
|
2010-09-17 05:24:14 +04:00
|
|
|
typedef mozilla::TimeStamp TimeStamp;
|
|
|
|
typedef mozilla::TimeDuration TimeDuration;
|
2011-11-02 17:44:16 +04:00
|
|
|
typedef mozilla::dom::Navigator Navigator;
|
2011-06-29 15:06:43 +04:00
|
|
|
typedef nsDataHashtable<nsUint64HashKey, nsGlobalWindow*> WindowByIdTable;
|
2010-09-17 05:24:14 +04:00
|
|
|
|
2004-05-04 01:48:36 +04:00
|
|
|
// public methods
|
|
|
|
nsPIDOMWindow* GetPrivateParent();
|
|
|
|
// callback for close event
|
|
|
|
void ReallyCloseWindow();
|
|
|
|
|
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
|
|
|
|
2011-08-20 17:53:34 +04:00
|
|
|
// nsWrapperCache
|
2012-03-14 19:25:40 +04:00
|
|
|
JSObject *WrapObject(JSContext *cx, JSObject *scope, bool *triedToWrap)
|
2011-08-20 17:53:34 +04:00
|
|
|
{
|
|
|
|
NS_ASSERTION(IsOuterWindow(),
|
|
|
|
"Inner window supports nsWrapperCache, fix WrapObject!");
|
|
|
|
*triedToWrap = true;
|
2012-07-30 18:20:58 +04:00
|
|
|
return EnsureInnerWindow() ? GetWrapper() : nullptr;
|
2011-08-20 17:53:34 +04:00
|
|
|
}
|
|
|
|
|
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();
|
2010-06-08 20:13:08 +04:00
|
|
|
JSObject *FastGetGlobalJSObject()
|
|
|
|
{
|
|
|
|
return mJSObject;
|
|
|
|
}
|
2006-06-13 07:07:47 +04:00
|
|
|
|
2012-03-23 21:13:29 +04:00
|
|
|
virtual nsresult EnsureScriptEnvironment();
|
2006-06-13 07:07:47 +04:00
|
|
|
|
2012-03-23 21:13:29 +04:00
|
|
|
virtual nsIScriptContext *GetScriptContext();
|
2006-06-13 07:07:47 +04:00
|
|
|
|
2011-04-14 16:04:08 +04:00
|
|
|
virtual void OnFinalize(JSObject* aObject);
|
2011-09-29 10:19:26 +04:00
|
|
|
virtual void SetScriptsEnabled(bool aEnabled, bool aFireTimeouts);
|
2001-01-18 10:44:29 +03:00
|
|
|
|
2012-01-26 19:03:21 +04:00
|
|
|
virtual bool IsBlackForCC();
|
|
|
|
|
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
|
|
|
|
2012-11-07 22:10:40 +04:00
|
|
|
#ifdef MOZ_B2G
|
|
|
|
// nsIDOMWindowB2G
|
|
|
|
NS_DECL_NSIDOMWINDOWB2G
|
|
|
|
#endif // MOZ_B2G
|
|
|
|
|
2011-06-23 14:39:48 +04:00
|
|
|
// nsIDOMWindowPerformance
|
|
|
|
NS_DECL_NSIDOMWINDOWPERFORMANCE
|
|
|
|
|
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
|
|
|
// nsIDOMJSWindow
|
|
|
|
NS_DECL_NSIDOMJSWINDOW
|
2001-01-18 10:44:29 +03:00
|
|
|
|
|
|
|
// nsIDOMEventTarget
|
2002-11-09 03:25:25 +03:00
|
|
|
NS_DECL_NSIDOMEVENTTARGET
|
|
|
|
|
2011-08-24 23:49:25 +04:00
|
|
|
// nsITouchEventReceiver
|
|
|
|
NS_DECL_NSITOUCHEVENTRECEIVER
|
|
|
|
|
2011-08-24 23:49:25 +04:00
|
|
|
// nsIInlineEventHandlers
|
|
|
|
NS_DECL_NSIINLINEEVENTHANDLERS
|
|
|
|
|
2001-01-18 10:44:29 +03:00
|
|
|
// nsPIDOMWindow
|
2004-05-04 01:48:36 +04:00
|
|
|
virtual NS_HIDDEN_(nsPIDOMWindow*) GetPrivateRoot();
|
2011-09-29 10:19:26 +04:00
|
|
|
virtual NS_HIDDEN_(void) ActivateOrDeactivate(bool aActivate);
|
|
|
|
virtual NS_HIDDEN_(void) SetActive(bool aActive);
|
|
|
|
virtual NS_HIDDEN_(void) SetIsBackground(bool aIsBackground);
|
2011-06-24 06:18:00 +04:00
|
|
|
virtual NS_HIDDEN_(void) SetChromeEventHandler(nsIDOMEventTarget* aChromeEventHandler);
|
2004-05-04 01:48:36 +04:00
|
|
|
|
2012-09-05 22:32:06 +04:00
|
|
|
virtual NS_HIDDEN_(void) SetInitialPrincipalToSubject();
|
2002-04-17 08:17:16 +04:00
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
virtual NS_HIDDEN_(PopupControlState) PushPopupControlState(PopupControlState state, bool aForce) const;
|
2004-09-04 23:28:46 +04:00
|
|
|
virtual NS_HIDDEN_(void) PopPopupControlState(PopupControlState state) const;
|
|
|
|
virtual NS_HIDDEN_(PopupControlState) GetPopupControlState() const;
|
|
|
|
|
2012-09-06 11:20:26 +04:00
|
|
|
virtual already_AddRefed<nsISupports> SaveWindowState();
|
2005-05-05 00:22:32 +04:00
|
|
|
virtual NS_HIDDEN_(nsresult) RestoreWindowState(nsISupports *aState);
|
2012-08-22 19:56:38 +04:00
|
|
|
virtual NS_HIDDEN_(void) SuspendTimeouts(uint32_t aIncrease = 1,
|
2011-09-29 10:19:26 +04:00
|
|
|
bool aFreezeChildren = true);
|
|
|
|
virtual NS_HIDDEN_(nsresult) ResumeTimeouts(bool aThawChildren = true);
|
2012-08-22 19:56:38 +04:00
|
|
|
virtual NS_HIDDEN_(uint32_t) TimeoutSuspendCount();
|
2006-05-04 01:53:08 +04:00
|
|
|
virtual NS_HIDDEN_(nsresult) FireDelayedDOMEvents();
|
2011-09-29 10:19:26 +04:00
|
|
|
virtual NS_HIDDEN_(bool) IsFrozen() const
|
2008-01-17 00:54:33 +03:00
|
|
|
{
|
|
|
|
return mIsFrozen;
|
|
|
|
}
|
2005-07-31 00:57:07 +04:00
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
virtual NS_HIDDEN_(bool) WouldReuseInnerWindow(nsIDocument *aNewDocument);
|
2006-03-07 20:08:51 +03:00
|
|
|
|
2005-12-01 22:35:27 +03:00
|
|
|
virtual NS_HIDDEN_(void) SetDocShell(nsIDocShell* aDocShell);
|
2012-05-25 23:00:32 +04:00
|
|
|
virtual void DetachFromDocShell();
|
2005-12-01 22:35:27 +03:00
|
|
|
virtual NS_HIDDEN_(nsresult) SetNewDocument(nsIDocument *aDocument,
|
2010-09-16 02:54:00 +04:00
|
|
|
nsISupports *aState,
|
2011-09-29 10:19:26 +04:00
|
|
|
bool aForceReuseInnerWindow);
|
2010-06-10 20:23:40 +04:00
|
|
|
void DispatchDOMWindowCreated();
|
2011-07-15 14:31:34 +04:00
|
|
|
virtual NS_HIDDEN_(void) SetOpenerWindow(nsIDOMWindow* aOpener,
|
2011-09-29 10:19:26 +04:00
|
|
|
bool aOriginalOpener);
|
2006-04-08 07:23:37 +04:00
|
|
|
virtual NS_HIDDEN_(void) EnsureSizeUpToDate();
|
2005-08-23 04:24:57 +04:00
|
|
|
|
2011-07-15 14:31:34 +04:00
|
|
|
virtual NS_HIDDEN_(nsIDOMWindow*) EnterModalState();
|
|
|
|
virtual NS_HIDDEN_(void) LeaveModalState(nsIDOMWindow* aWindow);
|
2006-07-06 02:48:04 +04:00
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
virtual NS_HIDDEN_(bool) CanClose();
|
2010-01-28 21:35:20 +03:00
|
|
|
virtual NS_HIDDEN_(nsresult) ForceClose();
|
|
|
|
|
2010-08-02 17:34:54 +04:00
|
|
|
virtual NS_HIDDEN_(void) MaybeUpdateTouchState();
|
|
|
|
virtual NS_HIDDEN_(void) UpdateTouchState();
|
2011-09-29 10:19:26 +04:00
|
|
|
virtual NS_HIDDEN_(bool) DispatchCustomEvent(const char *aEventName);
|
2012-06-15 10:31:27 +04:00
|
|
|
virtual NS_HIDDEN_(void) RefreshCompartmentPrincipal();
|
2012-02-20 01:02:08 +04:00
|
|
|
virtual NS_HIDDEN_(nsresult) SetFullScreenInternal(bool aIsFullScreen, bool aRequireTrust);
|
2009-08-21 18:42:37 +04:00
|
|
|
|
2011-07-15 14:32:37 +04:00
|
|
|
// nsIDOMStorageIndexedDB
|
|
|
|
NS_DECL_NSIDOMSTORAGEINDEXEDDB
|
2006-05-19 09:57:36 +04:00
|
|
|
|
2001-05-17 06:15:27 +04:00
|
|
|
// nsIInterfaceRequestor
|
|
|
|
NS_DECL_NSIINTERFACEREQUESTOR
|
|
|
|
|
2012-10-02 12:07:35 +04:00
|
|
|
// WebIDL interface.
|
|
|
|
uint32_t GetLength();
|
2012-10-02 12:07:36 +04:00
|
|
|
already_AddRefed<nsIDOMWindow> IndexedGetter(uint32_t aIndex, bool& aFound);
|
2012-10-02 12:07:35 +04:00
|
|
|
|
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().
|
2013-01-29 17:44:01 +04:00
|
|
|
return (nsGlobalWindow *)(nsIDOMEventTarget *)supports;
|
2009-05-13 00:20:42 +04:00
|
|
|
}
|
2010-08-11 02:00:26 +04:00
|
|
|
static nsISupports *ToSupports(nsGlobalWindow *win)
|
|
|
|
{
|
|
|
|
// Make sure this matches the casts we do in QueryInterface().
|
2013-01-29 17:44:01 +04:00
|
|
|
return (nsISupports *)(nsIDOMEventTarget *)win;
|
2010-08-11 02:00:26 +04:00
|
|
|
}
|
2009-05-13 00:20:42 +04:00
|
|
|
static nsGlobalWindow *FromWrapper(nsIXPConnectWrappedNative *wrapper)
|
|
|
|
{
|
|
|
|
return FromSupports(wrapper->Native());
|
2005-07-31 00:57:07 +04:00
|
|
|
}
|
|
|
|
|
2012-05-23 19:27:10 +04: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-17 05:24:14 +04:00
|
|
|
inline nsGlobalWindow *GetTop()
|
|
|
|
{
|
|
|
|
nsCOMPtr<nsIDOMWindow> top;
|
|
|
|
GetTop(getter_AddRefs(top));
|
|
|
|
if (top)
|
2012-06-07 18:43:23 +04:00
|
|
|
return static_cast<nsGlobalWindow *>(top.get());
|
2012-07-30 18:20:58 +04:00
|
|
|
return nullptr;
|
2012-06-07 18:43:23 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
inline nsGlobalWindow* GetScriptableTop()
|
|
|
|
{
|
|
|
|
nsCOMPtr<nsIDOMWindow> top;
|
|
|
|
GetScriptableTop(getter_AddRefs(top));
|
|
|
|
if (top) {
|
|
|
|
return static_cast<nsGlobalWindow *>(top.get());
|
|
|
|
}
|
2012-07-30 18:20:58 +04:00
|
|
|
return nullptr;
|
2010-09-17 05:24:14 +04:00
|
|
|
}
|
|
|
|
|
2012-08-13 23:03:59 +04:00
|
|
|
// Returns true if dialogs need to be prevented from appearings for this
|
|
|
|
// window. beingAbused returns whether dialogs are being abused.
|
|
|
|
bool DialogsAreBlocked(bool *aBeingAbused);
|
2010-09-17 05:24:14 +04:00
|
|
|
|
2012-08-13 23:03:59 +04:00
|
|
|
// Returns true if we've reached the state in this top level window where we
|
|
|
|
// ask the user if further dialogs should be blocked. This method must only
|
|
|
|
// be called on the scriptable top inner window.
|
|
|
|
bool DialogsAreBeingAbused();
|
2010-09-17 05:24:14 +04:00
|
|
|
|
2012-08-13 23:03:59 +04:00
|
|
|
// Ask the user if further dialogs should be blocked, if dialogs are currently
|
|
|
|
// being abused. This is used in the cases where we have no modifiable UI to
|
|
|
|
// show, in that case we show a separate dialog to ask this question.
|
|
|
|
bool ConfirmDialogIfNeeded();
|
2010-09-17 05:24:14 +04:00
|
|
|
|
|
|
|
// Prevent further dialogs in this (top level) window
|
2012-08-13 23:05:34 +04:00
|
|
|
void PreventFurtherDialogs(bool aPermanent);
|
2010-09-17 05:24:14 +04:00
|
|
|
|
2011-11-22 04:34:21 +04:00
|
|
|
virtual void SetHasAudioAvailableEventListeners();
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
nsIScriptContext *GetScriptContextInternal(uint32_t aLangID)
|
2006-06-13 07:07:47 +04:00
|
|
|
{
|
2010-06-29 22:46:39 +04:00
|
|
|
NS_ASSERTION(aLangID == nsIProgrammingLanguage::JAVASCRIPT,
|
|
|
|
"We don't support this language ID");
|
2006-06-13 07:07:47 +04:00
|
|
|
if (mOuterWindow) {
|
2010-06-29 22:46:39 +04:00
|
|
|
return GetOuterWindowInternal()->mContext;
|
2006-06-13 07:07:47 +04:00
|
|
|
}
|
|
|
|
|
2010-06-29 22:46:39 +04:00
|
|
|
return mContext;
|
2006-06-13 07:07:47 +04:00
|
|
|
}
|
|
|
|
|
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
|
|
|
}
|
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
bool IsCreatingInnerWindow() const
|
2006-11-17 04:06:41 +03:00
|
|
|
{
|
|
|
|
return mCreatingInnerWindow;
|
|
|
|
}
|
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
bool IsChromeWindow() const
|
2007-08-03 03:34:38 +04:00
|
|
|
{
|
|
|
|
return mIsChrome;
|
|
|
|
}
|
|
|
|
|
2012-11-23 05:25:28 +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();
|
|
|
|
|
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
|
|
|
|
2011-08-31 18:54:39 +04:00
|
|
|
static void Init();
|
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);
|
2011-09-29 10:19:26 +04:00
|
|
|
static bool 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;
|
|
|
|
|
2012-01-26 19:03:21 +04:00
|
|
|
NS_DECL_CYCLE_COLLECTION_SKIPPABLE_SCRIPT_HOLDER_CLASS_AMBIGUOUS(nsGlobalWindow,
|
2013-01-29 17:44:01 +04:00
|
|
|
nsIDOMEventTarget)
|
2007-01-05 01:31:26 +03:00
|
|
|
|
2011-11-26 14:14:29 +04:00
|
|
|
virtual NS_HIDDEN_(JSObject*)
|
2008-02-13 07:17:18 +03:00
|
|
|
GetCachedXBLPrototypeHandler(nsXBLPrototypeHandler* aKey);
|
|
|
|
|
|
|
|
virtual NS_HIDDEN_(void)
|
|
|
|
CacheXBLPrototypeHandler(nsXBLPrototypeHandler* aKey,
|
2011-12-18 14:05:12 +04:00
|
|
|
nsScriptObjectHolder<JSObject>& aHandler);
|
2008-02-13 07:17:18 +03:00
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
virtual bool TakeFocus(bool aFocus, uint32_t 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 22:00:39 +04:00
|
|
|
virtual void SetReadyForFocus();
|
|
|
|
virtual void PageHidden();
|
2011-04-01 00:30:32 +04:00
|
|
|
virtual nsresult DispatchAsyncHashchange(nsIURI *aOldURI, nsIURI *aNewURI);
|
2011-03-01 10:08:56 +03:00
|
|
|
virtual nsresult DispatchSyncPopState();
|
2009-09-01 20:45:05 +04:00
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
virtual void EnableDeviceSensor(uint32_t aType);
|
|
|
|
virtual void DisableDeviceSensor(uint32_t aType);
|
2012-03-25 04:29:49 +04:00
|
|
|
|
2012-09-11 10:05:00 +04:00
|
|
|
virtual void EnableTimeChangeNotifications();
|
|
|
|
virtual void DisableTimeChangeNotifications();
|
|
|
|
|
2012-11-07 22:10:40 +04:00
|
|
|
#ifdef MOZ_B2G
|
2012-09-30 17:47:48 +04:00
|
|
|
virtual void EnableNetworkEvent(uint32_t aType);
|
|
|
|
virtual void DisableNetworkEvent(uint32_t aType);
|
2012-11-07 22:10:40 +04:00
|
|
|
#endif // MOZ_B2G
|
2012-09-30 17:47:48 +04:00
|
|
|
|
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
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
static bool DOMWindowDumpEnabled();
|
2008-02-13 07:17:18 +03:00
|
|
|
|
2010-03-12 07:42:05 +03:00
|
|
|
void MaybeForgiveSpamCount();
|
2011-09-29 10:19:26 +04:00
|
|
|
bool IsClosedOrClosing() {
|
2010-03-12 07:42:05 +03:00
|
|
|
return (mIsClosed ||
|
|
|
|
mInClose ||
|
|
|
|
mHavePendingClose ||
|
|
|
|
mCleanedUp);
|
|
|
|
}
|
|
|
|
|
2010-08-27 19:49:08 +04:00
|
|
|
static void FirePopupBlockedEvent(nsIDOMDocument* aDoc,
|
|
|
|
nsIDOMWindow *aRequestingWindow, nsIURI *aPopupURI,
|
|
|
|
const nsAString &aPopupWindowName,
|
|
|
|
const nsAString &aPopupWindowFeatures);
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
virtual uint32_t GetSerial() {
|
2010-09-10 02:15:40 +04:00
|
|
|
return mSerial;
|
|
|
|
}
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
static nsGlobalWindow* GetOuterWindowWithId(uint64_t aWindowID) {
|
2011-09-04 03:43:22 +04:00
|
|
|
if (!sWindowsById) {
|
2012-07-30 18:20:58 +04:00
|
|
|
return nullptr;
|
2011-09-04 03:43:22 +04:00
|
|
|
}
|
|
|
|
|
2011-06-29 15:03:54 +04:00
|
|
|
nsGlobalWindow* outerWindow = sWindowsById->Get(aWindowID);
|
2012-07-30 18:20:58 +04:00
|
|
|
return outerWindow && !outerWindow->IsInnerWindow() ? outerWindow : nullptr;
|
2010-10-21 04:24:16 +04:00
|
|
|
}
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
static nsGlobalWindow* GetInnerWindowWithId(uint64_t aInnerWindowID) {
|
2011-09-03 03:49:08 +04:00
|
|
|
if (!sWindowsById) {
|
2012-07-30 18:20:58 +04:00
|
|
|
return nullptr;
|
2011-09-03 03:49:08 +04:00
|
|
|
}
|
|
|
|
|
2011-08-25 00:44:35 +04:00
|
|
|
nsGlobalWindow* innerWindow = sWindowsById->Get(aInnerWindowID);
|
2012-07-30 18:20:58 +04:00
|
|
|
return innerWindow && innerWindow->IsInnerWindow() ? innerWindow : nullptr;
|
2011-08-25 00:44:35 +04:00
|
|
|
}
|
|
|
|
|
2011-05-25 10:31:59 +04:00
|
|
|
static bool HasIndexedDBSupport();
|
2011-01-12 20:35:31 +03:00
|
|
|
|
2011-06-29 15:06:43 +04:00
|
|
|
static WindowByIdTable* GetWindowsTable() {
|
|
|
|
return sWindowsById;
|
|
|
|
}
|
|
|
|
|
2012-02-02 01:58:01 +04:00
|
|
|
void SizeOfIncludingThis(nsWindowSizes* aWindowSizes) const;
|
2011-06-29 15:06:43 +04:00
|
|
|
|
2012-01-26 19:03:21 +04:00
|
|
|
void UnmarkGrayTimers();
|
2012-03-13 04:56:07 +04:00
|
|
|
|
|
|
|
void AddEventTargetObject(nsDOMEventTargetHelper* aObject);
|
|
|
|
void RemoveEventTargetObject(nsDOMEventTargetHelper* aObject);
|
2012-03-04 20:02:00 +04:00
|
|
|
|
2012-07-14 02:39:46 +04:00
|
|
|
void NotifyIdleObserver(IdleObserverHolder* aIdleObserverHolder,
|
2012-06-29 12:32:21 +04:00
|
|
|
bool aCallOnidle);
|
2012-07-14 02:39:46 +04:00
|
|
|
nsresult HandleIdleActiveEvent();
|
2012-08-22 19:56:38 +04:00
|
|
|
bool ContainsIdleObserver(nsIIdleObserver* aIdleObserver, uint32_t timeInS);
|
2012-06-29 12:32:21 +04:00
|
|
|
void HandleIdleObserverCallback();
|
|
|
|
|
2012-10-12 14:17:56 +04:00
|
|
|
void AllowScriptsToClose()
|
|
|
|
{
|
|
|
|
mAllowScriptsToClose = true;
|
|
|
|
}
|
2012-11-26 18:19:02 +04:00
|
|
|
|
|
|
|
#define EVENT(name_, id_, type_, struct_) \
|
|
|
|
mozilla::dom::EventHandlerNonNull* GetOn##name_() \
|
|
|
|
{ \
|
|
|
|
nsEventListenerManager *elm = GetListenerManager(false); \
|
|
|
|
return elm ? elm->GetEventHandler(nsGkAtoms::on##name_) : nullptr; \
|
|
|
|
} \
|
|
|
|
void SetOn##name_(mozilla::dom::EventHandlerNonNull* handler, \
|
|
|
|
mozilla::ErrorResult& error) \
|
|
|
|
{ \
|
|
|
|
nsEventListenerManager *elm = GetListenerManager(true); \
|
|
|
|
if (elm) { \
|
|
|
|
error = elm->SetEventHandler(nsGkAtoms::on##name_, handler); \
|
|
|
|
} else { \
|
|
|
|
error.Throw(NS_ERROR_OUT_OF_MEMORY); \
|
|
|
|
} \
|
|
|
|
}
|
|
|
|
#define ERROR_EVENT(name_, id_, type_, struct_) \
|
|
|
|
mozilla::dom::OnErrorEventHandlerNonNull* GetOn##name_() \
|
|
|
|
{ \
|
|
|
|
nsEventListenerManager *elm = GetListenerManager(false); \
|
|
|
|
return elm ? elm->GetOnErrorEventHandler() : nullptr; \
|
|
|
|
} \
|
|
|
|
void SetOn##name_(mozilla::dom::OnErrorEventHandlerNonNull* handler, \
|
|
|
|
mozilla::ErrorResult& error) \
|
|
|
|
{ \
|
|
|
|
nsEventListenerManager *elm = GetListenerManager(true); \
|
|
|
|
if (elm) { \
|
|
|
|
error = elm->SetEventHandler(handler); \
|
|
|
|
} else { \
|
|
|
|
error.Throw(NS_ERROR_OUT_OF_MEMORY); \
|
|
|
|
} \
|
|
|
|
}
|
|
|
|
#define BEFOREUNLOAD_EVENT(name_, id_, type_, struct_) \
|
|
|
|
mozilla::dom::BeforeUnloadEventHandlerNonNull* GetOn##name_() \
|
|
|
|
{ \
|
|
|
|
nsEventListenerManager *elm = GetListenerManager(false); \
|
|
|
|
return elm ? elm->GetOnBeforeUnloadEventHandler() : nullptr; \
|
|
|
|
} \
|
|
|
|
void SetOn##name_(mozilla::dom::BeforeUnloadEventHandlerNonNull* handler, \
|
|
|
|
mozilla::ErrorResult& error) \
|
|
|
|
{ \
|
|
|
|
nsEventListenerManager *elm = GetListenerManager(true); \
|
|
|
|
if (elm) { \
|
|
|
|
error = elm->SetEventHandler(handler); \
|
|
|
|
} else { \
|
|
|
|
error.Throw(NS_ERROR_OUT_OF_MEMORY); \
|
|
|
|
} \
|
|
|
|
}
|
|
|
|
#define WINDOW_ONLY_EVENT EVENT
|
|
|
|
#define TOUCH_EVENT EVENT
|
|
|
|
#include "nsEventNameList.h"
|
|
|
|
#undef TOUCH_EVENT
|
|
|
|
#undef WINDOW_ONLY_EVENT
|
|
|
|
#undef BEFOREUNLOAD_EVENT
|
|
|
|
#undef ERROR_EVENT
|
|
|
|
#undef EVENT
|
|
|
|
|
2000-02-08 16:40:10 +03:00
|
|
|
protected:
|
2012-06-29 12:32:21 +04:00
|
|
|
// Array of idle observers that are notified of idle events.
|
|
|
|
nsTObserverArray<IdleObserverHolder> mIdleObservers;
|
|
|
|
|
|
|
|
// Idle timer used for function callbacks to notify idle observers.
|
|
|
|
nsCOMPtr<nsITimer> mIdleTimer;
|
|
|
|
|
|
|
|
// Idle fuzz time added to idle timer callbacks.
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t mIdleFuzzFactor;
|
2012-06-29 12:32:21 +04:00
|
|
|
|
|
|
|
// Index in mArrayIdleObservers
|
|
|
|
// Next idle observer to notify user idle status
|
2012-08-22 19:56:38 +04:00
|
|
|
int32_t mIdleCallbackIndex;
|
2012-06-29 12:32:21 +04:00
|
|
|
|
|
|
|
// If false then the topic is "active"
|
|
|
|
// If true then the topic is "idle"
|
|
|
|
bool mCurrentlyIdle;
|
|
|
|
|
|
|
|
// Set to true when a fuzz time needs to be applied
|
|
|
|
// to active notifications to the idle observer.
|
|
|
|
bool mAddActiveEventFuzzTime;
|
|
|
|
|
|
|
|
nsCOMPtr <nsIIdleService> mIdleService;
|
|
|
|
|
2012-11-01 16:40:11 +04:00
|
|
|
nsCOMPtr <nsIDOMMozWakeLock> mWakeLock;
|
|
|
|
|
2012-06-29 12:32:21 +04:00
|
|
|
static bool sIdleObserversAPIFuzzTimeDisabled;
|
|
|
|
|
2011-04-01 00:30:32 +04:00
|
|
|
friend class HashchangeCallback;
|
2011-04-28 00:54:07 +04:00
|
|
|
friend class nsBarProp;
|
2011-04-01 00:30:32 +04:00
|
|
|
|
2001-01-18 10:44:29 +03:00
|
|
|
// Object Management
|
2004-12-10 22:48:22 +03:00
|
|
|
virtual ~nsGlobalWindow();
|
2011-09-29 10:19:26 +04:00
|
|
|
void CleanUp(bool 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
|
|
|
|
2012-05-09 19:10:18 +04:00
|
|
|
inline void MaybeClearInnerWindow(nsGlobalWindow* aExpectedInner)
|
|
|
|
{
|
|
|
|
if(mInnerWindow == aExpectedInner) {
|
2012-07-30 18:20:58 +04:00
|
|
|
mInnerWindow = nullptr;
|
2012-05-09 19:10:18 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-03-15 14:06:39 +03:00
|
|
|
void FreeInnerObjects();
|
2012-04-06 02:33:20 +04:00
|
|
|
JSObject *CallerGlobal();
|
2008-01-30 08:30:11 +03:00
|
|
|
nsGlobalWindow *CallerInnerWindow();
|
2005-08-15 22:16:42 +04:00
|
|
|
|
2012-06-17 12:11:16 +04:00
|
|
|
// Only to be called on an inner window.
|
|
|
|
// aDocument must not be null.
|
|
|
|
void InnerSetNewDocument(nsIDocument* aDocument);
|
2010-03-13 03:59:18 +03:00
|
|
|
|
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
|
2011-07-15 14:31:34 +04:00
|
|
|
nsIDOMWindow* GetParentInternal();
|
2001-11-01 02:52:52 +03:00
|
|
|
|
2004-05-04 01:48:36 +04:00
|
|
|
// popup tracking
|
2011-09-29 10:19:26 +04:00
|
|
|
bool IsPopupSpamWindow()
|
2005-07-31 00:57:07 +04:00
|
|
|
{
|
2005-08-12 08:11:00 +04:00
|
|
|
if (IsInnerWindow() && !mOuterWindow) {
|
2011-10-17 18:59:28 +04:00
|
|
|
return false;
|
2005-08-12 08:11:00 +04:00
|
|
|
}
|
|
|
|
|
2005-07-31 00:57:07 +04:00
|
|
|
return GetOuterWindowInternal()->mIsPopupSpam;
|
|
|
|
}
|
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
void SetPopupSpamWindow(bool aPopup)
|
2005-07-31 00:57:07 +04:00
|
|
|
{
|
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
|
2012-08-14 18:58:00 +04:00
|
|
|
|
|
|
|
virtual nsresult
|
|
|
|
OpenNoNavigate(const nsAString& aUrl,
|
|
|
|
const nsAString& aName,
|
|
|
|
const nsAString& aOptions,
|
|
|
|
nsIDOMWindow **_retval);
|
|
|
|
|
2006-02-07 23:46:39 +03:00
|
|
|
/**
|
2012-08-14 18:58:00 +04:00
|
|
|
* @param aUrl the URL we intend to load into the window. If aNavigate is
|
|
|
|
* true, we'll actually load this URL into the window. Otherwise,
|
|
|
|
* aUrl is advisory; OpenInternal will not load the URL into the
|
|
|
|
* new window.
|
|
|
|
*
|
2006-02-07 23:46:39 +03:00
|
|
|
* @param aName the name to use for the new window
|
2012-08-14 18:58:00 +04:00
|
|
|
*
|
2006-02-07 23:46:39 +03:00
|
|
|
* @param aOptions the window options to use for the new window
|
2012-08-14 18:58:00 +04:00
|
|
|
*
|
2006-02-07 23:46:39 +03:00
|
|
|
* @param aDialog true when called from variants of OpenDialog. If this is
|
2012-08-14 18:58:00 +04:00
|
|
|
* true, this method will skip popup blocking checks. The aDialog
|
|
|
|
* argument is passed on to the window watcher.
|
|
|
|
*
|
2006-02-07 23:46:39 +03:00
|
|
|
* @param aCalledNoScript true when called via the [noscript] open()
|
2012-08-14 18:58:00 +04:00
|
|
|
* and openDialog() methods. When this is true, we do NOT want to use
|
|
|
|
* the JS stack for things like caller determination.
|
|
|
|
*
|
2006-02-07 23:46:39 +03:00
|
|
|
* @param aDoJSFixups true when this is the content-accessible JS version of
|
2012-08-14 18:58:00 +04:00
|
|
|
* 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 aNavigate true if we should navigate to the provided URL, false
|
|
|
|
* otherwise. When aNavigate is false, we also skip our can-load
|
|
|
|
* security check, on the assumption that whoever *actually* loads this
|
|
|
|
* page will do their own security check.
|
|
|
|
*
|
2006-02-07 23:46:39 +03:00
|
|
|
* @param argv The arguments to pass to the new window. The first
|
2012-08-14 18:58:00 +04:00
|
|
|
* three args, if present, will be aUrl, aName, and aOptions. So this
|
|
|
|
* param only matters if there are more than 3 arguments.
|
|
|
|
*
|
2006-02-07 23:46:39 +03:00
|
|
|
* @param argc The number of arguments in argv.
|
2012-08-14 18:58:00 +04:00
|
|
|
*
|
2006-02-07 23:46:39 +03:00
|
|
|
* @param aExtraArgument Another way to pass arguments in. This is mutually
|
2012-08-14 18:58:00 +04:00
|
|
|
* exclusive with the argv/argc approach.
|
|
|
|
*
|
|
|
|
* @param aJSCallerContext The calling script's context. This must be null
|
|
|
|
* when aCalledNoScript is true.
|
2012-07-24 07:30:12 +04:00
|
|
|
*
|
2012-08-14 18:58:00 +04:00
|
|
|
* @param aReturn [out] The window that was opened, if any.
|
2006-02-07 23:46:39 +03:00
|
|
|
*/
|
|
|
|
NS_HIDDEN_(nsresult) OpenInternal(const nsAString& aUrl,
|
|
|
|
const nsAString& aName,
|
|
|
|
const nsAString& aOptions,
|
2011-09-29 10:19:26 +04:00
|
|
|
bool aDialog,
|
|
|
|
bool aContentModal,
|
|
|
|
bool aCalledNoScript,
|
|
|
|
bool aDoJSFixups,
|
2012-08-14 18:58:00 +04:00
|
|
|
bool aNavigate,
|
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);
|
|
|
|
|
|
|
|
// Timeout Functions
|
2010-07-15 17:59:24 +04:00
|
|
|
// Language agnostic timeout function (all args passed).
|
|
|
|
// |interval| is in milliseconds.
|
2006-06-13 07:07:47 +04:00
|
|
|
nsresult SetTimeoutOrInterval(nsIScriptTimeoutHandler *aHandler,
|
2012-08-22 19:56:38 +04:00
|
|
|
int32_t interval,
|
|
|
|
bool aIsInterval, int32_t *aReturn);
|
|
|
|
nsresult ClearTimeoutOrInterval(int32_t aTimerID);
|
2006-06-13 07:07:47 +04:00
|
|
|
|
|
|
|
// JS specific timeout functions (JS args grabbed from context).
|
2012-08-22 19:56:38 +04:00
|
|
|
nsresult SetTimeoutOrInterval(bool aIsInterval, int32_t* aReturn);
|
2011-06-29 23:49:42 +04:00
|
|
|
nsresult ResetTimersForNonBackgroundWindow();
|
2006-06-13 07:07:47 +04:00
|
|
|
|
|
|
|
// The timeout implementation functions.
|
|
|
|
void RunTimeout(nsTimeout *aTimeout);
|
2012-07-30 18:20:58 +04:00
|
|
|
void RunTimeout() { RunTimeout(nullptr); }
|
2012-04-24 22:16:29 +04:00
|
|
|
// Return true if |aTimeout| was cleared while its handler ran.
|
|
|
|
bool RunTimeoutHandler(nsTimeout* aTimeout, nsIScriptContext* aScx);
|
|
|
|
// Return true if |aTimeout| needs to be reinserted into the timeout list.
|
|
|
|
bool RescheduleTimeout(nsTimeout* aTimeout, const TimeStamp& now,
|
|
|
|
bool aRunningPendingTimeouts);
|
2006-06-13 07:07:47 +04:00
|
|
|
|
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);
|
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,
|
2011-09-29 10:19:26 +04:00
|
|
|
bool *aFreeSecurityPass, JSContext **aCXused);
|
|
|
|
bool PopupWhitelisted();
|
2009-09-16 22:46:05 +04:00
|
|
|
PopupControlState RevisePopupAbuseLevel(PopupControlState);
|
2011-09-29 10:19:26 +04:00
|
|
|
void FireAbuseEvents(bool aBlocked, bool 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();
|
2012-06-29 12:32:21 +04:00
|
|
|
|
|
|
|
nsresult ScheduleNextIdleObserverCallback();
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t GetFuzzTimeMS();
|
2012-06-29 12:32:21 +04:00
|
|
|
nsresult ScheduleActiveTimerCallback();
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t FindInsertionIndex(IdleObserverHolder* aIdleObserver);
|
2012-06-29 12:32:21 +04:00
|
|
|
virtual nsresult RegisterIdleObserver(nsIIdleObserver* aIdleObserverPtr);
|
|
|
|
nsresult FindIndexOfElementToRemove(nsIIdleObserver* aIdleObserver,
|
2012-08-22 19:56:38 +04:00
|
|
|
int32_t* aRemoveElementIndex);
|
2012-06-29 12:32:21 +04:00
|
|
|
virtual nsresult UnregisterIdleObserver(nsIIdleObserver* aIdleObserverPtr);
|
|
|
|
|
2011-04-01 00:30:32 +04:00
|
|
|
nsresult FireHashchange(const nsAString &aOldURL, const nsAString &aNewURL);
|
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();
|
2012-08-22 19:56:38 +04:00
|
|
|
nsresult CheckSecurityWidthAndHeight(int32_t* width, int32_t* height);
|
|
|
|
nsresult CheckSecurityLeftAndTop(int32_t* left, int32_t* top);
|
2010-12-22 01:35:09 +03: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
|
2012-08-22 19:56:38 +04:00
|
|
|
nsresult SetDocShellWidthAndHeight(int32_t width, int32_t height);
|
2010-12-22 01:35:09 +03:00
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
static bool 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
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
bool CanMoveResizeWindows();
|
2008-03-19 23:27:34 +03:00
|
|
|
|
2012-10-28 08:24:02 +04:00
|
|
|
bool 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.
|
2012-08-22 19:56:38 +04:00
|
|
|
nsresult GetScrollXY(int32_t* aScrollX, int32_t* aScrollY,
|
2011-09-29 10:19:26 +04:00
|
|
|
bool aDoFlush);
|
2012-08-22 19:56:38 +04:00
|
|
|
nsresult GetScrollMaxXY(int32_t* aScrollMaxX, int32_t* aScrollMaxY);
|
2012-06-29 12:32:21 +04:00
|
|
|
|
2008-04-02 02:20:45 +04:00
|
|
|
nsresult GetOuterSize(nsIntSize* aSizeCSSPixels);
|
2012-08-22 19:56:38 +04:00
|
|
|
nsresult SetOuterSize(int32_t aLengthCSSPixels, bool aIsWidth);
|
2009-07-30 07:16:44 +04:00
|
|
|
nsRect GetInnerScreenRect();
|
2003-04-15 17:40:46 +04:00
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
bool IsFrame()
|
2004-07-05 19:51:31 +04:00
|
|
|
{
|
2012-07-30 18:20:58 +04:00
|
|
|
return GetParentInternal() != nullptr;
|
2004-07-05 19:51:31 +04:00
|
|
|
}
|
|
|
|
|
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.
|
2011-09-29 10:19:26 +04:00
|
|
|
bool WindowExists(const nsAString& aName, bool 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?");
|
2011-10-17 18:59:28 +04:00
|
|
|
mIsFrozen = true;
|
2011-05-23 01:30:07 +04:00
|
|
|
NotifyDOMWindowFrozen(this);
|
2005-08-15 22:16:42 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void Thaw()
|
|
|
|
{
|
2011-10-17 18:59:28 +04:00
|
|
|
mIsFrozen = false;
|
2011-05-23 01:30:07 +04:00
|
|
|
NotifyDOMWindowThawed(this);
|
2005-08-15 22:16:42 +04:00
|
|
|
}
|
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
bool IsInModalState();
|
2006-07-06 02:48:04 +04:00
|
|
|
|
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.
|
2012-08-22 19:56:38 +04:00
|
|
|
int32_t DevToCSSIntPixels(int32_t px);
|
|
|
|
int32_t CSSToDevIntPixels(int32_t px);
|
2009-02-10 11:29:53 +03:00
|
|
|
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 void SetFocusedNode(nsIContent* aNode,
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t aFocusMethod = 0,
|
2011-09-29 10:19:26 +04: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 22:00:39 +04:00
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
virtual uint32_t GetFocusMethod();
|
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
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
virtual bool ShouldShowFocusRing();
|
2010-04-21 18:53:42 +04:00
|
|
|
|
|
|
|
virtual void SetKeyboardIndicators(UIStateChangeType aShowAccelerators,
|
|
|
|
UIStateChangeType aShowFocusRings);
|
2011-09-29 10:19:26 +04:00
|
|
|
virtual void GetKeyboardIndicators(bool* aShowAccelerators,
|
|
|
|
bool* aShowFocusRings);
|
2010-04-21 18:53:42 +04:00
|
|
|
|
2011-09-29 10:19:26 +04: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 22:00:39 +04:00
|
|
|
|
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);
|
2010-05-15 01:17:52 +04:00
|
|
|
void NotifyWindowIDDestroyed(const char* aTopic);
|
2011-05-23 01:30:07 +04:00
|
|
|
|
|
|
|
static void NotifyDOMWindowFrozen(nsGlobalWindow* aWindow);
|
|
|
|
static void NotifyDOMWindowThawed(nsGlobalWindow* aWindow);
|
2012-06-29 12:32:21 +04:00
|
|
|
|
2010-06-02 00:36:16 +04:00
|
|
|
void ClearStatus();
|
2008-02-14 02:41:17 +03:00
|
|
|
|
2010-06-16 15:43:36 +04:00
|
|
|
virtual void UpdateParentTarget();
|
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
bool GetIsTabModalPromptAllowed();
|
2011-02-16 21:27:25 +03:00
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
inline int32_t DOMMinTimeoutValue() const;
|
2011-03-26 04:05:55 +03:00
|
|
|
|
2012-03-24 12:18:21 +04:00
|
|
|
nsresult CreateOuterObject(nsGlobalWindow* aNewInner);
|
|
|
|
nsresult SetOuterObject(JSContext* aCx, JSObject* aOuterObject);
|
2012-03-30 21:31:16 +04:00
|
|
|
nsresult CloneStorageEvent(const nsAString& aType,
|
|
|
|
nsCOMPtr<nsIDOMStorageEvent>& aEvent);
|
2012-03-24 12:18:21 +04:00
|
|
|
|
2012-05-23 19:27:10 +04:00
|
|
|
// Implements Get{Real,Scriptable}Top.
|
|
|
|
nsresult GetTopImpl(nsIDOMWindow **aWindow, bool aScriptable);
|
|
|
|
|
2012-10-02 12:07:35 +04:00
|
|
|
// Outer windows only.
|
|
|
|
nsDOMWindowList* GetWindowList();
|
|
|
|
|
2012-10-18 01:01:56 +04:00
|
|
|
// Helper for getComputedStyle and getDefaultComputedStyle
|
|
|
|
nsresult GetComputedStyleHelper(nsIDOMElement* aElt,
|
|
|
|
const nsAString& aPseudoElt,
|
|
|
|
bool aDefaultStylesOnly,
|
|
|
|
nsIDOMCSSStyleDeclaration** aReturn);
|
|
|
|
|
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
|
2012-05-25 23:00:32 +04:00
|
|
|
// |CleanUp| and |DetachFromDocShell|.
|
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.
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mIsFrozen : 1;
|
2012-06-29 12:32:21 +04:00
|
|
|
|
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!
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mFullScreen : 1;
|
|
|
|
bool mIsClosed : 1;
|
|
|
|
bool mInClose : 1;
|
2005-10-15 01:56:21 +04: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-29 10:19:26 +04:00
|
|
|
bool mHavePendingClose : 1;
|
|
|
|
bool mHadOriginalOpener : 1;
|
|
|
|
bool 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.
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mBlockScriptedClosingFlag : 1;
|
2006-08-30 02:25:12 +04:00
|
|
|
|
2006-05-04 01:53:08 +04:00
|
|
|
// Track what sorts of events we need to fire when thawed
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mFireOfflineStatusChangeEventOnThaw : 1;
|
2012-06-29 12:32:21 +04:00
|
|
|
bool mNotifyIdleObserversIdleOnThaw : 1;
|
|
|
|
bool mNotifyIdleObserversActiveOnThaw : 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.
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mCreatingInnerWindow : 1;
|
2007-08-03 03:34:38 +04:00
|
|
|
|
|
|
|
// Fast way to tell if this is a chrome window (without having to QI).
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mIsChrome : 1;
|
2007-08-03 03:34:38 +04:00
|
|
|
|
2011-01-23 22:51:00 +03: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-29 10:19:26 +04:00
|
|
|
bool mCleanMessageManager : 1;
|
2011-01-23 22:51:00 +03: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 22:00:39 +04:00
|
|
|
// Indicates that the current document has never received a document focus
|
|
|
|
// event.
|
2011-09-29 10:19:26 +04: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 22:00:39 +04:00
|
|
|
|
2010-04-21 18:53:42 +04:00
|
|
|
// whether to show keyboard accelerators
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mShowAccelerators : 1;
|
2010-04-21 18:53:42 +04:00
|
|
|
|
|
|
|
// whether to show focus rings
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mShowFocusRings : 1;
|
2010-04-21 18:53:42 +04:00
|
|
|
|
|
|
|
// when true, show focus rings for the current focused content only.
|
|
|
|
// This will be reset when another element is focused
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mShowFocusRingForContent : 1;
|
2010-04-21 18:53:42 +04:00
|
|
|
|
2010-05-13 16:19:50 +04:00
|
|
|
// true if tab navigation has occurred for this window. Focus rings
|
2010-04-21 18:53:42 +04:00
|
|
|
// should be displayed.
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mFocusByKeyOccurred : 1;
|
2010-04-21 18:53:42 +04:00
|
|
|
|
2010-05-15 01:17:52 +04:00
|
|
|
// whether we've sent the destroy notification for our window id
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mNotifiedIDDestroyed : 1;
|
2012-10-12 14:17:56 +04:00
|
|
|
// whether scripts may close the window,
|
|
|
|
// even if "dom.allow_scripts_to_close_windows" is false.
|
|
|
|
bool mAllowScriptsToClose : 1;
|
2010-05-15 01:17:52 +04:00
|
|
|
|
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;
|
2011-11-02 17:44:16 +04:00
|
|
|
nsRefPtr<Navigator> mNavigator;
|
2004-12-10 22:48:22 +03:00
|
|
|
nsRefPtr<nsScreen> mScreen;
|
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;
|
2012-04-02 06:23:51 +04:00
|
|
|
nsRefPtr<nsDOMWindowUtils> mWindowUtils;
|
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
|
2006-05-04 01:53:08 +04:00
|
|
|
nsGlobalWindowObserver* mObserver;
|
2001-01-18 10:44:29 +03:00
|
|
|
nsCOMPtr<nsIDOMCrypto> mCrypto;
|
2013-02-17 08:43:16 +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
|
|
|
|
2010-06-29 22:46:39 +04:00
|
|
|
nsCOMPtr<nsIXPConnectJSObjectHolder> mInnerWindowHolder;
|
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.
|
2011-06-24 06:18:01 +04:00
|
|
|
nsRefPtr<nsEventListenerManager> mListenerManager;
|
2011-07-08 22:04:25 +04: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.
|
2012-11-01 18:06:22 +04:00
|
|
|
mozilla::LinkedList<nsTimeout> mTimeouts;
|
2006-09-21 07:46:46 +04:00
|
|
|
// If mTimeoutInsertionPoint is non-null, insertions should happen after it.
|
2011-07-08 22:04:25 +04:00
|
|
|
// This is a dummy timeout at the moment; if that ever changes, the logic in
|
|
|
|
// ResetTimersForNonBackgroundWindow needs to change.
|
2006-09-21 07:46:46 +04:00
|
|
|
nsTimeout* mTimeoutInsertionPoint;
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t mTimeoutPublicIdCounter;
|
|
|
|
uint32_t mTimeoutFiringDepth;
|
2010-08-07 04:17:33 +04:00
|
|
|
nsRefPtr<nsLocation> mLocation;
|
2011-02-01 20:19:35 +03:00
|
|
|
nsRefPtr<nsHistory> mHistory;
|
2003-06-19 03:48:57 +04:00
|
|
|
|
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-08-12 08:11:00 +04:00
|
|
|
JSObject* mJSObject;
|
2005-07-31 20:44:28 +04:00
|
|
|
|
2011-01-14 17:39:21 +03:00
|
|
|
typedef nsCOMArray<nsIDOMStorageEvent> nsDOMStorageEventArray;
|
2010-01-28 17:53:53 +03:00
|
|
|
nsDOMStorageEventArray mPendingStorageEvents;
|
2006-05-19 09:57:36 +04:00
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t mTimeoutsSuspendDepth;
|
2009-02-17 23:07:39 +03: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 22:00:39 +04:00
|
|
|
// the method that was used to focus mFocusedNode
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t mFocusMethod;
|
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
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t mSerial;
|
2010-09-10 02:15:40 +04:00
|
|
|
|
2006-02-15 06:22:17 +03:00
|
|
|
#ifdef DEBUG
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mSetOpenerWindowCalled;
|
2008-04-29 01:51:11 +04:00
|
|
|
nsCOMPtr<nsIURI> mLastOpenedURI;
|
2006-02-15 06:22:17 +03:00
|
|
|
#endif
|
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mCleanedUp, mCallCleanUpAfterModalDialogCloses;
|
2010-03-12 07:42:05 +03:00
|
|
|
|
2008-01-17 00:54:33 +03:00
|
|
|
nsCOMPtr<nsIDOMOfflineResourceList> mApplicationCache;
|
|
|
|
|
2012-03-21 22:07:31 +04:00
|
|
|
nsDataHashtable<nsPtrHashKey<nsXBLPrototypeHandler>, JSObject*> mCachedXBLPrototypeHandlers;
|
2008-02-13 07:17:18 +03:00
|
|
|
|
2009-03-03 23:11:14 +03:00
|
|
|
nsCOMPtr<nsIDocument> mSuspendedDoc;
|
|
|
|
|
2010-06-28 20:44:30 +04:00
|
|
|
nsCOMPtr<nsIIDBFactory> mIndexedDB;
|
2010-06-23 23:46:08 +04:00
|
|
|
|
2012-08-13 23:03:59 +04:00
|
|
|
// This counts the number of windows that have been opened in rapid succession
|
|
|
|
// (i.e. within dom.successive_dialog_time_limit of each other). It is reset
|
|
|
|
// to 0 once a dialog is opened after dom.successive_dialog_time_limit seconds
|
|
|
|
// have elapsed without any other dialogs.
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t mDialogAbuseCount;
|
2010-09-17 05:24:14 +04:00
|
|
|
|
2012-08-13 23:03:59 +04:00
|
|
|
// This holds the time when the last modal dialog was shown. If more than
|
|
|
|
// MAX_DIALOG_LIMIT dialogs are shown within the time span defined by
|
|
|
|
// dom.successive_dialog_time_limit, we show a checkbox or confirmation prompt
|
|
|
|
// to allow disabling of further dialogs from this window.
|
2010-09-17 05:24:14 +04:00
|
|
|
TimeStamp mLastDialogQuitTime;
|
2012-08-13 23:03:59 +04:00
|
|
|
|
|
|
|
// This is set to true once the user has opted-in to preventing further
|
|
|
|
// dialogs for this window. Subsequent dialogs may still open if
|
|
|
|
// mDialogAbuseCount gets reset.
|
|
|
|
bool mStopAbuseDialogs;
|
2010-09-17 05:24:14 +04:00
|
|
|
|
2012-08-13 23:05:34 +04:00
|
|
|
// This flag gets set when dialogs should be permanently disabled for this
|
|
|
|
// window (e.g. when we are closing the tab and therefore are guaranteed to be
|
|
|
|
// destroying this window).
|
|
|
|
bool mDialogsPermanentlyDisabled;
|
|
|
|
|
2012-03-13 04:56:07 +04:00
|
|
|
nsTHashtable<nsPtrHashKey<nsDOMEventTargetHelper> > mEventTargetObjects;
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
nsTArray<uint32_t> mEnabledSensors;
|
2012-03-25 04:30:03 +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
|
|
|
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;
|
2012-11-29 10:36:15 +04:00
|
|
|
friend class nsDOMDesktopNotification;
|
2010-10-21 04:24:16 +04:00
|
|
|
|
2011-06-29 15:03:54 +04:00
|
|
|
static WindowByIdTable* sWindowsById;
|
2011-08-14 21:22:29 +04:00
|
|
|
static bool sWarnedAboutWindowInternal;
|
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)
|
|
|
|
{
|
2011-10-17 18:59:28 +04:00
|
|
|
mIsChrome = true;
|
|
|
|
mCleanMessageManager = true;
|
2011-01-23 22:51:00 +03: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 18:59:28 +04:00
|
|
|
mCleanMessageManager = false;
|
2005-07-31 00:57:07 +04:00
|
|
|
}
|
|
|
|
|
2011-06-21 18:51:49 +04:00
|
|
|
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsGlobalChromeWindow,
|
|
|
|
nsGlobalWindow)
|
2007-03-08 14:17:16 +03:00
|
|
|
|
2004-12-07 19:09:23 +03:00
|
|
|
nsCOMPtr<nsIBrowserDOMWindow> mBrowserDOMWindow;
|
2012-08-27 18:13:02 +04:00
|
|
|
nsCOMPtr<nsIMessageBroadcaster> mMessageManager;
|
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)
|
|
|
|
{
|
2011-10-17 18:59:28 +04:00
|
|
|
mIsModalContentWindow = true;
|
2007-07-26 21:52:26 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
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-09-16 02:54:00 +04:00
|
|
|
nsISupports *aState,
|
2011-09-29 10:19:26 +04:00
|
|
|
bool aForceReuseInnerWindow);
|
2009-10-07 04:09:16 +04:00
|
|
|
|
2007-07-26 21:52:26 +04:00
|
|
|
protected:
|
|
|
|
nsCOMPtr<nsIVariant> mReturnValue;
|
|
|
|
};
|
|
|
|
|
2004-02-24 06:22:35 +03:00
|
|
|
/* factory function */
|
2012-04-14 17:03:16 +04:00
|
|
|
inline already_AddRefed<nsGlobalWindow>
|
|
|
|
NS_NewScriptGlobalObject(bool aIsChrome, bool aIsModalContentWindow)
|
|
|
|
{
|
|
|
|
nsRefPtr<nsGlobalWindow> global;
|
|
|
|
|
|
|
|
if (aIsChrome) {
|
2012-07-30 18:20:58 +04:00
|
|
|
global = new nsGlobalChromeWindow(nullptr);
|
2012-04-14 17:03:16 +04:00
|
|
|
} else if (aIsModalContentWindow) {
|
2012-07-30 18:20:58 +04:00
|
|
|
global = new nsGlobalModalWindow(nullptr);
|
2012-04-14 17:03:16 +04:00
|
|
|
} else {
|
2012-07-30 18:20:58 +04:00
|
|
|
global = new nsGlobalWindow(nullptr);
|
2012-04-14 17:03:16 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
return global.forget();
|
|
|
|
}
|
2004-02-24 06:22:35 +03:00
|
|
|
|
1998-07-24 09:05:42 +04:00
|
|
|
#endif /* nsGlobalWindow_h___ */
|