2015-05-03 22:32:37 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 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___
|
|
|
|
|
2013-08-22 10:30:55 +04:00
|
|
|
#include "nsPIDOMWindow.h"
|
|
|
|
|
2013-08-15 22:17:48 +04:00
|
|
|
#include "nsTHashtable.h"
|
|
|
|
#include "nsHashKeys.h"
|
|
|
|
#include "nsRefPtrHashtable.h"
|
2014-05-23 16:51:56 +04:00
|
|
|
#include "nsInterfaceHashtable.h"
|
2010-09-17 05:24:14 +04:00
|
|
|
|
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"
|
2006-05-19 09:57:36 +04:00
|
|
|
#include "nsDataHashtable.h"
|
2013-06-18 14:00:38 +04:00
|
|
|
#include "nsJSThingHashtable.h"
|
2007-01-05 01:31:26 +03:00
|
|
|
#include "nsCycleCollectionParticipant.h"
|
2000-02-08 16:40:10 +03:00
|
|
|
|
|
|
|
// Interfaces Needed
|
2004-12-07 19:09:23 +03:00
|
|
|
#include "nsIBrowserDOMWindow.h"
|
2007-05-14 13:11:38 +04:00
|
|
|
#include "nsIDOMEventTarget.h"
|
2001-05-17 06:15:27 +04:00
|
|
|
#include "nsIInterfaceRequestor.h"
|
2002-02-09 06:36:55 +03:00
|
|
|
#include "nsIDOMChromeWindow.h"
|
2000-02-08 16:40:10 +03:00
|
|
|
#include "nsIScriptGlobalObject.h"
|
2013-09-09 07:28:48 +04:00
|
|
|
#include "nsIScriptObjectPrincipal.h"
|
2000-02-08 16:40:10 +03:00
|
|
|
#include "nsITimer.h"
|
2007-07-26 21:52:26 +04:00
|
|
|
#include "nsIDOMModalContentWindow.h"
|
2014-03-17 10:56:53 +04:00
|
|
|
#include "mozilla/EventListenerManager.h"
|
2000-07-14 01:48:25 +04:00
|
|
|
#include "nsIPrincipal.h"
|
2002-02-20 06:33:52 +03:00
|
|
|
#include "nsSize.h"
|
2017-01-05 09:54:02 +03:00
|
|
|
#include "mozilla/FlushType.h"
|
2005-07-31 00:57:07 +04:00
|
|
|
#include "prclist.h"
|
2016-12-22 22:05:54 +03:00
|
|
|
#include "mozilla/dom/BindingDeclarations.h"
|
2014-05-23 11:33:24 +04:00
|
|
|
#include "mozilla/dom/StorageEvent.h"
|
|
|
|
#include "mozilla/dom/StorageEventBinding.h"
|
2014-07-25 05:30:07 +04:00
|
|
|
#include "mozilla/dom/UnionTypes.h"
|
2015-09-26 00:03:51 +03:00
|
|
|
#include "mozilla/ErrorResult.h"
|
2010-05-18 16:28:37 +04:00
|
|
|
#include "nsFrameMessageManager.h"
|
2016-05-11 03:57:29 +03:00
|
|
|
#include "mozilla/Attributes.h"
|
|
|
|
#include "mozilla/GuardObjects.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"
|
2012-04-21 00:43:48 +04:00
|
|
|
#include "nsWrapperCacheInlines.h"
|
2012-06-29 12:32:21 +04:00
|
|
|
#include "nsIIdleObserver.h"
|
2013-04-25 19:13:21 +04:00
|
|
|
#include "nsIDocument.h"
|
2013-01-29 17:44:01 +04:00
|
|
|
#include "mozilla/dom/EventTarget.h"
|
2014-08-06 02:01:32 +04:00
|
|
|
#include "mozilla/dom/WindowBinding.h"
|
2013-07-01 11:14:24 +04:00
|
|
|
#include "Units.h"
|
2013-09-06 21:50:24 +04:00
|
|
|
#include "nsComponentManagerUtils.h"
|
2015-03-29 17:59:08 +03:00
|
|
|
#include "nsSize.h"
|
2015-04-24 01:05:29 +03:00
|
|
|
#include "nsCheapSets.h"
|
2015-07-30 21:47:00 +03:00
|
|
|
#include "mozilla/dom/ImageBitmapSource.h"
|
2016-12-03 01:22:48 +03:00
|
|
|
#include "mozilla/UniquePtr.h"
|
2013-01-29 17:44:01 +04:00
|
|
|
|
1999-04-29 00:33:43 +04:00
|
|
|
#define DEFAULT_HOME_PAGE "www.mozilla.org"
|
|
|
|
#define PREF_BROWSER_STARTUP_HOMEPAGE "browser.startup.homepage"
|
|
|
|
|
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
|
|
|
|
|
2013-08-15 22:17:48 +04:00
|
|
|
class nsIArray;
|
|
|
|
class nsIBaseWindow;
|
2013-03-22 04:05:20 +04:00
|
|
|
class nsIContent;
|
2013-10-08 19:51:42 +04:00
|
|
|
class nsICSSDeclaration;
|
2013-08-15 22:17:48 +04:00
|
|
|
class nsIDocShellTreeOwner;
|
|
|
|
class nsIDOMOfflineResourceList;
|
2009-09-03 07:57:46 +04:00
|
|
|
class nsIScrollableFrame;
|
2007-10-13 20:42:44 +04:00
|
|
|
class nsIControllers;
|
2014-02-16 01:12:33 +04:00
|
|
|
class nsIJSID;
|
2013-08-15 22:17:48 +04:00
|
|
|
class nsIScriptContext;
|
|
|
|
class nsIScriptTimeoutHandler;
|
2016-10-05 15:26:08 +03:00
|
|
|
class nsITimeoutHandler;
|
2013-08-15 22:17:48 +04:00
|
|
|
class nsIWebBrowserChrome;
|
2016-10-07 21:59:59 +03:00
|
|
|
class mozIDOMWindowProxy;
|
1998-07-24 09:05:42 +04:00
|
|
|
|
2013-08-15 22:17:48 +04:00
|
|
|
class nsDOMWindowList;
|
2004-12-10 22:48:22 +03:00
|
|
|
class nsScreen;
|
|
|
|
class nsHistory;
|
2006-05-04 01:53:08 +04:00
|
|
|
class nsGlobalWindowObserver;
|
2006-09-21 07:46:46 +04:00
|
|
|
class nsGlobalWindow;
|
2012-04-02 06:23:51 +04:00
|
|
|
class nsDOMWindowUtils;
|
2012-06-29 12:32:21 +04:00
|
|
|
class nsIIdleService;
|
2013-09-07 06:15:49 +04:00
|
|
|
struct nsRect;
|
2007-05-29 13:45:30 +04:00
|
|
|
|
2012-02-02 01:58:01 +04:00
|
|
|
class nsWindowSizes;
|
|
|
|
|
2016-11-08 15:54:40 +03:00
|
|
|
class IdleRequestExecutor;
|
|
|
|
|
2011-11-02 17:44:16 +04:00
|
|
|
namespace mozilla {
|
2016-12-01 13:33:05 +03:00
|
|
|
class AbstractThread;
|
2014-04-01 10:13:50 +04:00
|
|
|
class DOMEventTargetHelper;
|
2016-11-07 23:30:17 +03:00
|
|
|
class ThrottledEventQueue;
|
2011-11-02 17:44:16 +04:00
|
|
|
namespace dom {
|
2013-05-31 14:30:00 +04:00
|
|
|
class BarProp;
|
2016-04-27 06:47:22 +03:00
|
|
|
struct ChannelPixelLayout;
|
2014-02-28 03:39:00 +04:00
|
|
|
class Console;
|
2015-02-02 17:36:04 +03:00
|
|
|
class Crypto;
|
2016-10-12 10:26:02 +03:00
|
|
|
class CustomElementRegistry;
|
2016-10-07 21:59:59 +03:00
|
|
|
class DocGroup;
|
2014-03-28 08:03:03 +04:00
|
|
|
class External;
|
2013-10-08 19:51:42 +04:00
|
|
|
class Function;
|
2013-08-15 22:17:48 +04:00
|
|
|
class Gamepad;
|
2017-01-12 04:23:37 +03:00
|
|
|
enum class ImageBitmapFormat : uint8_t;
|
2016-08-22 15:52:45 +03:00
|
|
|
class IdleRequest;
|
|
|
|
class IdleRequestCallback;
|
2016-11-08 15:54:40 +03:00
|
|
|
class IncrementalRunnable;
|
2017-03-10 11:36:09 +03:00
|
|
|
#ifdef ENABLE_INTL_API
|
2017-03-04 05:30:00 +03:00
|
|
|
class IntlUtils;
|
2017-03-10 11:36:09 +03:00
|
|
|
#endif
|
2016-09-16 10:18:18 +03:00
|
|
|
class Location;
|
2013-12-16 18:03:34 +04:00
|
|
|
class MediaQueryList;
|
2014-08-26 18:11:15 +04:00
|
|
|
class MozSelfSupport;
|
2011-11-02 17:44:16 +04:00
|
|
|
class Navigator;
|
2014-03-28 08:03:03 +04:00
|
|
|
class OwningExternalOrWindowProxy;
|
2014-07-25 05:30:07 +04:00
|
|
|
class Promise;
|
2015-06-17 13:44:27 +03:00
|
|
|
class PostMessageEvent;
|
2014-10-01 22:43:26 +04:00
|
|
|
struct RequestInit;
|
2014-11-20 14:58:00 +03:00
|
|
|
class RequestOrUSVString;
|
2014-04-10 20:09:40 +04:00
|
|
|
class Selection;
|
2013-04-07 16:19:56 +04:00
|
|
|
class SpeechSynthesis;
|
2016-10-07 21:59:59 +03:00
|
|
|
class TabGroup;
|
2016-08-22 15:52:19 +03:00
|
|
|
class Timeout;
|
2016-02-09 18:43:00 +03:00
|
|
|
class U2F;
|
2016-04-13 03:39:28 +03:00
|
|
|
class VRDisplay;
|
2016-10-19 01:18:10 +03:00
|
|
|
enum class VRDisplayEventReason : uint8_t;
|
2016-07-05 01:46:49 +03:00
|
|
|
class VREventObserver;
|
2014-01-07 16:16:07 +04:00
|
|
|
class WakeLock;
|
2015-10-24 07:37:28 +03:00
|
|
|
#if defined(MOZ_WIDGET_ANDROID) || defined(MOZ_WIDGET_GONK)
|
|
|
|
class WindowOrientationObserver;
|
|
|
|
#endif
|
2016-11-06 11:53:34 +03:00
|
|
|
class Worklet;
|
2015-03-02 16:22:00 +03:00
|
|
|
namespace cache {
|
|
|
|
class CacheStorage;
|
|
|
|
} // namespace cache
|
2013-03-31 12:18:30 +04:00
|
|
|
class IDBFactory;
|
2011-11-02 17:44:16 +04:00
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|
|
|
|
|
2013-10-08 19:51:42 +04:00
|
|
|
extern already_AddRefed<nsIScriptTimeoutHandler>
|
2015-09-04 02:03:19 +03:00
|
|
|
NS_CreateJSTimeoutHandler(JSContext* aCx, nsGlobalWindow *aWindow,
|
2013-10-08 19:51:42 +04:00
|
|
|
mozilla::dom::Function& aFunction,
|
|
|
|
const mozilla::dom::Sequence<JS::Value>& aArguments,
|
|
|
|
mozilla::ErrorResult& aError);
|
|
|
|
|
|
|
|
extern already_AddRefed<nsIScriptTimeoutHandler>
|
|
|
|
NS_CreateJSTimeoutHandler(JSContext* aCx, nsGlobalWindow *aWindow,
|
|
|
|
const nsAString& aExpression,
|
|
|
|
mozilla::ErrorResult& aError);
|
|
|
|
|
2015-05-04 09:57:52 +03:00
|
|
|
extern const js::Class OuterWindowProxyClass;
|
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2013-05-17 21:43:19 +04:00
|
|
|
// Helper class to manage modal dialog arguments and all their quirks.
|
|
|
|
//
|
|
|
|
// Given our clunky embedding APIs, modal dialog arguments need to be passed
|
|
|
|
// as an nsISupports parameter to WindowWatcher, get stuck inside an array of
|
|
|
|
// length 1, and then passed back to the newly-created dialog.
|
|
|
|
//
|
|
|
|
// However, we need to track both the caller-passed value as well as the
|
|
|
|
// caller's, so that we can do an origin check (even for primitives) when the
|
|
|
|
// value is accessed. This class encapsulates that magic.
|
2013-05-17 21:43:19 +04:00
|
|
|
//
|
|
|
|
// We also use the same machinery for |returnValue|, which needs similar origin
|
|
|
|
// checks.
|
2015-03-21 21:35:18 +03:00
|
|
|
class DialogValueHolder final : public nsISupports
|
2013-05-17 21:43:19 +04:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
|
|
|
NS_DECL_CYCLE_COLLECTION_CLASS(DialogValueHolder)
|
|
|
|
|
|
|
|
DialogValueHolder(nsIPrincipal* aSubject, nsIVariant* aValue)
|
|
|
|
: mOrigin(aSubject)
|
|
|
|
, mValue(aValue) {}
|
2015-10-07 23:11:09 +03:00
|
|
|
nsresult Get(nsIPrincipal* aSubject, nsIVariant** aResult);
|
2014-04-08 15:40:37 +04:00
|
|
|
void Get(JSContext* aCx, JS::Handle<JSObject*> aScope, nsIPrincipal* aSubject,
|
2015-10-26 19:55:45 +03:00
|
|
|
JS::MutableHandle<JS::Value> aResult, mozilla::ErrorResult& aError);
|
2013-05-17 21:43:19 +04:00
|
|
|
private:
|
2014-06-23 23:56:07 +04:00
|
|
|
virtual ~DialogValueHolder() {}
|
|
|
|
|
2013-05-17 21:43:19 +04:00
|
|
|
nsCOMPtr<nsIPrincipal> mOrigin;
|
|
|
|
nsCOMPtr<nsIVariant> mValue;
|
|
|
|
};
|
|
|
|
|
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
|
|
|
|
2016-01-30 20:05:36 +03:00
|
|
|
// NB: Currently nsPIDOMWindowInner and nsPIDOMWindowOuter are identical classes
|
|
|
|
// with identical member variables and identical vtables, that only differ in
|
|
|
|
// type name. nsGlobalWindow doesn't want to doubly inherit (and have two
|
|
|
|
// copies of everything), and it also doesn't want to privilege one over
|
|
|
|
// the other by making it possible to convert types through the C++ type system
|
|
|
|
// instead of our accessor methods (AsInner and AsOuter) that do dynamic
|
|
|
|
// checking. So we inherit from nsPIDOMWindow<nsISupports>, which is also
|
|
|
|
// identical to both nsPIDOMWindowInner and nsPIDOMWindowOuter, but not
|
|
|
|
// convertible to either.
|
|
|
|
|
2013-01-29 17:44:01 +04:00
|
|
|
class nsGlobalWindow : public mozilla::dom::EventTarget,
|
2016-01-30 20:05:36 +03:00
|
|
|
public nsPIDOMWindow<nsISupports>,
|
2016-02-05 21:12:25 +03:00
|
|
|
private nsIDOMWindowInternal,
|
2005-07-31 23:43:27 +04:00
|
|
|
public nsIScriptGlobalObject,
|
2013-09-09 07:28:48 +04:00
|
|
|
public nsIScriptObjectPrincipal,
|
2004-12-10 22:48:22 +03:00
|
|
|
public nsSupportsWeakReference,
|
2005-07-31 00:57:07 +04:00
|
|
|
public nsIInterfaceRequestor,
|
2014-09-06 07:33:37 +04:00
|
|
|
public PRCListStr
|
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-06-29 15:06:43 +04:00
|
|
|
typedef nsDataHashtable<nsUint64HashKey, nsGlobalWindow*> WindowByIdTable;
|
2010-09-17 05:24:14 +04:00
|
|
|
|
2015-01-06 01:53:37 +03:00
|
|
|
static void
|
|
|
|
AssertIsOnMainThread()
|
|
|
|
#ifdef DEBUG
|
|
|
|
;
|
|
|
|
#else
|
|
|
|
{ }
|
|
|
|
#endif
|
|
|
|
|
2016-01-30 20:05:36 +03:00
|
|
|
static nsGlobalWindow* Cast(nsPIDOMWindowInner* aPIWin) {
|
|
|
|
return static_cast<nsGlobalWindow*>(
|
|
|
|
reinterpret_cast<nsPIDOMWindow<nsISupports>*>(aPIWin));
|
|
|
|
}
|
2016-10-10 22:09:00 +03:00
|
|
|
static const nsGlobalWindow* Cast(const nsPIDOMWindowInner* aPIWin) {
|
|
|
|
return static_cast<const nsGlobalWindow*>(
|
|
|
|
reinterpret_cast<const nsPIDOMWindow<nsISupports>*>(aPIWin));
|
|
|
|
}
|
2016-01-30 20:05:36 +03:00
|
|
|
static nsGlobalWindow* Cast(mozIDOMWindow* aWin) {
|
|
|
|
return Cast(nsPIDOMWindowInner::From(aWin));
|
|
|
|
}
|
|
|
|
static nsGlobalWindow* Cast(nsPIDOMWindowOuter* aPIWin) {
|
|
|
|
return static_cast<nsGlobalWindow*>(
|
|
|
|
reinterpret_cast<nsPIDOMWindow<nsISupports>*>(aPIWin));
|
2017-02-16 22:39:28 +03:00
|
|
|
}
|
|
|
|
static const nsGlobalWindow* Cast(const nsPIDOMWindowOuter* aPIWin) {
|
|
|
|
return static_cast<const nsGlobalWindow*>(
|
|
|
|
reinterpret_cast<const nsPIDOMWindow<nsISupports>*>(aPIWin));
|
2016-01-30 20:05:36 +03:00
|
|
|
}
|
|
|
|
static nsGlobalWindow* Cast(mozIDOMWindowProxy* aWin) {
|
|
|
|
return Cast(nsPIDOMWindowOuter::From(aWin));
|
|
|
|
}
|
2015-09-26 00:03:51 +03:00
|
|
|
|
2004-05-04 01:48:36 +04:00
|
|
|
// public methods
|
2016-01-30 20:05:36 +03:00
|
|
|
nsPIDOMWindowOuter* GetPrivateParent();
|
2014-05-25 22:31:07 +04:00
|
|
|
|
2004-05-04 01:48:36 +04:00
|
|
|
// 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
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual JSObject *WrapObject(JSContext *cx, JS::Handle<JSObject*> aGivenProto) override
|
2011-08-20 17:53:34 +04:00
|
|
|
{
|
2016-01-30 20:05:36 +03:00
|
|
|
return IsInnerWindow() || AsOuter()->EnsureInnerWindow() ? GetWrapper() : nullptr;
|
2011-08-20 17:53:34 +04:00
|
|
|
}
|
|
|
|
|
2013-04-04 13:27:06 +04:00
|
|
|
// nsIGlobalJSObjectHolder
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual JSObject* GetGlobalJSObject() override;
|
2013-04-04 13:27:06 +04:00
|
|
|
|
2001-01-18 10:44:29 +03:00
|
|
|
// nsIScriptGlobalObject
|
2013-11-20 17:55:09 +04:00
|
|
|
JSObject *FastGetGlobalJSObject() const
|
2010-06-08 20:13:08 +04:00
|
|
|
{
|
2013-11-09 14:20:22 +04:00
|
|
|
return GetWrapperPreserveColor();
|
2010-06-08 20:13:08 +04:00
|
|
|
}
|
2013-11-09 14:20:22 +04:00
|
|
|
|
2013-03-29 00:37:22 +04:00
|
|
|
void TraceGlobalJSObject(JSTracer* aTrc);
|
2006-06-13 07:07:47 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual nsresult EnsureScriptEnvironment() override;
|
2006-06-13 07:07:47 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual nsIScriptContext *GetScriptContext() override;
|
2006-06-13 07:07:47 +04:00
|
|
|
|
2013-04-03 00:08:41 +04:00
|
|
|
void PoisonOuterWindowProxy(JSObject *aObject);
|
2001-01-18 10:44:29 +03:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual bool IsBlackForCC(bool aTracingNeeded = true) override;
|
2012-01-26 19:03:21 +04:00
|
|
|
|
2001-01-18 10:44:29 +03:00
|
|
|
// nsIScriptObjectPrincipal
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual nsIPrincipal* GetPrincipal() override;
|
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
|
|
|
|
2015-07-17 08:10:35 +03:00
|
|
|
nsresult
|
|
|
|
OpenJS(const nsAString& aUrl, const nsAString& aName,
|
2016-01-30 20:05:36 +03:00
|
|
|
const nsAString& aOptions, nsPIDOMWindowOuter **_retval);
|
2015-07-17 08:10:35 +03:00
|
|
|
void CaptureEvents();
|
|
|
|
void ReleaseEvents();
|
|
|
|
void Dump(const nsAString& aStr);
|
|
|
|
void SetResizable(bool aResizable) const;
|
2001-01-18 10:44:29 +03:00
|
|
|
|
|
|
|
// nsIDOMEventTarget
|
2002-11-09 03:25:25 +03:00
|
|
|
NS_DECL_NSIDOMEVENTTARGET
|
2013-10-23 03:32:04 +04:00
|
|
|
|
2014-03-17 10:56:53 +04:00
|
|
|
virtual mozilla::EventListenerManager*
|
2015-03-21 19:28:04 +03:00
|
|
|
GetExistingListenerManager() const override;
|
2013-10-23 03:32:04 +04:00
|
|
|
|
2014-03-17 10:56:53 +04:00
|
|
|
virtual mozilla::EventListenerManager*
|
2015-03-21 19:28:04 +03:00
|
|
|
GetOrCreateListenerManager() override;
|
2013-10-23 03:32:04 +04:00
|
|
|
|
2013-04-17 01:16:08 +04:00
|
|
|
using mozilla::dom::EventTarget::RemoveEventListener;
|
|
|
|
virtual void AddEventListener(const nsAString& aType,
|
2013-09-24 04:25:17 +04:00
|
|
|
mozilla::dom::EventListener* aListener,
|
2016-04-26 11:23:17 +03:00
|
|
|
const mozilla::dom::AddEventListenerOptionsOrBoolean& aOptions,
|
2013-04-17 01:16:08 +04:00
|
|
|
const mozilla::dom::Nullable<bool>& aWantsUntrusted,
|
2015-03-21 19:28:04 +03:00
|
|
|
mozilla::ErrorResult& aRv) override;
|
2016-01-30 20:05:36 +03:00
|
|
|
virtual nsPIDOMWindowOuter* GetOwnerGlobalForBindings() override;
|
2002-11-09 03:25:25 +03:00
|
|
|
|
2015-05-12 22:56:39 +03:00
|
|
|
virtual nsIGlobalObject* GetOwnerGlobal() const override
|
|
|
|
{
|
|
|
|
if (IsOuterWindow()) {
|
|
|
|
return GetCurrentInnerWindowInternal();
|
|
|
|
}
|
|
|
|
|
|
|
|
return const_cast<nsGlobalWindow*>(this);
|
|
|
|
}
|
|
|
|
|
2001-01-18 10:44:29 +03:00
|
|
|
// nsPIDOMWindow
|
2016-01-30 20:05:36 +03:00
|
|
|
virtual nsPIDOMWindowOuter* GetPrivateRoot() override;
|
2013-11-28 18:07:55 +04:00
|
|
|
|
|
|
|
// Outer windows only.
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual void ActivateOrDeactivate(bool aActivate) override;
|
|
|
|
virtual void SetActive(bool aActive) override;
|
2016-02-24 20:43:07 +03:00
|
|
|
virtual bool IsTopLevelWindowActive() override;
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual void SetIsBackground(bool aIsBackground) override;
|
|
|
|
virtual void SetChromeEventHandler(mozilla::dom::EventTarget* aChromeEventHandler) override;
|
2004-05-04 01:48:36 +04:00
|
|
|
|
2014-05-20 23:50:58 +04:00
|
|
|
// Outer windows only.
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual void SetInitialPrincipalToSubject() override;
|
2002-04-17 08:17:16 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual PopupControlState PushPopupControlState(PopupControlState state, bool aForce) const override;
|
|
|
|
virtual void PopPopupControlState(PopupControlState state) const override;
|
|
|
|
virtual PopupControlState GetPopupControlState() const override;
|
2004-09-04 23:28:46 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual already_AddRefed<nsISupports> SaveWindowState() override;
|
|
|
|
virtual nsresult RestoreWindowState(nsISupports *aState) override;
|
2016-10-26 20:20:15 +03:00
|
|
|
|
2017-03-02 19:36:36 +03:00
|
|
|
void Suspend();
|
|
|
|
void Resume();
|
2016-10-26 20:20:16 +03:00
|
|
|
virtual bool IsSuspended() const override;
|
2017-03-02 19:36:36 +03:00
|
|
|
void Freeze();
|
|
|
|
void Thaw();
|
2016-10-26 20:20:16 +03:00
|
|
|
virtual bool IsFrozen() const override;
|
2017-03-02 19:36:36 +03:00
|
|
|
void SyncStateFromParentWindow();
|
2016-10-26 20:20:15 +03:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual nsresult FireDelayedDOMEvents() override;
|
2005-07-31 00:57:07 +04:00
|
|
|
|
2014-05-20 23:50:58 +04:00
|
|
|
// Outer windows only.
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual bool WouldReuseInnerWindow(nsIDocument* aNewDocument) override;
|
2006-03-07 20:08:51 +03:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual void SetDocShell(nsIDocShell* aDocShell) override;
|
|
|
|
virtual void DetachFromDocShell() override;
|
2014-06-02 16:08:21 +04:00
|
|
|
virtual nsresult SetNewDocument(nsIDocument *aDocument,
|
2015-01-03 05:13:39 +03:00
|
|
|
nsISupports *aState,
|
2015-03-21 19:28:04 +03:00
|
|
|
bool aForceReuseInnerWindow) override;
|
2014-05-20 23:50:59 +04:00
|
|
|
|
|
|
|
// Outer windows only.
|
2010-06-10 20:23:40 +04:00
|
|
|
void DispatchDOMWindowCreated();
|
2014-05-20 23:50:59 +04:00
|
|
|
|
2016-01-30 20:05:36 +03:00
|
|
|
virtual void SetOpenerWindow(nsPIDOMWindowOuter* aOpener,
|
2015-03-21 19:28:04 +03:00
|
|
|
bool aOriginalOpener) override;
|
2013-11-28 18:07:55 +04:00
|
|
|
|
2013-07-01 11:14:24 +04:00
|
|
|
// Outer windows only.
|
2017-04-18 05:28:52 +03:00
|
|
|
virtual void EnsureSizeAndPositionUpToDate() override;
|
2005-08-23 04:24:57 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual void EnterModalState() override;
|
|
|
|
virtual void LeaveModalState() override;
|
2006-07-06 02:48:04 +04:00
|
|
|
|
2014-05-20 23:50:58 +04:00
|
|
|
// Outer windows only.
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual bool CanClose() override;
|
|
|
|
virtual void ForceClose() override;
|
2014-06-29 19:31:12 +04:00
|
|
|
|
2015-04-03 03:45:50 +03:00
|
|
|
virtual void MaybeUpdateTouchState() override;
|
|
|
|
|
2014-06-29 19:31:12 +04:00
|
|
|
// Outer windows only.
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual bool DispatchCustomEvent(const nsAString& aEventName) override;
|
2014-06-29 19:31:12 +04:00
|
|
|
bool DispatchResizeEvent(const mozilla::CSSIntSize& aSize);
|
|
|
|
|
2014-06-29 19:36:01 +04:00
|
|
|
// Inner windows only.
|
2016-02-04 00:30:45 +03:00
|
|
|
void RefreshCompartmentPrincipal();
|
2014-06-29 19:36:01 +04:00
|
|
|
|
2015-07-13 13:44:36 +03:00
|
|
|
// For accessing protected field mFullScreen
|
|
|
|
friend class FullscreenTransitionTask;
|
|
|
|
|
2014-06-29 19:35:56 +04:00
|
|
|
// Outer windows only.
|
2015-07-09 01:00:33 +03:00
|
|
|
virtual nsresult SetFullscreenInternal(
|
2016-05-27 23:49:04 +03:00
|
|
|
FullscreenReason aReason, bool aIsFullscreen) override final;
|
2015-06-10 14:13:12 +03:00
|
|
|
virtual void FinishFullscreenChange(bool aIsFullscreen) override final;
|
2016-01-12 07:18:47 +03:00
|
|
|
bool SetWidgetFullscreen(FullscreenReason aReason, bool aIsFullscreen,
|
2015-08-27 16:14:49 +03:00
|
|
|
nsIWidget* aWidget, nsIScreen* aScreen);
|
2014-06-29 19:35:56 +04:00
|
|
|
bool FullScreen() const;
|
|
|
|
|
2014-06-29 19:36:02 +04:00
|
|
|
// Inner windows only.
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual void SetHasGamepadEventListener(bool aHasGamepad = true) override;
|
2016-07-05 01:46:49 +03:00
|
|
|
void NotifyVREventListenerAdded();
|
2017-02-04 03:49:15 +03:00
|
|
|
bool HasUsedVR() const;
|
2017-04-18 14:51:27 +03:00
|
|
|
|
|
|
|
using EventTarget::EventListenerAdded;
|
2016-07-05 01:46:49 +03:00
|
|
|
virtual void EventListenerAdded(nsIAtom* aType) override;
|
2011-08-03 22:12:08 +04:00
|
|
|
|
2001-05-17 06:15:27 +04:00
|
|
|
// nsIInterfaceRequestor
|
|
|
|
NS_DECL_NSIINTERFACEREQUESTOR
|
|
|
|
|
2012-10-02 12:07:35 +04:00
|
|
|
// WebIDL interface.
|
2016-01-30 20:05:36 +03:00
|
|
|
already_AddRefed<nsPIDOMWindowOuter> IndexedGetterOuter(uint32_t aIndex);
|
|
|
|
already_AddRefed<nsPIDOMWindowOuter> IndexedGetter(uint32_t aIndex);
|
2012-10-02 12:07:35 +04:00
|
|
|
|
2015-01-26 21:26:33 +03:00
|
|
|
static bool IsPrivilegedChromeWindow(JSContext* /* unused */, JSObject* aObj);
|
2014-02-06 08:36:59 +04:00
|
|
|
|
2014-07-26 09:41:10 +04:00
|
|
|
static bool IsShowModalDialogEnabled(JSContext* /* unused */ = nullptr,
|
|
|
|
JSObject* /* unused */ = nullptr);
|
|
|
|
|
2014-11-08 03:07:12 +03:00
|
|
|
bool DoResolve(JSContext* aCx, JS::Handle<JSObject*> aObj,
|
|
|
|
JS::Handle<jsid> aId,
|
2016-01-28 13:28:04 +03:00
|
|
|
JS::MutableHandle<JS::PropertyDescriptor> aDesc);
|
2015-04-28 19:25:55 +03:00
|
|
|
// The return value is whether DoResolve might end up resolving the given id.
|
|
|
|
// If in doubt, return true.
|
|
|
|
static bool MayResolve(jsid aId);
|
2014-01-30 10:33:25 +04:00
|
|
|
|
2014-01-30 10:33:27 +04:00
|
|
|
void GetOwnPropertyNames(JSContext* aCx, nsTArray<nsString>& aNames,
|
|
|
|
mozilla::ErrorResult& aRv);
|
|
|
|
|
2001-01-18 10:44:29 +03:00
|
|
|
// Object Management
|
2014-08-27 06:42:13 +04:00
|
|
|
static already_AddRefed<nsGlobalWindow> Create(nsGlobalWindow *aOuterWindow);
|
2005-07-31 00:57:07 +04:00
|
|
|
|
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-04-06 04:44:15 +04:00
|
|
|
return (nsGlobalWindow *)(mozilla::dom::EventTarget *)supports;
|
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
|
|
|
}
|
2016-01-30 20:05:36 +03:00
|
|
|
already_AddRefed<nsPIDOMWindowOuter> GetTop() override;
|
|
|
|
nsPIDOMWindowOuter* GetScriptableTop() override;
|
2015-10-27 00:37:32 +03:00
|
|
|
inline nsGlobalWindow *GetTopInternal()
|
2010-09-17 05:24:14 +04:00
|
|
|
{
|
2015-10-27 00:37:32 +03:00
|
|
|
nsGlobalWindow* outer = IsOuterWindow() ? this : GetOuterWindowInternal();
|
2016-01-30 20:05:36 +03:00
|
|
|
nsCOMPtr<nsPIDOMWindowOuter> top = outer ? outer->GetTop() : nullptr;
|
|
|
|
if (top) {
|
|
|
|
return nsGlobalWindow::Cast(top);
|
|
|
|
}
|
2012-07-30 18:20:58 +04:00
|
|
|
return nullptr;
|
2012-06-07 18:43:23 +04:00
|
|
|
}
|
|
|
|
|
2015-10-27 00:37:32 +03:00
|
|
|
inline nsGlobalWindow* GetScriptableTopInternal()
|
2012-06-07 18:43:23 +04:00
|
|
|
{
|
2016-01-30 20:05:36 +03:00
|
|
|
nsPIDOMWindowOuter* top = GetScriptableTop();
|
|
|
|
return nsGlobalWindow::Cast(top);
|
2010-09-17 05:24:14 +04:00
|
|
|
}
|
|
|
|
|
2016-01-30 20:05:36 +03:00
|
|
|
nsPIDOMWindowOuter* GetChildWindow(const nsAString& aName);
|
2013-03-15 09:38:26 +04:00
|
|
|
|
2013-10-09 01:00:12 +04:00
|
|
|
// These return true if we've reached the state in this top level window
|
|
|
|
// where we ask the user if further dialogs should be blocked.
|
|
|
|
//
|
|
|
|
// DialogsAreBeingAbused must be called on the scriptable top inner window.
|
|
|
|
//
|
|
|
|
// ShouldPromptToBlockDialogs is implemented in terms of
|
|
|
|
// DialogsAreBeingAbused, and will get the scriptable top inner window
|
|
|
|
// automatically.
|
2013-11-28 18:07:55 +04:00
|
|
|
// Outer windows only.
|
2013-10-09 01:00:12 +04:00
|
|
|
bool ShouldPromptToBlockDialogs();
|
2013-11-28 18:07:55 +04:00
|
|
|
// Inner windows only.
|
2012-08-13 23:03:59 +04:00
|
|
|
bool DialogsAreBeingAbused();
|
2010-09-17 05:24:14 +04:00
|
|
|
|
2013-10-09 01:00:12 +04:00
|
|
|
// These functions are used for controlling and determining whether dialogs
|
2016-05-11 03:57:29 +03:00
|
|
|
// (alert, prompt, confirm) are currently allowed in this window. If you want
|
|
|
|
// to temporarily disable dialogs, please use TemporarilyDisableDialogs, not
|
|
|
|
// EnableDialogs/DisableDialogs, because correctly determining whether to
|
|
|
|
// re-enable dialogs is actually quite difficult.
|
2013-10-09 01:00:12 +04:00
|
|
|
void EnableDialogs();
|
|
|
|
void DisableDialogs();
|
2014-05-20 23:50:59 +04:00
|
|
|
// Outer windows only.
|
2013-10-09 01:00:12 +04:00
|
|
|
bool AreDialogsEnabled();
|
2010-09-17 05:24:14 +04:00
|
|
|
|
2016-05-11 03:57:29 +03:00
|
|
|
class MOZ_RAII TemporarilyDisableDialogs
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
// Takes an inner _or_ outer window.
|
|
|
|
explicit TemporarilyDisableDialogs(nsGlobalWindow* aWindow
|
|
|
|
MOZ_GUARD_OBJECT_NOTIFIER_PARAM);
|
|
|
|
~TemporarilyDisableDialogs();
|
|
|
|
|
|
|
|
private:
|
|
|
|
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
|
|
|
|
|
|
|
|
// Always an inner window; this is the window whose dialog state we messed
|
|
|
|
// with. We just want to keep it alive, because we plan to poke at its
|
|
|
|
// members in our destructor.
|
|
|
|
RefPtr<nsGlobalWindow> mTopWindow;
|
|
|
|
// This is not a AutoRestore<bool> because that would require careful
|
|
|
|
// member destructor ordering, which is a bit fragile. This way we can
|
|
|
|
// explicitly restore things before we drop our ref to mTopWindow.
|
|
|
|
bool mSavedDialogsEnabled;
|
|
|
|
};
|
|
|
|
friend class TemporarilyDisableDialogs;
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsGlobalWindow *GetOuterWindowInternal()
|
|
|
|
{
|
2016-01-30 20:05:36 +03:00
|
|
|
return nsGlobalWindow::Cast(GetOuterWindow());
|
2005-07-31 00:57:07 +04:00
|
|
|
}
|
|
|
|
|
2016-01-30 20:05:36 +03:00
|
|
|
nsGlobalWindow* GetCurrentInnerWindowInternal() const
|
2005-07-31 00:57:07 +04:00
|
|
|
{
|
2014-08-19 23:02:05 +04:00
|
|
|
MOZ_ASSERT(IsOuterWindow());
|
2016-01-30 20:05:36 +03:00
|
|
|
return nsGlobalWindow::Cast(mInnerWindow);
|
2005-07-31 00:57:07 +04:00
|
|
|
}
|
|
|
|
|
2016-01-30 20:05:36 +03:00
|
|
|
nsGlobalWindow* EnsureInnerWindowInternal()
|
2005-12-11 23:38:29 +03:00
|
|
|
{
|
2016-01-30 20:05:36 +03:00
|
|
|
return nsGlobalWindow::Cast(AsOuter()->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
|
|
|
{
|
2016-01-30 20:05:36 +03:00
|
|
|
return mCreatingInnerWindow;
|
2006-11-17 04:06:41 +03:00
|
|
|
}
|
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
bool IsChromeWindow() const
|
2007-08-03 03:34:38 +04:00
|
|
|
{
|
|
|
|
return mIsChrome;
|
|
|
|
}
|
|
|
|
|
2014-02-06 01:09:18 +04:00
|
|
|
using nsPIDOMWindow::IsModalContentWindow;
|
|
|
|
static bool IsModalContentWindow(JSContext* aCx, JSObject* aGlobal);
|
|
|
|
|
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,
|
2014-01-04 19:02:17 +04:00
|
|
|
const char16_t* aData);
|
2005-08-20 00:09:38 +04:00
|
|
|
|
2013-11-28 18:07:55 +04:00
|
|
|
// Outer windows only.
|
2013-05-21 21:45:56 +04:00
|
|
|
void UnblockScriptedClosing();
|
|
|
|
|
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();
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 21:42:36 +04:00
|
|
|
|
2005-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
|
|
|
|
2014-02-21 00:55:40 +04:00
|
|
|
#ifdef DEBUG
|
|
|
|
// Call Unlink on this window. This may cause bad things to happen, so use
|
|
|
|
// with caution.
|
|
|
|
void RiskyUnlink();
|
|
|
|
#endif
|
|
|
|
|
2014-06-02 16:08:21 +04:00
|
|
|
virtual JSObject*
|
2015-03-21 19:28:04 +03:00
|
|
|
GetCachedXBLPrototypeHandler(nsXBLPrototypeHandler* aKey) override;
|
2008-02-13 07:17:18 +03:00
|
|
|
|
2014-06-02 16:08:21 +04:00
|
|
|
virtual void
|
2008-02-13 07:17:18 +03:00
|
|
|
CacheXBLPrototypeHandler(nsXBLPrototypeHandler* aKey,
|
2015-03-21 19:28:04 +03:00
|
|
|
JS::Handle<JSObject*> aHandler) override;
|
2008-02-13 07:17:18 +03:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual bool TakeFocus(bool aFocus, uint32_t aFocusMethod) override;
|
|
|
|
virtual void SetReadyForFocus() override;
|
|
|
|
virtual void PageHidden() override;
|
|
|
|
virtual nsresult DispatchAsyncHashchange(nsIURI *aOldURI, nsIURI *aNewURI) override;
|
|
|
|
virtual nsresult DispatchSyncPopState() override;
|
2009-09-01 20:45:05 +04:00
|
|
|
|
2013-11-28 18:07:55 +04:00
|
|
|
// Inner windows only.
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual void EnableDeviceSensor(uint32_t aType) override;
|
|
|
|
virtual void DisableDeviceSensor(uint32_t aType) override;
|
2012-03-25 04:29:49 +04:00
|
|
|
|
2015-10-24 07:37:28 +03:00
|
|
|
#if defined(MOZ_WIDGET_ANDROID) || defined(MOZ_WIDGET_GONK)
|
|
|
|
virtual void EnableOrientationChangeListener() override;
|
|
|
|
virtual void DisableOrientationChangeListener() override;
|
|
|
|
#endif
|
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual void EnableTimeChangeNotifications() override;
|
|
|
|
virtual void DisableTimeChangeNotifications() override;
|
2012-09-11 10:05:00 +04:00
|
|
|
|
2012-11-07 22:10:40 +04:00
|
|
|
#ifdef MOZ_B2G
|
2013-11-28 18:07:55 +04:00
|
|
|
// Inner windows only.
|
2015-08-26 15:56:59 +03:00
|
|
|
virtual void EnableNetworkEvent(mozilla::EventMessage aEventMessage) override;
|
|
|
|
virtual void DisableNetworkEvent(
|
|
|
|
mozilla::EventMessage aEventMessage) override;
|
2012-11-07 22:10:40 +04:00
|
|
|
#endif // MOZ_B2G
|
2012-09-30 17:47:48 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual nsresult SetArguments(nsIArray* aArguments) override;
|
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-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);
|
|
|
|
}
|
|
|
|
|
2015-03-06 16:04:49 +03:00
|
|
|
bool
|
|
|
|
HadOriginalOpener() const
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(IsOuterWindow());
|
|
|
|
return mHadOriginalOpener;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
IsTopLevelWindow()
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(IsOuterWindow());
|
2016-01-30 20:05:36 +03:00
|
|
|
nsPIDOMWindowOuter* parentWindow = GetScriptableTop();
|
|
|
|
return parentWindow == this->AsOuter();
|
2015-03-06 16:04:49 +03:00
|
|
|
}
|
|
|
|
|
2014-07-01 03:02:01 +04:00
|
|
|
virtual void
|
|
|
|
FirePopupBlockedEvent(nsIDocument* aDoc,
|
|
|
|
nsIURI* aPopupURI,
|
|
|
|
const nsAString& aPopupWindowName,
|
2015-03-21 19:28:04 +03:00
|
|
|
const nsAString& aPopupWindowFeatures) override;
|
2010-08-27 19:49:08 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual uint32_t GetSerial() override {
|
2010-09-10 02:15:40 +04:00
|
|
|
return mSerial;
|
|
|
|
}
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
static nsGlobalWindow* GetOuterWindowWithId(uint64_t aWindowID) {
|
2015-01-06 01:53:37 +03:00
|
|
|
AssertIsOnMainThread();
|
|
|
|
|
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) {
|
2015-01-06 01:53:37 +03:00
|
|
|
AssertIsOnMainThread();
|
|
|
|
|
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-06-29 15:06:43 +04:00
|
|
|
static WindowByIdTable* GetWindowsTable() {
|
2015-01-06 01:53:37 +03:00
|
|
|
AssertIsOnMainThread();
|
|
|
|
|
2011-06-29 15:06:43 +04:00
|
|
|
return sWindowsById;
|
|
|
|
}
|
|
|
|
|
2013-10-01 03:20:23 +04:00
|
|
|
void AddSizeOfIncludingThis(nsWindowSizes* aWindowSizes) const;
|
2011-06-29 15:06:43 +04:00
|
|
|
|
2014-05-20 23:50:57 +04:00
|
|
|
// Inner windows only.
|
2014-04-01 10:13:50 +04:00
|
|
|
void AddEventTargetObject(mozilla::DOMEventTargetHelper* aObject);
|
|
|
|
void RemoveEventTargetObject(mozilla::DOMEventTargetHelper* 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
|
|
|
|
2013-08-12 23:54:49 +04:00
|
|
|
enum SlowScriptResponse {
|
|
|
|
ContinueSlowScript = 0,
|
2015-01-17 05:34:47 +03:00
|
|
|
ContinueSlowScriptAndKeepNotifying,
|
2013-08-12 23:54:49 +04:00
|
|
|
AlwaysContinueSlowScript,
|
|
|
|
KillSlowScript
|
|
|
|
};
|
|
|
|
SlowScriptResponse ShowSlowScriptDialog();
|
|
|
|
|
2014-06-29 19:36:02 +04:00
|
|
|
// Inner windows only.
|
2012-02-16 04:47:13 +04:00
|
|
|
void AddGamepad(uint32_t aIndex, mozilla::dom::Gamepad* aGamepad);
|
2013-04-03 04:59:27 +04:00
|
|
|
void RemoveGamepad(uint32_t aIndex);
|
2015-10-18 08:24:48 +03:00
|
|
|
void GetGamepads(nsTArray<RefPtr<mozilla::dom::Gamepad> >& aGamepads);
|
2012-02-16 04:47:13 +04:00
|
|
|
already_AddRefed<mozilla::dom::Gamepad> GetGamepad(uint32_t aIndex);
|
2011-08-03 22:12:08 +04:00
|
|
|
void SetHasSeenGamepadInput(bool aHasSeen);
|
|
|
|
bool HasSeenGamepadInput();
|
|
|
|
void SyncGamepadState();
|
2017-03-07 05:17:57 +03:00
|
|
|
void StopGamepadHaptics();
|
2011-08-03 22:12:08 +04:00
|
|
|
|
2014-06-29 19:36:02 +04:00
|
|
|
// Inner windows only.
|
2011-08-03 22:12:08 +04:00
|
|
|
// Enable/disable updates for gamepad input.
|
|
|
|
void EnableGamepadUpdates();
|
|
|
|
void DisableGamepadUpdates();
|
|
|
|
|
2016-07-05 01:46:49 +03:00
|
|
|
// Inner windows only.
|
|
|
|
// Enable/disable updates for VR
|
|
|
|
void EnableVRUpdates();
|
|
|
|
void DisableVRUpdates();
|
|
|
|
|
2016-04-13 03:39:28 +03:00
|
|
|
// Update the VR displays for this window
|
|
|
|
bool UpdateVRDisplays(nsTArray<RefPtr<mozilla::dom::VRDisplay>>& aDisplays);
|
2016-08-22 15:52:45 +03:00
|
|
|
|
2016-07-05 01:52:21 +03:00
|
|
|
// Inner windows only.
|
|
|
|
// Called to inform that the set of active VR displays has changed.
|
|
|
|
void NotifyActiveVRDisplaysChanged();
|
2011-08-03 22:12:08 +04:00
|
|
|
|
2017-02-23 03:11:58 +03:00
|
|
|
// Outer windows only.
|
|
|
|
uint32_t GetAutoActivateVRDisplayID();
|
|
|
|
// Outer windows only.
|
|
|
|
void SetAutoActivateVRDisplayID(uint32_t aAutoActivateVRDisplayID);
|
|
|
|
|
2016-10-19 01:18:10 +03:00
|
|
|
void DispatchVRDisplayActivate(uint32_t aDisplayID,
|
|
|
|
mozilla::dom::VRDisplayEventReason aReason);
|
|
|
|
void DispatchVRDisplayDeactivate(uint32_t aDisplayID,
|
|
|
|
mozilla::dom::VRDisplayEventReason aReason);
|
2017-02-14 22:21:09 +03:00
|
|
|
void DispatchVRDisplayConnect(uint32_t aDisplayID);
|
|
|
|
void DispatchVRDisplayDisconnect(uint32_t aDisplayID);
|
|
|
|
void DispatchVRDisplayPresentChange(uint32_t aDisplayID);
|
2016-10-19 01:18:10 +03:00
|
|
|
|
2012-11-26 18:19:02 +04:00
|
|
|
#define EVENT(name_, id_, type_, struct_) \
|
|
|
|
mozilla::dom::EventHandlerNonNull* GetOn##name_() \
|
|
|
|
{ \
|
2014-03-17 10:56:53 +04:00
|
|
|
mozilla::EventListenerManager* elm = GetExistingListenerManager(); \
|
2013-08-16 14:06:24 +04:00
|
|
|
return elm ? elm->GetEventHandler(nsGkAtoms::on##name_, EmptyString()) \
|
|
|
|
: nullptr; \
|
2012-11-26 18:19:02 +04:00
|
|
|
} \
|
2013-09-17 15:01:28 +04:00
|
|
|
void SetOn##name_(mozilla::dom::EventHandlerNonNull* handler) \
|
2012-11-26 18:19:02 +04:00
|
|
|
{ \
|
2014-03-17 10:56:53 +04:00
|
|
|
mozilla::EventListenerManager* elm = GetOrCreateListenerManager(); \
|
2012-11-26 18:19:02 +04:00
|
|
|
if (elm) { \
|
2013-09-17 15:01:28 +04:00
|
|
|
elm->SetEventHandler(nsGkAtoms::on##name_, EmptyString(), handler); \
|
2012-11-26 18:19:02 +04:00
|
|
|
} \
|
|
|
|
}
|
|
|
|
#define ERROR_EVENT(name_, id_, type_, struct_) \
|
|
|
|
mozilla::dom::OnErrorEventHandlerNonNull* GetOn##name_() \
|
|
|
|
{ \
|
2014-03-17 10:56:53 +04:00
|
|
|
mozilla::EventListenerManager* elm = GetExistingListenerManager(); \
|
2012-11-26 18:19:02 +04:00
|
|
|
return elm ? elm->GetOnErrorEventHandler() : nullptr; \
|
|
|
|
} \
|
2013-09-17 15:01:28 +04:00
|
|
|
void SetOn##name_(mozilla::dom::OnErrorEventHandlerNonNull* handler) \
|
2012-11-26 18:19:02 +04:00
|
|
|
{ \
|
2014-03-17 10:56:53 +04:00
|
|
|
mozilla::EventListenerManager* elm = GetOrCreateListenerManager(); \
|
2012-11-26 18:19:02 +04:00
|
|
|
if (elm) { \
|
2013-09-17 15:01:28 +04:00
|
|
|
elm->SetEventHandler(handler); \
|
2012-11-26 18:19:02 +04:00
|
|
|
} \
|
|
|
|
}
|
|
|
|
#define BEFOREUNLOAD_EVENT(name_, id_, type_, struct_) \
|
2013-10-08 19:51:15 +04:00
|
|
|
mozilla::dom::OnBeforeUnloadEventHandlerNonNull* GetOn##name_() \
|
2012-11-26 18:19:02 +04:00
|
|
|
{ \
|
2014-03-17 10:56:53 +04:00
|
|
|
mozilla::EventListenerManager* elm = GetExistingListenerManager(); \
|
2012-11-26 18:19:02 +04:00
|
|
|
return elm ? elm->GetOnBeforeUnloadEventHandler() : nullptr; \
|
|
|
|
} \
|
2013-10-08 19:51:15 +04:00
|
|
|
void SetOn##name_(mozilla::dom::OnBeforeUnloadEventHandlerNonNull* handler) \
|
2012-11-26 18:19:02 +04:00
|
|
|
{ \
|
2014-03-17 10:56:53 +04:00
|
|
|
mozilla::EventListenerManager* elm = GetOrCreateListenerManager(); \
|
2012-11-26 18:19:02 +04:00
|
|
|
if (elm) { \
|
2013-09-17 15:01:28 +04:00
|
|
|
elm->SetEventHandler(handler); \
|
2012-11-26 18:19:02 +04:00
|
|
|
} \
|
|
|
|
}
|
|
|
|
#define WINDOW_ONLY_EVENT EVENT
|
|
|
|
#define TOUCH_EVENT EVENT
|
2014-04-01 15:42:12 +04:00
|
|
|
#include "mozilla/EventNameList.h"
|
2012-11-26 18:19:02 +04:00
|
|
|
#undef TOUCH_EVENT
|
|
|
|
#undef WINDOW_ONLY_EVENT
|
|
|
|
#undef BEFOREUNLOAD_EVENT
|
|
|
|
#undef ERROR_EVENT
|
|
|
|
#undef EVENT
|
|
|
|
|
2013-10-08 19:51:42 +04:00
|
|
|
nsISupports* GetParentObject()
|
|
|
|
{
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
2014-09-06 00:36:36 +04:00
|
|
|
static JSObject*
|
|
|
|
CreateNamedPropertiesObject(JSContext *aCx, JS::Handle<JSObject*> aProto);
|
|
|
|
|
2014-12-09 22:44:37 +03:00
|
|
|
nsGlobalWindow* Window();
|
2015-04-27 20:38:12 +03:00
|
|
|
nsGlobalWindow* Self();
|
2013-10-08 19:51:42 +04:00
|
|
|
nsIDocument* GetDocument()
|
|
|
|
{
|
|
|
|
return GetDoc();
|
|
|
|
}
|
2015-07-17 08:10:35 +03:00
|
|
|
void GetNameOuter(nsAString& aName);
|
2013-10-08 19:51:42 +04:00
|
|
|
void GetName(nsAString& aName, mozilla::ErrorResult& aError);
|
2015-07-17 08:10:35 +03:00
|
|
|
void SetNameOuter(const nsAString& aName, mozilla::ErrorResult& aError);
|
2013-10-08 19:51:42 +04:00
|
|
|
void SetName(const nsAString& aName, mozilla::ErrorResult& aError);
|
2016-09-16 10:18:18 +03:00
|
|
|
mozilla::dom::Location* GetLocation(mozilla::ErrorResult& aError);
|
2015-10-27 00:37:32 +03:00
|
|
|
nsIDOMLocation* GetLocation() override;
|
2013-10-08 19:51:42 +04:00
|
|
|
nsHistory* GetHistory(mozilla::ErrorResult& aError);
|
2016-10-12 10:26:02 +03:00
|
|
|
mozilla::dom::CustomElementRegistry* CustomElements() override;
|
2013-10-08 19:51:42 +04:00
|
|
|
mozilla::dom::BarProp* GetLocationbar(mozilla::ErrorResult& aError);
|
|
|
|
mozilla::dom::BarProp* GetMenubar(mozilla::ErrorResult& aError);
|
|
|
|
mozilla::dom::BarProp* GetPersonalbar(mozilla::ErrorResult& aError);
|
|
|
|
mozilla::dom::BarProp* GetScrollbars(mozilla::ErrorResult& aError);
|
|
|
|
mozilla::dom::BarProp* GetStatusbar(mozilla::ErrorResult& aError);
|
|
|
|
mozilla::dom::BarProp* GetToolbar(mozilla::ErrorResult& aError);
|
2015-07-17 08:10:35 +03:00
|
|
|
void GetStatusOuter(nsAString& aStatus);
|
2013-10-08 19:51:42 +04:00
|
|
|
void GetStatus(nsAString& aStatus, mozilla::ErrorResult& aError);
|
2015-07-17 08:10:35 +03:00
|
|
|
void SetStatusOuter(const nsAString& aStatus);
|
2013-10-08 19:51:42 +04:00
|
|
|
void SetStatus(const nsAString& aStatus, mozilla::ErrorResult& aError);
|
2015-10-14 08:23:15 +03:00
|
|
|
void CloseOuter(bool aTrustedCaller);
|
2013-10-08 19:51:42 +04:00
|
|
|
void Close(mozilla::ErrorResult& aError);
|
2015-10-27 00:37:32 +03:00
|
|
|
nsresult Close() override;
|
2015-07-17 08:10:35 +03:00
|
|
|
bool GetClosedOuter();
|
2013-10-08 19:51:42 +04:00
|
|
|
bool GetClosed(mozilla::ErrorResult& aError);
|
2015-10-27 00:37:32 +03:00
|
|
|
bool Closed() override;
|
2015-07-17 08:10:35 +03:00
|
|
|
void StopOuter(mozilla::ErrorResult& aError);
|
2013-10-08 19:51:42 +04:00
|
|
|
void Stop(mozilla::ErrorResult& aError);
|
2015-07-17 08:10:35 +03:00
|
|
|
void FocusOuter(mozilla::ErrorResult& aError);
|
2013-10-08 19:51:42 +04:00
|
|
|
void Focus(mozilla::ErrorResult& aError);
|
2015-10-27 00:37:32 +03:00
|
|
|
nsresult Focus() override;
|
2015-07-17 08:10:35 +03:00
|
|
|
void BlurOuter();
|
2013-10-08 19:51:42 +04:00
|
|
|
void Blur(mozilla::ErrorResult& aError);
|
2016-01-30 20:05:36 +03:00
|
|
|
already_AddRefed<nsPIDOMWindowOuter> GetFramesOuter();
|
2015-10-27 00:37:32 +03:00
|
|
|
already_AddRefed<nsIDOMWindowCollection> GetFrames() override;
|
2016-01-30 20:05:36 +03:00
|
|
|
already_AddRefed<nsPIDOMWindowOuter> GetFrames(mozilla::ErrorResult& aError);
|
2013-10-08 19:51:42 +04:00
|
|
|
uint32_t Length();
|
2016-01-30 20:05:36 +03:00
|
|
|
already_AddRefed<nsPIDOMWindowOuter> GetTopOuter();
|
|
|
|
already_AddRefed<nsPIDOMWindowOuter> GetTop(mozilla::ErrorResult& aError);
|
2015-10-27 00:37:32 +03:00
|
|
|
|
|
|
|
nsresult GetPrompter(nsIPrompt** aPrompt) override;
|
2014-06-03 19:38:37 +04:00
|
|
|
protected:
|
2014-08-27 06:42:13 +04:00
|
|
|
explicit nsGlobalWindow(nsGlobalWindow *aOuterWindow);
|
2016-01-30 20:05:36 +03:00
|
|
|
nsPIDOMWindowOuter* GetOpenerWindowOuter();
|
2014-08-27 06:42:13 +04:00
|
|
|
// Initializes the mWasOffline member variable
|
|
|
|
void InitWasOffline();
|
2014-06-03 19:38:37 +04:00
|
|
|
public:
|
2016-10-07 21:59:59 +03:00
|
|
|
nsPIDOMWindowOuter*
|
|
|
|
GetSanitizedOpener(nsPIDOMWindowOuter* aOpener);
|
|
|
|
|
2016-03-11 14:56:05 +03:00
|
|
|
nsPIDOMWindowOuter* GetOpenerWindow(mozilla::ErrorResult& aError);
|
2014-06-12 00:26:52 +04:00
|
|
|
void GetOpener(JSContext* aCx, JS::MutableHandle<JS::Value> aRetval,
|
|
|
|
mozilla::ErrorResult& aError);
|
2016-01-30 20:05:36 +03:00
|
|
|
already_AddRefed<nsPIDOMWindowOuter> GetOpener() override;
|
2014-06-03 19:38:37 +04:00
|
|
|
void SetOpener(JSContext* aCx, JS::Handle<JS::Value> aOpener,
|
|
|
|
mozilla::ErrorResult& aError);
|
2016-01-30 20:05:36 +03:00
|
|
|
already_AddRefed<nsPIDOMWindowOuter> GetParentOuter();
|
|
|
|
already_AddRefed<nsPIDOMWindowOuter> GetParent(mozilla::ErrorResult& aError);
|
|
|
|
already_AddRefed<nsPIDOMWindowOuter> GetParent() override;
|
|
|
|
nsPIDOMWindowOuter* GetScriptableParent() override;
|
2016-04-25 17:17:32 +03:00
|
|
|
nsPIDOMWindowOuter* GetScriptableParentOrNull() override;
|
2016-09-29 17:14:42 +03:00
|
|
|
mozilla::dom::Element*
|
2016-10-11 04:07:48 +03:00
|
|
|
GetFrameElementOuter(nsIPrincipal& aSubjectPrincipal);
|
2016-09-29 17:14:42 +03:00
|
|
|
mozilla::dom::Element*
|
2016-10-11 04:07:48 +03:00
|
|
|
GetFrameElement(nsIPrincipal& aSubjectPrincipal,
|
2016-09-29 17:14:42 +03:00
|
|
|
mozilla::ErrorResult& aError);
|
2015-10-27 00:37:32 +03:00
|
|
|
already_AddRefed<nsIDOMElement> GetFrameElement() override;
|
2016-01-30 20:05:36 +03:00
|
|
|
already_AddRefed<nsPIDOMWindowOuter>
|
|
|
|
OpenOuter(const nsAString& aUrl,
|
|
|
|
const nsAString& aName,
|
|
|
|
const nsAString& aOptions,
|
|
|
|
mozilla::ErrorResult& aError);
|
|
|
|
already_AddRefed<nsPIDOMWindowOuter>
|
|
|
|
Open(const nsAString& aUrl,
|
|
|
|
const nsAString& aName,
|
|
|
|
const nsAString& aOptions,
|
|
|
|
mozilla::ErrorResult& aError);
|
2015-10-27 00:37:32 +03:00
|
|
|
nsresult Open(const nsAString& aUrl, const nsAString& aName,
|
2016-01-30 20:05:36 +03:00
|
|
|
const nsAString& aOptions,
|
2016-10-20 23:52:38 +03:00
|
|
|
nsIDocShellLoadInfo* aLoadInfo,
|
2016-10-20 23:52:38 +03:00
|
|
|
bool aForceNoOpener,
|
2016-01-30 20:05:36 +03:00
|
|
|
nsPIDOMWindowOuter **_retval) override;
|
2017-04-14 05:40:03 +03:00
|
|
|
mozilla::dom::Navigator* Navigator();
|
2015-10-27 00:37:32 +03:00
|
|
|
nsIDOMNavigator* GetNavigator() override;
|
2013-10-08 19:51:42 +04:00
|
|
|
nsIDOMOfflineResourceList* GetApplicationCache(mozilla::ErrorResult& aError);
|
2015-10-27 00:37:32 +03:00
|
|
|
already_AddRefed<nsIDOMOfflineResourceList> GetApplicationCache() override;
|
2014-02-01 03:02:56 +04:00
|
|
|
|
2015-10-24 07:37:28 +03:00
|
|
|
#if defined(MOZ_WIDGET_ANDROID) || defined(MOZ_WIDGET_GONK)
|
2016-12-22 22:05:54 +03:00
|
|
|
int16_t Orientation(mozilla::dom::CallerType aCallerType) const;
|
2015-10-24 07:37:28 +03:00
|
|
|
#endif
|
|
|
|
|
2014-02-28 03:39:00 +04:00
|
|
|
mozilla::dom::Console* GetConsole(mozilla::ErrorResult& aRv);
|
|
|
|
|
2016-04-28 13:13:09 +03:00
|
|
|
// https://w3c.github.io/webappsec-secure-contexts/#dom-window-issecurecontext
|
|
|
|
bool IsSecureContext() const;
|
2017-01-13 03:57:44 +03:00
|
|
|
bool IsSecureContextIfOpenerIgnored() const;
|
2016-04-28 13:13:09 +03:00
|
|
|
|
2014-03-28 08:03:03 +04:00
|
|
|
void GetSidebar(mozilla::dom::OwningExternalOrWindowProxy& aResult,
|
|
|
|
mozilla::ErrorResult& aRv);
|
|
|
|
already_AddRefed<mozilla::dom::External> GetExternal(mozilla::ErrorResult& aRv);
|
|
|
|
|
2015-06-17 14:17:33 +03:00
|
|
|
// Exposed only for testing
|
|
|
|
static bool
|
|
|
|
TokenizeDialogOptions(nsAString& aToken, nsAString::const_iterator& aIter,
|
|
|
|
nsAString::const_iterator aEnd);
|
|
|
|
static void
|
|
|
|
ConvertDialogOptions(const nsAString& aOptions, nsAString& aResult);
|
|
|
|
|
2016-12-14 16:43:26 +03:00
|
|
|
mozilla::dom::Worklet*
|
|
|
|
GetAudioWorklet(mozilla::ErrorResult& aRv);
|
2016-11-06 11:53:34 +03:00
|
|
|
|
2016-12-17 00:21:51 +03:00
|
|
|
mozilla::dom::Worklet*
|
|
|
|
GetPaintWorklet(mozilla::ErrorResult& aRv);
|
|
|
|
|
2017-02-20 06:11:00 +03:00
|
|
|
void
|
2017-03-13 18:31:43 +03:00
|
|
|
GetAppLocalesAsBCP47(nsTArray<nsString>& aLocales);
|
2017-02-20 06:11:00 +03:00
|
|
|
|
2017-03-10 11:36:09 +03:00
|
|
|
#ifdef ENABLE_INTL_API
|
2017-03-04 05:30:00 +03:00
|
|
|
mozilla::dom::IntlUtils*
|
|
|
|
GetIntlUtils(mozilla::ErrorResult& aRv);
|
2017-03-10 11:36:09 +03:00
|
|
|
#endif
|
2017-03-04 05:30:00 +03:00
|
|
|
|
2014-02-01 03:02:56 +04:00
|
|
|
protected:
|
|
|
|
bool AlertOrConfirm(bool aAlert, const nsAString& aMessage,
|
2016-10-11 04:07:48 +03:00
|
|
|
nsIPrincipal& aSubjectPrincipal,
|
2014-02-01 03:02:56 +04:00
|
|
|
mozilla::ErrorResult& aError);
|
|
|
|
|
|
|
|
public:
|
2016-10-11 04:07:48 +03:00
|
|
|
void Alert(nsIPrincipal& aSubjectPrincipal,
|
2016-09-29 17:14:42 +03:00
|
|
|
mozilla::ErrorResult& aError);
|
|
|
|
void AlertOuter(const nsAString& aMessage,
|
2016-10-11 04:07:48 +03:00
|
|
|
nsIPrincipal& aSubjectPrincipal,
|
2016-09-29 17:14:42 +03:00
|
|
|
mozilla::ErrorResult& aError);
|
|
|
|
void Alert(const nsAString& aMessage,
|
2016-10-11 04:07:48 +03:00
|
|
|
nsIPrincipal& aSubjectPrincipal,
|
2016-09-29 17:14:42 +03:00
|
|
|
mozilla::ErrorResult& aError);
|
|
|
|
bool ConfirmOuter(const nsAString& aMessage,
|
2016-10-11 04:07:48 +03:00
|
|
|
nsIPrincipal& aSubjectPrincipal,
|
2016-09-29 17:14:42 +03:00
|
|
|
mozilla::ErrorResult& aError);
|
|
|
|
bool Confirm(const nsAString& aMessage,
|
2016-10-11 04:07:48 +03:00
|
|
|
nsIPrincipal& aSubjectPrincipal,
|
2016-09-29 17:14:42 +03:00
|
|
|
mozilla::ErrorResult& aError);
|
|
|
|
void PromptOuter(const nsAString& aMessage, const nsAString& aInitial,
|
|
|
|
nsAString& aReturn,
|
2016-10-11 04:07:48 +03:00
|
|
|
nsIPrincipal& aSubjectPrincipal,
|
2016-09-29 17:14:42 +03:00
|
|
|
mozilla::ErrorResult& aError);
|
|
|
|
void Prompt(const nsAString& aMessage, const nsAString& aInitial,
|
|
|
|
nsAString& aReturn,
|
2016-10-11 04:07:48 +03:00
|
|
|
nsIPrincipal& aSubjectPrincipal,
|
2016-09-29 17:14:42 +03:00
|
|
|
mozilla::ErrorResult& aError);
|
2015-03-02 16:22:00 +03:00
|
|
|
already_AddRefed<mozilla::dom::cache::CacheStorage> GetCaches(mozilla::ErrorResult& aRv);
|
2014-11-20 14:58:00 +03:00
|
|
|
already_AddRefed<mozilla::dom::Promise> Fetch(const mozilla::dom::RequestOrUSVString& aInput,
|
2014-07-25 05:30:07 +04:00
|
|
|
const mozilla::dom::RequestInit& aInit,
|
2017-02-01 23:43:37 +03:00
|
|
|
mozilla::dom::CallerType aCallerType,
|
2014-07-25 05:30:07 +04:00
|
|
|
mozilla::ErrorResult& aRv);
|
2015-07-17 08:10:35 +03:00
|
|
|
void PrintOuter(mozilla::ErrorResult& aError);
|
2013-10-08 19:51:42 +04:00
|
|
|
void Print(mozilla::ErrorResult& aError);
|
2014-06-12 00:26:52 +04:00
|
|
|
void ShowModalDialog(JSContext* aCx, const nsAString& aUrl,
|
|
|
|
JS::Handle<JS::Value> aArgument,
|
|
|
|
const nsAString& aOptions,
|
|
|
|
JS::MutableHandle<JS::Value> aRetval,
|
2016-10-11 04:07:48 +03:00
|
|
|
nsIPrincipal& aSubjectPrincipal,
|
2014-06-12 00:26:52 +04:00
|
|
|
mozilla::ErrorResult& aError);
|
2013-10-08 19:51:42 +04:00
|
|
|
void PostMessageMoz(JSContext* aCx, JS::Handle<JS::Value> aMessage,
|
|
|
|
const nsAString& aTargetOrigin,
|
2017-02-03 13:00:38 +03:00
|
|
|
const mozilla::dom::Sequence<JSObject*>& aTransfer,
|
2016-10-11 04:07:48 +03:00
|
|
|
nsIPrincipal& aSubjectPrincipal,
|
2013-10-08 19:51:42 +04:00
|
|
|
mozilla::ErrorResult& aError);
|
|
|
|
int32_t SetTimeout(JSContext* aCx, mozilla::dom::Function& aFunction,
|
|
|
|
int32_t aTimeout,
|
|
|
|
const mozilla::dom::Sequence<JS::Value>& aArguments,
|
|
|
|
mozilla::ErrorResult& aError);
|
|
|
|
int32_t SetTimeout(JSContext* aCx, const nsAString& aHandler,
|
2014-02-19 19:13:38 +04:00
|
|
|
int32_t aTimeout,
|
|
|
|
const mozilla::dom::Sequence<JS::Value>& /* unused */,
|
|
|
|
mozilla::ErrorResult& aError);
|
2016-03-10 12:50:56 +03:00
|
|
|
void ClearTimeout(int32_t aHandle);
|
2013-10-08 19:51:42 +04:00
|
|
|
int32_t SetInterval(JSContext* aCx, mozilla::dom::Function& aFunction,
|
|
|
|
const mozilla::dom::Optional<int32_t>& aTimeout,
|
|
|
|
const mozilla::dom::Sequence<JS::Value>& aArguments,
|
|
|
|
mozilla::ErrorResult& aError);
|
|
|
|
int32_t SetInterval(JSContext* aCx, const nsAString& aHandler,
|
|
|
|
const mozilla::dom::Optional<int32_t>& aTimeout,
|
2014-02-19 19:13:38 +04:00
|
|
|
const mozilla::dom::Sequence<JS::Value>& /* unused */,
|
2013-10-08 19:51:42 +04:00
|
|
|
mozilla::ErrorResult& aError);
|
2016-03-10 12:50:56 +03:00
|
|
|
void ClearInterval(int32_t aHandle);
|
2017-02-14 00:06:47 +03:00
|
|
|
void GetOrigin(nsAString& aOrigin);
|
2013-10-08 19:51:42 +04:00
|
|
|
void Atob(const nsAString& aAsciiBase64String, nsAString& aBinaryData,
|
|
|
|
mozilla::ErrorResult& aError);
|
|
|
|
void Btoa(const nsAString& aBinaryData, nsAString& aAsciiBase64String,
|
|
|
|
mozilla::ErrorResult& aError);
|
2017-01-04 16:53:01 +03:00
|
|
|
mozilla::dom::Storage* GetSessionStorage(mozilla::ErrorResult& aError);
|
|
|
|
mozilla::dom::Storage*
|
2016-10-11 04:07:48 +03:00
|
|
|
GetLocalStorage(mozilla::ErrorResult& aError);
|
2015-07-17 08:10:35 +03:00
|
|
|
mozilla::dom::Selection* GetSelectionOuter();
|
2014-04-10 20:09:40 +04:00
|
|
|
mozilla::dom::Selection* GetSelection(mozilla::ErrorResult& aError);
|
2015-10-27 00:37:32 +03:00
|
|
|
already_AddRefed<nsISelection> GetSelection() override;
|
2016-02-17 00:46:08 +03:00
|
|
|
mozilla::dom::IDBFactory* GetIndexedDB(mozilla::ErrorResult& aError);
|
2013-10-08 19:51:42 +04:00
|
|
|
already_AddRefed<nsICSSDeclaration>
|
|
|
|
GetComputedStyle(mozilla::dom::Element& aElt, const nsAString& aPseudoElt,
|
2015-10-27 00:37:32 +03:00
|
|
|
mozilla::ErrorResult& aError) override;
|
2015-07-17 08:10:35 +03:00
|
|
|
already_AddRefed<mozilla::dom::MediaQueryList> MatchMediaOuter(const nsAString& aQuery);
|
2013-12-16 18:03:34 +04:00
|
|
|
already_AddRefed<mozilla::dom::MediaQueryList> MatchMedia(const nsAString& aQuery,
|
|
|
|
mozilla::ErrorResult& aError);
|
2013-10-08 19:51:42 +04:00
|
|
|
nsScreen* GetScreen(mozilla::ErrorResult& aError);
|
2015-10-27 00:37:32 +03:00
|
|
|
nsIDOMScreen* GetScreen() override;
|
2016-12-22 22:06:32 +03:00
|
|
|
void MoveToOuter(int32_t aXPos, int32_t aYPos,
|
|
|
|
mozilla::dom::CallerType aCallerType,
|
|
|
|
mozilla::ErrorResult& aError);
|
|
|
|
void MoveTo(int32_t aXPos, int32_t aYPos,
|
|
|
|
mozilla::dom::CallerType aCallerType,
|
|
|
|
mozilla::ErrorResult& aError);
|
|
|
|
void MoveByOuter(int32_t aXDif, int32_t aYDif,
|
|
|
|
mozilla::dom::CallerType aCallerType,
|
|
|
|
mozilla::ErrorResult& aError);
|
|
|
|
void MoveBy(int32_t aXDif, int32_t aYDif,
|
|
|
|
mozilla::dom::CallerType aCallerType,
|
|
|
|
mozilla::ErrorResult& aError);
|
2015-10-27 00:37:32 +03:00
|
|
|
nsresult MoveBy(int32_t aXDif, int32_t aYDif) override;
|
2016-12-22 22:06:32 +03:00
|
|
|
void ResizeToOuter(int32_t aWidth, int32_t aHeight,
|
|
|
|
mozilla::dom::CallerType aCallerType,
|
|
|
|
mozilla::ErrorResult& aError);
|
2013-10-08 19:51:42 +04:00
|
|
|
void ResizeTo(int32_t aWidth, int32_t aHeight,
|
2016-12-22 22:06:32 +03:00
|
|
|
mozilla::dom::CallerType aCallerType,
|
2013-10-08 19:51:42 +04:00
|
|
|
mozilla::ErrorResult& aError);
|
2016-12-22 22:06:32 +03:00
|
|
|
void ResizeByOuter(int32_t aWidthDif, int32_t aHeightDif,
|
|
|
|
mozilla::dom::CallerType aCallerType,
|
|
|
|
mozilla::ErrorResult& aError);
|
2013-10-08 19:51:42 +04:00
|
|
|
void ResizeBy(int32_t aWidthDif, int32_t aHeightDif,
|
2016-12-22 22:06:32 +03:00
|
|
|
mozilla::dom::CallerType aCallerType,
|
2013-10-08 19:51:42 +04:00
|
|
|
mozilla::ErrorResult& aError);
|
Bug 1045754 - Part 1 - Implement updated CSSOM-View smooth-scrolling specification. r=bz
- Added new WebIDL dictionary, ScrollToOptions. This dictionary extends
ScrollOptions by adding "left" and "top", specifying the scroll offset.
This will be later extended with more members to allow scroll offsets to be
specified with logical axes.
- Implemented Window.Scroll, Window.ScrollTo, Window.ScrollBy, Element.Scroll,
Element.ScrollTo, and Element.ScrollBy functions that accept ScrollToOptions
as a single parameter.
- Removed ScrollOptions dictionary parameter from existing Window.Scroll,
Window.ScrollTo, and Window.ScrollBy functions as these have been replaced
with functions accepting a single parameter, ScrollToOptions.
- Added new WebIDL dictionary, ScrollIntoViewOptions. This dictionary
extends ScrollOptions by adding "block", specifying whether the element
start or end will be scrolled into view.
- Replaced Element.ScrollIntoView(bool,ScrollOptions) with
Element.ScrollIntoView(ScrollIntoViewOptions) to match updated
CSSOM-View scroll-behavior specification.
2014-10-01 21:47:56 +04:00
|
|
|
void Scroll(double aXScroll, double aYScroll);
|
|
|
|
void Scroll(const mozilla::dom::ScrollToOptions& aOptions);
|
|
|
|
void ScrollTo(double aXScroll, double aYScroll);
|
|
|
|
void ScrollTo(const mozilla::dom::ScrollToOptions& aOptions);
|
|
|
|
void ScrollBy(double aXScrollDif, double aYScrollDif);
|
|
|
|
void ScrollBy(const mozilla::dom::ScrollToOptions& aOptions);
|
2014-08-06 02:01:32 +04:00
|
|
|
void ScrollByLines(int32_t numLines,
|
|
|
|
const mozilla::dom::ScrollOptions& aOptions);
|
|
|
|
void ScrollByPages(int32_t numPages,
|
|
|
|
const mozilla::dom::ScrollOptions& aOptions);
|
2015-02-20 03:03:07 +03:00
|
|
|
void MozScrollSnap();
|
2015-04-09 05:50:45 +03:00
|
|
|
void GetInnerWidth(JSContext* aCx, JS::MutableHandle<JS::Value> aValue,
|
2016-12-22 22:05:54 +03:00
|
|
|
mozilla::dom::CallerType aCallerType,
|
2015-04-09 05:50:45 +03:00
|
|
|
mozilla::ErrorResult& aError);
|
|
|
|
void SetInnerWidth(JSContext* aCx, JS::Handle<JS::Value> aValue,
|
2016-12-22 22:05:54 +03:00
|
|
|
mozilla::dom::CallerType aCallerType,
|
2015-04-09 05:50:45 +03:00
|
|
|
mozilla::ErrorResult& aError);
|
|
|
|
void GetInnerHeight(JSContext* aCx, JS::MutableHandle<JS::Value> aValue,
|
2016-12-22 22:05:54 +03:00
|
|
|
mozilla::dom::CallerType aCallerType,
|
|
|
|
mozilla::ErrorResult& aError);
|
2015-04-09 05:50:45 +03:00
|
|
|
void SetInnerHeight(JSContext* aCx, JS::Handle<JS::Value> aValue,
|
2016-12-22 22:05:54 +03:00
|
|
|
mozilla::dom::CallerType aCallerType,
|
2015-04-09 05:50:45 +03:00
|
|
|
mozilla::ErrorResult& aError);
|
2017-03-03 00:01:31 +03:00
|
|
|
double GetScrollXOuter();
|
|
|
|
double GetScrollX(mozilla::ErrorResult& aError);
|
|
|
|
double GetPageXOffset(mozilla::ErrorResult& aError)
|
2013-10-08 19:51:42 +04:00
|
|
|
{
|
|
|
|
return GetScrollX(aError);
|
|
|
|
}
|
2017-03-03 00:01:31 +03:00
|
|
|
double GetScrollYOuter();
|
|
|
|
double GetScrollY(mozilla::ErrorResult& aError);
|
|
|
|
double GetPageYOffset(mozilla::ErrorResult& aError)
|
2013-10-08 19:51:42 +04:00
|
|
|
{
|
|
|
|
return GetScrollY(aError);
|
|
|
|
}
|
2015-04-09 05:50:45 +03:00
|
|
|
void GetScreenX(JSContext* aCx, JS::MutableHandle<JS::Value> aValue,
|
2016-12-22 22:05:54 +03:00
|
|
|
mozilla::dom::CallerType aCallerType,
|
2015-04-09 05:50:45 +03:00
|
|
|
mozilla::ErrorResult& aError);
|
|
|
|
void SetScreenX(JSContext* aCx, JS::Handle<JS::Value> aValue,
|
2016-12-22 22:05:54 +03:00
|
|
|
mozilla::dom::CallerType aCallerType,
|
2015-04-09 05:50:45 +03:00
|
|
|
mozilla::ErrorResult& aError);
|
|
|
|
void GetScreenY(JSContext* aCx, JS::MutableHandle<JS::Value> aValue,
|
2016-12-22 22:05:54 +03:00
|
|
|
mozilla::dom::CallerType aCallerType,
|
2015-04-09 05:50:45 +03:00
|
|
|
mozilla::ErrorResult& aError);
|
|
|
|
void SetScreenY(JSContext* aCx, JS::Handle<JS::Value> aValue,
|
2016-12-22 22:05:54 +03:00
|
|
|
mozilla::dom::CallerType aCallerType,
|
2015-04-09 05:50:45 +03:00
|
|
|
mozilla::ErrorResult& aError);
|
|
|
|
void GetOuterWidth(JSContext* aCx, JS::MutableHandle<JS::Value> aValue,
|
2016-12-22 22:05:54 +03:00
|
|
|
mozilla::dom::CallerType aCallerType,
|
2015-04-09 05:50:45 +03:00
|
|
|
mozilla::ErrorResult& aError);
|
|
|
|
void SetOuterWidth(JSContext* aCx, JS::Handle<JS::Value> aValue,
|
2016-12-22 22:05:54 +03:00
|
|
|
mozilla::dom::CallerType aCallerType,
|
2015-04-09 05:50:45 +03:00
|
|
|
mozilla::ErrorResult& aError);
|
|
|
|
void GetOuterHeight(JSContext* aCx, JS::MutableHandle<JS::Value> aValue,
|
2016-12-22 22:05:54 +03:00
|
|
|
mozilla::dom::CallerType aCallerType,
|
2015-04-09 05:50:45 +03:00
|
|
|
mozilla::ErrorResult& aError);
|
|
|
|
void SetOuterHeight(JSContext* aCx, JS::Handle<JS::Value> aValue,
|
2016-12-22 22:05:54 +03:00
|
|
|
mozilla::dom::CallerType aCallerType,
|
2015-04-09 05:50:45 +03:00
|
|
|
mozilla::ErrorResult& aError);
|
2013-10-08 19:51:42 +04:00
|
|
|
int32_t RequestAnimationFrame(mozilla::dom::FrameRequestCallback& aCallback,
|
|
|
|
mozilla::ErrorResult& aError);
|
|
|
|
void CancelAnimationFrame(int32_t aHandle, mozilla::ErrorResult& aError);
|
2016-08-22 15:52:45 +03:00
|
|
|
|
|
|
|
uint32_t RequestIdleCallback(JSContext* aCx,
|
|
|
|
mozilla::dom::IdleRequestCallback& aCallback,
|
|
|
|
const mozilla::dom::IdleRequestOptions& aOptions,
|
|
|
|
mozilla::ErrorResult& aError);
|
|
|
|
void CancelIdleCallback(uint32_t aHandle);
|
|
|
|
|
2013-04-07 16:19:56 +04:00
|
|
|
#ifdef MOZ_WEBSPEECH
|
2013-10-08 19:51:42 +04:00
|
|
|
mozilla::dom::SpeechSynthesis*
|
|
|
|
GetSpeechSynthesis(mozilla::ErrorResult& aError);
|
2016-01-06 05:01:24 +03:00
|
|
|
bool HasActiveSpeechSynthesis();
|
2013-04-07 16:19:56 +04:00
|
|
|
#endif
|
2016-12-22 22:06:32 +03:00
|
|
|
void SizeToContentOuter(mozilla::dom::CallerType aCallerType,
|
|
|
|
mozilla::ErrorResult& aError);
|
|
|
|
void SizeToContent(mozilla::dom::CallerType aCallerType,
|
|
|
|
mozilla::ErrorResult& aError);
|
2015-02-02 17:36:04 +03:00
|
|
|
mozilla::dom::Crypto* GetCrypto(mozilla::ErrorResult& aError);
|
2016-02-09 18:43:00 +03:00
|
|
|
mozilla::dom::U2F* GetU2f(mozilla::ErrorResult& aError);
|
2015-07-17 08:10:35 +03:00
|
|
|
nsIControllers* GetControllersOuter(mozilla::ErrorResult& aError);
|
2013-10-08 19:51:42 +04:00
|
|
|
nsIControllers* GetControllers(mozilla::ErrorResult& aError);
|
2015-10-27 00:37:32 +03:00
|
|
|
nsresult GetControllers(nsIControllers** aControllers) override;
|
2015-07-17 08:10:35 +03:00
|
|
|
mozilla::dom::Element* GetRealFrameElementOuter();
|
2014-06-04 22:11:05 +04:00
|
|
|
mozilla::dom::Element* GetRealFrameElement(mozilla::ErrorResult& aError);
|
2016-12-22 22:05:54 +03:00
|
|
|
float GetMozInnerScreenXOuter(mozilla::dom::CallerType aCallerType);
|
|
|
|
float GetMozInnerScreenX(mozilla::dom::CallerType aCallerType,
|
|
|
|
mozilla::ErrorResult& aError);
|
|
|
|
float GetMozInnerScreenYOuter(mozilla::dom::CallerType aCallerType);
|
|
|
|
float GetMozInnerScreenY(mozilla::dom::CallerType aCallerType,
|
|
|
|
mozilla::ErrorResult& aError);
|
2016-12-22 22:05:54 +03:00
|
|
|
float GetDevicePixelRatioOuter(mozilla::dom::CallerType aCallerType);
|
|
|
|
float GetDevicePixelRatio(mozilla::dom::CallerType aCallerType,
|
|
|
|
mozilla::ErrorResult& aError);
|
2015-10-27 07:38:02 +03:00
|
|
|
int32_t GetScrollMinX(mozilla::ErrorResult& aError);
|
|
|
|
int32_t GetScrollMinY(mozilla::ErrorResult& aError);
|
2013-10-08 19:51:42 +04:00
|
|
|
int32_t GetScrollMaxX(mozilla::ErrorResult& aError);
|
|
|
|
int32_t GetScrollMaxY(mozilla::ErrorResult& aError);
|
2015-07-17 08:10:35 +03:00
|
|
|
bool GetFullScreenOuter();
|
2013-10-08 19:51:42 +04:00
|
|
|
bool GetFullScreen(mozilla::ErrorResult& aError);
|
2015-10-27 00:37:32 +03:00
|
|
|
bool GetFullScreen() override;
|
2015-07-17 08:10:35 +03:00
|
|
|
void SetFullScreenOuter(bool aFullScreen, mozilla::ErrorResult& aError);
|
2013-10-08 19:51:42 +04:00
|
|
|
void SetFullScreen(bool aFullScreen, mozilla::ErrorResult& aError);
|
2015-10-27 00:37:32 +03:00
|
|
|
nsresult SetFullScreen(bool aFullScreen) override;
|
2015-07-17 08:10:35 +03:00
|
|
|
void BackOuter(mozilla::ErrorResult& aError);
|
2013-10-08 19:51:42 +04:00
|
|
|
void Back(mozilla::ErrorResult& aError);
|
2015-07-17 08:10:35 +03:00
|
|
|
void ForwardOuter(mozilla::ErrorResult& aError);
|
2013-10-08 19:51:42 +04:00
|
|
|
void Forward(mozilla::ErrorResult& aError);
|
2017-04-25 13:22:25 +03:00
|
|
|
void HomeOuter(nsIPrincipal& aSubjectPrincipal, mozilla::ErrorResult& aError);
|
|
|
|
void Home(nsIPrincipal& aSubjectPrincipal, mozilla::ErrorResult& aError);
|
2015-07-17 08:10:35 +03:00
|
|
|
bool FindOuter(const nsAString& aString, bool aCaseSensitive, bool aBackwards,
|
|
|
|
bool aWrapAround, bool aWholeWord, bool aSearchInFrames,
|
|
|
|
bool aShowDialog, mozilla::ErrorResult& aError);
|
2013-10-08 19:51:42 +04:00
|
|
|
bool Find(const nsAString& aString, bool aCaseSensitive, bool aBackwards,
|
|
|
|
bool aWrapAround, bool aWholeWord, bool aSearchInFrames,
|
|
|
|
bool aShowDialog, mozilla::ErrorResult& aError);
|
2015-07-17 08:10:35 +03:00
|
|
|
uint64_t GetMozPaintCountOuter();
|
2013-10-08 19:51:42 +04:00
|
|
|
uint64_t GetMozPaintCount(mozilla::ErrorResult& aError);
|
2014-08-26 18:11:15 +04:00
|
|
|
|
2015-06-07 16:02:00 +03:00
|
|
|
bool ShouldResistFingerprinting();
|
|
|
|
|
2014-08-26 18:11:15 +04:00
|
|
|
mozilla::dom::MozSelfSupport* GetMozSelfSupport(mozilla::ErrorResult& aError);
|
|
|
|
|
2016-01-30 20:05:36 +03:00
|
|
|
already_AddRefed<nsPIDOMWindowOuter>
|
|
|
|
OpenDialogOuter(JSContext* aCx,
|
|
|
|
const nsAString& aUrl,
|
|
|
|
const nsAString& aName,
|
|
|
|
const nsAString& aOptions,
|
|
|
|
const mozilla::dom::Sequence<JS::Value>& aExtraArgument,
|
|
|
|
mozilla::ErrorResult& aError);
|
|
|
|
already_AddRefed<nsPIDOMWindowOuter>
|
|
|
|
OpenDialog(JSContext* aCx,
|
|
|
|
const nsAString& aUrl,
|
|
|
|
const nsAString& aName,
|
|
|
|
const nsAString& aOptions,
|
|
|
|
const mozilla::dom::Sequence<JS::Value>& aExtraArgument,
|
|
|
|
mozilla::ErrorResult& aError);
|
2015-10-27 00:37:32 +03:00
|
|
|
nsresult OpenDialog(const nsAString& aUrl, const nsAString& aName,
|
|
|
|
const nsAString& aOptions,
|
2016-01-30 20:05:36 +03:00
|
|
|
nsISupports* aExtraArgument,
|
|
|
|
nsPIDOMWindowOuter** _retval) override;
|
2015-10-27 00:37:32 +03:00
|
|
|
nsresult UpdateCommands(const nsAString& anAction, nsISelection* aSel, int16_t aReason) override;
|
2015-09-26 00:03:51 +03:00
|
|
|
|
2016-01-30 20:05:36 +03:00
|
|
|
already_AddRefed<nsPIDOMWindowOuter>
|
2016-12-22 22:05:55 +03:00
|
|
|
GetContentInternal(mozilla::ErrorResult& aError,
|
|
|
|
mozilla::dom::CallerType aCallerType);
|
2015-07-17 08:10:35 +03:00
|
|
|
void GetContentOuter(JSContext* aCx,
|
|
|
|
JS::MutableHandle<JSObject*> aRetval,
|
2016-12-22 22:06:30 +03:00
|
|
|
mozilla::dom::CallerType aCallerType,
|
2015-07-17 08:10:35 +03:00
|
|
|
mozilla::ErrorResult& aError);
|
2014-06-12 00:26:52 +04:00
|
|
|
void GetContent(JSContext* aCx,
|
|
|
|
JS::MutableHandle<JSObject*> aRetval,
|
2016-12-22 22:05:55 +03:00
|
|
|
mozilla::dom::CallerType aCallerType,
|
2014-06-12 00:26:52 +04:00
|
|
|
mozilla::ErrorResult& aError);
|
2016-01-30 20:05:36 +03:00
|
|
|
already_AddRefed<nsPIDOMWindowOuter> GetContent()
|
2015-09-26 00:03:51 +03:00
|
|
|
{
|
|
|
|
MOZ_ASSERT(IsOuterWindow());
|
2016-12-22 22:05:55 +03:00
|
|
|
mozilla::IgnoredErrorResult ignored;
|
2016-01-30 20:05:36 +03:00
|
|
|
nsCOMPtr<nsPIDOMWindowOuter> win =
|
2016-12-22 22:05:55 +03:00
|
|
|
GetContentInternal(ignored, mozilla::dom::CallerType::System);
|
2015-11-21 00:29:41 +03:00
|
|
|
return win.forget();
|
2015-09-26 00:03:51 +03:00
|
|
|
}
|
|
|
|
|
2014-06-12 00:26:52 +04:00
|
|
|
void Get_content(JSContext* aCx,
|
|
|
|
JS::MutableHandle<JSObject*> aRetval,
|
2017-02-01 23:43:36 +03:00
|
|
|
mozilla::dom::SystemCallerGuarantee aCallerType,
|
2014-06-12 00:26:52 +04:00
|
|
|
mozilla::ErrorResult& aError)
|
2013-12-09 19:34:04 +04:00
|
|
|
{
|
2013-12-13 01:11:54 +04:00
|
|
|
if (mDoc) {
|
|
|
|
mDoc->WarnOnceAbout(nsIDocument::eWindow_Content);
|
|
|
|
}
|
2016-12-22 22:05:55 +03:00
|
|
|
GetContent(aCx, aRetval, aCallerType, aError);
|
2013-12-09 19:34:04 +04:00
|
|
|
}
|
2013-06-01 12:53:00 +04:00
|
|
|
|
2015-07-30 21:47:00 +03:00
|
|
|
already_AddRefed<mozilla::dom::Promise>
|
2017-03-18 03:36:13 +03:00
|
|
|
CreateImageBitmap(JSContext* aCx,
|
|
|
|
const mozilla::dom::ImageBitmapSource& aImage,
|
2015-07-30 21:47:00 +03:00
|
|
|
mozilla::ErrorResult& aRv);
|
|
|
|
|
|
|
|
already_AddRefed<mozilla::dom::Promise>
|
2017-03-18 03:36:13 +03:00
|
|
|
CreateImageBitmap(JSContext* aCx,
|
|
|
|
const mozilla::dom::ImageBitmapSource& aImage,
|
2015-07-30 21:47:00 +03:00
|
|
|
int32_t aSx, int32_t aSy, int32_t aSw, int32_t aSh,
|
|
|
|
mozilla::ErrorResult& aRv);
|
|
|
|
|
2016-04-27 06:47:22 +03:00
|
|
|
already_AddRefed<mozilla::dom::Promise>
|
2017-03-18 03:36:13 +03:00
|
|
|
CreateImageBitmap(JSContext* aCx,
|
|
|
|
const mozilla::dom::ImageBitmapSource& aImage,
|
2016-04-27 06:47:22 +03:00
|
|
|
int32_t aOffset, int32_t aLength,
|
|
|
|
mozilla::dom::ImageBitmapFormat aFormat,
|
|
|
|
const mozilla::dom::Sequence<mozilla::dom::ChannelPixelLayout>& aLayout,
|
|
|
|
mozilla::ErrorResult& aRv);
|
|
|
|
|
|
|
|
|
2014-02-06 08:37:30 +04:00
|
|
|
// ChromeWindow bits. Do NOT call these unless your window is in
|
|
|
|
// fact an nsGlobalChromeWindow.
|
|
|
|
uint16_t WindowState();
|
2015-07-17 08:10:35 +03:00
|
|
|
nsIBrowserDOMWindow* GetBrowserDOMWindowOuter();
|
2014-02-06 08:37:30 +04:00
|
|
|
nsIBrowserDOMWindow* GetBrowserDOMWindow(mozilla::ErrorResult& aError);
|
2015-07-17 08:10:35 +03:00
|
|
|
void SetBrowserDOMWindowOuter(nsIBrowserDOMWindow* aBrowserWindow);
|
2014-02-06 08:37:30 +04:00
|
|
|
void SetBrowserDOMWindow(nsIBrowserDOMWindow* aBrowserWindow,
|
|
|
|
mozilla::ErrorResult& aError);
|
|
|
|
void GetAttention(mozilla::ErrorResult& aError);
|
|
|
|
void GetAttentionWithCycleCount(int32_t aCycleCount,
|
|
|
|
mozilla::ErrorResult& aError);
|
2015-07-17 08:10:35 +03:00
|
|
|
void SetCursorOuter(const nsAString& aCursor, mozilla::ErrorResult& aError);
|
2014-02-06 08:37:30 +04:00
|
|
|
void SetCursor(const nsAString& aCursor, mozilla::ErrorResult& aError);
|
2016-08-22 02:15:49 +03:00
|
|
|
void Maximize();
|
|
|
|
void Minimize();
|
|
|
|
void Restore();
|
2014-02-06 08:37:30 +04:00
|
|
|
void NotifyDefaultButtonLoaded(mozilla::dom::Element& aDefaultButton,
|
|
|
|
mozilla::ErrorResult& aError);
|
|
|
|
nsIMessageBroadcaster* GetMessageManager(mozilla::ErrorResult& aError);
|
2014-05-23 16:51:56 +04:00
|
|
|
nsIMessageBroadcaster* GetGroupMessageManager(const nsAString& aGroup,
|
|
|
|
mozilla::ErrorResult& aError);
|
2014-03-05 04:37:43 +04:00
|
|
|
void BeginWindowMove(mozilla::dom::Event& aMouseDownEvent,
|
2014-02-06 08:37:30 +04:00
|
|
|
mozilla::dom::Element* aPanel,
|
|
|
|
mozilla::ErrorResult& aError);
|
|
|
|
|
2015-07-17 08:10:35 +03:00
|
|
|
void GetDialogArgumentsOuter(JSContext* aCx, JS::MutableHandle<JS::Value> aRetval,
|
2016-10-11 04:07:48 +03:00
|
|
|
nsIPrincipal& aSubjectPrincipal,
|
2015-07-17 08:10:35 +03:00
|
|
|
mozilla::ErrorResult& aError);
|
2014-06-12 00:26:52 +04:00
|
|
|
void GetDialogArguments(JSContext* aCx, JS::MutableHandle<JS::Value> aRetval,
|
2016-10-11 04:07:48 +03:00
|
|
|
nsIPrincipal& aSubjectPrincipal,
|
2014-06-12 00:26:52 +04:00
|
|
|
mozilla::ErrorResult& aError);
|
2015-07-17 08:10:35 +03:00
|
|
|
void GetReturnValueOuter(JSContext* aCx, JS::MutableHandle<JS::Value> aReturnValue,
|
2016-10-11 04:07:48 +03:00
|
|
|
nsIPrincipal& aSubjectPrincipal,
|
2015-07-17 08:10:35 +03:00
|
|
|
mozilla::ErrorResult& aError);
|
2014-06-12 00:26:52 +04:00
|
|
|
void GetReturnValue(JSContext* aCx, JS::MutableHandle<JS::Value> aReturnValue,
|
2016-10-11 04:07:48 +03:00
|
|
|
nsIPrincipal& aSubjectPrincipal,
|
2014-06-12 00:26:52 +04:00
|
|
|
mozilla::ErrorResult& aError);
|
2015-07-17 08:10:35 +03:00
|
|
|
void SetReturnValueOuter(JSContext* aCx, JS::Handle<JS::Value> aReturnValue,
|
2016-10-11 04:07:48 +03:00
|
|
|
nsIPrincipal& aSubjectPrincipal,
|
2015-07-17 08:10:35 +03:00
|
|
|
mozilla::ErrorResult& aError);
|
2014-02-06 01:09:18 +04:00
|
|
|
void SetReturnValue(JSContext* aCx, JS::Handle<JS::Value> aReturnValue,
|
2016-10-11 04:07:48 +03:00
|
|
|
nsIPrincipal& aSubjectPrincipal,
|
2014-02-06 01:09:18 +04:00
|
|
|
mozilla::ErrorResult& aError);
|
|
|
|
|
2014-06-12 00:26:52 +04:00
|
|
|
void GetInterface(JSContext* aCx, nsIJSID* aIID,
|
|
|
|
JS::MutableHandle<JS::Value> aRetval,
|
|
|
|
mozilla::ErrorResult& aError);
|
2014-02-16 01:12:33 +04:00
|
|
|
|
2015-07-17 08:10:35 +03:00
|
|
|
already_AddRefed<nsWindowRoot> GetWindowRootOuter();
|
2015-04-17 23:17:26 +03:00
|
|
|
already_AddRefed<nsWindowRoot> GetWindowRoot(mozilla::ErrorResult& aError);
|
2016-06-09 20:04:42 +03:00
|
|
|
|
|
|
|
mozilla::dom::Performance* GetPerformance();
|
2016-12-03 01:22:48 +03:00
|
|
|
|
2000-02-08 16:40:10 +03:00
|
|
|
protected:
|
2015-04-09 05:50:45 +03:00
|
|
|
// Web IDL helpers
|
|
|
|
|
|
|
|
// Redefine the property called aPropName on this window object to be a value
|
|
|
|
// property with the value aValue, much like we would do for a [Replaceable]
|
|
|
|
// property in IDL.
|
|
|
|
void RedefineProperty(JSContext* aCx, const char* aPropName,
|
|
|
|
JS::Handle<JS::Value> aValue,
|
|
|
|
mozilla::ErrorResult& aError);
|
|
|
|
|
2015-04-09 05:50:45 +03:00
|
|
|
// Implementation guts for our writable IDL attributes that are really
|
|
|
|
// supposed to be readonly replaceable.
|
2016-12-22 22:05:54 +03:00
|
|
|
typedef int32_t
|
|
|
|
(nsGlobalWindow::*WindowCoordGetter)(mozilla::dom::CallerType aCallerType,
|
|
|
|
mozilla::ErrorResult&);
|
2016-12-22 22:06:30 +03:00
|
|
|
typedef void
|
|
|
|
(nsGlobalWindow::*WindowCoordSetter)(int32_t,
|
|
|
|
mozilla::dom::CallerType aCallerType,
|
|
|
|
mozilla::ErrorResult&);
|
2015-04-09 05:50:45 +03:00
|
|
|
void GetReplaceableWindowCoord(JSContext* aCx, WindowCoordGetter aGetter,
|
|
|
|
JS::MutableHandle<JS::Value> aRetval,
|
2016-12-22 22:05:54 +03:00
|
|
|
mozilla::dom::CallerType aCallerType,
|
2015-04-09 05:50:45 +03:00
|
|
|
mozilla::ErrorResult& aError);
|
|
|
|
void SetReplaceableWindowCoord(JSContext* aCx, WindowCoordSetter aSetter,
|
|
|
|
JS::Handle<JS::Value> aValue,
|
|
|
|
const char* aPropName,
|
2016-12-22 22:06:30 +03:00
|
|
|
mozilla::dom::CallerType aCallerType,
|
2015-04-09 05:50:45 +03:00
|
|
|
mozilla::ErrorResult& aError);
|
|
|
|
// And the implementations of WindowCoordGetter/WindowCoordSetter.
|
2015-10-27 00:37:32 +03:00
|
|
|
public:
|
2015-07-17 08:10:35 +03:00
|
|
|
int32_t GetInnerWidthOuter(mozilla::ErrorResult& aError);
|
2015-10-27 00:37:32 +03:00
|
|
|
protected:
|
2016-12-22 22:05:54 +03:00
|
|
|
int32_t GetInnerWidth(mozilla::dom::CallerType aCallerType,
|
|
|
|
mozilla::ErrorResult& aError);
|
2015-10-27 00:37:32 +03:00
|
|
|
nsresult GetInnerWidth(int32_t* aWidth) override;
|
2016-12-22 22:06:30 +03:00
|
|
|
void SetInnerWidthOuter(int32_t aInnerWidth,
|
|
|
|
mozilla::dom::CallerType aCallerType,
|
|
|
|
mozilla::ErrorResult& aError);
|
|
|
|
void SetInnerWidth(int32_t aInnerWidth,
|
|
|
|
mozilla::dom::CallerType aCallerType,
|
|
|
|
mozilla::ErrorResult& aError);
|
2015-10-27 00:37:32 +03:00
|
|
|
public:
|
2015-07-17 08:10:35 +03:00
|
|
|
int32_t GetInnerHeightOuter(mozilla::ErrorResult& aError);
|
2015-10-27 00:37:32 +03:00
|
|
|
protected:
|
2016-12-22 22:05:54 +03:00
|
|
|
int32_t GetInnerHeight(mozilla::dom::CallerType aCallerType,
|
|
|
|
mozilla::ErrorResult& aError);
|
2015-10-27 00:37:32 +03:00
|
|
|
nsresult GetInnerHeight(int32_t* aHeight) override;
|
2016-12-22 22:06:30 +03:00
|
|
|
void SetInnerHeightOuter(int32_t aInnerHeight,
|
|
|
|
mozilla::dom::CallerType aCallerType,
|
|
|
|
mozilla::ErrorResult& aError);
|
|
|
|
void SetInnerHeight(int32_t aInnerHeight,
|
|
|
|
mozilla::dom::CallerType aCallerType,
|
|
|
|
mozilla::ErrorResult& aError);
|
2016-12-22 22:05:54 +03:00
|
|
|
int32_t GetScreenXOuter(mozilla::dom::CallerType aCallerType,
|
|
|
|
mozilla::ErrorResult& aError);
|
2016-12-22 22:05:54 +03:00
|
|
|
int32_t GetScreenX(mozilla::dom::CallerType aCallerType,
|
|
|
|
mozilla::ErrorResult& aError);
|
2016-12-22 22:06:30 +03:00
|
|
|
void SetScreenXOuter(int32_t aScreenX,
|
|
|
|
mozilla::dom::CallerType aCallerType,
|
|
|
|
mozilla::ErrorResult& aError);
|
|
|
|
void SetScreenX(int32_t aScreenX,
|
|
|
|
mozilla::dom::CallerType aCallerType,
|
|
|
|
mozilla::ErrorResult& aError);
|
2016-12-22 22:05:54 +03:00
|
|
|
int32_t GetScreenYOuter(mozilla::dom::CallerType aCallerType,
|
|
|
|
mozilla::ErrorResult& aError);
|
2016-12-22 22:05:54 +03:00
|
|
|
int32_t GetScreenY(mozilla::dom::CallerType aCallerType,
|
|
|
|
mozilla::ErrorResult& aError);
|
2016-12-22 22:06:30 +03:00
|
|
|
void SetScreenYOuter(int32_t aScreenY,
|
|
|
|
mozilla::dom::CallerType aCallerType,
|
|
|
|
mozilla::ErrorResult& aError);
|
|
|
|
void SetScreenY(int32_t aScreenY,
|
|
|
|
mozilla::dom::CallerType aCallerType,
|
|
|
|
mozilla::ErrorResult& aError);
|
2016-12-22 22:05:54 +03:00
|
|
|
int32_t GetOuterWidthOuter(mozilla::dom::CallerType aCallerType,
|
|
|
|
mozilla::ErrorResult& aError);
|
|
|
|
int32_t GetOuterWidth(mozilla::dom::CallerType aCallerType,
|
|
|
|
mozilla::ErrorResult& aError);
|
2016-12-22 22:06:30 +03:00
|
|
|
void SetOuterWidthOuter(int32_t aOuterWidth,
|
|
|
|
mozilla::dom::CallerType aCallerType,
|
|
|
|
mozilla::ErrorResult& aError);
|
|
|
|
void SetOuterWidth(int32_t aOuterWidth,
|
|
|
|
mozilla::dom::CallerType aCallerType,
|
|
|
|
mozilla::ErrorResult& aError);
|
2016-12-22 22:05:54 +03:00
|
|
|
int32_t GetOuterHeightOuter(mozilla::dom::CallerType aCallerType,
|
|
|
|
mozilla::ErrorResult& aError);
|
|
|
|
int32_t GetOuterHeight(mozilla::dom::CallerType aCallerType,
|
|
|
|
mozilla::ErrorResult& aError);
|
2016-12-22 22:06:30 +03:00
|
|
|
void SetOuterHeightOuter(int32_t aOuterHeight,
|
|
|
|
mozilla::dom::CallerType aCallerType,
|
|
|
|
mozilla::ErrorResult& aError);
|
|
|
|
void SetOuterHeight(int32_t aOuterHeight,
|
|
|
|
mozilla::dom::CallerType aCallerType,
|
|
|
|
mozilla::ErrorResult& aError);
|
2015-04-09 05:50:45 +03:00
|
|
|
|
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;
|
|
|
|
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<mozilla::dom::WakeLock> mWakeLock;
|
2012-11-01 16:40:11 +04:00
|
|
|
|
2012-06-29 12:32:21 +04:00
|
|
|
static bool sIdleObserversAPIFuzzTimeDisabled;
|
|
|
|
|
2011-04-01 00:30:32 +04:00
|
|
|
friend class HashchangeCallback;
|
2013-05-31 14:30:00 +04:00
|
|
|
friend class mozilla::dom::BarProp;
|
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();
|
2013-12-18 04:12:33 +04:00
|
|
|
void DropOuterWindowDocs();
|
2013-07-27 02:46:13 +04:00
|
|
|
void CleanUp();
|
2002-12-20 11:00:08 +03:00
|
|
|
void ClearControllers();
|
2014-05-20 23:50:58 +04:00
|
|
|
// Outer windows only.
|
|
|
|
void 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)
|
|
|
|
{
|
2016-01-30 20:05:36 +03:00
|
|
|
if(mInnerWindow == aExpectedInner->AsInner()) {
|
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();
|
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.
|
2014-02-06 01:09:19 +04:00
|
|
|
void InnerSetNewDocument(JSContext* aCx, nsIDocument* aDocument);
|
2010-03-13 03:59:18 +03:00
|
|
|
|
2014-06-29 19:31:09 +04:00
|
|
|
// Inner windows only.
|
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
|
2016-01-30 20:05:36 +03:00
|
|
|
nsPIDOMWindowOuter* GetParentInternal();
|
2001-11-01 02:52:52 +03:00
|
|
|
|
2016-10-20 23:52:38 +03:00
|
|
|
public:
|
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;
|
|
|
|
}
|
|
|
|
|
2016-10-20 23:52:38 +03:00
|
|
|
// Outer windows only.
|
|
|
|
void SetIsPopupSpamWindow(bool aIsPopupSpam);
|
2004-05-04 01:48:36 +04:00
|
|
|
|
2016-10-20 23:52:38 +03:00
|
|
|
protected:
|
2001-01-18 10:44:29 +03:00
|
|
|
// Window Control Functions
|
2012-08-14 18:58:00 +04:00
|
|
|
|
2014-06-29 19:36:03 +04:00
|
|
|
// Outer windows only.
|
2012-08-14 18:58:00 +04:00
|
|
|
virtual nsresult
|
|
|
|
OpenNoNavigate(const nsAString& aUrl,
|
|
|
|
const nsAString& aName,
|
|
|
|
const nsAString& aOptions,
|
2016-01-30 20:05:36 +03:00
|
|
|
nsPIDOMWindowOuter** _retval) override;
|
2012-08-14 18:58:00 +04:00
|
|
|
|
2014-06-29 19:36:03 +04:00
|
|
|
private:
|
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 aExtraArgument Another way to pass arguments in. This is mutually
|
2016-10-20 23:52:38 +03:00
|
|
|
* exclusive with the argv approach.
|
|
|
|
*
|
|
|
|
* @param aLoadInfo to be passed on along to the windowwatcher.
|
2012-08-14 18:58:00 +04:00
|
|
|
*
|
2016-10-20 23:52:38 +03:00
|
|
|
* @param aForceNoOpener if true, will act as if "noopener" were passed in
|
|
|
|
* aOptions, but without affecting any other window
|
|
|
|
* features.
|
|
|
|
*
|
|
|
|
* @param aReturn [out] The window that was opened, if any. Will be null if
|
|
|
|
* aForceNoOpener is true of if aOptions contains
|
|
|
|
* "noopener".
|
2014-06-29 19:36:03 +04:00
|
|
|
*
|
|
|
|
* Outer windows only.
|
2006-02-07 23:46:39 +03:00
|
|
|
*/
|
2014-06-02 16:08:21 +04:00
|
|
|
nsresult OpenInternal(const nsAString& aUrl,
|
2016-01-30 20:05:36 +03:00
|
|
|
const nsAString& aName,
|
|
|
|
const nsAString& aOptions,
|
|
|
|
bool aDialog,
|
|
|
|
bool aContentModal,
|
|
|
|
bool aCalledNoScript,
|
|
|
|
bool aDoJSFixups,
|
|
|
|
bool aNavigate,
|
|
|
|
nsIArray *argv,
|
|
|
|
nsISupports *aExtraArgument,
|
2016-10-20 23:52:38 +03:00
|
|
|
nsIDocShellLoadInfo* aLoadInfo,
|
2016-10-20 23:52:38 +03:00
|
|
|
bool aForceNoOpener,
|
2016-01-30 20:05:36 +03:00
|
|
|
nsPIDOMWindowOuter **aReturn);
|
2006-02-07 23:46:39 +03:00
|
|
|
|
2016-10-26 20:20:15 +03:00
|
|
|
template<typename Method>
|
|
|
|
void CallOnChildren(Method aMethod);
|
|
|
|
|
2016-10-26 20:20:16 +03:00
|
|
|
void FreezeInternal();
|
|
|
|
void ThawInternal();
|
2016-10-26 20:20:15 +03:00
|
|
|
|
2014-06-29 19:36:03 +04:00
|
|
|
public:
|
2001-01-18 10:44:29 +03:00
|
|
|
// Timeout Functions
|
2010-07-15 17:59:24 +04:00
|
|
|
// |interval| is in milliseconds.
|
2015-09-04 02:03:19 +03:00
|
|
|
int32_t SetTimeoutOrInterval(JSContext* aCx,
|
|
|
|
mozilla::dom::Function& aFunction,
|
2013-10-08 19:51:42 +04:00
|
|
|
int32_t aTimeout,
|
|
|
|
const mozilla::dom::Sequence<JS::Value>& aArguments,
|
|
|
|
bool aIsInterval, mozilla::ErrorResult& aError);
|
|
|
|
int32_t SetTimeoutOrInterval(JSContext* aCx, const nsAString& aHandler,
|
|
|
|
int32_t aTimeout, bool aIsInterval,
|
|
|
|
mozilla::ErrorResult& aError);
|
2006-06-13 07:07:47 +04:00
|
|
|
|
2012-04-24 22:16:29 +04:00
|
|
|
// Return true if |aTimeout| was cleared while its handler ran.
|
2016-08-22 15:52:19 +03:00
|
|
|
bool RunTimeoutHandler(mozilla::dom::Timeout* aTimeout, nsIScriptContext* aScx);
|
2001-01-18 10:44:29 +03:00
|
|
|
|
|
|
|
// Helper Functions
|
2013-04-26 10:51:01 +04:00
|
|
|
already_AddRefed<nsIDocShellTreeOwner> GetTreeOwner();
|
|
|
|
already_AddRefed<nsIBaseWindow> GetTreeOwnerWindow();
|
2013-04-26 10:51:04 +04:00
|
|
|
already_AddRefed<nsIWebBrowserChrome> GetWebBrowserChrome();
|
2001-06-20 05:25:09 +04:00
|
|
|
nsresult SecurityCheckURL(const char *aURL);
|
2015-06-27 05:36:40 +03:00
|
|
|
bool IsPrivateBrowsing();
|
2014-04-17 11:02:36 +04:00
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
bool PopupWhitelisted();
|
2009-09-16 22:46:05 +04:00
|
|
|
PopupControlState RevisePopupAbuseLevel(PopupControlState);
|
2016-04-28 23:18:52 +03:00
|
|
|
void FireAbuseEvents(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);
|
2014-08-27 06:42:13 +04:00
|
|
|
void FireOfflineStatusEventIfChanged();
|
2012-06-29 12:32:21 +04:00
|
|
|
|
2015-03-04 09:16:21 +03:00
|
|
|
bool GetIsPrerendered();
|
|
|
|
|
2017-01-18 21:10:54 +03:00
|
|
|
private:
|
|
|
|
void ReportLargeAllocStatus();
|
|
|
|
|
|
|
|
public:
|
2013-11-28 18:07:55 +04:00
|
|
|
// Inner windows only.
|
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);
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual nsresult RegisterIdleObserver(nsIIdleObserver* aIdleObserverPtr) override;
|
2012-06-29 12:32:21 +04:00
|
|
|
nsresult FindIndexOfElementToRemove(nsIIdleObserver* aIdleObserver,
|
2012-08-22 19:56:38 +04:00
|
|
|
int32_t* aRemoveElementIndex);
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual nsresult UnregisterIdleObserver(nsIIdleObserver* aIdleObserverPtr) override;
|
2012-06-29 12:32:21 +04:00
|
|
|
|
2013-11-28 18:07:55 +04:00
|
|
|
// Inner windows only.
|
2011-04-01 00:30:32 +04:00
|
|
|
nsresult FireHashchange(const nsAString &aOldURL, const nsAString &aNewURL);
|
2009-11-27 08:01:43 +03:00
|
|
|
|
2017-01-05 10:31:56 +03:00
|
|
|
void FlushPendingNotifications(mozilla::FlushType aType);
|
2013-11-28 18:07:55 +04:00
|
|
|
|
|
|
|
// Outer windows only.
|
2002-02-05 08:47:22 +03:00
|
|
|
void EnsureReflowFlushAndPaint();
|
2016-12-22 22:06:30 +03:00
|
|
|
void CheckSecurityWidthAndHeight(int32_t* width, int32_t* height,
|
|
|
|
mozilla::dom::CallerType aCallerType);
|
|
|
|
void CheckSecurityLeftAndTop(int32_t* left, int32_t* top,
|
|
|
|
mozilla::dom::CallerType aCallerType);
|
2010-12-22 01:35:09 +03:00
|
|
|
|
2013-11-28 18:07:55 +04:00
|
|
|
// Outer windows only.
|
2010-12-22 01:35:09 +03:00
|
|
|
// Arguments to this function should have values in app units
|
2013-04-26 10:50:54 +04:00
|
|
|
void SetCSSViewportWidthAndHeight(nscoord width, nscoord height);
|
2010-12-22 01:35:09 +03:00
|
|
|
// 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
|
|
|
|
2016-09-29 17:14:42 +03:00
|
|
|
static void MakeScriptDialogTitle(nsAString& aOutTitle,
|
|
|
|
nsIPrincipal* aSubjectPrincipal);
|
2000-02-08 16:40:10 +03:00
|
|
|
|
2013-11-28 18:07:55 +04:00
|
|
|
// Outer windows only.
|
2016-12-22 22:06:32 +03:00
|
|
|
bool CanMoveResizeWindows(mozilla::dom::CallerType aCallerType);
|
2008-03-19 23:27:34 +03:00
|
|
|
|
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.
|
2014-06-29 19:31:12 +04:00
|
|
|
// Outer windows only.
|
2017-03-03 00:01:31 +03:00
|
|
|
mozilla::CSSPoint GetScrollXY(bool aDoFlush);
|
2014-06-29 19:31:12 +04:00
|
|
|
|
2015-10-27 07:38:02 +03:00
|
|
|
int32_t GetScrollBoundaryOuter(mozilla::Side aSide);
|
2012-06-29 12:32:21 +04:00
|
|
|
|
2013-07-01 11:14:24 +04:00
|
|
|
// Outer windows only.
|
|
|
|
nsresult GetInnerSize(mozilla::CSSIntSize& aSize);
|
2016-12-22 22:05:54 +03:00
|
|
|
nsIntSize GetOuterSize(mozilla::dom::CallerType aCallerType,
|
|
|
|
mozilla::ErrorResult& aError);
|
2013-10-08 19:51:42 +04:00
|
|
|
void SetOuterSize(int32_t aLengthCSSPixels, bool aIsWidth,
|
2016-12-22 22:06:30 +03:00
|
|
|
mozilla::dom::CallerType aCallerType,
|
|
|
|
mozilla::ErrorResult& aError);
|
2009-07-30 07:16:44 +04:00
|
|
|
nsRect GetInnerScreenRect();
|
2003-04-15 17:40:46 +04:00
|
|
|
|
2014-08-06 02:01:34 +04:00
|
|
|
void ScrollTo(const mozilla::CSSIntPoint& aScroll,
|
|
|
|
const mozilla::dom::ScrollOptions& aOptions);
|
2013-07-01 11:14:34 +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
|
|
|
}
|
|
|
|
|
2013-11-28 18:07:55 +04:00
|
|
|
// Outer windows only.
|
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.
|
2016-10-20 23:52:38 +03:00
|
|
|
bool WindowExists(const nsAString& aName, bool aForceNoOpener,
|
|
|
|
bool aLookForCallerOnJSStack);
|
2005-01-11 22:36:40 +03:00
|
|
|
|
2005-03-06 21:43:07 +03:00
|
|
|
already_AddRefed<nsIWidget> GetMainWidget();
|
2015-08-29 04:12:41 +03:00
|
|
|
nsIWidget* GetNearestWidget() const;
|
2005-03-06 21:43:07 +03: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,
|
2015-03-21 19:28:04 +03:00
|
|
|
bool aNeedsFocus = false) override;
|
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
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual uint32_t GetFocusMethod() override;
|
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
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual bool ShouldShowFocusRing() override;
|
2010-04-21 18:53:42 +04:00
|
|
|
|
|
|
|
virtual void SetKeyboardIndicators(UIStateChangeType aShowAccelerators,
|
2015-03-21 19:28:04 +03:00
|
|
|
UIStateChangeType aShowFocusRings) override;
|
2010-04-21 18:53:42 +04:00
|
|
|
|
2013-11-28 18:07:55 +04:00
|
|
|
// Inner windows only.
|
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
|
|
|
|
2013-04-04 11:02:11 +04:00
|
|
|
public:
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual already_AddRefed<nsPIWindowRoot> GetTopWindowRoot() override;
|
2010-02-20 19:07:03 +03:00
|
|
|
|
2013-04-04 11:02:11 +04:00
|
|
|
protected:
|
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
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual void UpdateParentTarget() override;
|
2010-06-16 15:43:36 +04:00
|
|
|
|
2016-03-18 22:44:40 +03:00
|
|
|
void InitializeShowFocusRings();
|
|
|
|
|
2014-09-06 06:42:33 +04:00
|
|
|
// Clear the document-dependent slots on our JS wrapper. Inner windows only.
|
|
|
|
void ClearDocumentDependentSlots(JSContext* aCx);
|
2014-06-29 19:36:03 +04:00
|
|
|
|
|
|
|
// Inner windows only.
|
2014-05-23 11:33:24 +04:00
|
|
|
already_AddRefed<mozilla::dom::StorageEvent>
|
|
|
|
CloneStorageEvent(const nsAString& aType,
|
2015-10-18 08:24:48 +03:00
|
|
|
const RefPtr<mozilla::dom::StorageEvent>& aEvent,
|
2014-08-13 16:56:25 +04:00
|
|
|
mozilla::ErrorResult& aRv);
|
2012-03-24 12:18:21 +04:00
|
|
|
|
2016-02-10 01:40:45 +03:00
|
|
|
public:
|
2012-10-02 12:07:35 +04:00
|
|
|
// Outer windows only.
|
|
|
|
nsDOMWindowList* GetWindowList();
|
|
|
|
|
2016-02-10 01:40:45 +03:00
|
|
|
protected:
|
2015-07-17 08:10:35 +03:00
|
|
|
already_AddRefed<nsICSSDeclaration>
|
2017-04-13 11:50:37 +03:00
|
|
|
GetComputedStyleOuter(mozilla::dom::Element& aElt,
|
|
|
|
const nsAString& aPseudoElt);
|
2012-10-18 01:01:56 +04:00
|
|
|
|
2014-05-20 23:50:58 +04:00
|
|
|
// Outer windows only.
|
2013-04-15 16:38:48 +04:00
|
|
|
void PreloadLocalStorage();
|
|
|
|
|
2016-02-05 19:29:33 +03:00
|
|
|
// Returns CSS pixels based on primary screen. Outer windows only.
|
2016-12-22 22:05:54 +03:00
|
|
|
mozilla::CSSIntPoint GetScreenXY(mozilla::dom::CallerType aCallerType,
|
|
|
|
mozilla::ErrorResult& aError);
|
2013-10-08 19:51:42 +04:00
|
|
|
|
|
|
|
nsGlobalWindow* InnerForSetTimeoutOrInterval(mozilla::ErrorResult& aError);
|
|
|
|
|
2015-07-17 08:10:35 +03:00
|
|
|
void PostMessageMozOuter(JSContext* aCx, JS::Handle<JS::Value> aMessage,
|
|
|
|
const nsAString& aTargetOrigin,
|
|
|
|
JS::Handle<JS::Value> aTransfer,
|
2016-10-11 04:07:48 +03:00
|
|
|
nsIPrincipal& aSubjectPrincipal,
|
2015-07-17 08:10:35 +03:00
|
|
|
mozilla::ErrorResult& aError);
|
2013-10-08 19:51:42 +04:00
|
|
|
void PostMessageMoz(JSContext* aCx, JS::Handle<JS::Value> aMessage,
|
|
|
|
const nsAString& aTargetOrigin,
|
|
|
|
JS::Handle<JS::Value> aTransfer,
|
2016-10-11 04:07:48 +03:00
|
|
|
nsIPrincipal& aSubjectPrincipal,
|
2013-10-08 19:51:42 +04:00
|
|
|
mozilla::ErrorResult& aError);
|
|
|
|
|
2015-07-17 08:10:35 +03:00
|
|
|
already_AddRefed<nsIVariant>
|
|
|
|
ShowModalDialogOuter(const nsAString& aUrl, nsIVariant* aArgument,
|
2016-09-29 17:14:42 +03:00
|
|
|
const nsAString& aOptions,
|
2016-10-11 04:07:48 +03:00
|
|
|
nsIPrincipal& aSubjectPrincipal,
|
2016-09-29 17:14:42 +03:00
|
|
|
mozilla::ErrorResult& aError);
|
2015-07-17 08:10:35 +03:00
|
|
|
|
2013-10-08 19:51:42 +04:00
|
|
|
already_AddRefed<nsIVariant>
|
|
|
|
ShowModalDialog(const nsAString& aUrl, nsIVariant* aArgument,
|
2016-09-29 17:14:42 +03:00
|
|
|
const nsAString& aOptions,
|
2016-10-11 04:07:48 +03:00
|
|
|
nsIPrincipal& aSubjectPrincipal,
|
2016-09-29 17:14:42 +03:00
|
|
|
mozilla::ErrorResult& aError);
|
2013-10-08 19:51:42 +04:00
|
|
|
|
2013-12-14 21:52:13 +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();
|
|
|
|
|
2016-02-18 13:47:47 +03:00
|
|
|
// Helper called after moving/resizing, to update docShell's presContext
|
|
|
|
// if we have caused a resolution change by moving across monitors.
|
|
|
|
void CheckForDPIChange();
|
|
|
|
|
2015-07-14 22:28:57 +03:00
|
|
|
private:
|
|
|
|
// Fire the JS engine's onNewGlobalObject hook. Only used on inner windows.
|
|
|
|
void FireOnNewGlobalObject();
|
|
|
|
|
2015-07-24 23:05:14 +03:00
|
|
|
void DisconnectEventTargetObjects();
|
|
|
|
|
2017-01-13 03:57:44 +03:00
|
|
|
|
|
|
|
enum class SecureContextFlags {
|
|
|
|
eDefault,
|
|
|
|
eIgnoreOpener
|
|
|
|
};
|
2016-04-28 13:13:09 +03:00
|
|
|
// Called only on outer windows to compute the value that will be returned by
|
|
|
|
// IsSecureContext() for the inner window that corresponds to aDocument.
|
2017-01-13 03:57:44 +03:00
|
|
|
bool ComputeIsSecureContext(nsIDocument* aDocument,
|
|
|
|
SecureContextFlags aFlags =
|
|
|
|
SecureContextFlags::eDefault);
|
2016-04-28 13:13:09 +03:00
|
|
|
|
2016-10-28 21:10:32 +03:00
|
|
|
// nsPIDOMWindow<T> should be able to see these helper methods.
|
|
|
|
friend class nsPIDOMWindow<mozIDOMWindowProxy>;
|
|
|
|
friend class nsPIDOMWindow<mozIDOMWindow>;
|
|
|
|
friend class nsPIDOMWindow<nsISupports>;
|
|
|
|
|
2016-10-07 21:59:59 +03:00
|
|
|
mozilla::dom::TabGroup* TabGroupInner();
|
|
|
|
mozilla::dom::TabGroup* TabGroupOuter();
|
2016-09-13 18:32:08 +03:00
|
|
|
|
2016-11-11 18:38:15 +03:00
|
|
|
bool IsBackgroundInternal() const;
|
|
|
|
|
2016-10-29 01:25:08 +03:00
|
|
|
public:
|
|
|
|
// Dispatch a runnable related to the global.
|
|
|
|
virtual nsresult Dispatch(const char* aName,
|
2017-01-19 07:26:17 +03:00
|
|
|
mozilla::TaskCategory aCategory,
|
2016-10-29 01:25:08 +03:00
|
|
|
already_AddRefed<nsIRunnable>&& aRunnable) override;
|
|
|
|
|
2016-12-16 00:48:14 +03:00
|
|
|
virtual nsIEventTarget*
|
2017-01-19 07:26:17 +03:00
|
|
|
EventTargetFor(mozilla::TaskCategory aCategory) const override;
|
2016-10-29 01:57:50 +03:00
|
|
|
|
2016-12-01 13:33:05 +03:00
|
|
|
virtual mozilla::AbstractThread*
|
2017-01-19 07:26:17 +03:00
|
|
|
AbstractMainThreadFor(mozilla::TaskCategory aCategory) override;
|
2016-12-01 13:33:05 +03:00
|
|
|
|
2016-11-08 15:54:40 +03:00
|
|
|
void DisableIdleCallbackRequests();
|
2017-02-27 17:00:24 +03:00
|
|
|
uint32_t LastIdleRequestHandle() const { return mIdleRequestCallbackCounter - 1; }
|
2016-11-08 15:54:40 +03:00
|
|
|
nsresult RunIdleRequest(mozilla::dom::IdleRequest* aRequest,
|
|
|
|
DOMHighResTimeStamp aDeadline, bool aDidTimeout);
|
|
|
|
nsresult ExecuteIdleRequest(TimeStamp aDeadline);
|
|
|
|
void ScheduleIdleRequestDispatch();
|
2017-01-20 15:43:28 +03:00
|
|
|
void SuspendIdleRequests();
|
|
|
|
void ResumeIdleRequests();
|
2016-11-08 15:54:40 +03:00
|
|
|
|
|
|
|
typedef mozilla::LinkedList<mozilla::dom::IdleRequest> IdleRequests;
|
|
|
|
void InsertIdleCallback(mozilla::dom::IdleRequest* aRequest);
|
|
|
|
|
|
|
|
void RemoveIdleCallback(mozilla::dom::IdleRequest* aRequest);
|
|
|
|
|
2015-07-14 22:28:57 +03:00
|
|
|
protected:
|
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;
|
2015-05-06 01:04:31 +03:00
|
|
|
bool mFullscreenMode : 1;
|
2011-09-29 10:19:26 +04:00
|
|
|
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;
|
2016-04-28 13:13:09 +03:00
|
|
|
bool mOriginalOpenerWasSecureContext : 1;
|
2017-01-13 03:57:44 +03:00
|
|
|
bool mIsSecureContextIfOpenerIgnored : 1;
|
2011-09-29 10:19:26 +04:00
|
|
|
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
|
|
|
|
2014-08-27 06:42:13 +04:00
|
|
|
// Window offline status. Checked to see if we need to fire offline event
|
|
|
|
bool mWasOffline : 1;
|
|
|
|
|
2016-03-01 19:16:33 +03:00
|
|
|
// Represents whether the inner window's page has had a slow script notice.
|
|
|
|
// Only used by inner windows; will always be false for outer windows.
|
|
|
|
// This is used to implement Telemetry measures such as SLOW_SCRIPT_PAGE_COUNT.
|
|
|
|
bool mHasHadSlowScript : 1;
|
|
|
|
|
2006-05-04 01:53:08 +04:00
|
|
|
// Track what sorts of events we need to fire when thawed
|
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
|
|
|
// 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
|
|
|
|
2014-06-29 19:36:02 +04:00
|
|
|
// Inner windows only.
|
2011-08-03 22:12:08 +04:00
|
|
|
// Indicates whether this window wants gamepad input events
|
|
|
|
bool mHasGamepad : 1;
|
2016-07-05 01:46:49 +03:00
|
|
|
|
|
|
|
// Inner windows only.
|
|
|
|
// Indicates whether this window wants VR events
|
|
|
|
bool mHasVREvents : 1;
|
2015-04-24 01:05:29 +03:00
|
|
|
nsCheapSet<nsUint32HashKey> mGamepadIndexSet;
|
2012-02-16 04:47:13 +04:00
|
|
|
nsRefPtrHashtable<nsUint32HashKey, mozilla::dom::Gamepad> mGamepads;
|
2011-08-03 22:12:08 +04:00
|
|
|
bool mHasSeenGamepadInput;
|
|
|
|
|
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
|
|
|
|
2017-01-23 20:23:57 +03:00
|
|
|
bool mTopLevelOuterContentWindow : 1;
|
|
|
|
|
2001-01-18 10:44:29 +03:00
|
|
|
nsCOMPtr<nsIScriptContext> mContext;
|
2008-02-09 00:09:36 +03:00
|
|
|
nsWeakPtr mOpener;
|
2001-01-18 10:44:29 +03:00
|
|
|
nsCOMPtr<nsIControllers> mControllers;
|
2013-05-17 21:43:19 +04:00
|
|
|
|
|
|
|
// For |window.arguments|, via |openDialog|.
|
2006-06-13 07:07:47 +04:00
|
|
|
nsCOMPtr<nsIArray> mArguments;
|
2013-05-17 21:43:19 +04:00
|
|
|
|
|
|
|
// For |window.dialogArguments|, via |showModalDialog|.
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<DialogValueHolder> mDialogArguments;
|
2013-05-17 21:43:19 +04:00
|
|
|
|
2014-02-06 01:09:18 +04:00
|
|
|
// Only used in the outer.
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<DialogValueHolder> mReturnValue;
|
2014-02-06 01:09:18 +04:00
|
|
|
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<mozilla::dom::Navigator> mNavigator;
|
|
|
|
RefPtr<nsScreen> mScreen;
|
|
|
|
RefPtr<nsDOMWindowList> mFrames;
|
2015-07-17 08:10:35 +03:00
|
|
|
// All BarProps are inner window only.
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<mozilla::dom::BarProp> mMenubar;
|
|
|
|
RefPtr<mozilla::dom::BarProp> mToolbar;
|
|
|
|
RefPtr<mozilla::dom::BarProp> mLocationbar;
|
|
|
|
RefPtr<mozilla::dom::BarProp> mPersonalbar;
|
|
|
|
RefPtr<mozilla::dom::BarProp> mStatusbar;
|
|
|
|
RefPtr<mozilla::dom::BarProp> mScrollbars;
|
2016-08-22 15:52:19 +03:00
|
|
|
RefPtr<nsDOMWindowUtils> mWindowUtils;
|
2001-01-18 10:44:29 +03:00
|
|
|
nsString mStatus;
|
|
|
|
nsString mDefaultStatus;
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<nsGlobalWindowObserver> mObserver; // Inner windows only.
|
|
|
|
RefPtr<mozilla::dom::Crypto> mCrypto;
|
2016-02-09 18:43:00 +03:00
|
|
|
RefPtr<mozilla::dom::U2F> mU2F;
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<mozilla::dom::cache::CacheStorage> mCacheStorage;
|
|
|
|
RefPtr<mozilla::dom::Console> mConsole;
|
2016-12-14 16:43:26 +03:00
|
|
|
RefPtr<mozilla::dom::Worklet> mAudioWorklet;
|
2016-12-17 00:21:51 +03:00
|
|
|
RefPtr<mozilla::dom::Worklet> mPaintWorklet;
|
2014-03-28 08:03:03 +04:00
|
|
|
// We need to store an nsISupports pointer to this object because the
|
|
|
|
// mozilla::dom::External class doesn't exist on b2g and using the type
|
|
|
|
// forward declared here means that ~nsGlobalWindow wouldn't compile because
|
|
|
|
// it wouldn't see the ~External function's declaration.
|
|
|
|
nsCOMPtr<nsISupports> mExternal;
|
2013-02-17 08:43:16 +04:00
|
|
|
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<mozilla::dom::MozSelfSupport> mMozSelfSupport;
|
2014-08-26 18:11:15 +04:00
|
|
|
|
2017-01-04 16:53:01 +03:00
|
|
|
RefPtr<mozilla::dom::Storage> mLocalStorage;
|
|
|
|
RefPtr<mozilla::dom::Storage> mSessionStorage;
|
2009-03-19 02:43:45 +03:00
|
|
|
|
2005-08-12 08:11:00 +04:00
|
|
|
// These member variable are used only on inner windows.
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<mozilla::EventListenerManager> mListenerManager;
|
2016-09-16 10:18:18 +03:00
|
|
|
RefPtr<mozilla::dom::Location> mLocation;
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<nsHistory> mHistory;
|
2016-10-12 10:26:02 +03:00
|
|
|
RefPtr<mozilla::dom::CustomElementRegistry> mCustomElements;
|
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;
|
2013-07-23 13:58:26 +04:00
|
|
|
|
2016-10-26 20:20:15 +03:00
|
|
|
uint32_t mSuspendDepth;
|
|
|
|
uint32_t mFreezeDepth;
|
|
|
|
|
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
|
|
|
|
2016-08-22 15:52:45 +03:00
|
|
|
// The current idle request callback handle
|
|
|
|
uint32_t mIdleRequestCallbackCounter;
|
|
|
|
IdleRequests mIdleRequestCallbacks;
|
2016-11-08 15:54:40 +03:00
|
|
|
RefPtr<IdleRequestExecutor> mIdleRequestExecutor;
|
2016-08-22 15:52:45 +03: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
|
|
|
|
|
2013-08-08 04:07:41 +04:00
|
|
|
#ifdef MOZ_B2G
|
|
|
|
bool mNetworkUploadObserverEnabled;
|
|
|
|
bool mNetworkDownloadObserverEnabled;
|
|
|
|
#endif // MOZ_B2G
|
|
|
|
|
2013-08-08 04:45:54 +04:00
|
|
|
bool mCleanedUp;
|
|
|
|
|
2008-01-17 00:54:33 +03:00
|
|
|
nsCOMPtr<nsIDOMOfflineResourceList> mApplicationCache;
|
|
|
|
|
2016-10-18 19:58:19 +03:00
|
|
|
using XBLPrototypeHandlerTable = nsJSThingHashtable<nsPtrHashKey<nsXBLPrototypeHandler>, JSObject*>;
|
|
|
|
nsAutoPtr<XBLPrototypeHandlerTable> mCachedXBLPrototypeHandlers;
|
2008-02-13 07:17:18 +03:00
|
|
|
|
2013-12-18 04:12:33 +04:00
|
|
|
// mSuspendedDoc is only set on outer windows. It's useful when we get matched
|
|
|
|
// EnterModalState/LeaveModalState calls, in which case the outer window is
|
|
|
|
// responsible for unsuspending events on the document. If we don't (for
|
|
|
|
// example, if the outer window is closed before the LeaveModalState call),
|
|
|
|
// then the inner window whose mDoc is our mSuspendedDoc is responsible for
|
|
|
|
// unsuspending it.
|
2009-03-03 23:11:14 +03:00
|
|
|
nsCOMPtr<nsIDocument> mSuspendedDoc;
|
|
|
|
|
2016-02-17 00:46:08 +03:00
|
|
|
RefPtr<mozilla::dom::IDBFactory> 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
|
|
|
|
2013-10-09 01:00:12 +04:00
|
|
|
// This flag keeps track of whether dialogs are
|
|
|
|
// currently enabled on this window.
|
|
|
|
bool mAreDialogsEnabled;
|
2012-08-13 23:05:34 +04:00
|
|
|
|
2014-04-01 10:13:50 +04:00
|
|
|
nsTHashtable<nsPtrHashKey<mozilla::DOMEventTargetHelper> > mEventTargetObjects;
|
2012-03-13 04:56:07 +04:00
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
nsTArray<uint32_t> mEnabledSensors;
|
2012-03-25 04:30:03 +04:00
|
|
|
|
2015-10-24 07:37:28 +03:00
|
|
|
#if defined(MOZ_WIDGET_ANDROID) || defined(MOZ_WIDGET_GONK)
|
|
|
|
nsAutoPtr<mozilla::dom::WindowOrientationObserver> mOrientationChangeObserver;
|
|
|
|
#endif
|
|
|
|
|
2013-04-07 16:19:56 +04:00
|
|
|
#ifdef MOZ_WEBSPEECH
|
|
|
|
// mSpeechSynthesis is only used on inner windows.
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<mozilla::dom::SpeechSynthesis> mSpeechSynthesis;
|
2013-04-07 16:19:56 +04:00
|
|
|
#endif
|
|
|
|
|
2016-10-07 21:59:59 +03:00
|
|
|
#ifdef DEBUG
|
|
|
|
// This member is used in the debug only assertions in TabGroup()
|
|
|
|
// to catch cyclic parent/opener trees and not overflow the stack.
|
|
|
|
bool mIsValidatingTabGroup;
|
|
|
|
#endif
|
|
|
|
|
2014-11-13 18:11:55 +03:00
|
|
|
// This is the CC generation the last time we called CanSkip.
|
|
|
|
uint32_t mCanSkipCCGeneration;
|
|
|
|
|
2016-04-13 03:39:28 +03:00
|
|
|
// The VR Displays for this window
|
|
|
|
nsTArray<RefPtr<mozilla::dom::VRDisplay>> mVRDisplays;
|
2014-07-09 23:24:49 +04:00
|
|
|
|
2017-02-14 22:21:09 +03:00
|
|
|
RefPtr<mozilla::dom::VREventObserver> mVREventObserver;
|
2016-07-05 01:46:49 +03:00
|
|
|
|
2017-02-23 03:11:58 +03:00
|
|
|
// When non-zero, the document should receive a vrdisplayactivate event
|
|
|
|
// after loading. The value is the ID of the VRDisplay that content should
|
|
|
|
// begin presentation on.
|
|
|
|
uint32_t mAutoActivateVRDisplayID; // Outer windows only
|
|
|
|
|
2017-03-10 11:36:09 +03:00
|
|
|
#ifdef ENABLE_INTL_API
|
2017-03-04 05:30:00 +03:00
|
|
|
RefPtr<mozilla::dom::IntlUtils> mIntlUtils;
|
2017-03-10 11:36:09 +03:00
|
|
|
#endif
|
2017-03-04 05:30:00 +03: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;
|
2015-06-17 13:44:27 +03:00
|
|
|
friend class mozilla::dom::PostMessageEvent;
|
2013-04-10 18:20:43 +04:00
|
|
|
friend class DesktopNotification;
|
2016-12-03 01:22:48 +03:00
|
|
|
friend class mozilla::dom::TimeoutManager;
|
2016-11-08 15:54:40 +03:00
|
|
|
friend class IdleRequestExecutor;
|
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
|
|
|
};
|
|
|
|
|
2013-10-08 19:51:42 +04:00
|
|
|
inline nsISupports*
|
|
|
|
ToSupports(nsGlobalWindow *p)
|
|
|
|
{
|
|
|
|
return static_cast<nsIDOMEventTarget*>(p);
|
|
|
|
}
|
|
|
|
|
|
|
|
inline nsISupports*
|
|
|
|
ToCanonicalSupports(nsGlobalWindow *p)
|
|
|
|
{
|
|
|
|
return static_cast<nsIDOMEventTarget*>(p);
|
|
|
|
}
|
|
|
|
|
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
|
|
|
|
|
2014-08-27 06:42:13 +04:00
|
|
|
static already_AddRefed<nsGlobalChromeWindow> Create(nsGlobalWindow *aOuterWindow);
|
2011-01-23 22:51:00 +03:00
|
|
|
|
2015-10-27 08:21:51 +03:00
|
|
|
void DisconnectAndClearGroupMessageManagers()
|
2014-05-23 16:51:56 +04:00
|
|
|
{
|
2015-10-27 08:21:51 +03:00
|
|
|
for (auto iter = mGroupMessageManagers.Iter(); !iter.Done(); iter.Next()) {
|
|
|
|
nsIMessageBroadcaster* mm = iter.UserData();
|
|
|
|
if (mm) {
|
|
|
|
static_cast<nsFrameMessageManager*>(mm)->Disconnect();
|
|
|
|
}
|
2014-05-23 16:51:56 +04:00
|
|
|
}
|
2015-10-27 08:21:51 +03:00
|
|
|
mGroupMessageManagers.Clear();
|
2014-05-23 16:51:56 +04:00
|
|
|
}
|
|
|
|
|
2014-07-09 01:23:17 +04:00
|
|
|
protected:
|
2014-08-27 06:42:13 +04:00
|
|
|
explicit nsGlobalChromeWindow(nsGlobalWindow *aOuterWindow)
|
|
|
|
: nsGlobalWindow(aOuterWindow),
|
|
|
|
mGroupMessageManagers(1)
|
|
|
|
{
|
|
|
|
mIsChrome = true;
|
|
|
|
mCleanMessageManager = true;
|
|
|
|
}
|
|
|
|
|
2011-01-23 22:51:00 +03:00
|
|
|
~nsGlobalChromeWindow()
|
|
|
|
{
|
2015-02-10 01:34:50 +03:00
|
|
|
MOZ_ASSERT(mCleanMessageManager,
|
|
|
|
"chrome windows may always disconnect the msg manager");
|
2014-05-23 16:51:56 +04:00
|
|
|
|
2015-10-27 08:21:51 +03:00
|
|
|
DisconnectAndClearGroupMessageManagers();
|
2014-05-23 16:51:56 +04:00
|
|
|
|
2011-01-23 22:51:00 +03:00
|
|
|
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
|
|
|
}
|
|
|
|
|
2014-07-09 01:23:17 +04:00
|
|
|
public:
|
2011-06-21 18:51:49 +04:00
|
|
|
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsGlobalChromeWindow,
|
|
|
|
nsGlobalWindow)
|
2007-03-08 14:17:16 +03:00
|
|
|
|
2014-02-06 08:37:30 +04:00
|
|
|
using nsGlobalWindow::GetBrowserDOMWindow;
|
|
|
|
using nsGlobalWindow::SetBrowserDOMWindow;
|
|
|
|
using nsGlobalWindow::GetAttention;
|
|
|
|
using nsGlobalWindow::GetAttentionWithCycleCount;
|
|
|
|
using nsGlobalWindow::SetCursor;
|
|
|
|
using nsGlobalWindow::Maximize;
|
|
|
|
using nsGlobalWindow::Minimize;
|
|
|
|
using nsGlobalWindow::Restore;
|
|
|
|
using nsGlobalWindow::NotifyDefaultButtonLoaded;
|
|
|
|
using nsGlobalWindow::GetMessageManager;
|
2014-05-23 16:51:56 +04:00
|
|
|
using nsGlobalWindow::GetGroupMessageManager;
|
2014-02-06 08:37:30 +04:00
|
|
|
using nsGlobalWindow::BeginWindowMove;
|
|
|
|
|
2004-12-07 19:09:23 +03:00
|
|
|
nsCOMPtr<nsIBrowserDOMWindow> mBrowserDOMWindow;
|
2012-08-27 18:13:02 +04:00
|
|
|
nsCOMPtr<nsIMessageBroadcaster> mMessageManager;
|
2014-05-23 16:51:56 +04:00
|
|
|
nsInterfaceHashtable<nsStringHashKey, nsIMessageBroadcaster> mGroupMessageManagers;
|
2016-05-03 10:58:57 +03:00
|
|
|
// A weak pointer to the nsPresShell that we are doing fullscreen for.
|
|
|
|
// The pointer being set indicates we've set the IsInFullscreenChange
|
|
|
|
// flag on this pres shell.
|
|
|
|
nsWeakPtr mFullscreenPresShell;
|
2016-10-07 21:59:59 +03:00
|
|
|
nsCOMPtr<mozIDOMWindowProxy> mOpenerForInitialContentBrowser;
|
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:
|
2014-08-27 06:42:13 +04:00
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
|
|
|
NS_DECL_NSIDOMMODALCONTENTWINDOW
|
|
|
|
|
|
|
|
static already_AddRefed<nsGlobalModalWindow> Create(nsGlobalWindow *aOuterWindow);
|
|
|
|
|
|
|
|
protected:
|
2014-08-05 17:19:51 +04:00
|
|
|
explicit nsGlobalModalWindow(nsGlobalWindow *aOuterWindow)
|
2007-07-26 21:52:26 +04:00
|
|
|
: nsGlobalWindow(aOuterWindow)
|
|
|
|
{
|
2011-10-17 18:59:28 +04:00
|
|
|
mIsModalContentWindow = true;
|
2007-07-26 21:52:26 +04:00
|
|
|
}
|
|
|
|
|
2014-07-09 01:23:17 +04:00
|
|
|
~nsGlobalModalWindow() {}
|
2007-07-26 21:52:26 +04:00
|
|
|
};
|
|
|
|
|
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)
|
|
|
|
{
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<nsGlobalWindow> global;
|
2012-04-14 17:03:16 +04:00
|
|
|
|
|
|
|
if (aIsChrome) {
|
2014-08-27 06:42:13 +04:00
|
|
|
global = nsGlobalChromeWindow::Create(nullptr);
|
2012-04-14 17:03:16 +04:00
|
|
|
} else if (aIsModalContentWindow) {
|
2014-08-27 06:42:13 +04:00
|
|
|
global = nsGlobalModalWindow::Create(nullptr);
|
2012-04-14 17:03:16 +04:00
|
|
|
} else {
|
2014-08-27 06:42:13 +04:00
|
|
|
global = nsGlobalWindow::Create(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___ */
|