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/. */
|
1999-12-14 02:13:33 +03:00
|
|
|
|
1999-10-14 14:58:25 +04:00
|
|
|
#ifndef nsPIDOMWindow_h__
|
|
|
|
#define nsPIDOMWindow_h__
|
|
|
|
|
2011-07-15 14:31:34 +04:00
|
|
|
#include "nsIDOMWindow.h"
|
2016-01-30 20:05:36 +03:00
|
|
|
#include "mozIDOMWindow.h"
|
2011-07-15 14:31:34 +04:00
|
|
|
|
2004-05-04 01:48:36 +04:00
|
|
|
#include "nsCOMPtr.h"
|
2012-11-24 03:33:41 +04:00
|
|
|
#include "nsTArray.h"
|
2013-04-06 04:44:15 +04:00
|
|
|
#include "mozilla/dom/EventTarget.h"
|
2017-01-31 03:13:18 +03:00
|
|
|
#include "mozilla/TaskCategory.h"
|
2013-08-28 06:59:14 +04:00
|
|
|
#include "js/TypeDecls.h"
|
2015-11-23 21:38:08 +03:00
|
|
|
#include "nsRefPtrHashtable.h"
|
2013-03-21 00:09:09 +04:00
|
|
|
|
2016-01-22 21:27:54 +03:00
|
|
|
// Only fired for inner windows.
|
2008-02-14 02:41:17 +03:00
|
|
|
#define DOM_WINDOW_DESTROYED_TOPIC "dom-window-destroyed"
|
2011-05-23 01:30:07 +04:00
|
|
|
#define DOM_WINDOW_FROZEN_TOPIC "dom-window-frozen"
|
|
|
|
#define DOM_WINDOW_THAWED_TOPIC "dom-window-thawed"
|
2008-02-14 02:41:17 +03:00
|
|
|
|
2016-01-30 20:05:36 +03:00
|
|
|
class nsGlobalWindow;
|
2013-08-22 10:30:55 +04:00
|
|
|
class nsIArray;
|
|
|
|
class nsIContent;
|
2015-10-27 00:37:32 +03:00
|
|
|
class nsICSSDeclaration;
|
2013-08-22 10:30:55 +04:00
|
|
|
class nsIDocShell;
|
2016-10-20 23:52:38 +03:00
|
|
|
class nsIDocShellLoadInfo;
|
2013-08-22 10:30:55 +04:00
|
|
|
class nsIDocument;
|
2012-06-29 12:32:21 +04:00
|
|
|
class nsIIdleObserver;
|
2016-09-29 17:14:42 +03:00
|
|
|
class nsIPrincipal;
|
2013-08-22 10:30:55 +04:00
|
|
|
class nsIScriptTimeoutHandler;
|
2017-06-13 23:40:00 +03:00
|
|
|
class nsISerialEventTarget;
|
2013-08-22 10:30:55 +04:00
|
|
|
class nsIURI;
|
2016-01-30 20:05:36 +03:00
|
|
|
class nsPIDOMWindowInner;
|
|
|
|
class nsPIDOMWindowOuter;
|
2013-08-22 10:30:55 +04:00
|
|
|
class nsPIWindowRoot;
|
|
|
|
class nsXBLPrototypeHandler;
|
|
|
|
|
2016-05-03 04:51:22 +03:00
|
|
|
typedef uint32_t SuspendTypes;
|
|
|
|
|
2013-08-22 10:30:55 +04:00
|
|
|
namespace mozilla {
|
2016-11-07 23:30:17 +03:00
|
|
|
class ThrottledEventQueue;
|
2013-08-22 10:30:55 +04:00
|
|
|
namespace dom {
|
|
|
|
class AudioContext;
|
2016-10-28 21:10:32 +03:00
|
|
|
class DocGroup;
|
|
|
|
class TabGroup;
|
2013-08-22 10:30:55 +04:00
|
|
|
class Element;
|
2016-06-09 20:04:42 +03:00
|
|
|
class Performance;
|
2016-06-12 17:26:51 +03:00
|
|
|
class ServiceWorkerRegistration;
|
2016-08-22 15:52:19 +03:00
|
|
|
class Timeout;
|
2016-12-03 01:22:48 +03:00
|
|
|
class TimeoutManager;
|
2016-10-12 10:26:02 +03:00
|
|
|
class CustomElementRegistry;
|
2016-12-22 22:05:54 +03:00
|
|
|
enum class CallerType : uint32_t;
|
2015-07-13 18:25:42 +03:00
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|
2006-02-20 21:52:42 +03:00
|
|
|
|
2004-09-04 23:28:46 +04:00
|
|
|
// Popup control state enum. The values in this enum must go from most
|
2004-09-05 12:24:29 +04:00
|
|
|
// permissive to least permissive so that it's safe to push state in
|
2004-09-04 23:28:46 +04:00
|
|
|
// all situations. Pushing popup state onto the stack never makes the
|
|
|
|
// current popup state less permissive (see
|
2004-12-10 22:48:22 +03:00
|
|
|
// nsGlobalWindow::PushPopupControlState()).
|
2004-09-04 23:28:46 +04:00
|
|
|
enum PopupControlState {
|
|
|
|
openAllowed = 0, // open that window without worries
|
|
|
|
openControlled, // it's a popup, but allow it
|
|
|
|
openAbused, // it's a popup. disallow it, but allow domain override.
|
|
|
|
openOverridden // disallow window open
|
|
|
|
};
|
|
|
|
|
2013-09-24 14:04:14 +04:00
|
|
|
enum UIStateChangeType
|
|
|
|
{
|
|
|
|
UIStateChangeType_NoChange,
|
|
|
|
UIStateChangeType_Set,
|
2016-06-09 14:59:31 +03:00
|
|
|
UIStateChangeType_Clear,
|
|
|
|
UIStateChangeType_Invalid // used for serialization only
|
2013-09-24 14:04:14 +04:00
|
|
|
};
|
|
|
|
|
2016-01-30 20:05:36 +03:00
|
|
|
enum class FullscreenReason
|
|
|
|
{
|
|
|
|
// Toggling the fullscreen mode requires trusted context.
|
|
|
|
ForFullscreenMode,
|
|
|
|
// Fullscreen API is the API provided to untrusted content.
|
|
|
|
ForFullscreenAPI,
|
|
|
|
// This reason can only be used with exiting fullscreen.
|
|
|
|
// It is otherwise identical to eForFullscreenAPI except it would
|
|
|
|
// suppress the fullscreen transition.
|
|
|
|
ForForceExitFullscreen
|
|
|
|
};
|
|
|
|
|
2017-01-18 21:10:54 +03:00
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
2017-05-08 16:49:31 +03:00
|
|
|
|
|
|
|
class Location;
|
|
|
|
|
2017-01-18 21:10:54 +03:00
|
|
|
// The states in this enum represent the different possible outcomes which the
|
|
|
|
// window could be experiencing of loading a document with the
|
|
|
|
// Large-Allocation header. The NONE case represents the case where no
|
|
|
|
// Large-Allocation header was set.
|
|
|
|
enum class LargeAllocStatus : uint8_t
|
|
|
|
{
|
|
|
|
// These are the OK states, NONE means that no large allocation status message
|
|
|
|
// should be printed, while SUCCESS means that the success message should be
|
|
|
|
// printed.
|
|
|
|
NONE,
|
|
|
|
SUCCESS,
|
|
|
|
|
|
|
|
// These are the ERROR states. If a window is in one of these states, then the
|
|
|
|
// next document loaded in that window should have an error message reported
|
|
|
|
// to it.
|
|
|
|
NON_GET,
|
|
|
|
NON_E10S,
|
2017-01-27 23:35:26 +03:00
|
|
|
NOT_ONLY_TOPLEVEL_IN_TABGROUP,
|
|
|
|
NON_WIN32
|
2017-01-18 21:10:54 +03:00
|
|
|
};
|
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|
1999-10-14 14:58:25 +04:00
|
|
|
|
2016-01-30 20:05:36 +03:00
|
|
|
// nsPIDOMWindowInner and nsPIDOMWindowOuter are identical in all respects
|
|
|
|
// except for the type name. They *must* remain identical so that we can
|
|
|
|
// reinterpret_cast between them.
|
|
|
|
template<class T>
|
|
|
|
class nsPIDOMWindow : public T
|
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
|
|
|
{
|
1999-10-14 14:58:25 +04:00
|
|
|
public:
|
2016-01-30 20:05:36 +03:00
|
|
|
nsPIDOMWindowInner* AsInner();
|
|
|
|
const nsPIDOMWindowInner* AsInner() const;
|
|
|
|
nsPIDOMWindowOuter* AsOuter();
|
|
|
|
const nsPIDOMWindowOuter* AsOuter() const;
|
1999-10-14 14:58:25 +04:00
|
|
|
|
2016-01-30 20:05:36 +03:00
|
|
|
virtual nsPIDOMWindowOuter* GetPrivateRoot() = 0;
|
2016-10-12 10:26:02 +03:00
|
|
|
virtual mozilla::dom::CustomElementRegistry* CustomElements() = 0;
|
2013-11-28 18:07:55 +04:00
|
|
|
// Outer windows only.
|
2011-09-29 10:19:26 +04:00
|
|
|
virtual void ActivateOrDeactivate(bool aActivate) = 0;
|
2000-06-23 04:42:21 +04:00
|
|
|
|
2011-06-21 19:37:38 +04:00
|
|
|
// this is called GetTopWindowRoot to avoid conflicts with nsIDOMWindow::GetWindowRoot
|
2015-10-27 00:37:32 +03:00
|
|
|
/**
|
|
|
|
* |top| gets the root of the window hierarchy.
|
|
|
|
*
|
|
|
|
* This function does not cross chrome-content boundaries, so if this
|
|
|
|
* window's parent is of a different type, |top| will return this window.
|
|
|
|
*
|
|
|
|
* When script reads the top property, we run GetScriptableTop, which
|
|
|
|
* will not cross an <iframe mozbrowser> boundary.
|
|
|
|
*
|
|
|
|
* In contrast, C++ calls to GetTop are forwarded to GetRealTop, which
|
|
|
|
* ignores <iframe mozbrowser> boundaries.
|
|
|
|
*/
|
|
|
|
|
2016-01-30 20:05:36 +03:00
|
|
|
virtual already_AddRefed<nsPIDOMWindowOuter> GetTop() = 0; // Outer only
|
|
|
|
virtual already_AddRefed<nsPIDOMWindowOuter> GetParent() = 0;
|
|
|
|
virtual nsPIDOMWindowOuter* GetScriptableTop() = 0;
|
|
|
|
virtual nsPIDOMWindowOuter* GetScriptableParent() = 0;
|
2010-02-20 19:07:03 +03:00
|
|
|
virtual already_AddRefed<nsPIWindowRoot> GetTopWindowRoot() = 0;
|
|
|
|
|
2016-09-28 21:27:35 +03:00
|
|
|
bool IsRootOuterWindow()
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(IsOuterWindow());
|
|
|
|
return mIsRootOuterWindow;
|
|
|
|
}
|
|
|
|
|
2016-04-25 17:17:32 +03:00
|
|
|
/**
|
|
|
|
* Behavies identically to GetScriptableParent extept that it returns null
|
|
|
|
* if GetScriptableParent would return this window.
|
|
|
|
*/
|
|
|
|
virtual nsPIDOMWindowOuter* GetScriptableParentOrNull() = 0;
|
|
|
|
|
2013-11-28 18:07:55 +04:00
|
|
|
// Inner windows only.
|
|
|
|
virtual nsresult RegisterIdleObserver(nsIIdleObserver* aIdleObserver) = 0;
|
|
|
|
virtual nsresult UnregisterIdleObserver(nsIIdleObserver* aIdleObserver) = 0;
|
|
|
|
|
2016-02-24 20:43:07 +03:00
|
|
|
virtual bool IsTopLevelWindowActive() = 0;
|
|
|
|
|
2013-11-28 18:07:55 +04:00
|
|
|
// Outer windows only.
|
2011-09-29 10:19:26 +04:00
|
|
|
virtual void SetActive(bool aActive)
|
2010-03-17 20:10:57 +03:00
|
|
|
{
|
2013-11-28 18:07:55 +04:00
|
|
|
MOZ_ASSERT(IsOuterWindow());
|
2010-03-17 20:10:57 +03:00
|
|
|
mIsActive = aActive;
|
|
|
|
}
|
2015-03-12 19:14:55 +03:00
|
|
|
|
2017-05-24 18:36:27 +03:00
|
|
|
virtual void SetIsBackground(bool aIsBackground) = 0;
|
2011-03-26 04:05:55 +03:00
|
|
|
|
2013-04-06 04:44:15 +04:00
|
|
|
mozilla::dom::EventTarget* GetChromeEventHandler() const
|
2005-07-31 00:57:07 +04:00
|
|
|
{
|
2004-05-04 01:48:36 +04:00
|
|
|
return mChromeEventHandler;
|
|
|
|
}
|
2000-07-12 03:34:44 +04:00
|
|
|
|
2014-01-20 11:58:23 +04:00
|
|
|
// Outer windows only.
|
2013-04-06 04:44:15 +04:00
|
|
|
virtual void SetChromeEventHandler(mozilla::dom::EventTarget* aChromeEventHandler) = 0;
|
2008-08-08 03:15:40 +04:00
|
|
|
|
2013-04-06 04:44:15 +04:00
|
|
|
mozilla::dom::EventTarget* GetParentTarget()
|
2010-06-16 15:43:36 +04:00
|
|
|
{
|
|
|
|
if (!mParentTarget) {
|
|
|
|
UpdateParentTarget();
|
|
|
|
}
|
|
|
|
return mParentTarget;
|
|
|
|
}
|
|
|
|
|
2015-04-03 03:45:50 +03:00
|
|
|
virtual void MaybeUpdateTouchState() {}
|
|
|
|
|
2012-05-22 13:25:44 +04:00
|
|
|
nsIDocument* GetExtantDoc() const
|
|
|
|
{
|
|
|
|
return mDoc;
|
|
|
|
}
|
2012-12-26 15:00:05 +04:00
|
|
|
nsIURI* GetDocumentURI() const;
|
|
|
|
nsIURI* GetDocBaseURI() const;
|
2002-04-12 06:15:43 +04:00
|
|
|
|
2012-08-04 11:44:01 +04:00
|
|
|
nsIDocument* GetDoc()
|
|
|
|
{
|
|
|
|
if (!mDoc) {
|
|
|
|
MaybeCreateDoc();
|
|
|
|
}
|
|
|
|
return mDoc;
|
|
|
|
}
|
|
|
|
|
|
|
|
protected:
|
|
|
|
// Lazily instantiate an about:blank document if necessary, and if
|
|
|
|
// we have what it takes to do so.
|
|
|
|
void MaybeCreateDoc();
|
|
|
|
|
|
|
|
public:
|
2005-05-05 00:22:32 +04:00
|
|
|
// Check whether a document is currently loading
|
2016-01-30 20:05:36 +03:00
|
|
|
inline bool IsLoading() const;
|
|
|
|
inline bool IsHandlingResizeEvent() const;
|
2004-10-20 06:19:57 +04:00
|
|
|
|
2012-09-05 22:32:06 +04:00
|
|
|
// Set the window up with an about:blank document with the current subject
|
|
|
|
// principal.
|
2014-05-20 23:50:58 +04:00
|
|
|
// Outer windows only.
|
2012-09-05 22:32:06 +04:00
|
|
|
virtual void SetInitialPrincipalToSubject() = 0;
|
2012-09-05 22:32:06 +04:00
|
|
|
|
2005-06-18 10:06:45 +04:00
|
|
|
virtual PopupControlState PushPopupControlState(PopupControlState aState,
|
2011-09-29 10:19:26 +04:00
|
|
|
bool aForce) const = 0;
|
2004-09-04 23:28:46 +04:00
|
|
|
virtual void PopPopupControlState(PopupControlState state) const = 0;
|
|
|
|
virtual PopupControlState GetPopupControlState() const = 0;
|
2006-02-07 23:46:39 +03:00
|
|
|
|
2005-07-31 00:57:07 +04:00
|
|
|
// Returns an object containing the window's state. This also suspends
|
2005-05-05 00:22:32 +04:00
|
|
|
// all running timeouts in the window.
|
2012-09-06 11:20:26 +04:00
|
|
|
virtual already_AddRefed<nsISupports> SaveWindowState() = 0;
|
2005-05-05 00:22:32 +04:00
|
|
|
|
|
|
|
// Restore the window state from aState.
|
|
|
|
virtual nsresult RestoreWindowState(nsISupports *aState) = 0;
|
|
|
|
|
2016-10-26 20:20:15 +03:00
|
|
|
// Determine if the window is suspended or frozen. Outer windows
|
|
|
|
// will forward this call to the inner window for convenience. If
|
|
|
|
// there is no inner window then the outer window is considered
|
|
|
|
// suspended and frozen by default.
|
2016-10-26 20:20:16 +03:00
|
|
|
virtual bool IsSuspended() const = 0;
|
|
|
|
virtual bool IsFrozen() const = 0;
|
2016-10-26 20:20:15 +03:00
|
|
|
|
2006-05-04 01:53:08 +04:00
|
|
|
// Fire any DOM notification events related to things that happened while
|
|
|
|
// the window was frozen.
|
|
|
|
virtual nsresult FireDelayedDOMEvents() = 0;
|
2005-08-25 11:06:59 +04:00
|
|
|
|
2016-01-30 20:05:36 +03:00
|
|
|
nsPIDOMWindowOuter* GetOuterWindow()
|
2005-12-11 23:38:29 +03:00
|
|
|
{
|
2016-01-30 20:05:36 +03:00
|
|
|
return mIsInnerWindow ? mOuterWindow.get() : AsOuter();
|
2005-12-11 23:38:29 +03:00
|
|
|
}
|
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
bool IsInnerWindow() const
|
2005-07-31 00:57:07 +04:00
|
|
|
{
|
2005-08-12 08:11:00 +04:00
|
|
|
return mIsInnerWindow;
|
2005-07-31 00:57:07 +04:00
|
|
|
}
|
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
bool IsOuterWindow() const
|
2005-07-31 00:57:07 +04:00
|
|
|
{
|
|
|
|
return !IsInnerWindow();
|
|
|
|
}
|
|
|
|
|
2014-05-20 23:50:58 +04:00
|
|
|
// Outer windows only.
|
|
|
|
virtual bool WouldReuseInnerWindow(nsIDocument* aNewDocument) = 0;
|
2005-08-23 04:24:57 +04:00
|
|
|
|
2005-12-01 22:35:27 +03:00
|
|
|
/**
|
|
|
|
* Get the docshell in this window.
|
|
|
|
*/
|
2016-01-30 20:05:36 +03:00
|
|
|
nsIDocShell *GetDocShell() const;
|
2005-11-29 02:56:44 +03:00
|
|
|
|
2005-12-01 22:35:27 +03:00
|
|
|
/**
|
2012-05-25 23:00:32 +04:00
|
|
|
* Set the docshell in the window. Must not be called with a null docshell
|
|
|
|
* (use DetachFromDocShell for that).
|
2005-12-01 22:35:27 +03:00
|
|
|
*/
|
2005-11-29 02:56:44 +03:00
|
|
|
virtual void SetDocShell(nsIDocShell *aDocShell) = 0;
|
|
|
|
|
2012-05-25 23:00:32 +04:00
|
|
|
/**
|
|
|
|
* Detach an outer window from its docshell.
|
|
|
|
*/
|
|
|
|
virtual void DetachFromDocShell() = 0;
|
|
|
|
|
2005-12-01 22:35:27 +03:00
|
|
|
/**
|
|
|
|
* Set a new document in the window. Calling this method will in
|
|
|
|
* most cases create a new inner window. If this method is called on
|
|
|
|
* an inner window the call will be forewarded to the outer window,
|
|
|
|
* if the inner window is not the current inner window an
|
|
|
|
* NS_ERROR_NOT_AVAILABLE error code will be returned. This may be
|
|
|
|
* called with a pointer to the current document, in that case the
|
|
|
|
* document remains unchanged, but a new inner window will be
|
|
|
|
* created.
|
2012-06-06 11:36:58 +04:00
|
|
|
*
|
|
|
|
* aDocument must not be null.
|
2005-12-01 22:35:27 +03:00
|
|
|
*/
|
|
|
|
virtual nsresult SetNewDocument(nsIDocument *aDocument,
|
2010-09-16 02:54:00 +04:00
|
|
|
nsISupports *aState,
|
2011-09-29 10:19:26 +04:00
|
|
|
bool aForceReuseInnerWindow) = 0;
|
2005-12-01 22:35:27 +03:00
|
|
|
|
|
|
|
/**
|
2006-02-15 06:22:17 +03:00
|
|
|
* Set the opener window. aOriginalOpener is true if and only if this is the
|
|
|
|
* original opener for the window. That is, it can only be true at most once
|
|
|
|
* during the life cycle of a window, and then only the first time
|
|
|
|
* SetOpenerWindow is called. It might never be true, of course, if the
|
|
|
|
* window does not have an opener when it's created.
|
2005-12-01 22:35:27 +03:00
|
|
|
*/
|
2016-01-30 20:05:36 +03:00
|
|
|
virtual void SetOpenerWindow(nsPIDOMWindowOuter* aOpener,
|
2011-09-29 10:19:26 +04:00
|
|
|
bool aOriginalOpener) = 0;
|
2005-12-01 22:35:27 +03:00
|
|
|
|
2017-04-18 05:28:50 +03:00
|
|
|
/**
|
|
|
|
* Ensure the size and position of this window are up-to-date by doing
|
|
|
|
* a layout flush in the parent (which will in turn, do a layout flush
|
|
|
|
* in its parent, etc.).
|
|
|
|
*/
|
2017-04-18 05:28:52 +03:00
|
|
|
virtual void EnsureSizeAndPositionUpToDate() = 0;
|
2005-11-29 02:56:44 +03:00
|
|
|
|
2006-07-06 02:48:04 +04:00
|
|
|
/**
|
|
|
|
* Callback for notifying a window about a modal dialog being
|
|
|
|
* opened/closed with the window as a parent.
|
|
|
|
*/
|
2013-08-12 23:54:51 +04:00
|
|
|
virtual void EnterModalState() = 0;
|
|
|
|
virtual void LeaveModalState() = 0;
|
2006-07-06 02:48:04 +04:00
|
|
|
|
2014-05-20 23:50:58 +04:00
|
|
|
// Outer windows only.
|
2011-09-29 10:19:26 +04:00
|
|
|
virtual bool CanClose() = 0;
|
2014-05-20 23:50:58 +04:00
|
|
|
virtual void ForceClose() = 0;
|
2010-01-28 21:35:20 +03:00
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
bool IsModalContentWindow() const
|
2007-07-26 21:52:26 +04:00
|
|
|
{
|
|
|
|
return mIsModalContentWindow;
|
|
|
|
}
|
2006-07-06 02:48:04 +04:00
|
|
|
|
2008-10-16 01:06:32 +04:00
|
|
|
/**
|
|
|
|
* Call this to indicate that some node (this window, its document,
|
|
|
|
* or content in that document) has a paint event listener.
|
|
|
|
*/
|
|
|
|
void SetHasPaintEventListeners()
|
|
|
|
{
|
2011-10-17 18:59:28 +04:00
|
|
|
mMayHavePaintEventListener = true;
|
2008-10-16 01:06:32 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Call this to check whether some node (this window, its document,
|
|
|
|
* or content in that document) has a paint event listener.
|
|
|
|
*/
|
2011-09-29 10:19:26 +04:00
|
|
|
bool HasPaintEventListeners()
|
2008-10-16 01:06:32 +04:00
|
|
|
{
|
|
|
|
return mMayHavePaintEventListener;
|
|
|
|
}
|
2016-07-22 00:39:00 +03:00
|
|
|
|
2015-04-03 03:45:50 +03:00
|
|
|
/**
|
|
|
|
* Call this to indicate that some node (this window, its document,
|
|
|
|
* or content in that document) has a touch event listener.
|
|
|
|
*/
|
|
|
|
void SetHasTouchEventListeners()
|
|
|
|
{
|
|
|
|
if (!mMayHaveTouchEventListener) {
|
|
|
|
mMayHaveTouchEventListener = true;
|
|
|
|
MaybeUpdateTouchState();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-06-22 21:01:27 +03:00
|
|
|
/**
|
|
|
|
* Call this to indicate that some node (this window, its document,
|
|
|
|
* or content in that document) has a selectionchange event listener.
|
|
|
|
*/
|
|
|
|
void SetHasSelectionChangeEventListeners()
|
|
|
|
{
|
|
|
|
mMayHaveSelectionChangeEventListener = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Call this to check whether some node (this window, its document,
|
|
|
|
* or content in that document) has a selectionchange event listener.
|
|
|
|
*/
|
|
|
|
bool HasSelectionChangeEventListeners()
|
|
|
|
{
|
|
|
|
return mMayHaveSelectionChangeEventListener;
|
|
|
|
}
|
|
|
|
|
2012-02-20 01:02:08 +04:00
|
|
|
/**
|
|
|
|
* Moves the top-level window into fullscreen mode if aIsFullScreen is true,
|
2015-07-09 01:00:33 +03:00
|
|
|
* otherwise exits fullscreen.
|
2014-06-29 19:36:02 +04:00
|
|
|
*
|
|
|
|
* Outer windows only.
|
2012-02-20 01:02:08 +04:00
|
|
|
*/
|
2015-07-09 01:00:33 +03:00
|
|
|
virtual nsresult SetFullscreenInternal(
|
2016-05-27 23:49:04 +03:00
|
|
|
FullscreenReason aReason, bool aIsFullscreen) = 0;
|
2012-02-20 01:02:08 +04:00
|
|
|
|
2015-06-10 14:13:12 +03:00
|
|
|
/**
|
|
|
|
* This function should be called when the fullscreen state is flipped.
|
|
|
|
* If no widget is involved the fullscreen change, this method is called
|
2015-07-09 01:00:33 +03:00
|
|
|
* by SetFullscreenInternal, otherwise, it is called when the widget
|
2015-06-10 14:13:12 +03:00
|
|
|
* finishes its change to or from fullscreen.
|
|
|
|
*
|
|
|
|
* @param aIsFullscreen indicates whether the widget is in fullscreen.
|
|
|
|
*
|
|
|
|
* Outer windows only.
|
|
|
|
*/
|
|
|
|
virtual void FinishFullscreenChange(bool aIsFullscreen) = 0;
|
|
|
|
|
2011-11-26 14:14:29 +04:00
|
|
|
virtual JSObject* GetCachedXBLPrototypeHandler(nsXBLPrototypeHandler* aKey) = 0;
|
2008-02-13 07:17:18 +03:00
|
|
|
virtual void CacheXBLPrototypeHandler(nsXBLPrototypeHandler* aKey,
|
2013-03-21 00:09:09 +04:00
|
|
|
JS::Handle<JSObject*> aHandler) = 0;
|
2008-02-13 07:17:18 +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
|
|
|
/*
|
|
|
|
* Get and set the currently focused element within the document. If
|
|
|
|
* aNeedsFocus is true, then set mNeedsFocus to true to indicate that a
|
|
|
|
* document focus event is needed.
|
|
|
|
*
|
|
|
|
* DO NOT CALL EITHER OF THESE METHODS DIRECTLY. USE THE FOCUS MANAGER
|
|
|
|
* INSTEAD.
|
|
|
|
*/
|
2016-01-30 20:05:36 +03:00
|
|
|
nsIContent* GetFocusedNode() const;
|
Bug 178324, refactor focus by moving all focus handling into one place and simplifying it, add many tests, fixes many other bugs too numerous to mention in this small checkin comment, r=josh,smichaud,ere,dbaron,marco,neil,gavin,smaug,sr=smaug (CLOSED TREE)
2009-06-10 22:00:39 +04:00
|
|
|
virtual void SetFocusedNode(nsIContent* aNode,
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t aFocusMethod = 0,
|
2011-09-29 10:19:26 +04:00
|
|
|
bool aNeedsFocus = false) = 0;
|
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
|
|
|
|
|
|
|
/**
|
|
|
|
* Retrieves the method that was used to focus the current node.
|
|
|
|
*/
|
2012-08-22 19:56:38 +04:00
|
|
|
virtual uint32_t GetFocusMethod() = 0;
|
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
|
|
|
|
|
|
|
/*
|
|
|
|
* Tells the window that it now has focus or has lost focus, based on the
|
|
|
|
* state of aFocus. If this method returns true, then the document loaded
|
|
|
|
* in the window has never received a focus event and expects to receive
|
|
|
|
* one. If false is returned, the document has received a focus event before
|
|
|
|
* and should only receive one if the window is being focused.
|
|
|
|
*
|
|
|
|
* aFocusMethod may be set to one of the focus method constants in
|
|
|
|
* nsIFocusManager to indicate how focus was set.
|
|
|
|
*/
|
2012-08-22 19:56:38 +04:00
|
|
|
virtual bool TakeFocus(bool aFocus, uint32_t aFocusMethod) = 0;
|
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 window may now accept a document focus event. This
|
|
|
|
* should be called once a document has been loaded into the window.
|
|
|
|
*/
|
|
|
|
virtual void SetReadyForFocus() = 0;
|
|
|
|
|
2010-04-21 18:53:42 +04:00
|
|
|
/**
|
|
|
|
* Whether the focused content within the window should show a focus ring.
|
|
|
|
*/
|
2011-09-29 10:19:26 +04:00
|
|
|
virtual bool ShouldShowFocusRing() = 0;
|
2010-04-21 18:53:42 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the keyboard indicator state for accelerators and focus rings.
|
|
|
|
*/
|
|
|
|
virtual void SetKeyboardIndicators(UIStateChangeType aShowAccelerators,
|
|
|
|
UIStateChangeType aShowFocusRings) = 0;
|
|
|
|
|
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 page in the window has been hidden. This is used to
|
|
|
|
* reset the focus state.
|
|
|
|
*/
|
|
|
|
virtual void PageHidden() = 0;
|
|
|
|
|
2009-06-26 21:16:50 +04:00
|
|
|
/**
|
2010-11-29 22:13:12 +03:00
|
|
|
* Instructs this window to asynchronously dispatch a hashchange event. This
|
|
|
|
* method must be called on an inner window.
|
2009-06-26 21:16:50 +04:00
|
|
|
*/
|
2011-04-01 00:30:32 +04:00
|
|
|
virtual nsresult DispatchAsyncHashchange(nsIURI *aOldURI,
|
|
|
|
nsIURI *aNewURI) = 0;
|
2009-06-26 21:16:50 +04:00
|
|
|
|
2009-09-01 20:45:05 +04:00
|
|
|
/**
|
|
|
|
* Instructs this window to synchronously dispatch a popState event.
|
|
|
|
*/
|
2011-03-01 10:08:56 +03:00
|
|
|
virtual nsresult DispatchSyncPopState() = 0;
|
2009-08-21 18:42:37 +04:00
|
|
|
|
|
|
|
/**
|
2013-11-28 18:07:55 +04:00
|
|
|
* Tell this window that it should listen for sensor changes of the given
|
|
|
|
* type.
|
|
|
|
*
|
|
|
|
* Inner windows only.
|
2009-08-21 18:42:37 +04:00
|
|
|
*/
|
2012-08-22 19:56:38 +04:00
|
|
|
virtual void EnableDeviceSensor(uint32_t aType) = 0;
|
2009-08-21 18:42:37 +04:00
|
|
|
|
2011-10-06 21:27:41 +04:00
|
|
|
/**
|
2013-11-28 18:07:55 +04:00
|
|
|
* Tell this window that it should remove itself from sensor change
|
|
|
|
* notifications.
|
|
|
|
*
|
|
|
|
* Inner windows only.
|
2011-10-06 21:27:41 +04:00
|
|
|
*/
|
2012-08-22 19:56:38 +04:00
|
|
|
virtual void DisableDeviceSensor(uint32_t aType) = 0;
|
2011-10-06 21:27:41 +04:00
|
|
|
|
2017-07-21 03:52:30 +03:00
|
|
|
#if defined(MOZ_WIDGET_ANDROID)
|
2015-10-24 07:37:28 +03:00
|
|
|
virtual void EnableOrientationChangeListener() = 0;
|
|
|
|
virtual void DisableOrientationChangeListener() = 0;
|
|
|
|
#endif
|
|
|
|
|
2012-09-11 10:05:00 +04:00
|
|
|
virtual void EnableTimeChangeNotifications() = 0;
|
|
|
|
virtual void DisableTimeChangeNotifications() = 0;
|
|
|
|
|
2012-11-07 22:10:40 +04:00
|
|
|
#ifdef MOZ_B2G
|
2012-09-30 17:47:48 +04:00
|
|
|
/**
|
|
|
|
* Tell the window that it should start to listen to the network event of the
|
|
|
|
* given aType.
|
2013-11-28 18:07:55 +04:00
|
|
|
*
|
|
|
|
* Inner windows only.
|
2012-09-30 17:47:48 +04:00
|
|
|
*/
|
2015-08-26 15:56:59 +03:00
|
|
|
virtual void EnableNetworkEvent(mozilla::EventMessage aEventMessage) = 0;
|
2012-09-30 17:47:48 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Tell the window that it should stop to listen to the network event of the
|
|
|
|
* given aType.
|
2013-11-28 18:07:55 +04:00
|
|
|
*
|
|
|
|
* Inner windows only.
|
2012-09-30 17:47:48 +04:00
|
|
|
*/
|
2015-08-26 15:56:59 +03:00
|
|
|
virtual void DisableNetworkEvent(mozilla::EventMessage aEventMessage) = 0;
|
2012-11-07 22:10:40 +04:00
|
|
|
#endif // MOZ_B2G
|
2012-09-30 17:47:48 +04:00
|
|
|
|
2011-08-03 22:12:08 +04:00
|
|
|
/**
|
|
|
|
* Tell this window that there is an observer for gamepad input
|
2014-06-29 19:36:02 +04:00
|
|
|
*
|
|
|
|
* Inner windows only.
|
2011-08-03 22:12:08 +04:00
|
|
|
*/
|
|
|
|
virtual void SetHasGamepadEventListener(bool aHasGamepad = true) = 0;
|
|
|
|
|
2009-10-07 04:09:16 +04:00
|
|
|
/**
|
|
|
|
* Set a arguments for this window. This will be set on the window
|
|
|
|
* right away (if there's an existing document) and it will also be
|
2013-05-17 21:43:19 +04:00
|
|
|
* installed on the window when the next document is loaded.
|
|
|
|
*
|
|
|
|
* This function serves double-duty for passing both |arguments| and
|
|
|
|
* |dialogArguments| back from nsWindowWatcher to nsGlobalWindow. For the
|
|
|
|
* latter, the array is an array of length 0 whose only element is a
|
|
|
|
* DialogArgumentsHolder representing the JS value passed to showModalDialog.
|
2014-06-29 19:36:02 +04:00
|
|
|
*
|
|
|
|
* Outer windows only.
|
2009-10-07 04:09:16 +04:00
|
|
|
*/
|
2013-05-17 21:43:19 +04:00
|
|
|
virtual nsresult SetArguments(nsIArray *aArguments) = 0;
|
2009-10-07 04:09:16 +04:00
|
|
|
|
2010-09-10 02:15:40 +04:00
|
|
|
/**
|
|
|
|
* NOTE! This function *will* be called on multiple threads so the
|
|
|
|
* implementation must not do any AddRef/Release or other actions that will
|
|
|
|
* mutate internal state.
|
|
|
|
*/
|
2012-08-22 19:56:38 +04:00
|
|
|
virtual uint32_t GetSerial() = 0;
|
2010-09-10 02:15:40 +04:00
|
|
|
|
2010-10-21 04:24:15 +04:00
|
|
|
/**
|
|
|
|
* Return the window id of this window
|
|
|
|
*/
|
2012-08-22 19:56:38 +04:00
|
|
|
uint64_t WindowID() const { return mWindowID; }
|
2010-10-21 04:24:15 +04:00
|
|
|
|
2011-07-11 17:14:08 +04:00
|
|
|
/**
|
|
|
|
* Dispatch a custom event with name aEventName targeted at this window.
|
|
|
|
* Returns whether the default action should be performed.
|
2014-06-29 19:31:13 +04:00
|
|
|
*
|
|
|
|
* Outer windows only.
|
2011-07-11 17:14:08 +04:00
|
|
|
*/
|
2014-06-29 19:31:13 +04:00
|
|
|
virtual bool DispatchCustomEvent(const nsAString& aEventName) = 0;
|
2011-07-11 17:14:08 +04:00
|
|
|
|
2012-08-14 18:58:00 +04:00
|
|
|
/**
|
|
|
|
* Like nsIDOMWindow::Open, except that we don't navigate to the given URL.
|
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,
|
2016-01-30 20:05:36 +03:00
|
|
|
const nsAString& aOptions, nsPIDOMWindowOuter **_retval) = 0;
|
2012-08-14 18:58:00 +04:00
|
|
|
|
2014-07-01 03:02:01 +04:00
|
|
|
/**
|
|
|
|
* Fire a popup blocked event on the document.
|
|
|
|
*/
|
|
|
|
virtual void
|
|
|
|
FirePopupBlockedEvent(nsIDocument* aDoc,
|
|
|
|
nsIURI* aPopupURI,
|
|
|
|
const nsAString& aPopupWindowName,
|
|
|
|
const nsAString& aPopupWindowFeatures) = 0;
|
|
|
|
|
2012-12-26 02:00:15 +04:00
|
|
|
// WebIDL-ish APIs
|
2013-11-24 23:35:34 +04:00
|
|
|
void MarkUncollectableForCCGeneration(uint32_t aGeneration)
|
|
|
|
{
|
|
|
|
mMarkedCCGeneration = aGeneration;
|
|
|
|
}
|
|
|
|
|
|
|
|
uint32_t GetMarkedCCGeneration()
|
|
|
|
{
|
|
|
|
return mMarkedCCGeneration;
|
|
|
|
}
|
2014-05-23 22:19:00 +04:00
|
|
|
|
2015-10-27 00:37:32 +03:00
|
|
|
virtual nsIDOMScreen* GetScreen() = 0;
|
|
|
|
virtual nsIDOMNavigator* GetNavigator() = 0;
|
2017-05-09 23:41:19 +03:00
|
|
|
virtual mozilla::dom::Location* GetLocation() = 0;
|
2015-10-27 00:37:32 +03:00
|
|
|
virtual nsresult GetPrompter(nsIPrompt** aPrompt) = 0;
|
|
|
|
virtual nsresult GetControllers(nsIControllers** aControllers) = 0;
|
|
|
|
virtual already_AddRefed<nsISelection> GetSelection() = 0;
|
2016-01-30 20:05:36 +03:00
|
|
|
virtual already_AddRefed<nsPIDOMWindowOuter> GetOpener() = 0;
|
2015-10-27 00:37:32 +03:00
|
|
|
virtual already_AddRefed<nsIDOMWindowCollection> GetFrames() = 0;
|
2016-10-20 23:52:38 +03:00
|
|
|
// aLoadInfo will be passed on through to the windowwatcher.
|
2016-10-20 23:52:38 +03:00
|
|
|
// aForceNoOpener will act just like a "noopener" feature in aOptions except
|
|
|
|
// will not affect any other window features.
|
2015-10-27 00:37:32 +03:00
|
|
|
virtual 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) = 0;
|
2015-10-27 00:37:32 +03:00
|
|
|
virtual nsresult OpenDialog(const nsAString& aUrl, const nsAString& aName,
|
|
|
|
const nsAString& aOptions,
|
2016-01-30 20:05:36 +03:00
|
|
|
nsISupports* aExtraArgument,
|
|
|
|
nsPIDOMWindowOuter** _retval) = 0;
|
2015-10-27 00:37:32 +03:00
|
|
|
|
|
|
|
virtual nsresult GetInnerWidth(int32_t* aWidth) = 0;
|
|
|
|
virtual nsresult GetInnerHeight(int32_t* aHeight) = 0;
|
|
|
|
virtual already_AddRefed<nsICSSDeclaration>
|
|
|
|
GetComputedStyle(mozilla::dom::Element& aElt, const nsAString& aPseudoElt,
|
|
|
|
mozilla::ErrorResult& aError) = 0;
|
|
|
|
virtual already_AddRefed<nsIDOMElement> GetFrameElement() = 0;
|
|
|
|
virtual already_AddRefed<nsIDOMOfflineResourceList> GetApplicationCache() = 0;
|
|
|
|
virtual bool Closed() = 0;
|
|
|
|
virtual bool GetFullScreen() = 0;
|
|
|
|
virtual nsresult SetFullScreen(bool aFullScreen) = 0;
|
|
|
|
|
|
|
|
virtual nsresult Focus() = 0;
|
|
|
|
virtual nsresult Close() = 0;
|
|
|
|
|
|
|
|
virtual nsresult MoveBy(int32_t aXDif, int32_t aYDif) = 0;
|
|
|
|
virtual nsresult UpdateCommands(const nsAString& anAction, nsISelection* aSel, int16_t aReason) = 0;
|
|
|
|
|
2016-10-28 21:10:32 +03:00
|
|
|
mozilla::dom::TabGroup* TabGroup();
|
|
|
|
|
2016-11-23 08:14:39 +03:00
|
|
|
mozilla::dom::DocGroup* GetDocGroup() const;
|
2016-10-28 21:10:32 +03:00
|
|
|
|
2017-06-13 23:40:00 +03:00
|
|
|
virtual nsISerialEventTarget*
|
2017-01-19 07:26:17 +03:00
|
|
|
EventTargetFor(mozilla::TaskCategory aCategory) const = 0;
|
2016-11-07 23:30:17 +03:00
|
|
|
|
2004-05-04 01:48:36 +04:00
|
|
|
protected:
|
2005-08-12 08:11:00 +04:00
|
|
|
// The nsPIDOMWindow constructor. The aOuterWindow argument should
|
|
|
|
// be null if and only if the created window itself is an outer
|
|
|
|
// window. In all other cases aOuterWindow should be the outer
|
|
|
|
// window for the inner window that is being created.
|
2016-01-30 20:05:36 +03:00
|
|
|
explicit nsPIDOMWindow<T>(nsPIDOMWindowOuter *aOuterWindow);
|
2010-04-27 13:58:58 +04:00
|
|
|
|
2016-01-30 20:05:36 +03:00
|
|
|
~nsPIDOMWindow<T>();
|
2004-10-20 06:19:57 +04:00
|
|
|
|
2013-04-06 04:44:15 +04:00
|
|
|
void SetChromeEventHandlerInternal(mozilla::dom::EventTarget* aChromeEventHandler) {
|
2008-08-08 03:15:40 +04:00
|
|
|
mChromeEventHandler = aChromeEventHandler;
|
2010-06-16 15:42:42 +04:00
|
|
|
// mParentTarget will be set when the next event is dispatched.
|
2012-07-30 18:20:58 +04:00
|
|
|
mParentTarget = nullptr;
|
2008-08-08 03:15:40 +04:00
|
|
|
}
|
|
|
|
|
2010-06-16 15:43:36 +04:00
|
|
|
virtual void UpdateParentTarget() = 0;
|
|
|
|
|
2005-07-31 00:57:07 +04:00
|
|
|
// These two variables are special in that they're set to the same
|
|
|
|
// value on both the outer window and the current inner window. Make
|
|
|
|
// sure you keep them in sync!
|
2013-04-06 04:44:15 +04:00
|
|
|
nsCOMPtr<mozilla::dom::EventTarget> mChromeEventHandler; // strong
|
2013-04-24 08:22:37 +04:00
|
|
|
nsCOMPtr<nsIDocument> mDoc; // strong
|
2012-12-26 15:00:05 +04:00
|
|
|
// Cache the URI when mDoc is cleared.
|
|
|
|
nsCOMPtr<nsIURI> mDocumentURI; // strong
|
|
|
|
nsCOMPtr<nsIURI> mDocBaseURI; // strong
|
2005-07-31 00:57:07 +04:00
|
|
|
|
2013-04-06 04:44:15 +04:00
|
|
|
nsCOMPtr<mozilla::dom::EventTarget> mParentTarget; // strong
|
2010-06-16 15:42:42 +04:00
|
|
|
|
2005-07-31 00:57:07 +04:00
|
|
|
// These members are only used on outer windows.
|
2013-07-24 03:39:17 +04:00
|
|
|
nsCOMPtr<mozilla::dom::Element> mFrameElement;
|
2015-05-25 11:57:00 +03:00
|
|
|
// This reference is used by the subclass nsGlobalWindow, and cleared in it's
|
|
|
|
// DetachFromDocShell() method. This method is called by nsDocShell::Destroy(),
|
|
|
|
// which is called before the nsDocShell is destroyed.
|
|
|
|
nsIDocShell* MOZ_NON_OWNING_REF mDocShell; // Weak Reference
|
2005-07-31 00:57:07 +04:00
|
|
|
|
2012-12-26 02:00:15 +04:00
|
|
|
// mPerformance is only used on inner windows.
|
2016-06-09 20:04:42 +03:00
|
|
|
RefPtr<mozilla::dom::Performance> mPerformance;
|
2016-12-03 01:22:48 +03:00
|
|
|
// mTimeoutManager is only useed on inner windows.
|
|
|
|
mozilla::UniquePtr<mozilla::dom::TimeoutManager> mTimeoutManager;
|
2012-12-26 02:00:15 +04:00
|
|
|
|
2015-11-23 21:38:08 +03:00
|
|
|
typedef nsRefPtrHashtable<nsStringHashKey,
|
2016-06-12 17:26:51 +03:00
|
|
|
mozilla::dom::ServiceWorkerRegistration>
|
2015-11-23 21:38:08 +03:00
|
|
|
ServiceWorkerRegistrationTable;
|
|
|
|
ServiceWorkerRegistrationTable mServiceWorkerRegistrationTable;
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t mModalStateDepth;
|
2006-07-06 02:48:04 +04:00
|
|
|
|
2005-07-31 00:57:07 +04:00
|
|
|
// These variables are only used on inner windows.
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t mMutationBits;
|
2003-05-06 00:55:37 +04:00
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mIsDocumentLoaded;
|
|
|
|
bool mIsHandlingResizeEvent;
|
|
|
|
bool mIsInnerWindow;
|
|
|
|
bool mMayHavePaintEventListener;
|
2015-04-03 03:45:50 +03:00
|
|
|
bool mMayHaveTouchEventListener;
|
2017-06-22 21:01:27 +03:00
|
|
|
bool mMayHaveSelectionChangeEventListener;
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mMayHaveMouseEnterLeaveEventListener;
|
2014-02-11 10:33:29 +04:00
|
|
|
bool mMayHavePointerEnterLeaveEventListener;
|
2005-07-31 00:57:07 +04:00
|
|
|
|
2016-03-09 01:21:40 +03:00
|
|
|
// Used to detect whether we have called FreeInnerObjects() (e.g. to ensure
|
|
|
|
// that a call to ResumeTimeouts() after FreeInnerObjects() does nothing).
|
|
|
|
// This member is only used by inner windows.
|
|
|
|
bool mInnerObjectsFreed;
|
|
|
|
|
|
|
|
|
2007-07-26 21:52:26 +04:00
|
|
|
// This variable is used on both inner and outer windows (and they
|
|
|
|
// should match).
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mIsModalContentWindow;
|
2007-07-26 21:52:26 +04:00
|
|
|
|
2010-03-17 20:10:57 +03:00
|
|
|
// Tracks activation state that's used for :-moz-window-inactive.
|
2011-03-26 04:05:55 +03:00
|
|
|
// Only used on outer windows.
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mIsActive;
|
2010-03-17 20:10:57 +03:00
|
|
|
|
2011-03-26 04:05:55 +03:00
|
|
|
// Tracks whether our docshell is active. If it is, mIsBackground
|
|
|
|
// is false. Too bad we have so many different concepts of
|
|
|
|
// "active". Only used on outer windows.
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mIsBackground;
|
2011-03-26 04:05:55 +03:00
|
|
|
|
2016-05-03 04:51:22 +03:00
|
|
|
/**
|
|
|
|
* The suspended types can be "disposable" or "permanent". This varable only
|
|
|
|
* stores the value about permanent suspend.
|
|
|
|
* - disposable
|
|
|
|
* To pause all playing media in that window, but doesn't affect the media
|
|
|
|
* which starts after that.
|
|
|
|
*
|
|
|
|
* - permanent
|
|
|
|
* To pause all media in that window, and also affect the media which starts
|
|
|
|
* after that.
|
|
|
|
*/
|
|
|
|
SuspendTypes mMediaSuspend;
|
|
|
|
|
2014-03-11 14:46:55 +04:00
|
|
|
bool mAudioMuted;
|
|
|
|
float mAudioVolume;
|
|
|
|
|
2015-07-09 17:40:08 +03:00
|
|
|
bool mAudioCaptured;
|
|
|
|
|
2015-03-12 19:14:55 +03:00
|
|
|
// current desktop mode flag.
|
|
|
|
bool mDesktopModeViewport;
|
|
|
|
|
2016-09-28 21:27:35 +03:00
|
|
|
bool mIsRootOuterWindow;
|
|
|
|
|
2005-07-31 00:57:07 +04:00
|
|
|
// And these are the references between inner and outer windows.
|
2016-01-30 20:05:36 +03:00
|
|
|
nsPIDOMWindowInner* MOZ_NON_OWNING_REF mInnerWindow;
|
|
|
|
nsCOMPtr<nsPIDOMWindowOuter> mOuterWindow;
|
2010-04-27 13:58:58 +04:00
|
|
|
|
|
|
|
// the element within the document that is currently focused when this
|
|
|
|
// window is active
|
|
|
|
nsCOMPtr<nsIContent> mFocusedNode;
|
2010-10-21 04:24:15 +04:00
|
|
|
|
2012-11-24 03:33:41 +04:00
|
|
|
// The AudioContexts created for the current document, if any.
|
2013-09-12 08:16:53 +04:00
|
|
|
nsTArray<mozilla::dom::AudioContext*> mAudioContexts; // Weak
|
2012-11-24 03:33:41 +04:00
|
|
|
|
2016-10-28 21:10:32 +03:00
|
|
|
// This is present both on outer and inner windows.
|
|
|
|
RefPtr<mozilla::dom::TabGroup> mTabGroup;
|
|
|
|
|
2010-10-21 04:24:15 +04:00
|
|
|
// A unique (as long as our 64-bit counter doesn't roll over) id for
|
|
|
|
// this window.
|
2012-08-22 19:56:38 +04:00
|
|
|
uint64_t mWindowID;
|
2010-11-23 11:50:56 +03:00
|
|
|
|
|
|
|
// This is only used by the inner window. Set to true once we've sent
|
|
|
|
// the (chrome|content)-document-global-created notification.
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mHasNotifiedGlobalCreated;
|
2013-11-24 23:35:34 +04:00
|
|
|
|
|
|
|
uint32_t mMarkedCCGeneration;
|
2015-03-24 21:15:00 +03:00
|
|
|
|
|
|
|
// Let the service workers plumbing know that some feature are enabled while
|
|
|
|
// testing.
|
|
|
|
bool mServiceWorkersTestingEnabled;
|
2017-01-18 21:10:54 +03:00
|
|
|
|
|
|
|
mozilla::dom::LargeAllocStatus mLargeAllocStatus; // Outer window only
|
2017-05-17 09:11:09 +03:00
|
|
|
|
2017-04-18 13:21:34 +03:00
|
|
|
// mTopInnerWindow is only used on inner windows for tab-wise check by timeout
|
|
|
|
// throttling. It could be null.
|
|
|
|
nsCOMPtr<nsPIDOMWindowInner> mTopInnerWindow;
|
|
|
|
|
|
|
|
// The evidence that we have tried to cache mTopInnerWindow only once from
|
|
|
|
// SetNewDocument(). Note: We need this extra flag because mTopInnerWindow
|
|
|
|
// could be null and we don't want it to be set multiple times.
|
|
|
|
bool mHasTriedToCacheTopInnerWindow;
|
|
|
|
|
|
|
|
// The number of active IndexedDB databases. Inner window only.
|
|
|
|
uint32_t mNumOfIndexedDBDatabases;
|
1999-10-14 14:58:25 +04:00
|
|
|
};
|
|
|
|
|
2016-01-30 20:05:36 +03:00
|
|
|
#define NS_PIDOMWINDOWINNER_IID \
|
|
|
|
{ 0x775dabc9, 0x8f43, 0x4277, \
|
|
|
|
{ 0x9a, 0xdb, 0xf1, 0x99, 0x0d, 0x77, 0xcf, 0xfb } }
|
|
|
|
|
|
|
|
#define NS_PIDOMWINDOWOUTER_IID \
|
|
|
|
{ 0x769693d4, 0xb009, 0x4fe2, \
|
|
|
|
{ 0xaf, 0x18, 0x7d, 0xc8, 0xdf, 0x74, 0x96, 0xdf } }
|
|
|
|
|
|
|
|
// NB: It's very very important that these two classes have identical vtables
|
|
|
|
// and memory layout!
|
|
|
|
class nsPIDOMWindowInner : public nsPIDOMWindow<mozIDOMWindow>
|
|
|
|
{
|
|
|
|
friend nsGlobalWindow;
|
|
|
|
|
|
|
|
public:
|
|
|
|
NS_DECLARE_STATIC_IID_ACCESSOR(NS_PIDOMWINDOWINNER_IID)
|
|
|
|
|
|
|
|
static nsPIDOMWindowInner* From(mozIDOMWindow* aFrom) {
|
|
|
|
return static_cast<nsPIDOMWindowInner*>(aFrom);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Returns true if this object has an outer window and it is the current inner
|
|
|
|
// window of that outer.
|
|
|
|
inline bool IsCurrentInnerWindow() const;
|
|
|
|
|
|
|
|
// Returns true if the document of this window is the active document. This
|
|
|
|
// is not identical to IsCurrentInnerWindow() because document.open() will
|
|
|
|
// keep the same document active but create a new window.
|
|
|
|
inline bool HasActiveDocument();
|
|
|
|
|
|
|
|
bool AddAudioContext(mozilla::dom::AudioContext* aAudioContext);
|
|
|
|
void RemoveAudioContext(mozilla::dom::AudioContext* aAudioContext);
|
|
|
|
void MuteAudioContexts();
|
|
|
|
void UnmuteAudioContexts();
|
|
|
|
|
|
|
|
bool GetAudioCaptured() const;
|
|
|
|
nsresult SetAudioCapture(bool aCapture);
|
|
|
|
|
2016-06-12 17:26:51 +03:00
|
|
|
already_AddRefed<mozilla::dom::ServiceWorkerRegistration>
|
2016-01-30 20:05:36 +03:00
|
|
|
GetServiceWorkerRegistration(const nsAString& aScope);
|
|
|
|
void InvalidateServiceWorkerRegistration(const nsAString& aScope);
|
|
|
|
|
2016-06-09 20:04:42 +03:00
|
|
|
mozilla::dom::Performance* GetPerformance();
|
2016-01-30 20:05:36 +03:00
|
|
|
|
2016-02-04 00:30:45 +03:00
|
|
|
bool HasMutationListeners(uint32_t aMutationEventType) const
|
|
|
|
{
|
|
|
|
if (!mOuterWindow) {
|
|
|
|
NS_ERROR("HasMutationListeners() called on orphan inner window!");
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
return (mMutationBits & aMutationEventType) != 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SetMutationListeners(uint32_t aType)
|
|
|
|
{
|
|
|
|
if (!mOuterWindow) {
|
|
|
|
NS_ERROR("HasMutationListeners() called on orphan inner window!");
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
mMutationBits |= aType;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Call this to check whether some node (this window, its document,
|
|
|
|
* or content in that document) has a mouseenter/leave event listener.
|
|
|
|
*/
|
|
|
|
bool HasMouseEnterLeaveEventListeners()
|
|
|
|
{
|
|
|
|
return mMayHaveMouseEnterLeaveEventListener;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Call this to indicate that some node (this window, its document,
|
|
|
|
* or content in that document) has a mouseenter/leave event listener.
|
|
|
|
*/
|
|
|
|
void SetHasMouseEnterLeaveEventListeners()
|
|
|
|
{
|
|
|
|
mMayHaveMouseEnterLeaveEventListener = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Call this to check whether some node (this window, its document,
|
|
|
|
* or content in that document) has a Pointerenter/leave event listener.
|
|
|
|
*/
|
|
|
|
bool HasPointerEnterLeaveEventListeners()
|
|
|
|
{
|
|
|
|
return mMayHavePointerEnterLeaveEventListener;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Call this to indicate that some node (this window, its document,
|
|
|
|
* or content in that document) has a Pointerenter/leave event listener.
|
|
|
|
*/
|
|
|
|
void SetHasPointerEnterLeaveEventListeners()
|
|
|
|
{
|
|
|
|
mMayHavePointerEnterLeaveEventListener = true;
|
|
|
|
}
|
|
|
|
|
2016-03-09 01:21:40 +03:00
|
|
|
/**
|
|
|
|
* Check whether this has had inner objects freed.
|
|
|
|
*/
|
|
|
|
bool InnerObjectsFreed() const
|
|
|
|
{
|
|
|
|
return mInnerObjectsFreed;
|
|
|
|
}
|
2016-02-04 00:30:45 +03:00
|
|
|
|
2016-10-10 22:09:00 +03:00
|
|
|
/**
|
|
|
|
* Check whether this window is a secure context.
|
|
|
|
*/
|
|
|
|
bool IsSecureContext() const;
|
2017-01-13 03:57:44 +03:00
|
|
|
bool IsSecureContextIfOpenerIgnored() const;
|
2016-10-10 22:09:00 +03:00
|
|
|
|
2016-10-26 20:20:15 +03:00
|
|
|
// Calling suspend should prevent any asynchronous tasks from
|
|
|
|
// executing javascript for this window. This means setTimeout,
|
|
|
|
// requestAnimationFrame, and events should not be fired. Suspending
|
|
|
|
// a window also suspends its children and workers. Workers may
|
|
|
|
// continue to perform computations in the background. A window
|
|
|
|
// can have Suspend() called multiple times and will only resume after
|
|
|
|
// a matching number of Resume() calls.
|
2016-10-26 20:20:16 +03:00
|
|
|
void Suspend();
|
|
|
|
void Resume();
|
2016-10-26 20:20:15 +03:00
|
|
|
|
|
|
|
// Calling Freeze() on a window will automatically Suspend() it. In
|
|
|
|
// addition, the window and its children are further treated as no longer
|
|
|
|
// suitable for interaction with the user. For example, it may be marked
|
|
|
|
// non-visible, cannot be focused, etc. All worker threads are also frozen
|
|
|
|
// bringing them to a complete stop. A window can have Freeze() called
|
|
|
|
// multiple times and will only thaw after a matching number of Thaw()
|
|
|
|
// calls.
|
2016-10-26 20:20:16 +03:00
|
|
|
void Freeze();
|
|
|
|
void Thaw();
|
2016-10-26 20:20:15 +03:00
|
|
|
|
|
|
|
// Apply the parent window's suspend, freeze, and modal state to the current
|
|
|
|
// window.
|
2016-10-26 20:20:16 +03:00
|
|
|
void SyncStateFromParentWindow();
|
2016-10-26 20:20:15 +03:00
|
|
|
|
2017-02-09 04:03:22 +03:00
|
|
|
bool IsPlayingAudio();
|
2016-12-03 01:22:48 +03:00
|
|
|
|
2017-04-25 12:20:00 +03:00
|
|
|
bool IsDocumentLoaded() const;
|
|
|
|
|
2016-12-03 01:22:48 +03:00
|
|
|
mozilla::dom::TimeoutManager& TimeoutManager();
|
|
|
|
|
2016-12-13 18:24:44 +03:00
|
|
|
bool IsRunningTimeout();
|
|
|
|
|
2017-04-18 13:21:34 +03:00
|
|
|
// To cache top inner-window if available after constructed for tab-wised
|
|
|
|
// indexedDB counters.
|
|
|
|
void TryToCacheTopInnerWindow();
|
|
|
|
|
|
|
|
// Increase/Decrease the number of active IndexedDB transactions/databases for
|
|
|
|
// the decision making of TabGroup scheduling and timeout-throttling.
|
|
|
|
void UpdateActiveIndexedDBTransactionCount(int32_t aDelta);
|
|
|
|
void UpdateActiveIndexedDBDatabaseCount(int32_t aDelta);
|
|
|
|
|
|
|
|
// Return true if there is any active IndexedDB databases which could block
|
|
|
|
// timeout-throttling.
|
|
|
|
bool HasActiveIndexedDBDatabases();
|
|
|
|
|
2016-01-30 20:05:36 +03:00
|
|
|
protected:
|
|
|
|
void CreatePerformanceObjectIfNeeded();
|
|
|
|
};
|
|
|
|
|
|
|
|
NS_DEFINE_STATIC_IID_ACCESSOR(nsPIDOMWindowInner, NS_PIDOMWINDOWINNER_IID)
|
|
|
|
|
|
|
|
// NB: It's very very important that these two classes have identical vtables
|
|
|
|
// and memory layout!
|
|
|
|
class nsPIDOMWindowOuter : public nsPIDOMWindow<mozIDOMWindowProxy>
|
|
|
|
{
|
|
|
|
protected:
|
2016-05-03 04:51:22 +03:00
|
|
|
void RefreshMediaElementsVolume();
|
|
|
|
void RefreshMediaElementsSuspend(SuspendTypes aSuspend);
|
|
|
|
bool IsDisposableSuspend(SuspendTypes aSuspend) const;
|
2017-02-03 09:47:08 +03:00
|
|
|
void MaybeNotifyMediaResumedFromBlock(SuspendTypes aSuspend);
|
2016-01-30 20:05:36 +03:00
|
|
|
|
|
|
|
public:
|
|
|
|
NS_DECLARE_STATIC_IID_ACCESSOR(NS_PIDOMWINDOWOUTER_IID)
|
|
|
|
|
|
|
|
static nsPIDOMWindowOuter* From(mozIDOMWindowProxy* aFrom) {
|
|
|
|
return static_cast<nsPIDOMWindowOuter*>(aFrom);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Given an inner window, return its outer if the inner is the current inner.
|
|
|
|
// Otherwise (argument null or not an inner or not current) return null.
|
|
|
|
static nsPIDOMWindowOuter* GetFromCurrentInner(nsPIDOMWindowInner* aInner);
|
|
|
|
|
|
|
|
nsPIDOMWindowInner* GetCurrentInnerWindow() const
|
|
|
|
{
|
|
|
|
return mInnerWindow;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsPIDOMWindowInner* EnsureInnerWindow()
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(IsOuterWindow());
|
|
|
|
// GetDoc forces inner window creation if there isn't one already
|
|
|
|
GetDoc();
|
|
|
|
return GetCurrentInnerWindow();
|
|
|
|
}
|
|
|
|
|
2016-07-29 05:28:50 +03:00
|
|
|
/**
|
|
|
|
* Set initial keyboard indicator state for accelerators and focus rings.
|
|
|
|
*/
|
|
|
|
void SetInitialKeyboardIndicators(UIStateChangeType aShowAccelerators,
|
|
|
|
UIStateChangeType aShowFocusRings);
|
|
|
|
|
2016-01-30 20:05:36 +03:00
|
|
|
// Internal getter/setter for the frame element, this version of the
|
|
|
|
// getter crosses chrome boundaries whereas the public scriptable
|
|
|
|
// one doesn't for security reasons.
|
|
|
|
mozilla::dom::Element* GetFrameElementInternal() const;
|
|
|
|
void SetFrameElementInternal(mozilla::dom::Element* aFrameElement);
|
|
|
|
|
|
|
|
bool IsActive()
|
|
|
|
{
|
|
|
|
return mIsActive;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SetDesktopModeViewport(bool aDesktopModeViewport)
|
|
|
|
{
|
|
|
|
mDesktopModeViewport = aDesktopModeViewport;
|
|
|
|
}
|
|
|
|
bool IsDesktopModeViewport() const
|
|
|
|
{
|
|
|
|
return mDesktopModeViewport;
|
|
|
|
}
|
|
|
|
bool IsBackground()
|
|
|
|
{
|
|
|
|
return mIsBackground;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Audio API
|
2016-05-03 04:51:22 +03:00
|
|
|
SuspendTypes GetMediaSuspend() const;
|
|
|
|
void SetMediaSuspend(SuspendTypes aSuspend);
|
2016-04-18 13:48:41 +03:00
|
|
|
|
2016-01-30 20:05:36 +03:00
|
|
|
bool GetAudioMuted() const;
|
|
|
|
void SetAudioMuted(bool aMuted);
|
|
|
|
|
|
|
|
float GetAudioVolume() const;
|
|
|
|
nsresult SetAudioVolume(float aVolume);
|
|
|
|
|
2017-02-03 05:50:07 +03:00
|
|
|
void MaybeActiveMediaComponents();
|
|
|
|
|
2016-04-22 02:26:42 +03:00
|
|
|
void SetServiceWorkersTestingEnabled(bool aEnabled);
|
|
|
|
bool GetServiceWorkersTestingEnabled();
|
2016-12-22 22:05:54 +03:00
|
|
|
|
|
|
|
float GetDevicePixelRatio(mozilla::dom::CallerType aCallerType);
|
2017-01-18 21:10:54 +03:00
|
|
|
|
|
|
|
void SetLargeAllocStatus(mozilla::dom::LargeAllocStatus aStatus);
|
2017-02-16 22:39:28 +03:00
|
|
|
|
|
|
|
bool IsTopLevelWindow();
|
|
|
|
bool HadOriginalOpener() const;
|
2016-01-30 20:05:36 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
NS_DEFINE_STATIC_IID_ACCESSOR(nsPIDOMWindowOuter, NS_PIDOMWINDOWOUTER_IID)
|
2004-09-04 23:28:46 +04:00
|
|
|
|
2016-01-30 20:05:36 +03:00
|
|
|
#include "nsPIDOMWindowInlines.h"
|
2005-11-11 17:36:26 +03:00
|
|
|
|
2013-03-16 08:31:38 +04:00
|
|
|
#ifdef MOZILLA_INTERNAL_API
|
2004-09-04 23:28:46 +04:00
|
|
|
PopupControlState
|
2011-09-29 10:19:26 +04:00
|
|
|
PushPopupControlState(PopupControlState aState, bool aForce);
|
2004-09-04 23:28:46 +04:00
|
|
|
|
|
|
|
void
|
|
|
|
PopPopupControlState(PopupControlState aState);
|
2004-12-22 19:37:51 +03:00
|
|
|
|
|
|
|
#define NS_AUTO_POPUP_STATE_PUSHER nsAutoPopupStatePusherInternal
|
|
|
|
#else
|
|
|
|
#define NS_AUTO_POPUP_STATE_PUSHER nsAutoPopupStatePusherExternal
|
2004-09-04 23:28:46 +04:00
|
|
|
#endif
|
|
|
|
|
2004-12-22 19:57:03 +03:00
|
|
|
// Helper class that helps with pushing and popping popup control
|
2004-09-04 23:28:46 +04:00
|
|
|
// state. Note that this class looks different from within code that's
|
|
|
|
// part of the layout library than it does in code outside the layout
|
2004-12-22 19:37:51 +03:00
|
|
|
// library. We give the two object layouts different names so the symbols
|
|
|
|
// don't conflict, but code should always use the name
|
|
|
|
// |nsAutoPopupStatePusher|.
|
|
|
|
class NS_AUTO_POPUP_STATE_PUSHER
|
2004-09-04 23:28:46 +04:00
|
|
|
{
|
|
|
|
public:
|
2013-03-16 08:31:38 +04:00
|
|
|
#ifdef MOZILLA_INTERNAL_API
|
2014-08-05 17:19:51 +04:00
|
|
|
explicit NS_AUTO_POPUP_STATE_PUSHER(PopupControlState aState, bool aForce = false)
|
2004-09-24 03:39:16 +04:00
|
|
|
: mOldState(::PushPopupControlState(aState, aForce))
|
2004-09-04 23:28:46 +04:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2004-12-22 19:37:51 +03:00
|
|
|
~NS_AUTO_POPUP_STATE_PUSHER()
|
2004-09-04 23:28:46 +04:00
|
|
|
{
|
|
|
|
PopPopupControlState(mOldState);
|
|
|
|
}
|
|
|
|
#else
|
2016-01-30 20:05:36 +03:00
|
|
|
NS_AUTO_POPUP_STATE_PUSHER(nsPIDOMWindowOuter *aWindow, PopupControlState aState)
|
2011-09-30 01:44:36 +04:00
|
|
|
: mWindow(aWindow), mOldState(openAbused)
|
2004-09-04 23:28:46 +04:00
|
|
|
{
|
|
|
|
if (aWindow) {
|
2011-10-17 18:59:28 +04:00
|
|
|
mOldState = aWindow->PushPopupControlState(aState, false);
|
2004-09-04 23:28:46 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-12-22 19:37:51 +03:00
|
|
|
~NS_AUTO_POPUP_STATE_PUSHER()
|
2004-09-04 23:28:46 +04:00
|
|
|
{
|
|
|
|
if (mWindow) {
|
|
|
|
mWindow->PopPopupControlState(mOldState);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
protected:
|
2013-03-16 08:31:38 +04:00
|
|
|
#ifndef MOZILLA_INTERNAL_API
|
2016-01-30 20:05:36 +03:00
|
|
|
nsCOMPtr<nsPIDOMWindowOuter> mWindow;
|
2004-09-05 12:24:29 +04:00
|
|
|
#endif
|
2004-09-04 23:28:46 +04:00
|
|
|
PopupControlState mOldState;
|
|
|
|
|
|
|
|
private:
|
2004-09-06 01:29:45 +04:00
|
|
|
// Hide so that this class can only be stack-allocated
|
2012-07-30 18:20:58 +04:00
|
|
|
static void* operator new(size_t /*size*/) CPP_THROW_NEW { return nullptr; }
|
2004-09-06 01:29:45 +04:00
|
|
|
static void operator delete(void* /*memory*/) {}
|
2004-09-04 23:28:46 +04:00
|
|
|
};
|
|
|
|
|
2004-12-22 19:37:51 +03:00
|
|
|
#define nsAutoPopupStatePusher NS_AUTO_POPUP_STATE_PUSHER
|
|
|
|
|
1999-10-14 14:58:25 +04:00
|
|
|
#endif // nsPIDOMWindow_h__
|