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"
|
2018-11-16 21:27:00 +03:00
|
|
|
#include "nsDataHashtable.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"
|
2018-11-16 21:27:00 +03:00
|
|
|
#include "mozilla/TimeStamp.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
|
|
|
|
2018-07-14 01:42:07 +03:00
|
|
|
class nsDOMOfflineResourceList;
|
2018-05-25 06:32:19 +03:00
|
|
|
class nsDOMWindowList;
|
2017-11-15 19:33:39 +03:00
|
|
|
class nsGlobalWindowInner;
|
|
|
|
class nsGlobalWindowOuter;
|
2013-08-22 10:30:55 +04:00
|
|
|
class nsIArray;
|
2018-07-17 06:11:00 +03:00
|
|
|
class nsIChannel;
|
2013-08-22 10:30:55 +04:00
|
|
|
class nsIContent;
|
2015-10-27 00:37:32 +03:00
|
|
|
class nsICSSDeclaration;
|
2013-08-22 10:30:55 +04:00
|
|
|
class nsIDocShell;
|
2018-10-30 03:13:29 +03:00
|
|
|
class nsDocShellLoadState;
|
2013-08-22 10:30:55 +04:00
|
|
|
class nsIDocument;
|
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 {
|
2018-07-06 12:15:20 +03:00
|
|
|
class AutoplayPermissionManager;
|
2013-08-22 10:30:55 +04:00
|
|
|
namespace dom {
|
|
|
|
class AudioContext;
|
2018-11-09 11:53:53 +03:00
|
|
|
class BrowsingContext;
|
2017-11-21 23:13:05 +03:00
|
|
|
class ClientInfo;
|
2017-12-08 22:46:42 +03:00
|
|
|
class ClientState;
|
2018-08-03 06:49:09 +03:00
|
|
|
class ContentFrameMessageManager;
|
2016-10-28 21:10:32 +03:00
|
|
|
class DocGroup;
|
|
|
|
class TabGroup;
|
2013-08-22 10:30:55 +04:00
|
|
|
class Element;
|
2018-07-27 07:37:44 +03:00
|
|
|
class MozIdleObserver;
|
2018-01-22 20:59:15 +03:00
|
|
|
class Navigator;
|
2016-06-09 20:04:42 +03:00
|
|
|
class Performance;
|
2018-11-14 22:02:33 +03:00
|
|
|
class Report;
|
|
|
|
class ReportBody;
|
|
|
|
class ReportingObserver;
|
2018-05-08 20:52:36 +03:00
|
|
|
class Selection;
|
2018-01-31 20:10:26 +03:00
|
|
|
class ServiceWorker;
|
2017-12-06 04:45:22 +03:00
|
|
|
class ServiceWorkerDescriptor;
|
2016-08-22 15:52:19 +03:00
|
|
|
class Timeout;
|
2016-12-03 01:22:48 +03:00
|
|
|
class TimeoutManager;
|
2018-08-30 01:21:25 +03:00
|
|
|
class WindowGlobalChild;
|
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
|
|
|
|
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
|
|
|
|
2018-01-05 01:32:15 +03:00
|
|
|
// Must be kept in sync with xpcom/rust/xpcom/src/interfaces/nonidl.rs
|
2017-11-21 21:25:27 +03:00
|
|
|
#define NS_PIDOMWINDOWINNER_IID \
|
2018-11-30 13:46:48 +03:00
|
|
|
{ \
|
2017-11-21 21:25:27 +03:00
|
|
|
0x775dabc9, 0x8f43, 0x4277, { \
|
|
|
|
0x9a, 0xdb, 0xf1, 0x99, 0x0d, 0x77, 0xcf, 0xfb \
|
|
|
|
} \
|
|
|
|
}
|
|
|
|
|
2018-01-05 01:32:15 +03:00
|
|
|
// Must be kept in sync with xpcom/rust/xpcom/src/interfaces/nonidl.rs
|
2017-11-21 21:25:27 +03:00
|
|
|
#define NS_PIDOMWINDOWOUTER_IID \
|
2018-11-30 13:46:48 +03:00
|
|
|
{ \
|
2017-11-21 21:25:27 +03:00
|
|
|
0x769693d4, 0xb009, 0x4fe2, { \
|
|
|
|
0xaf, 0x18, 0x7d, 0xc8, 0xdf, 0x74, 0x96, 0xdf \
|
|
|
|
} \
|
|
|
|
}
|
|
|
|
|
2017-11-21 21:47:36 +03:00
|
|
|
class nsPIDOMWindowInner : public mozIDOMWindow {
|
2017-11-21 21:25:27 +03:00
|
|
|
protected:
|
|
|
|
friend nsGlobalWindowInner;
|
|
|
|
friend nsGlobalWindowOuter;
|
|
|
|
|
2017-11-21 21:47:36 +03:00
|
|
|
explicit nsPIDOMWindowInner(nsPIDOMWindowOuter* aOuterWindow);
|
2017-11-21 21:25:27 +03:00
|
|
|
|
|
|
|
~nsPIDOMWindowInner();
|
|
|
|
|
|
|
|
public:
|
|
|
|
NS_DECLARE_STATIC_IID_ACCESSOR(NS_PIDOMWINDOWINNER_IID)
|
|
|
|
|
|
|
|
nsPIDOMWindowInner* AsInner() { return this; }
|
|
|
|
const nsPIDOMWindowInner* AsInner() const { return this; }
|
|
|
|
|
2018-02-23 01:28:39 +03:00
|
|
|
nsIGlobalObject* AsGlobal();
|
|
|
|
const nsIGlobalObject* AsGlobal() const;
|
|
|
|
|
2017-11-21 21:25:27 +03:00
|
|
|
nsPIDOMWindowOuter* GetOuterWindow() const { return mOuterWindow; }
|
|
|
|
|
|
|
|
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();
|
|
|
|
|
|
|
|
// Returns true if this window is the same as mTopInnerWindow
|
|
|
|
inline bool IsTopInnerWindow() const;
|
|
|
|
|
|
|
|
// Check whether a document is currently loading
|
|
|
|
inline bool IsLoading() const;
|
|
|
|
inline bool IsHandlingResizeEvent() const;
|
|
|
|
|
|
|
|
bool AddAudioContext(mozilla::dom::AudioContext* aAudioContext);
|
|
|
|
void RemoveAudioContext(mozilla::dom::AudioContext* aAudioContext);
|
|
|
|
void MuteAudioContexts();
|
|
|
|
void UnmuteAudioContexts();
|
|
|
|
|
2018-11-23 18:31:39 +03:00
|
|
|
void SetAudioCapture(bool aCapture);
|
2017-11-21 21:25:27 +03:00
|
|
|
|
|
|
|
mozilla::dom::Performance* GetPerformance();
|
|
|
|
|
2018-08-04 09:54:58 +03:00
|
|
|
void QueuePerformanceNavigationTiming();
|
|
|
|
|
2017-11-21 21:25:27 +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;
|
|
|
|
}
|
2010-02-20 19:07:03 +03:00
|
|
|
|
2016-04-25 17:17:32 +03:00
|
|
|
/**
|
2017-11-21 21:25:27 +03:00
|
|
|
* Call this to check whether some node (this window, its document,
|
|
|
|
* or content in that document) has a mouseenter/leave event listener.
|
2016-04-25 17:17:32 +03:00
|
|
|
*/
|
2017-11-21 21:25:27 +03:00
|
|
|
bool HasMouseEnterLeaveEventListeners() {
|
|
|
|
return mMayHaveMouseEnterLeaveEventListener;
|
|
|
|
}
|
2016-04-25 17:17:32 +03:00
|
|
|
|
2017-11-21 21:25:27 +03:00
|
|
|
/**
|
|
|
|
* 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;
|
|
|
|
}
|
2013-11-28 18:07:55 +04:00
|
|
|
|
2017-11-21 21:25:27 +03:00
|
|
|
/**
|
|
|
|
* 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;
|
|
|
|
}
|
2016-02-24 20:43:07 +03:00
|
|
|
|
2017-11-21 21:25:27 +03:00
|
|
|
/**
|
|
|
|
* 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;
|
2010-03-17 20:10:57 +03:00
|
|
|
}
|
2015-03-12 19:14:55 +03:00
|
|
|
|
2018-11-14 18:38:56 +03:00
|
|
|
/**
|
|
|
|
* Call this to indiate that some node (this window, its document,
|
|
|
|
* or content in that document) has a text event listener in the default
|
|
|
|
* group.
|
|
|
|
*/
|
|
|
|
void SetHasTextEventListenerInDefaultGroup() {
|
|
|
|
mMayHaveTextEventListenerInDefaultGroup = true;
|
|
|
|
}
|
|
|
|
|
2018-04-04 15:57:17 +03:00
|
|
|
// Sets the event for window.event. Does NOT take ownership, so
|
|
|
|
// the caller is responsible for clearing the event before the
|
|
|
|
// event gets deallocated. Pass nullptr to set window.event to
|
|
|
|
// undefined. Returns the previous value.
|
|
|
|
mozilla::dom::Event* SetEvent(mozilla::dom::Event* aEvent) {
|
|
|
|
mozilla::dom::Event* old = mEvent;
|
|
|
|
mEvent = aEvent;
|
|
|
|
return old;
|
|
|
|
}
|
|
|
|
|
2017-11-21 21:25:27 +03:00
|
|
|
/**
|
|
|
|
* Check whether this window is a secure context.
|
|
|
|
*/
|
|
|
|
bool IsSecureContext() const;
|
|
|
|
bool IsSecureContextIfOpenerIgnored() const;
|
|
|
|
|
|
|
|
// 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.
|
|
|
|
void Suspend();
|
|
|
|
void Resume();
|
|
|
|
|
|
|
|
// Apply the parent window's suspend, freeze, and modal state to the current
|
|
|
|
// window.
|
|
|
|
void SyncStateFromParentWindow();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Increment active peer connection count.
|
|
|
|
*/
|
|
|
|
void AddPeerConnection();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Decrement active peer connection count.
|
|
|
|
*/
|
|
|
|
void RemovePeerConnection();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Check whether the active peer connection count is non-zero.
|
|
|
|
*/
|
|
|
|
bool HasActivePeerConnections();
|
|
|
|
|
|
|
|
bool IsPlayingAudio();
|
|
|
|
|
|
|
|
bool IsDocumentLoaded() const;
|
|
|
|
|
|
|
|
mozilla::dom::TimeoutManager& TimeoutManager();
|
|
|
|
|
|
|
|
bool IsRunningTimeout();
|
|
|
|
|
|
|
|
// 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();
|
|
|
|
|
|
|
|
// Increase/Decrease the number of open WebSockets.
|
|
|
|
void UpdateWebSocketCount(int32_t aDelta);
|
|
|
|
|
|
|
|
// Return true if there are any open WebSockets that could block
|
|
|
|
// timeout-throttling.
|
|
|
|
bool HasOpenWebSockets() const;
|
|
|
|
|
|
|
|
mozilla::Maybe<mozilla::dom::ClientInfo> GetClientInfo() const;
|
2017-12-08 22:46:42 +03:00
|
|
|
mozilla::Maybe<mozilla::dom::ClientState> GetClientState() const;
|
2017-12-06 04:45:22 +03:00
|
|
|
mozilla::Maybe<mozilla::dom::ServiceWorkerDescriptor> GetController() const;
|
2017-11-21 21:25:27 +03:00
|
|
|
|
2017-12-19 18:04:48 +03:00
|
|
|
void NoteCalledRegisterForServiceWorkerScope(const nsACString& aScope);
|
|
|
|
|
2018-06-23 20:11:47 +03:00
|
|
|
void NoteDOMContentLoaded();
|
|
|
|
|
2017-11-21 21:25:27 +03:00
|
|
|
mozilla::dom::TabGroup* TabGroup();
|
|
|
|
|
|
|
|
virtual mozilla::dom::CustomElementRegistry* CustomElements() = 0;
|
|
|
|
|
|
|
|
// XXX: This is called on inner windows
|
|
|
|
virtual nsPIDOMWindowOuter* GetScriptableTop() = 0;
|
|
|
|
virtual nsPIDOMWindowOuter* GetScriptableParent() = 0;
|
|
|
|
virtual already_AddRefed<nsPIWindowRoot> GetTopWindowRoot() = 0;
|
|
|
|
|
2013-04-06 04:44:15 +04:00
|
|
|
mozilla::dom::EventTarget* GetChromeEventHandler() const {
|
2004-05-04 01:48:36 +04:00
|
|
|
return mChromeEventHandler;
|
|
|
|
}
|
2000-07-12 03:34:44 +04:00
|
|
|
|
2018-07-27 07:37:44 +03:00
|
|
|
virtual nsresult RegisterIdleObserver(
|
|
|
|
mozilla::dom::MozIdleObserver& aIdleObserver) = 0;
|
|
|
|
virtual nsresult UnregisterIdleObserver(
|
|
|
|
mozilla::dom::MozIdleObserver& aIdleObserver) = 0;
|
2017-11-21 21:25:27 +03: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;
|
|
|
|
}
|
|
|
|
|
2018-08-30 01:21:25 +03:00
|
|
|
mozilla::dom::WindowGlobalChild* GetWindowGlobalChild() {
|
|
|
|
return mWindowGlobalChild;
|
|
|
|
}
|
|
|
|
|
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
|
|
|
|
2005-12-01 22:35:27 +03:00
|
|
|
/**
|
|
|
|
* Get the docshell in this window.
|
|
|
|
*/
|
2017-11-21 21:25:27 +03:00
|
|
|
inline nsIDocShell* GetDocShell() const;
|
2005-11-29 02:56:44 +03:00
|
|
|
|
2005-12-01 22:35:27 +03:00
|
|
|
/**
|
2017-11-21 21:25:27 +03:00
|
|
|
* Set a new document in the window. Calling this method will in most cases
|
|
|
|
* create a new inner window. The call will be forewarded to the outer window,
|
2005-12-01 22:35:27 +03:00
|
|
|
* if the inner window is not the current inner window an
|
2017-11-21 21:25:27 +03:00
|
|
|
* 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, nsISupports* aState,
|
2011-09-29 10:19:26 +04:00
|
|
|
bool aForceReuseInnerWindow) = 0;
|
2005-12-01 22:35:27 +03: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.
|
|
|
|
*/
|
2011-10-17 18:59:28 +04:00
|
|
|
void SetHasPaintEventListeners() { 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.
|
|
|
|
*/
|
|
|
|
bool HasPaintEventListeners() { 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;
|
|
|
|
}
|
|
|
|
|
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.
|
|
|
|
*/
|
2018-04-26 22:28:30 +03:00
|
|
|
inline mozilla::dom::Element* GetFocusedElement() const;
|
|
|
|
virtual void SetFocusedElement(mozilla::dom::Element* aElement,
|
|
|
|
uint32_t aFocusMethod = 0,
|
|
|
|
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
|
|
|
|
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.
|
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.
|
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
|
|
|
|
|
2011-08-03 22:12:08 +04:00
|
|
|
/**
|
2017-11-21 21:25:27 +03:00
|
|
|
* Tell this window that there is an observer for gamepad input
|
2014-06-29 19:36:02 +04:00
|
|
|
*
|
2017-11-21 21:25:27 +03:00
|
|
|
* Inner windows only.
|
2009-10-07 04:09:16 +04:00
|
|
|
*/
|
2017-11-21 21:25:27 +03:00
|
|
|
virtual void SetHasGamepadEventListener(bool aHasGamepad = true) = 0;
|
2009-10-07 04:09:16 +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
|
|
|
|
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
|
|
|
|
2018-01-22 20:59:15 +03:00
|
|
|
mozilla::dom::Navigator* Navigator();
|
2017-05-09 23:41:19 +03:00
|
|
|
virtual mozilla::dom::Location* GetLocation() = 0;
|
2017-11-21 21:25:27 +03:00
|
|
|
|
2015-10-27 00:37:32 +03:00
|
|
|
virtual nsresult GetControllers(nsIControllers** aControllers) = 0;
|
2017-11-21 21:25:27 +03:00
|
|
|
|
2018-05-25 06:32:19 +03:00
|
|
|
virtual nsDOMWindowList* GetFrames() = 0;
|
2015-10-27 00:37:32 +03:00
|
|
|
|
|
|
|
virtual nsresult GetInnerWidth(int32_t* aWidth) = 0;
|
|
|
|
virtual nsresult GetInnerHeight(int32_t* aHeight) = 0;
|
2017-11-21 21:25:27 +03:00
|
|
|
|
2015-10-27 00:37:32 +03:00
|
|
|
virtual already_AddRefed<nsICSSDeclaration> GetComputedStyle(
|
2017-11-21 21:25:27 +03:00
|
|
|
mozilla::dom::Element& aElt, const nsAString& aPseudoElt,
|
|
|
|
mozilla::ErrorResult& aError) = 0;
|
|
|
|
|
2018-04-27 06:37:33 +03:00
|
|
|
virtual mozilla::dom::Element* GetFrameElement() = 0;
|
2017-11-21 21:25:27 +03:00
|
|
|
|
2018-07-14 01:42:07 +03:00
|
|
|
virtual nsDOMOfflineResourceList* GetApplicationCache() = 0;
|
2017-11-21 21:25:27 +03:00
|
|
|
|
2015-10-27 00:37:32 +03:00
|
|
|
virtual bool GetFullScreen() = 0;
|
|
|
|
|
|
|
|
virtual nsresult Focus() = 0;
|
|
|
|
virtual nsresult Close() = 0;
|
|
|
|
|
2016-11-23 08:14:39 +03:00
|
|
|
mozilla::dom::DocGroup* GetDocGroup() const;
|
2017-06-13 23:40:00 +03:00
|
|
|
virtual nsISerialEventTarget* EventTargetFor(
|
2017-01-19 07:26:17 +03:00
|
|
|
mozilla::TaskCategory aCategory) const = 0;
|
2016-11-07 23:30:17 +03:00
|
|
|
|
2018-07-06 12:15:20 +03:00
|
|
|
// Returns the AutoplayPermissionManager that documents in this window should
|
|
|
|
// use to request permission to autoplay.
|
|
|
|
already_AddRefed<mozilla::AutoplayPermissionManager>
|
|
|
|
GetAutoplayPermissionManager();
|
2018-06-22 02:57:24 +03:00
|
|
|
|
2018-11-14 22:02:33 +03:00
|
|
|
void RegisterReportingObserver(mozilla::dom::ReportingObserver* aObserver,
|
|
|
|
bool aBuffered);
|
|
|
|
|
|
|
|
void UnregisterReportingObserver(mozilla::dom::ReportingObserver* aObserver);
|
|
|
|
|
|
|
|
void BroadcastReport(mozilla::dom::Report* aReport);
|
|
|
|
|
|
|
|
void NotifyReportingObservers();
|
|
|
|
|
2018-11-20 01:56:04 +03:00
|
|
|
void SaveStorageAccessGranted(const nsACString& aPermissionKey);
|
|
|
|
|
|
|
|
bool HasStorageAccessGranted(const nsACString& aPermissionKey);
|
|
|
|
|
2004-05-04 01:48:36 +04:00
|
|
|
protected:
|
2017-11-21 21:25:27 +03:00
|
|
|
void CreatePerformanceObjectIfNeeded();
|
2010-04-27 13:58:58 +04:00
|
|
|
|
2017-11-21 21:25:27 +03:00
|
|
|
// Lazily instantiate an about:blank document if necessary, and if
|
|
|
|
// we have what it takes to do so.
|
|
|
|
void MaybeCreateDoc();
|
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;
|
2017-11-21 21:47:36 +03: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!
|
|
|
|
nsCOMPtr<mozilla::dom::EventTarget> mChromeEventHandler; // strong
|
|
|
|
nsCOMPtr<nsIDocument> mDoc; // strong
|
|
|
|
// Cache the URI when mDoc is cleared.
|
|
|
|
nsCOMPtr<nsIURI> mDocumentURI; // strong
|
|
|
|
nsCOMPtr<nsIURI> mDocBaseURI; // strong
|
|
|
|
|
|
|
|
nsCOMPtr<mozilla::dom::EventTarget> mParentTarget; // strong
|
|
|
|
|
|
|
|
RefPtr<mozilla::dom::Performance> mPerformance;
|
|
|
|
mozilla::UniquePtr<mozilla::dom::TimeoutManager> mTimeoutManager;
|
|
|
|
|
2018-01-22 20:59:15 +03:00
|
|
|
RefPtr<mozilla::dom::Navigator> mNavigator;
|
|
|
|
|
2017-11-21 21:47:36 +03:00
|
|
|
// These variables are only used on inner windows.
|
2017-11-21 22:06:28 +03:00
|
|
|
uint32_t mMutationBits;
|
2017-11-21 21:47:36 +03:00
|
|
|
|
2017-11-21 22:06:28 +03:00
|
|
|
uint32_t mActivePeerConnections;
|
2017-11-21 21:47:36 +03:00
|
|
|
|
2017-11-21 22:06:28 +03:00
|
|
|
bool mIsDocumentLoaded;
|
|
|
|
bool mIsHandlingResizeEvent;
|
|
|
|
bool mMayHavePaintEventListener;
|
|
|
|
bool mMayHaveTouchEventListener;
|
|
|
|
bool mMayHaveSelectionChangeEventListener;
|
|
|
|
bool mMayHaveMouseEnterLeaveEventListener;
|
|
|
|
bool mMayHavePointerEnterLeaveEventListener;
|
2018-11-14 18:38:56 +03:00
|
|
|
// Only for telemetry probe so that you can remove this after the
|
|
|
|
// telemetry stops working.
|
|
|
|
bool mMayHaveTextEventListenerInDefaultGroup;
|
2017-11-21 21:47:36 +03:00
|
|
|
|
2017-11-21 22:06:28 +03:00
|
|
|
// Our inner window's outer window.
|
2017-11-21 21:47:36 +03:00
|
|
|
nsCOMPtr<nsPIDOMWindowOuter> mOuterWindow;
|
|
|
|
|
2018-04-26 22:28:30 +03:00
|
|
|
// The element within the document that is currently focused when this
|
2018-04-26 17:37:47 +03:00
|
|
|
// window is active.
|
2018-04-26 22:28:30 +03:00
|
|
|
RefPtr<mozilla::dom::Element> mFocusedElement;
|
2017-11-21 21:47:36 +03:00
|
|
|
|
|
|
|
// The AudioContexts created for the current document, if any.
|
|
|
|
nsTArray<mozilla::dom::AudioContext*> mAudioContexts; // Weak
|
|
|
|
|
|
|
|
RefPtr<mozilla::dom::TabGroup> mTabGroup;
|
|
|
|
|
|
|
|
// A unique (as long as our 64-bit counter doesn't roll over) id for
|
|
|
|
// this window.
|
|
|
|
uint64_t mWindowID;
|
|
|
|
|
2017-11-21 22:06:28 +03:00
|
|
|
// Set to true once we've sent the (chrome|content)-document-global-created
|
|
|
|
// notification.
|
2017-11-21 21:47:36 +03:00
|
|
|
bool mHasNotifiedGlobalCreated;
|
|
|
|
|
|
|
|
uint32_t mMarkedCCGeneration;
|
|
|
|
|
2017-11-21 22:06:28 +03:00
|
|
|
// mTopInnerWindow is used for tab-wise check by timeout throttling. It could
|
|
|
|
// be null.
|
2017-11-21 21:47:36 +03:00
|
|
|
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;
|
|
|
|
|
2017-11-21 22:06:28 +03:00
|
|
|
// The number of active IndexedDB databases.
|
2017-11-21 21:47:36 +03:00
|
|
|
uint32_t mNumOfIndexedDBDatabases;
|
|
|
|
|
2017-11-21 22:06:28 +03:00
|
|
|
// The number of open WebSockets.
|
2017-11-21 21:47:36 +03:00
|
|
|
uint32_t mNumOfOpenWebSockets;
|
2018-06-22 02:57:24 +03:00
|
|
|
|
|
|
|
// If we're in the process of requesting permission for this window to
|
|
|
|
// play audible media, or we've already been granted permission by the
|
|
|
|
// user, this is non-null, and encapsulates the request.
|
2018-07-06 12:15:20 +03:00
|
|
|
RefPtr<mozilla::AutoplayPermissionManager> mAutoplayPermissionManager;
|
2018-04-04 15:57:17 +03:00
|
|
|
|
|
|
|
// The event dispatch code sets and unsets this while keeping
|
|
|
|
// the event object alive.
|
|
|
|
mozilla::dom::Event* mEvent;
|
2018-11-14 22:02:33 +03:00
|
|
|
|
|
|
|
// List of Report objects for ReportingObservers.
|
|
|
|
nsTArray<RefPtr<mozilla::dom::ReportingObserver>> mReportingObservers;
|
|
|
|
nsTArray<RefPtr<mozilla::dom::Report>> mReportRecords;
|
2018-11-20 01:56:04 +03:00
|
|
|
|
|
|
|
// This is a list of storage access granted for the current window. These are
|
|
|
|
// also set as permissions, but it could happen that we need to access them
|
|
|
|
// synchronously in this context, and for this, we need a copy here.
|
|
|
|
nsTArray<nsCString> mStorageAccessGranted;
|
2018-08-30 01:21:25 +03:00
|
|
|
|
|
|
|
// The WindowGlobalChild actor for this window.
|
|
|
|
//
|
|
|
|
// This will be non-null during the full lifetime of the window, initialized
|
|
|
|
// during SetNewDocument, and cleared during FreeInnerObjects.
|
|
|
|
RefPtr<mozilla::dom::WindowGlobalChild> mWindowGlobalChild;
|
2017-11-21 21:25:27 +03:00
|
|
|
};
|
2010-06-16 15:43:36 +04:00
|
|
|
|
2017-11-21 21:25:27 +03:00
|
|
|
NS_DEFINE_STATIC_IID_ACCESSOR(nsPIDOMWindowInner, NS_PIDOMWINDOWINNER_IID)
|
2010-06-16 15:42:42 +04:00
|
|
|
|
2017-11-21 21:47:36 +03:00
|
|
|
class nsPIDOMWindowOuter : public mozIDOMWindowProxy {
|
2017-11-21 21:25:27 +03:00
|
|
|
protected:
|
2018-10-10 13:20:36 +03:00
|
|
|
explicit nsPIDOMWindowOuter(uint64_t aWindowID);
|
2017-10-02 17:58:44 +03:00
|
|
|
|
2017-11-21 21:25:27 +03:00
|
|
|
~nsPIDOMWindowOuter();
|
2005-07-31 00:57:07 +04:00
|
|
|
|
2017-11-21 21:25:27 +03:00
|
|
|
void RefreshMediaElementsVolume();
|
|
|
|
void RefreshMediaElementsSuspend(SuspendTypes aSuspend);
|
|
|
|
bool IsDisposableSuspend(SuspendTypes aSuspend) const;
|
|
|
|
void MaybeNotifyMediaResumedFromBlock(SuspendTypes aSuspend);
|
2012-12-26 02:00:15 +04:00
|
|
|
|
2017-11-21 21:25:27 +03:00
|
|
|
public:
|
|
|
|
NS_DECLARE_STATIC_IID_ACCESSOR(NS_PIDOMWINDOWOUTER_IID)
|
2015-11-23 21:38:08 +03:00
|
|
|
|
2017-11-21 21:25:27 +03:00
|
|
|
nsPIDOMWindowOuter* AsOuter() { return this; }
|
|
|
|
const nsPIDOMWindowOuter* AsOuter() const { return this; }
|
2006-07-06 02:48:04 +04:00
|
|
|
|
2017-11-21 21:25:27 +03:00
|
|
|
nsPIDOMWindowOuter* GetOuterWindow() const {
|
|
|
|
return const_cast<nsPIDOMWindowOuter*>(this);
|
|
|
|
}
|
2003-05-06 00:55:37 +04:00
|
|
|
|
2017-11-21 21:25:27 +03:00
|
|
|
static nsPIDOMWindowOuter* From(mozIDOMWindowProxy* aFrom) {
|
|
|
|
return static_cast<nsPIDOMWindowOuter*>(aFrom);
|
|
|
|
}
|
2017-08-04 13:28:15 +03:00
|
|
|
|
2017-11-21 21:25:27 +03:00
|
|
|
// 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);
|
2005-07-31 00:57:07 +04:00
|
|
|
|
2017-11-21 21:25:27 +03:00
|
|
|
// Check whether a document is currently loading
|
|
|
|
inline bool IsLoading() const;
|
|
|
|
inline bool IsHandlingResizeEvent() const;
|
2016-03-09 01:21:40 +03:00
|
|
|
|
2017-11-21 21:25:27 +03:00
|
|
|
nsPIDOMWindowInner* GetCurrentInnerWindow() const { return mInnerWindow; }
|
2016-03-09 01:21:40 +03:00
|
|
|
|
2017-11-21 21:25:27 +03:00
|
|
|
nsPIDOMWindowInner* EnsureInnerWindow() {
|
|
|
|
// GetDoc forces inner window creation if there isn't one already
|
|
|
|
GetDoc();
|
|
|
|
return GetCurrentInnerWindow();
|
|
|
|
}
|
2010-03-17 20:10:57 +03:00
|
|
|
|
2017-11-21 21:25:27 +03:00
|
|
|
bool IsRootOuterWindow() { return mIsRootOuterWindow; }
|
2011-03-26 04:05:55 +03:00
|
|
|
|
2016-05-03 04:51:22 +03:00
|
|
|
/**
|
2017-11-21 21:25:27 +03:00
|
|
|
* Set initial keyboard indicator state for accelerators and focus rings.
|
2016-05-03 04:51:22 +03:00
|
|
|
*/
|
2017-11-21 21:25:27 +03:00
|
|
|
void SetInitialKeyboardIndicators(UIStateChangeType aShowAccelerators,
|
|
|
|
UIStateChangeType aShowFocusRings);
|
2016-05-03 04:51:22 +03:00
|
|
|
|
2017-11-21 21:25:27 +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);
|
2014-03-11 14:46:55 +04:00
|
|
|
|
2017-11-21 21:25:27 +03:00
|
|
|
bool IsActive() { return mIsActive; }
|
2015-07-09 17:40:08 +03:00
|
|
|
|
2017-11-21 21:25:27 +03:00
|
|
|
void SetDesktopModeViewport(bool aDesktopModeViewport) {
|
|
|
|
mDesktopModeViewport = aDesktopModeViewport;
|
|
|
|
}
|
|
|
|
bool IsDesktopModeViewport() const { return mDesktopModeViewport; }
|
|
|
|
bool IsBackground() { return mIsBackground; }
|
2015-03-12 19:14:55 +03:00
|
|
|
|
2017-11-21 21:25:27 +03:00
|
|
|
// Audio API
|
|
|
|
SuspendTypes GetMediaSuspend() const;
|
|
|
|
void SetMediaSuspend(SuspendTypes aSuspend);
|
2016-09-28 21:27:35 +03:00
|
|
|
|
2017-11-21 21:25:27 +03:00
|
|
|
bool GetAudioMuted() const;
|
|
|
|
void SetAudioMuted(bool aMuted);
|
2010-04-27 13:58:58 +04:00
|
|
|
|
2017-11-21 21:25:27 +03:00
|
|
|
float GetAudioVolume() const;
|
|
|
|
nsresult SetAudioVolume(float aVolume);
|
2010-10-21 04:24:15 +04:00
|
|
|
|
2017-11-21 21:25:27 +03:00
|
|
|
void MaybeActiveMediaComponents();
|
2012-11-24 03:33:41 +04:00
|
|
|
|
2017-11-21 21:25:27 +03:00
|
|
|
void SetServiceWorkersTestingEnabled(bool aEnabled);
|
|
|
|
bool GetServiceWorkersTestingEnabled();
|
|
|
|
|
|
|
|
float GetDevicePixelRatio(mozilla::dom::CallerType aCallerType);
|
|
|
|
|
|
|
|
void SetLargeAllocStatus(mozilla::dom::LargeAllocStatus aStatus);
|
|
|
|
|
|
|
|
bool IsTopLevelWindow();
|
|
|
|
bool HadOriginalOpener() const;
|
|
|
|
|
|
|
|
mozilla::dom::TabGroup* TabGroup();
|
|
|
|
|
|
|
|
virtual nsPIDOMWindowOuter* GetPrivateRoot() = 0;
|
|
|
|
|
|
|
|
virtual void ActivateOrDeactivate(bool aActivate) = 0;
|
|
|
|
|
2018-11-16 21:27:00 +03:00
|
|
|
/**
|
|
|
|
* These functions are used to modify and check temporary autoplay permission.
|
|
|
|
*/
|
|
|
|
void NotifyTemporaryAutoplayPermissionChanged(int32_t aState,
|
|
|
|
const nsAString& aPrePath);
|
|
|
|
bool HasTemporaryAutoplayPermission();
|
|
|
|
|
2017-11-21 21:25:27 +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.
|
|
|
|
*/
|
|
|
|
|
|
|
|
virtual already_AddRefed<nsPIDOMWindowOuter> GetTop() = 0; // Outer only
|
|
|
|
virtual already_AddRefed<nsPIDOMWindowOuter> GetParent() = 0;
|
|
|
|
virtual nsPIDOMWindowOuter* GetScriptableTop() = 0;
|
|
|
|
virtual nsPIDOMWindowOuter* GetScriptableParent() = 0;
|
|
|
|
virtual already_AddRefed<nsPIWindowRoot> GetTopWindowRoot() = 0;
|
|
|
|
|
|
|
|
/**
|
2018-08-01 00:27:02 +03:00
|
|
|
* Behaves identically to GetScriptableParent except that it returns null
|
2017-11-21 21:25:27 +03:00
|
|
|
* if GetScriptableParent would return this window.
|
|
|
|
*/
|
|
|
|
virtual nsPIDOMWindowOuter* GetScriptableParentOrNull() = 0;
|
2016-10-28 21:10:32 +03:00
|
|
|
|
2017-11-21 21:25:27 +03:00
|
|
|
virtual bool IsTopLevelWindowActive() = 0;
|
2010-11-23 11:50:56 +03:00
|
|
|
|
2017-11-21 21:25:27 +03:00
|
|
|
virtual void SetActive(bool aActive) { mIsActive = aActive; }
|
2013-11-24 23:35:34 +04:00
|
|
|
|
2017-11-21 21:25:27 +03:00
|
|
|
virtual void SetIsBackground(bool aIsBackground) = 0;
|
2015-03-24 21:15:00 +03:00
|
|
|
|
2017-11-21 21:25:27 +03:00
|
|
|
mozilla::dom::EventTarget* GetChromeEventHandler() const {
|
|
|
|
return mChromeEventHandler;
|
|
|
|
}
|
2017-01-18 21:10:54 +03:00
|
|
|
|
2017-11-21 21:25:27 +03:00
|
|
|
virtual void SetChromeEventHandler(
|
|
|
|
mozilla::dom::EventTarget* aChromeEventHandler) = 0;
|
2017-05-17 09:11:09 +03:00
|
|
|
|
2017-11-21 21:25:27 +03:00
|
|
|
mozilla::dom::EventTarget* GetParentTarget() {
|
|
|
|
if (!mParentTarget) {
|
|
|
|
UpdateParentTarget();
|
|
|
|
}
|
|
|
|
return mParentTarget;
|
|
|
|
}
|
2017-04-18 13:21:34 +03:00
|
|
|
|
2018-08-03 06:49:09 +03:00
|
|
|
mozilla::dom::ContentFrameMessageManager* GetMessageManager() {
|
|
|
|
// We maintain our mMessageManager state alongside mParentTarget.
|
|
|
|
if (!mParentTarget) {
|
|
|
|
UpdateParentTarget();
|
|
|
|
}
|
|
|
|
return mMessageManager;
|
|
|
|
}
|
|
|
|
|
2017-11-21 21:25:27 +03:00
|
|
|
nsIDocument* GetExtantDoc() const { return mDoc; }
|
|
|
|
nsIURI* GetDocumentURI() const;
|
2017-08-23 13:12:44 +03:00
|
|
|
|
2017-11-21 21:25:27 +03:00
|
|
|
nsIDocument* GetDoc() {
|
|
|
|
if (!mDoc) {
|
|
|
|
MaybeCreateDoc();
|
|
|
|
}
|
|
|
|
return mDoc;
|
|
|
|
}
|
1999-10-14 14:58:25 +04:00
|
|
|
|
2017-11-21 21:25:27 +03:00
|
|
|
// Set the window up with an about:blank document with the current subject
|
|
|
|
// principal.
|
|
|
|
virtual void SetInitialPrincipalToSubject() = 0;
|
2016-01-30 20:05:36 +03:00
|
|
|
|
2017-11-21 21:25:27 +03:00
|
|
|
// Returns an object containing the window's state. This also suspends
|
|
|
|
// all running timeouts in the window.
|
|
|
|
virtual already_AddRefed<nsISupports> SaveWindowState() = 0;
|
2016-01-30 20:05:36 +03:00
|
|
|
|
2017-11-21 21:25:27 +03:00
|
|
|
// Restore the window state from aState.
|
|
|
|
virtual nsresult RestoreWindowState(nsISupports* aState) = 0;
|
2017-11-15 19:34:04 +03:00
|
|
|
|
2017-11-21 21:25:27 +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.
|
|
|
|
virtual bool IsSuspended() const = 0;
|
|
|
|
virtual bool IsFrozen() const = 0;
|
2016-01-30 20:05:36 +03:00
|
|
|
|
2017-11-21 21:25:27 +03:00
|
|
|
// Fire any DOM notification events related to things that happened while
|
|
|
|
// the window was frozen.
|
|
|
|
virtual nsresult FireDelayedDOMEvents() = 0;
|
2017-11-18 02:33:21 +03:00
|
|
|
|
2017-11-21 21:25:27 +03:00
|
|
|
/**
|
|
|
|
* Get the docshell in this window.
|
|
|
|
*/
|
|
|
|
inline nsIDocShell* GetDocShell() const;
|
2017-11-18 02:33:21 +03:00
|
|
|
|
2018-11-09 11:53:53 +03:00
|
|
|
mozilla::dom::BrowsingContext* GetBrowsingContext() const;
|
|
|
|
|
2017-11-21 21:25:27 +03:00
|
|
|
/**
|
|
|
|
* Set a new document in the window. Calling this method will in most cases
|
|
|
|
* create a new inner window. 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.
|
|
|
|
*
|
|
|
|
* aDocument must not be null.
|
|
|
|
*/
|
|
|
|
virtual nsresult SetNewDocument(nsIDocument* aDocument, nsISupports* aState,
|
|
|
|
bool aForceReuseInnerWindow) = 0;
|
2016-01-30 20:05:36 +03:00
|
|
|
|
2017-11-21 21:25:27 +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.
|
|
|
|
*/
|
|
|
|
virtual void SetOpenerWindow(nsPIDOMWindowOuter* aOpener,
|
|
|
|
bool aOriginalOpener) = 0;
|
2016-01-30 20:05:36 +03:00
|
|
|
|
2017-11-21 21:25:27 +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.).
|
|
|
|
*/
|
|
|
|
virtual void EnsureSizeAndPositionUpToDate() = 0;
|
2016-01-30 20:05:36 +03:00
|
|
|
|
2017-11-21 21:25:27 +03:00
|
|
|
/**
|
|
|
|
* Callback for notifying a window about a modal dialog being
|
|
|
|
* opened/closed with the window as a parent.
|
|
|
|
*/
|
|
|
|
virtual void EnterModalState() = 0;
|
|
|
|
virtual void LeaveModalState() = 0;
|
2016-01-30 20:05:36 +03:00
|
|
|
|
2017-11-21 21:25:27 +03:00
|
|
|
virtual bool CanClose() = 0;
|
|
|
|
virtual void ForceClose() = 0;
|
2016-02-04 00:30:45 +03:00
|
|
|
|
2017-11-21 21:25:27 +03:00
|
|
|
/**
|
|
|
|
* Moves the top-level window into fullscreen mode if aIsFullScreen is true,
|
|
|
|
* otherwise exits fullscreen.
|
|
|
|
*/
|
|
|
|
virtual nsresult SetFullscreenInternal(FullscreenReason aReason,
|
|
|
|
bool aIsFullscreen) = 0;
|
|
|
|
virtual void FullscreenWillChange(bool aIsFullscreen) = 0;
|
|
|
|
/**
|
|
|
|
* This function should be called when the fullscreen state is flipped.
|
|
|
|
* If no widget is involved the fullscreen change, this method is called
|
|
|
|
* by SetFullscreenInternal, otherwise, it is called when the widget
|
|
|
|
* finishes its change to or from fullscreen.
|
|
|
|
*
|
|
|
|
* @param aIsFullscreen indicates whether the widget is in fullscreen.
|
|
|
|
*/
|
|
|
|
virtual void FinishFullscreenChange(bool aIsFullscreen) = 0;
|
2016-02-04 00:30:45 +03:00
|
|
|
|
2017-11-21 21:25:27 +03:00
|
|
|
// XXX: These focus methods all forward to the inner, could we change
|
|
|
|
// consumers to call these on the inner directly?
|
2016-02-04 00:30:45 +03:00
|
|
|
|
2017-11-21 21:25:27 +03: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.
|
|
|
|
*/
|
2018-04-26 22:28:30 +03:00
|
|
|
inline mozilla::dom::Element* GetFocusedElement() const;
|
|
|
|
virtual void SetFocusedElement(mozilla::dom::Element* aElement,
|
|
|
|
uint32_t aFocusMethod = 0,
|
|
|
|
bool aNeedsFocus = false) = 0;
|
2016-02-04 00:30:45 +03:00
|
|
|
|
2017-11-21 21:25:27 +03:00
|
|
|
/**
|
|
|
|
* Retrieves the method that was used to focus the current node.
|
|
|
|
*/
|
|
|
|
virtual uint32_t GetFocusMethod() = 0;
|
2016-02-04 00:30:45 +03:00
|
|
|
|
2017-11-21 21:25:27 +03: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.
|
|
|
|
*/
|
|
|
|
virtual bool TakeFocus(bool aFocus, uint32_t aFocusMethod) = 0;
|
2016-02-04 00:30:45 +03:00
|
|
|
|
|
|
|
/**
|
2017-11-21 21:25:27 +03: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.
|
2016-02-04 00:30:45 +03:00
|
|
|
*/
|
2017-11-21 21:25:27 +03:00
|
|
|
virtual void SetReadyForFocus() = 0;
|
2016-02-04 00:30:45 +03:00
|
|
|
|
|
|
|
/**
|
2017-11-21 21:25:27 +03:00
|
|
|
* Whether the focused content within the window should show a focus ring.
|
2016-02-04 00:30:45 +03:00
|
|
|
*/
|
2017-11-21 21:25:27 +03:00
|
|
|
virtual bool ShouldShowFocusRing() = 0;
|
2016-02-04 00:30:45 +03:00
|
|
|
|
|
|
|
/**
|
2017-11-21 21:25:27 +03:00
|
|
|
* Set the keyboard indicator state for accelerators and focus rings.
|
2016-02-04 00:30:45 +03:00
|
|
|
*/
|
2017-11-21 21:25:27 +03:00
|
|
|
virtual void SetKeyboardIndicators(UIStateChangeType aShowAccelerators,
|
|
|
|
UIStateChangeType aShowFocusRings) = 0;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Indicates that the page in the window has been hidden. This is used to
|
|
|
|
* reset the focus state.
|
|
|
|
*/
|
|
|
|
virtual void PageHidden() = 0;
|
2016-02-04 00:30:45 +03:00
|
|
|
|
|
|
|
/**
|
2017-11-21 21:25:27 +03: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
|
|
|
|
* 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.
|
2016-02-04 00:30:45 +03:00
|
|
|
*/
|
2017-11-21 21:25:27 +03:00
|
|
|
virtual nsresult SetArguments(nsIArray* aArguments) = 0;
|
2016-02-04 00:30:45 +03:00
|
|
|
|
2016-10-10 22:09:00 +03:00
|
|
|
/**
|
2017-11-21 21:25:27 +03:00
|
|
|
* Return the window id of this window
|
2016-10-10 22:09:00 +03:00
|
|
|
*/
|
2017-11-21 21:25:27 +03:00
|
|
|
uint64_t WindowID() const { return mWindowID; }
|
2016-10-26 20:20:15 +03:00
|
|
|
|
2017-08-04 13:28:15 +03:00
|
|
|
/**
|
2017-11-21 21:25:27 +03:00
|
|
|
* Dispatch a custom event with name aEventName targeted at this window.
|
|
|
|
* Returns whether the default action should be performed.
|
|
|
|
*
|
|
|
|
* Outer windows only.
|
2017-08-04 13:28:15 +03:00
|
|
|
*/
|
2017-11-21 21:25:27 +03:00
|
|
|
virtual bool DispatchCustomEvent(const nsAString& aEventName) = 0;
|
2017-08-04 13:28:15 +03:00
|
|
|
|
|
|
|
/**
|
2017-11-21 21:25:27 +03:00
|
|
|
* Like nsIDOMWindow::Open, except that we don't navigate to the given URL.
|
|
|
|
*
|
|
|
|
* Outer windows only.
|
2017-08-04 13:28:15 +03:00
|
|
|
*/
|
2017-11-21 21:25:27 +03:00
|
|
|
virtual nsresult OpenNoNavigate(const nsAString& aUrl, const nsAString& aName,
|
|
|
|
const nsAString& aOptions,
|
|
|
|
nsPIDOMWindowOuter** _retval) = 0;
|
2017-08-04 13:28:15 +03:00
|
|
|
|
|
|
|
/**
|
2017-11-21 21:25:27 +03:00
|
|
|
* Fire a popup blocked event on the document.
|
2017-08-04 13:28:15 +03:00
|
|
|
*/
|
2017-11-21 21:25:27 +03:00
|
|
|
virtual void FirePopupBlockedEvent(nsIDocument* aDoc, nsIURI* aPopupURI,
|
|
|
|
const nsAString& aPopupWindowName,
|
|
|
|
const nsAString& aPopupWindowFeatures) = 0;
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2018-07-17 06:11:00 +03:00
|
|
|
virtual void NotifyContentBlockingState(unsigned aState, nsIChannel* aChannel,
|
2018-10-29 17:47:55 +03:00
|
|
|
bool aBlocked, nsIURI* aURIHint) = 0;
|
2018-07-17 06:11:00 +03:00
|
|
|
|
2017-11-21 21:25:27 +03:00
|
|
|
// WebIDL-ish APIs
|
|
|
|
void MarkUncollectableForCCGeneration(uint32_t aGeneration) {
|
|
|
|
mMarkedCCGeneration = aGeneration;
|
2016-01-30 20:05:36 +03:00
|
|
|
}
|
|
|
|
|
2017-11-21 21:25:27 +03:00
|
|
|
uint32_t GetMarkedCCGeneration() { return mMarkedCCGeneration; }
|
2016-01-30 20:05:36 +03:00
|
|
|
|
2017-11-21 21:25:27 +03:00
|
|
|
// XXX(nika): These feel like they should be inner window only, but they're
|
|
|
|
// called on the outer window.
|
2018-01-22 20:59:15 +03:00
|
|
|
virtual mozilla::dom::Navigator* GetNavigator() = 0;
|
2017-11-21 21:25:27 +03:00
|
|
|
virtual mozilla::dom::Location* GetLocation() = 0;
|
2017-11-20 20:30:15 +03:00
|
|
|
|
2017-11-21 21:25:27 +03:00
|
|
|
virtual nsresult GetPrompter(nsIPrompt** aPrompt) = 0;
|
|
|
|
virtual nsresult GetControllers(nsIControllers** aControllers) = 0;
|
2018-05-08 20:52:36 +03:00
|
|
|
virtual already_AddRefed<mozilla::dom::Selection> GetSelection() = 0;
|
2017-11-21 21:25:27 +03:00
|
|
|
virtual already_AddRefed<nsPIDOMWindowOuter> GetOpener() = 0;
|
2016-07-29 05:28:50 +03:00
|
|
|
|
2018-05-25 06:32:19 +03:00
|
|
|
virtual nsDOMWindowList* GetFrames() = 0;
|
2016-01-30 20:05:36 +03:00
|
|
|
|
2018-10-30 03:13:29 +03:00
|
|
|
// aLoadState will be passed on through to the windowwatcher.
|
2017-11-21 21:25:27 +03:00
|
|
|
// aForceNoOpener will act just like a "noopener" feature in aOptions except
|
|
|
|
// will not affect any other window features.
|
|
|
|
virtual nsresult Open(const nsAString& aUrl, const nsAString& aName,
|
|
|
|
const nsAString& aOptions,
|
2018-10-30 03:13:29 +03:00
|
|
|
nsDocShellLoadState* aLoadState, bool aForceNoOpener,
|
2017-11-21 21:25:27 +03:00
|
|
|
nsPIDOMWindowOuter** _retval) = 0;
|
|
|
|
virtual nsresult OpenDialog(const nsAString& aUrl, const nsAString& aName,
|
|
|
|
const nsAString& aOptions,
|
|
|
|
nsISupports* aExtraArgument,
|
|
|
|
nsPIDOMWindowOuter** _retval) = 0;
|
2016-01-30 20:05:36 +03:00
|
|
|
|
2017-11-21 21:25:27 +03:00
|
|
|
virtual nsresult GetInnerWidth(int32_t* aWidth) = 0;
|
|
|
|
virtual nsresult GetInnerHeight(int32_t* aHeight) = 0;
|
2016-01-30 20:05:36 +03:00
|
|
|
|
2018-04-27 06:37:33 +03:00
|
|
|
virtual mozilla::dom::Element* GetFrameElement() = 0;
|
2016-04-18 13:48:41 +03:00
|
|
|
|
2017-11-21 21:25:27 +03:00
|
|
|
virtual bool Closed() = 0;
|
|
|
|
virtual bool GetFullScreen() = 0;
|
2018-09-12 18:51:30 +03:00
|
|
|
virtual nsresult SetFullScreen(bool aFullscreen) = 0;
|
2016-01-30 20:05:36 +03:00
|
|
|
|
2017-11-21 21:25:27 +03:00
|
|
|
virtual nsresult Focus() = 0;
|
|
|
|
virtual nsresult Close() = 0;
|
2016-01-30 20:05:36 +03:00
|
|
|
|
2017-11-21 21:25:27 +03:00
|
|
|
virtual nsresult MoveBy(int32_t aXDif, int32_t aYDif) = 0;
|
2017-02-03 05:50:07 +03:00
|
|
|
|
2018-05-08 20:52:42 +03:00
|
|
|
virtual void UpdateCommands(const nsAString& anAction,
|
|
|
|
mozilla::dom::Selection* aSel,
|
|
|
|
int16_t aReason) = 0;
|
2016-12-22 22:05:54 +03:00
|
|
|
|
2017-11-21 21:25:27 +03:00
|
|
|
mozilla::dom::DocGroup* GetDocGroup() const;
|
|
|
|
virtual nsISerialEventTarget* EventTargetFor(
|
|
|
|
mozilla::TaskCategory aCategory) const = 0;
|
2017-01-18 21:10:54 +03:00
|
|
|
|
2017-11-22 01:24:57 +03:00
|
|
|
/**
|
|
|
|
* These methods provide a way to specify the opener value for the content in
|
|
|
|
* the window before the content itself is created. This is important in order
|
|
|
|
* to set the DocGroup of a document, as the opener must be set before the
|
|
|
|
* document is created.
|
|
|
|
*
|
|
|
|
* SetOpenerForInitialContentBrowser is used to set which opener will be used,
|
|
|
|
* and TakeOpenerForInitialContentBrowser is used by nsXULElement in order to
|
|
|
|
* take the value set earlier, and null out the value in the window.
|
|
|
|
*/
|
|
|
|
void SetOpenerForInitialContentBrowser(nsPIDOMWindowOuter* aOpener);
|
|
|
|
already_AddRefed<nsPIDOMWindowOuter> TakeOpenerForInitialContentBrowser();
|
|
|
|
|
2017-11-21 21:25:27 +03:00
|
|
|
protected:
|
|
|
|
// Lazily instantiate an about:blank document if necessary, and if
|
|
|
|
// we have what it takes to do so.
|
|
|
|
void MaybeCreateDoc();
|
2017-02-16 22:39:28 +03:00
|
|
|
|
2018-08-03 06:49:09 +03:00
|
|
|
void SetChromeEventHandlerInternal(
|
|
|
|
mozilla::dom::EventTarget* aChromeEventHandler);
|
2017-11-15 19:34:04 +03:00
|
|
|
|
2017-11-21 21:25:27 +03:00
|
|
|
virtual void UpdateParentTarget() = 0;
|
2017-11-21 21:47:36 +03: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!
|
|
|
|
nsCOMPtr<mozilla::dom::EventTarget> mChromeEventHandler; // strong
|
|
|
|
nsCOMPtr<nsIDocument> mDoc; // strong
|
|
|
|
// Cache the URI when mDoc is cleared.
|
|
|
|
nsCOMPtr<nsIURI> mDocumentURI; // strong
|
|
|
|
|
|
|
|
nsCOMPtr<mozilla::dom::EventTarget> mParentTarget; // strong
|
2018-08-03 06:49:09 +03:00
|
|
|
RefPtr<mozilla::dom::ContentFrameMessageManager> mMessageManager; // strong
|
2017-11-21 21:47:36 +03:00
|
|
|
|
|
|
|
nsCOMPtr<mozilla::dom::Element> mFrameElement;
|
|
|
|
|
|
|
|
// This reference is used by nsGlobalWindow.
|
|
|
|
nsCOMPtr<nsIDocShell> mDocShell;
|
|
|
|
|
2017-11-21 22:32:41 +03:00
|
|
|
uint32_t mModalStateDepth;
|
2017-11-21 21:47:36 +03:00
|
|
|
|
|
|
|
// Tracks activation state that's used for :-moz-window-inactive.
|
2017-11-21 22:32:41 +03:00
|
|
|
bool mIsActive;
|
2017-11-21 21:47:36 +03:00
|
|
|
|
|
|
|
// Tracks whether our docshell is active. If it is, mIsBackground
|
|
|
|
// is false. Too bad we have so many different concepts of
|
2017-11-21 22:32:41 +03:00
|
|
|
// "active".
|
|
|
|
bool mIsBackground;
|
2017-11-21 21:47:36 +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.
|
|
|
|
*/
|
2017-11-21 22:32:41 +03:00
|
|
|
SuspendTypes mMediaSuspend;
|
2017-11-21 21:47:36 +03:00
|
|
|
|
2017-11-21 22:32:41 +03:00
|
|
|
bool mAudioMuted;
|
|
|
|
float mAudioVolume;
|
2017-11-21 21:47:36 +03:00
|
|
|
|
|
|
|
// current desktop mode flag.
|
2017-11-21 22:32:41 +03:00
|
|
|
bool mDesktopModeViewport;
|
2017-11-21 21:47:36 +03:00
|
|
|
|
2017-11-21 22:32:41 +03:00
|
|
|
bool mIsRootOuterWindow;
|
2017-11-21 21:47:36 +03:00
|
|
|
|
|
|
|
// And these are the references between inner and outer windows.
|
|
|
|
nsPIDOMWindowInner* MOZ_NON_OWNING_REF mInnerWindow;
|
|
|
|
|
|
|
|
RefPtr<mozilla::dom::TabGroup> mTabGroup;
|
|
|
|
|
|
|
|
// A unique (as long as our 64-bit counter doesn't roll over) id for
|
|
|
|
// this window.
|
|
|
|
uint64_t mWindowID;
|
|
|
|
|
|
|
|
uint32_t mMarkedCCGeneration;
|
|
|
|
|
|
|
|
// Let the service workers plumbing know that some feature are enabled while
|
|
|
|
// testing.
|
|
|
|
bool mServiceWorkersTestingEnabled;
|
|
|
|
|
2017-11-21 22:32:41 +03:00
|
|
|
mozilla::dom::LargeAllocStatus mLargeAllocStatus;
|
2017-11-22 01:24:57 +03:00
|
|
|
|
|
|
|
nsCOMPtr<nsPIDOMWindowOuter> mOpenerForInitialContentBrowser;
|
2018-11-16 21:27:00 +03:00
|
|
|
|
|
|
|
using PermissionInfo = std::pair<bool, mozilla::TimeStamp>;
|
|
|
|
nsDataHashtable<nsStringHashKey, PermissionInfo> mAutoplayTemporaryPermission;
|
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
|
|
|
|
1999-10-14 14:58:25 +04:00
|
|
|
#endif // nsPIDOMWindow_h__
|