Coverage Report

Created: 2018-09-25 14:53

/src/mozilla-central/dom/base/nsGlobalWindowOuter.h
Line
Count
Source (jump to first uncovered line)
1
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
3
/* This Source Code Form is subject to the terms of the Mozilla Public
4
 * License, v. 2.0. If a copy of the MPL was not distributed with this
5
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6
7
#ifndef nsGlobalWindowOuter_h___
8
#define nsGlobalWindowOuter_h___
9
10
#include "nsPIDOMWindow.h"
11
12
#include "nsTHashtable.h"
13
#include "nsHashKeys.h"
14
#include "nsRefPtrHashtable.h"
15
#include "nsInterfaceHashtable.h"
16
17
// Local Includes
18
// Helper Classes
19
#include "nsCOMPtr.h"
20
#include "nsAutoPtr.h"
21
#include "nsWeakReference.h"
22
#include "nsDataHashtable.h"
23
#include "nsJSThingHashtable.h"
24
#include "nsCycleCollectionParticipant.h"
25
26
// Interfaces Needed
27
#include "nsIBrowserDOMWindow.h"
28
#include "nsIInterfaceRequestor.h"
29
#include "nsIDOMChromeWindow.h"
30
#include "nsIScriptGlobalObject.h"
31
#include "nsIScriptObjectPrincipal.h"
32
#include "nsITimer.h"
33
#include "mozilla/EventListenerManager.h"
34
#include "nsIPrincipal.h"
35
#include "nsSize.h"
36
#include "mozilla/FlushType.h"
37
#include "prclist.h"
38
#include "mozilla/dom/BindingDeclarations.h"
39
#include "mozilla/dom/ChromeMessageBroadcaster.h"
40
#include "mozilla/dom/StorageEvent.h"
41
#include "mozilla/dom/StorageEventBinding.h"
42
#include "mozilla/dom/UnionTypes.h"
43
#include "mozilla/ErrorResult.h"
44
#include "mozilla/Attributes.h"
45
#include "mozilla/GuardObjects.h"
46
#include "mozilla/LinkedList.h"
47
#include "nsWrapperCacheInlines.h"
48
#include "nsIDocument.h"
49
#include "mozilla/dom/EventTarget.h"
50
#include "mozilla/dom/WindowBinding.h"
51
#include "Units.h"
52
#include "nsComponentManagerUtils.h"
53
#include "nsSize.h"
54
#include "nsCheapSets.h"
55
#include "mozilla/dom/ImageBitmapSource.h"
56
#include "mozilla/UniquePtr.h"
57
58
class nsIArray;
59
class nsIBaseWindow;
60
class nsIContent;
61
class nsICSSDeclaration;
62
class nsIDocShellTreeOwner;
63
class nsIDOMWindowUtils;
64
class nsIScrollableFrame;
65
class nsIControllers;
66
class nsIJSID;
67
class nsIScriptContext;
68
class nsIScriptTimeoutHandler;
69
class nsITabChild;
70
class nsITimeoutHandler;
71
class nsIWebBrowserChrome;
72
class mozIDOMWindowProxy;
73
74
class nsDocShellLoadInfo;
75
class nsDOMWindowList;
76
class nsScreen;
77
class nsHistory;
78
class nsGlobalWindowObserver;
79
class nsGlobalWindowInner;
80
class nsDOMWindowUtils;
81
class nsIIdleService;
82
struct nsRect;
83
84
class nsWindowSizes;
85
86
class IdleRequestExecutor;
87
88
struct IdleObserverHolder;
89
90
namespace mozilla {
91
class AbstractThread;
92
class DOMEventTargetHelper;
93
class ThrottledEventQueue;
94
namespace dom {
95
class BarProp;
96
struct ChannelPixelLayout;
97
class Console;
98
class Crypto;
99
class CustomElementRegistry;
100
class DocGroup;
101
class External;
102
class Function;
103
class Gamepad;
104
enum class ImageBitmapFormat : uint8_t;
105
class IdleRequest;
106
class IdleRequestCallback;
107
class IncrementalRunnable;
108
class IntlUtils;
109
class Location;
110
class MediaQueryList;
111
class Navigator;
112
class OwningExternalOrWindowProxy;
113
class Promise;
114
class PostMessageEvent;
115
struct RequestInit;
116
class RequestOrUSVString;
117
class Selection;
118
class SpeechSynthesis;
119
class TabGroup;
120
class Timeout;
121
class U2F;
122
class VRDisplay;
123
enum class VRDisplayEventReason : uint8_t;
124
class VREventObserver;
125
class WakeLock;
126
#if defined(MOZ_WIDGET_ANDROID)
127
class WindowOrientationObserver;
128
#endif
129
class Worklet;
130
namespace cache {
131
class CacheStorage;
132
} // namespace cache
133
class IDBFactory;
134
} // namespace dom
135
} // namespace mozilla
136
137
extern already_AddRefed<nsIScriptTimeoutHandler>
138
NS_CreateJSTimeoutHandler(JSContext* aCx, nsGlobalWindowInner *aWindow,
139
                          mozilla::dom::Function& aFunction,
140
                          const mozilla::dom::Sequence<JS::Value>& aArguments,
141
                          mozilla::ErrorResult& aError);
142
143
extern already_AddRefed<nsIScriptTimeoutHandler>
144
NS_CreateJSTimeoutHandler(JSContext* aCx, nsGlobalWindowInner *aWindow,
145
                          const nsAString& aExpression,
146
                          mozilla::ErrorResult& aError);
147
148
extern const js::Class OuterWindowProxyClass;
149
150
//*****************************************************************************
151
// nsGlobalWindowOuter
152
//*****************************************************************************
153
154
// nsGlobalWindowOuter inherits PRCList for maintaining a list of all inner
155
// windows still in memory for any given outer window. This list is needed to
156
// ensure that mOuterWindow doesn't end up dangling. The nature of PRCList means
157
// that the window itself is always in the list, and an outer window's list will
158
// also contain all inner window objects that are still in memory (and in
159
// reality all inner window object's lists also contain its outer and all other
160
// inner windows belonging to the same outer window, but that's an unimportant
161
// side effect of inheriting PRCList).
162
163
class nsGlobalWindowOuter final
164
  : public mozilla::dom::EventTarget
165
  , public nsPIDOMWindowOuter
166
  , private nsIDOMWindow
167
    // NOTE: This interface is private, as it's only
168
    // implemented on chrome windows.
169
  , private nsIDOMChromeWindow
170
  , public nsIScriptGlobalObject
171
  , public nsIScriptObjectPrincipal
172
  , public nsSupportsWeakReference
173
  , public nsIInterfaceRequestor
174
  , public PRCListStr
175
{
176
public:
177
  typedef nsDataHashtable<nsUint64HashKey, nsGlobalWindowOuter*> OuterWindowByIdTable;
178
179
  static void
180
  AssertIsOnMainThread()
181
#ifdef DEBUG
182
  ;
183
#else
184
21
  { }
185
#endif
186
187
0
  static nsGlobalWindowOuter* Cast(nsPIDOMWindowOuter* aPIWin) {
188
0
    return static_cast<nsGlobalWindowOuter*>(aPIWin);
189
0
  }
190
0
  static const nsGlobalWindowOuter* Cast(const nsPIDOMWindowOuter* aPIWin) {
191
0
    return static_cast<const nsGlobalWindowOuter*>(aPIWin);
192
0
  }
193
0
  static nsGlobalWindowOuter* Cast(mozIDOMWindowProxy* aWin) {
194
0
    return Cast(nsPIDOMWindowOuter::From(aWin));
195
0
  }
196
197
  static nsGlobalWindowOuter*
198
  GetOuterWindowWithId(uint64_t aWindowID)
199
0
  {
200
0
    AssertIsOnMainThread();
201
0
202
0
    if (!sOuterWindowsById) {
203
0
      return nullptr;
204
0
    }
205
0
206
0
    nsGlobalWindowOuter* outerWindow = sOuterWindowsById->Get(aWindowID);
207
0
    return outerWindow;
208
0
  }
209
210
18
  static OuterWindowByIdTable* GetWindowsTable() {
211
18
    AssertIsOnMainThread();
212
18
213
18
    return sOuterWindowsById;
214
18
  }
215
216
  static nsGlobalWindowOuter *FromSupports(nsISupports *supports)
217
0
  {
218
0
    // Make sure this matches the casts we do in QueryInterface().
219
0
    return (nsGlobalWindowOuter *)(mozilla::dom::EventTarget *)supports;
220
0
  }
221
222
  static already_AddRefed<nsGlobalWindowOuter> Create(bool aIsChrome);
223
224
  // public methods
225
  nsPIDOMWindowOuter* GetPrivateParent();
226
227
  // callback for close event
228
  void ReallyCloseWindow();
229
230
  // nsISupports
231
  NS_DECL_CYCLE_COLLECTING_ISUPPORTS
232
233
  // nsWrapperCache
234
  virtual JSObject *WrapObject(JSContext *cx, JS::Handle<JSObject*> aGivenProto) override
235
0
  {
236
0
    return EnsureInnerWindow() ? GetWrapper() : nullptr;
237
0
  }
238
239
  // nsIGlobalJSObjectHolder
240
  virtual JSObject* GetGlobalJSObject() override;
241
242
  // nsIScriptGlobalObject
243
  JSObject *FastGetGlobalJSObject() const
244
0
  {
245
0
    return GetWrapperPreserveColor();
246
0
  }
247
248
  virtual nsresult EnsureScriptEnvironment() override;
249
250
  virtual nsIScriptContext *GetScriptContext() override;
251
252
  void PoisonOuterWindowProxy(JSObject *aObject);
253
254
  virtual bool IsBlackForCC(bool aTracingNeeded = true) override;
255
256
  // nsIScriptObjectPrincipal
257
  virtual nsIPrincipal* GetPrincipal() override;
258
259
  // nsIDOMWindow
260
  NS_DECL_NSIDOMWINDOW
261
262
  // nsIDOMChromeWindow (only implemented on chrome windows)
263
  NS_DECL_NSIDOMCHROMEWINDOW
264
265
  mozilla::dom::ChromeMessageBroadcaster* GetMessageManager();
266
  mozilla::dom::ChromeMessageBroadcaster* GetGroupMessageManager(const nsAString& aGroup);
267
268
  nsresult
269
  OpenJS(const nsAString& aUrl, const nsAString& aName,
270
         const nsAString& aOptions, nsPIDOMWindowOuter **_retval);
271
272
  virtual mozilla::EventListenerManager*
273
    GetExistingListenerManager() const override;
274
275
  virtual mozilla::EventListenerManager*
276
    GetOrCreateListenerManager() override;
277
278
  bool ComputeDefaultWantsUntrusted(mozilla::ErrorResult& aRv) final;
279
280
  virtual nsPIDOMWindowOuter* GetOwnerGlobalForBindings() override;
281
282
  virtual nsIGlobalObject* GetOwnerGlobal() const override;
283
284
  EventTarget* GetTargetForEventTargetChain() override;
285
286
  using mozilla::dom::EventTarget::DispatchEvent;
287
  bool DispatchEvent(mozilla::dom::Event& aEvent,
288
                     mozilla::dom::CallerType aCallerType,
289
                     mozilla::ErrorResult& aRv) override;
290
291
  void GetEventTargetParent(mozilla::EventChainPreVisitor& aVisitor) override;
292
293
  nsresult PostHandleEvent(mozilla::EventChainPostVisitor& aVisitor) override;
294
295
  // nsPIDOMWindow
296
  virtual nsPIDOMWindowOuter* GetPrivateRoot() override;
297
298
  // Outer windows only.
299
  virtual void ActivateOrDeactivate(bool aActivate) override;
300
  virtual void SetActive(bool aActive) override;
301
  virtual bool IsTopLevelWindowActive() override;
302
  virtual void SetIsBackground(bool aIsBackground) override;
303
  virtual void SetChromeEventHandler(mozilla::dom::EventTarget* aChromeEventHandler) override;
304
305
  // Outer windows only.
306
  virtual void SetInitialPrincipalToSubject() override;
307
308
  virtual PopupControlState PushPopupControlState(PopupControlState state, bool aForce) const override;
309
  virtual void PopPopupControlState(PopupControlState state) const override;
310
  virtual PopupControlState GetPopupControlState() const override;
311
312
  virtual already_AddRefed<nsISupports> SaveWindowState() override;
313
  virtual nsresult RestoreWindowState(nsISupports *aState) override;
314
315
  virtual bool IsSuspended() const override;
316
  virtual bool IsFrozen() const override;
317
318
  virtual nsresult FireDelayedDOMEvents() override;
319
320
  // Outer windows only.
321
  bool WouldReuseInnerWindow(nsIDocument* aNewDocument);
322
323
  void SetDocShell(nsIDocShell* aDocShell);
324
  void DetachFromDocShell();
325
326
  virtual nsresult SetNewDocument(nsIDocument *aDocument,
327
                                  nsISupports *aState,
328
                                  bool aForceReuseInnerWindow) override;
329
330
  // Outer windows only.
331
  void DispatchDOMWindowCreated();
332
333
  virtual void SetOpenerWindow(nsPIDOMWindowOuter* aOpener,
334
                               bool aOriginalOpener) override;
335
336
  // Outer windows only.
337
  virtual void EnsureSizeAndPositionUpToDate() override;
338
339
  virtual void EnterModalState() override;
340
  virtual void LeaveModalState() override;
341
342
  // Outer windows only.
343
  virtual bool CanClose() override;
344
  virtual void ForceClose() override;
345
346
  // Outer windows only.
347
  virtual bool DispatchCustomEvent(const nsAString& aEventName) override;
348
  bool DispatchResizeEvent(const mozilla::CSSIntSize& aSize);
349
350
  // For accessing protected field mFullscreen
351
  friend class FullscreenTransitionTask;
352
353
  // Outer windows only.
354
  nsresult SetFullscreenInternal(
355
    FullscreenReason aReason, bool aIsFullscreen) final;
356
  void FullscreenWillChange(bool aIsFullscreen) final;
357
  void FinishFullscreenChange(bool aIsFullscreen) final;
358
  bool SetWidgetFullscreen(FullscreenReason aReason, bool aIsFullscreen,
359
                           nsIWidget* aWidget, nsIScreen* aScreen);
360
  bool Fullscreen() const;
361
362
  // nsIInterfaceRequestor
363
  NS_DECL_NSIINTERFACEREQUESTOR
364
365
  already_AddRefed<nsPIDOMWindowOuter> IndexedGetterOuter(uint32_t aIndex);
366
367
  already_AddRefed<nsPIDOMWindowOuter> GetTop() override;
368
  nsPIDOMWindowOuter* GetScriptableTop() override;
369
  inline nsGlobalWindowOuter *GetTopInternal();
370
371
  inline nsGlobalWindowOuter* GetScriptableTopInternal();
372
373
  nsPIDOMWindowOuter* GetChildWindow(const nsAString& aName);
374
375
  // These return true if we've reached the state in this top level window
376
  // where we ask the user if further dialogs should be blocked.
377
  //
378
  // DialogsAreBeingAbused must be called on the scriptable top inner window.
379
  //
380
  // ShouldPromptToBlockDialogs is implemented in terms of
381
  // DialogsAreBeingAbused, and will get the scriptable top inner window
382
  // automatically.
383
  // Outer windows only.
384
  bool ShouldPromptToBlockDialogs();
385
386
  // These functions are used for controlling and determining whether dialogs
387
  // (alert, prompt, confirm) are currently allowed in this window.  If you want
388
  // to temporarily disable dialogs, please use TemporarilyDisableDialogs, not
389
  // EnableDialogs/DisableDialogs, because correctly determining whether to
390
  // re-enable dialogs is actually quite difficult.
391
  void EnableDialogs();
392
  void DisableDialogs();
393
  // Outer windows only.
394
  bool AreDialogsEnabled();
395
396
  class MOZ_RAII TemporarilyDisableDialogs
397
  {
398
  public:
399
    explicit TemporarilyDisableDialogs(nsGlobalWindowOuter* aWindow
400
                                       MOZ_GUARD_OBJECT_NOTIFIER_PARAM);
401
    ~TemporarilyDisableDialogs();
402
403
  private:
404
    MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
405
406
    // Always an inner window; this is the window whose dialog state we messed
407
    // with.  We just want to keep it alive, because we plan to poke at its
408
    // members in our destructor.
409
    RefPtr<nsGlobalWindowInner> mTopWindow;
410
    // This is not a AutoRestore<bool> because that would require careful
411
    // member destructor ordering, which is a bit fragile.  This way we can
412
    // explicitly restore things before we drop our ref to mTopWindow.
413
    bool mSavedDialogsEnabled;
414
  };
415
  friend class TemporarilyDisableDialogs;
416
417
  nsIScriptContext *GetContextInternal();
418
419
  nsGlobalWindowOuter *GetOuterWindowInternal();
420
421
  nsGlobalWindowInner* GetCurrentInnerWindowInternal() const;
422
423
  nsGlobalWindowInner* EnsureInnerWindowInternal();
424
425
  bool IsCreatingInnerWindow() const
426
0
  {
427
0
    return mCreatingInnerWindow;
428
0
  }
429
430
  bool IsChromeWindow() const
431
0
  {
432
0
    return mIsChrome;
433
0
  }
434
435
  // GetScrollFrame does not flush.  Callers should do it themselves as needed,
436
  // depending on which info they actually want off the scrollable frame.
437
  nsIScrollableFrame *GetScrollFrame();
438
439
  // Outer windows only.
440
  void UnblockScriptedClosing();
441
442
  static void Init();
443
  static void ShutDown();
444
  static bool IsCallerChrome();
445
446
  friend class WindowStateHolder;
447
448
  NS_DECL_CYCLE_COLLECTION_SKIPPABLE_SCRIPT_HOLDER_CLASS_AMBIGUOUS(nsGlobalWindowOuter,
449
                                                                   mozilla::dom::EventTarget)
450
451
  virtual bool TakeFocus(bool aFocus, uint32_t aFocusMethod) override;
452
  virtual void SetReadyForFocus() override;
453
  virtual void PageHidden() override;
454
455
  virtual nsresult SetArguments(nsIArray* aArguments) override;
456
457
  void MaybeForgiveSpamCount();
458
0
  bool IsClosedOrClosing() {
459
0
    return (mIsClosed ||
460
0
            mInClose ||
461
0
            mHavePendingClose ||
462
0
            mCleanedUp);
463
0
  }
464
465
  bool
466
  IsCleanedUp() const
467
0
  {
468
0
    return mCleanedUp;
469
0
  }
470
471
  bool
472
  HadOriginalOpener() const
473
0
  {
474
0
    return mHadOriginalOpener;
475
0
  }
476
477
  bool IsTopLevelWindow();
478
479
  virtual void
480
  FirePopupBlockedEvent(nsIDocument* aDoc,
481
                        nsIURI* aPopupURI,
482
                        const nsAString& aPopupWindowName,
483
                        const nsAString& aPopupWindowFeatures) override;
484
485
  virtual void
486
  NotifyContentBlockingState(unsigned aState,
487
                             nsIChannel* aChannel) override;
488
489
0
  virtual uint32_t GetSerial() override {
490
0
    return mSerial;
491
0
  }
492
493
  void AddSizeOfIncludingThis(nsWindowSizes& aWindowSizes) const;
494
495
  void AllowScriptsToClose()
496
0
  {
497
0
    mAllowScriptsToClose = true;
498
0
  }
499
500
  // Outer windows only.
501
  uint32_t GetAutoActivateVRDisplayID();
502
  // Outer windows only.
503
  void SetAutoActivateVRDisplayID(uint32_t aAutoActivateVRDisplayID);
504
505
#define EVENT(name_, id_, type_, struct_)                                     \
506
  mozilla::dom::EventHandlerNonNull* GetOn##name_()                           \
507
0
  {                                                                           \
508
0
    mozilla::EventListenerManager* elm = GetExistingListenerManager();        \
509
0
    return elm ? elm->GetEventHandler(nsGkAtoms::on##name_) : nullptr;        \
510
0
  }                                                                           \
Unexecuted instantiation: nsGlobalWindowOuter::GetOnabort()
Unexecuted instantiation: nsGlobalWindowOuter::GetOncanplay()
Unexecuted instantiation: nsGlobalWindowOuter::GetOncanplaythrough()
Unexecuted instantiation: nsGlobalWindowOuter::GetOnchange()
Unexecuted instantiation: nsGlobalWindowOuter::GetOnCheckboxStateChange()
Unexecuted instantiation: nsGlobalWindowOuter::GetOnRadioStateChange()
Unexecuted instantiation: nsGlobalWindowOuter::GetOnauxclick()
Unexecuted instantiation: nsGlobalWindowOuter::GetOnclick()
Unexecuted instantiation: nsGlobalWindowOuter::GetOnclose()
Unexecuted instantiation: nsGlobalWindowOuter::GetOncontextmenu()
Unexecuted instantiation: nsGlobalWindowOuter::GetOndblclick()
Unexecuted instantiation: nsGlobalWindowOuter::GetOndrag()
Unexecuted instantiation: nsGlobalWindowOuter::GetOndragend()
Unexecuted instantiation: nsGlobalWindowOuter::GetOndragenter()
Unexecuted instantiation: nsGlobalWindowOuter::GetOndragexit()
Unexecuted instantiation: nsGlobalWindowOuter::GetOndragleave()
Unexecuted instantiation: nsGlobalWindowOuter::GetOndragover()
Unexecuted instantiation: nsGlobalWindowOuter::GetOndragstart()
Unexecuted instantiation: nsGlobalWindowOuter::GetOndrop()
Unexecuted instantiation: nsGlobalWindowOuter::GetOndurationchange()
Unexecuted instantiation: nsGlobalWindowOuter::GetOnemptied()
Unexecuted instantiation: nsGlobalWindowOuter::GetOnended()
Unexecuted instantiation: nsGlobalWindowOuter::GetOnfullscreenchange()
Unexecuted instantiation: nsGlobalWindowOuter::GetOnfullscreenerror()
Unexecuted instantiation: nsGlobalWindowOuter::GetOninput()
Unexecuted instantiation: nsGlobalWindowOuter::GetOninvalid()
Unexecuted instantiation: nsGlobalWindowOuter::GetOnkeydown()
Unexecuted instantiation: nsGlobalWindowOuter::GetOnkeypress()
Unexecuted instantiation: nsGlobalWindowOuter::GetOnkeyup()
Unexecuted instantiation: nsGlobalWindowOuter::GetOnmozkeydownonplugin()
Unexecuted instantiation: nsGlobalWindowOuter::GetOnmozkeyuponplugin()
Unexecuted instantiation: nsGlobalWindowOuter::GetOnloadeddata()
Unexecuted instantiation: nsGlobalWindowOuter::GetOnloadedmetadata()
Unexecuted instantiation: nsGlobalWindowOuter::GetOnloadend()
Unexecuted instantiation: nsGlobalWindowOuter::GetOnloadstart()
Unexecuted instantiation: nsGlobalWindowOuter::GetOnmousedown()
Unexecuted instantiation: nsGlobalWindowOuter::GetOnmouseenter()
Unexecuted instantiation: nsGlobalWindowOuter::GetOnmouseleave()
Unexecuted instantiation: nsGlobalWindowOuter::GetOnmousemove()
Unexecuted instantiation: nsGlobalWindowOuter::GetOnmouseout()
Unexecuted instantiation: nsGlobalWindowOuter::GetOnmouseover()
Unexecuted instantiation: nsGlobalWindowOuter::GetOnmouseup()
Unexecuted instantiation: nsGlobalWindowOuter::GetOnmozfullscreenchange()
Unexecuted instantiation: nsGlobalWindowOuter::GetOnmozfullscreenerror()
Unexecuted instantiation: nsGlobalWindowOuter::GetOnmozpointerlockchange()
Unexecuted instantiation: nsGlobalWindowOuter::GetOnmozpointerlockerror()
Unexecuted instantiation: nsGlobalWindowOuter::GetOnpointerlockchange()
Unexecuted instantiation: nsGlobalWindowOuter::GetOnpointerlockerror()
Unexecuted instantiation: nsGlobalWindowOuter::GetOnpointerdown()
Unexecuted instantiation: nsGlobalWindowOuter::GetOnpointermove()
Unexecuted instantiation: nsGlobalWindowOuter::GetOnpointerup()
Unexecuted instantiation: nsGlobalWindowOuter::GetOnpointercancel()
Unexecuted instantiation: nsGlobalWindowOuter::GetOnpointerover()
Unexecuted instantiation: nsGlobalWindowOuter::GetOnpointerout()
Unexecuted instantiation: nsGlobalWindowOuter::GetOnpointerenter()
Unexecuted instantiation: nsGlobalWindowOuter::GetOnpointerleave()
Unexecuted instantiation: nsGlobalWindowOuter::GetOngotpointercapture()
Unexecuted instantiation: nsGlobalWindowOuter::GetOnlostpointercapture()
Unexecuted instantiation: nsGlobalWindowOuter::GetOnselectstart()
Unexecuted instantiation: nsGlobalWindowOuter::GetOnpause()
Unexecuted instantiation: nsGlobalWindowOuter::GetOnplay()
Unexecuted instantiation: nsGlobalWindowOuter::GetOnplaying()
Unexecuted instantiation: nsGlobalWindowOuter::GetOnprogress()
Unexecuted instantiation: nsGlobalWindowOuter::GetOnratechange()
Unexecuted instantiation: nsGlobalWindowOuter::GetOnreset()
Unexecuted instantiation: nsGlobalWindowOuter::GetOnseeked()
Unexecuted instantiation: nsGlobalWindowOuter::GetOnseeking()
Unexecuted instantiation: nsGlobalWindowOuter::GetOnselect()
Unexecuted instantiation: nsGlobalWindowOuter::GetOnshow()
Unexecuted instantiation: nsGlobalWindowOuter::GetOnstalled()
Unexecuted instantiation: nsGlobalWindowOuter::GetOnsubmit()
Unexecuted instantiation: nsGlobalWindowOuter::GetOnsuspend()
Unexecuted instantiation: nsGlobalWindowOuter::GetOntimeupdate()
Unexecuted instantiation: nsGlobalWindowOuter::GetOntoggle()
Unexecuted instantiation: nsGlobalWindowOuter::GetOnvolumechange()
Unexecuted instantiation: nsGlobalWindowOuter::GetOnwaiting()
Unexecuted instantiation: nsGlobalWindowOuter::GetOnwheel()
Unexecuted instantiation: nsGlobalWindowOuter::GetOncopy()
Unexecuted instantiation: nsGlobalWindowOuter::GetOncut()
Unexecuted instantiation: nsGlobalWindowOuter::GetOnpaste()
Unexecuted instantiation: nsGlobalWindowOuter::GetOnbeforescriptexecute()
Unexecuted instantiation: nsGlobalWindowOuter::GetOnafterscriptexecute()
Unexecuted instantiation: nsGlobalWindowOuter::GetOnblur()
Unexecuted instantiation: nsGlobalWindowOuter::GetOnfocus()
Unexecuted instantiation: nsGlobalWindowOuter::GetOnfocusin()
Unexecuted instantiation: nsGlobalWindowOuter::GetOnfocusout()
Unexecuted instantiation: nsGlobalWindowOuter::GetOnload()
Unexecuted instantiation: nsGlobalWindowOuter::GetOnresize()
Unexecuted instantiation: nsGlobalWindowOuter::GetOnscroll()
Unexecuted instantiation: nsGlobalWindowOuter::GetOnafterprint()
Unexecuted instantiation: nsGlobalWindowOuter::GetOnbeforeprint()
Unexecuted instantiation: nsGlobalWindowOuter::GetOnhashchange()
Unexecuted instantiation: nsGlobalWindowOuter::GetOnlanguagechange()
Unexecuted instantiation: nsGlobalWindowOuter::GetOnmessage()
Unexecuted instantiation: nsGlobalWindowOuter::GetOnmessageerror()
Unexecuted instantiation: nsGlobalWindowOuter::GetOnoffline()
Unexecuted instantiation: nsGlobalWindowOuter::GetOnonline()
Unexecuted instantiation: nsGlobalWindowOuter::GetOnpagehide()
Unexecuted instantiation: nsGlobalWindowOuter::GetOnpageshow()
Unexecuted instantiation: nsGlobalWindowOuter::GetOnpopstate()
Unexecuted instantiation: nsGlobalWindowOuter::GetOnstorage()
Unexecuted instantiation: nsGlobalWindowOuter::GetOnunload()
Unexecuted instantiation: nsGlobalWindowOuter::GetOndevicemotion()
Unexecuted instantiation: nsGlobalWindowOuter::GetOndeviceorientation()
Unexecuted instantiation: nsGlobalWindowOuter::GetOnabsolutedeviceorientation()
Unexecuted instantiation: nsGlobalWindowOuter::GetOndeviceproximity()
Unexecuted instantiation: nsGlobalWindowOuter::GetOnuserproximity()
Unexecuted instantiation: nsGlobalWindowOuter::GetOndevicelight()
Unexecuted instantiation: nsGlobalWindowOuter::GetOnvrdisplayactivate()
Unexecuted instantiation: nsGlobalWindowOuter::GetOnvrdisplaydeactivate()
Unexecuted instantiation: nsGlobalWindowOuter::GetOnvrdisplayconnect()
Unexecuted instantiation: nsGlobalWindowOuter::GetOnvrdisplaydisconnect()
Unexecuted instantiation: nsGlobalWindowOuter::GetOnvrdisplaypresentchange()
Unexecuted instantiation: nsGlobalWindowOuter::GetOnappinstalled()
Unexecuted instantiation: nsGlobalWindowOuter::GetOntouchstart()
Unexecuted instantiation: nsGlobalWindowOuter::GetOntouchend()
Unexecuted instantiation: nsGlobalWindowOuter::GetOntouchmove()
Unexecuted instantiation: nsGlobalWindowOuter::GetOntouchcancel()
Unexecuted instantiation: nsGlobalWindowOuter::GetOntransitionstart()
Unexecuted instantiation: nsGlobalWindowOuter::GetOntransitionrun()
Unexecuted instantiation: nsGlobalWindowOuter::GetOntransitionend()
Unexecuted instantiation: nsGlobalWindowOuter::GetOntransitioncancel()
Unexecuted instantiation: nsGlobalWindowOuter::GetOnanimationstart()
Unexecuted instantiation: nsGlobalWindowOuter::GetOnanimationend()
Unexecuted instantiation: nsGlobalWindowOuter::GetOnanimationiteration()
Unexecuted instantiation: nsGlobalWindowOuter::GetOnanimationcancel()
Unexecuted instantiation: nsGlobalWindowOuter::GetOnwebkitAnimationEnd()
Unexecuted instantiation: nsGlobalWindowOuter::GetOnwebkitAnimationIteration()
Unexecuted instantiation: nsGlobalWindowOuter::GetOnwebkitAnimationStart()
Unexecuted instantiation: nsGlobalWindowOuter::GetOnwebkitTransitionEnd()
Unexecuted instantiation: nsGlobalWindowOuter::GetOnwebkitanimationend()
Unexecuted instantiation: nsGlobalWindowOuter::GetOnwebkitanimationiteration()
Unexecuted instantiation: nsGlobalWindowOuter::GetOnwebkitanimationstart()
Unexecuted instantiation: nsGlobalWindowOuter::GetOnwebkittransitionend()
511
  void SetOn##name_(mozilla::dom::EventHandlerNonNull* handler)               \
512
0
  {                                                                           \
513
0
    mozilla::EventListenerManager* elm = GetOrCreateListenerManager();        \
514
0
    if (elm) {                                                                \
515
0
      elm->SetEventHandler(nsGkAtoms::on##name_, handler);                    \
516
0
    }                                                                         \
517
0
  }
Unexecuted instantiation: nsGlobalWindowOuter::SetOnabort(mozilla::dom::EventHandlerNonNull*)
Unexecuted instantiation: nsGlobalWindowOuter::SetOncanplay(mozilla::dom::EventHandlerNonNull*)
Unexecuted instantiation: nsGlobalWindowOuter::SetOncanplaythrough(mozilla::dom::EventHandlerNonNull*)
Unexecuted instantiation: nsGlobalWindowOuter::SetOnchange(mozilla::dom::EventHandlerNonNull*)
Unexecuted instantiation: nsGlobalWindowOuter::SetOnCheckboxStateChange(mozilla::dom::EventHandlerNonNull*)
Unexecuted instantiation: nsGlobalWindowOuter::SetOnRadioStateChange(mozilla::dom::EventHandlerNonNull*)
Unexecuted instantiation: nsGlobalWindowOuter::SetOnauxclick(mozilla::dom::EventHandlerNonNull*)
Unexecuted instantiation: nsGlobalWindowOuter::SetOnclick(mozilla::dom::EventHandlerNonNull*)
Unexecuted instantiation: nsGlobalWindowOuter::SetOnclose(mozilla::dom::EventHandlerNonNull*)
Unexecuted instantiation: nsGlobalWindowOuter::SetOncontextmenu(mozilla::dom::EventHandlerNonNull*)
Unexecuted instantiation: nsGlobalWindowOuter::SetOndblclick(mozilla::dom::EventHandlerNonNull*)
Unexecuted instantiation: nsGlobalWindowOuter::SetOndrag(mozilla::dom::EventHandlerNonNull*)
Unexecuted instantiation: nsGlobalWindowOuter::SetOndragend(mozilla::dom::EventHandlerNonNull*)
Unexecuted instantiation: nsGlobalWindowOuter::SetOndragenter(mozilla::dom::EventHandlerNonNull*)
Unexecuted instantiation: nsGlobalWindowOuter::SetOndragexit(mozilla::dom::EventHandlerNonNull*)
Unexecuted instantiation: nsGlobalWindowOuter::SetOndragleave(mozilla::dom::EventHandlerNonNull*)
Unexecuted instantiation: nsGlobalWindowOuter::SetOndragover(mozilla::dom::EventHandlerNonNull*)
Unexecuted instantiation: nsGlobalWindowOuter::SetOndragstart(mozilla::dom::EventHandlerNonNull*)
Unexecuted instantiation: nsGlobalWindowOuter::SetOndrop(mozilla::dom::EventHandlerNonNull*)
Unexecuted instantiation: nsGlobalWindowOuter::SetOndurationchange(mozilla::dom::EventHandlerNonNull*)
Unexecuted instantiation: nsGlobalWindowOuter::SetOnemptied(mozilla::dom::EventHandlerNonNull*)
Unexecuted instantiation: nsGlobalWindowOuter::SetOnended(mozilla::dom::EventHandlerNonNull*)
Unexecuted instantiation: nsGlobalWindowOuter::SetOnfullscreenchange(mozilla::dom::EventHandlerNonNull*)
Unexecuted instantiation: nsGlobalWindowOuter::SetOnfullscreenerror(mozilla::dom::EventHandlerNonNull*)
Unexecuted instantiation: nsGlobalWindowOuter::SetOninput(mozilla::dom::EventHandlerNonNull*)
Unexecuted instantiation: nsGlobalWindowOuter::SetOninvalid(mozilla::dom::EventHandlerNonNull*)
Unexecuted instantiation: nsGlobalWindowOuter::SetOnkeydown(mozilla::dom::EventHandlerNonNull*)
Unexecuted instantiation: nsGlobalWindowOuter::SetOnkeypress(mozilla::dom::EventHandlerNonNull*)
Unexecuted instantiation: nsGlobalWindowOuter::SetOnkeyup(mozilla::dom::EventHandlerNonNull*)
Unexecuted instantiation: nsGlobalWindowOuter::SetOnmozkeydownonplugin(mozilla::dom::EventHandlerNonNull*)
Unexecuted instantiation: nsGlobalWindowOuter::SetOnmozkeyuponplugin(mozilla::dom::EventHandlerNonNull*)
Unexecuted instantiation: nsGlobalWindowOuter::SetOnloadeddata(mozilla::dom::EventHandlerNonNull*)
Unexecuted instantiation: nsGlobalWindowOuter::SetOnloadedmetadata(mozilla::dom::EventHandlerNonNull*)
Unexecuted instantiation: nsGlobalWindowOuter::SetOnloadend(mozilla::dom::EventHandlerNonNull*)
Unexecuted instantiation: nsGlobalWindowOuter::SetOnloadstart(mozilla::dom::EventHandlerNonNull*)
Unexecuted instantiation: nsGlobalWindowOuter::SetOnmousedown(mozilla::dom::EventHandlerNonNull*)
Unexecuted instantiation: nsGlobalWindowOuter::SetOnmouseenter(mozilla::dom::EventHandlerNonNull*)
Unexecuted instantiation: nsGlobalWindowOuter::SetOnmouseleave(mozilla::dom::EventHandlerNonNull*)
Unexecuted instantiation: nsGlobalWindowOuter::SetOnmousemove(mozilla::dom::EventHandlerNonNull*)
Unexecuted instantiation: nsGlobalWindowOuter::SetOnmouseout(mozilla::dom::EventHandlerNonNull*)
Unexecuted instantiation: nsGlobalWindowOuter::SetOnmouseover(mozilla::dom::EventHandlerNonNull*)
Unexecuted instantiation: nsGlobalWindowOuter::SetOnmouseup(mozilla::dom::EventHandlerNonNull*)
Unexecuted instantiation: nsGlobalWindowOuter::SetOnmozfullscreenchange(mozilla::dom::EventHandlerNonNull*)
Unexecuted instantiation: nsGlobalWindowOuter::SetOnmozfullscreenerror(mozilla::dom::EventHandlerNonNull*)
Unexecuted instantiation: nsGlobalWindowOuter::SetOnmozpointerlockchange(mozilla::dom::EventHandlerNonNull*)
Unexecuted instantiation: nsGlobalWindowOuter::SetOnmozpointerlockerror(mozilla::dom::EventHandlerNonNull*)
Unexecuted instantiation: nsGlobalWindowOuter::SetOnpointerlockchange(mozilla::dom::EventHandlerNonNull*)
Unexecuted instantiation: nsGlobalWindowOuter::SetOnpointerlockerror(mozilla::dom::EventHandlerNonNull*)
Unexecuted instantiation: nsGlobalWindowOuter::SetOnpointerdown(mozilla::dom::EventHandlerNonNull*)
Unexecuted instantiation: nsGlobalWindowOuter::SetOnpointermove(mozilla::dom::EventHandlerNonNull*)
Unexecuted instantiation: nsGlobalWindowOuter::SetOnpointerup(mozilla::dom::EventHandlerNonNull*)
Unexecuted instantiation: nsGlobalWindowOuter::SetOnpointercancel(mozilla::dom::EventHandlerNonNull*)
Unexecuted instantiation: nsGlobalWindowOuter::SetOnpointerover(mozilla::dom::EventHandlerNonNull*)
Unexecuted instantiation: nsGlobalWindowOuter::SetOnpointerout(mozilla::dom::EventHandlerNonNull*)
Unexecuted instantiation: nsGlobalWindowOuter::SetOnpointerenter(mozilla::dom::EventHandlerNonNull*)
Unexecuted instantiation: nsGlobalWindowOuter::SetOnpointerleave(mozilla::dom::EventHandlerNonNull*)
Unexecuted instantiation: nsGlobalWindowOuter::SetOngotpointercapture(mozilla::dom::EventHandlerNonNull*)
Unexecuted instantiation: nsGlobalWindowOuter::SetOnlostpointercapture(mozilla::dom::EventHandlerNonNull*)
Unexecuted instantiation: nsGlobalWindowOuter::SetOnselectstart(mozilla::dom::EventHandlerNonNull*)
Unexecuted instantiation: nsGlobalWindowOuter::SetOnpause(mozilla::dom::EventHandlerNonNull*)
Unexecuted instantiation: nsGlobalWindowOuter::SetOnplay(mozilla::dom::EventHandlerNonNull*)
Unexecuted instantiation: nsGlobalWindowOuter::SetOnplaying(mozilla::dom::EventHandlerNonNull*)
Unexecuted instantiation: nsGlobalWindowOuter::SetOnprogress(mozilla::dom::EventHandlerNonNull*)
Unexecuted instantiation: nsGlobalWindowOuter::SetOnratechange(mozilla::dom::EventHandlerNonNull*)
Unexecuted instantiation: nsGlobalWindowOuter::SetOnreset(mozilla::dom::EventHandlerNonNull*)
Unexecuted instantiation: nsGlobalWindowOuter::SetOnseeked(mozilla::dom::EventHandlerNonNull*)
Unexecuted instantiation: nsGlobalWindowOuter::SetOnseeking(mozilla::dom::EventHandlerNonNull*)
Unexecuted instantiation: nsGlobalWindowOuter::SetOnselect(mozilla::dom::EventHandlerNonNull*)
Unexecuted instantiation: nsGlobalWindowOuter::SetOnshow(mozilla::dom::EventHandlerNonNull*)
Unexecuted instantiation: nsGlobalWindowOuter::SetOnstalled(mozilla::dom::EventHandlerNonNull*)
Unexecuted instantiation: nsGlobalWindowOuter::SetOnsubmit(mozilla::dom::EventHandlerNonNull*)
Unexecuted instantiation: nsGlobalWindowOuter::SetOnsuspend(mozilla::dom::EventHandlerNonNull*)
Unexecuted instantiation: nsGlobalWindowOuter::SetOntimeupdate(mozilla::dom::EventHandlerNonNull*)
Unexecuted instantiation: nsGlobalWindowOuter::SetOntoggle(mozilla::dom::EventHandlerNonNull*)
Unexecuted instantiation: nsGlobalWindowOuter::SetOnvolumechange(mozilla::dom::EventHandlerNonNull*)
Unexecuted instantiation: nsGlobalWindowOuter::SetOnwaiting(mozilla::dom::EventHandlerNonNull*)
Unexecuted instantiation: nsGlobalWindowOuter::SetOnwheel(mozilla::dom::EventHandlerNonNull*)
Unexecuted instantiation: nsGlobalWindowOuter::SetOncopy(mozilla::dom::EventHandlerNonNull*)
Unexecuted instantiation: nsGlobalWindowOuter::SetOncut(mozilla::dom::EventHandlerNonNull*)
Unexecuted instantiation: nsGlobalWindowOuter::SetOnpaste(mozilla::dom::EventHandlerNonNull*)
Unexecuted instantiation: nsGlobalWindowOuter::SetOnbeforescriptexecute(mozilla::dom::EventHandlerNonNull*)
Unexecuted instantiation: nsGlobalWindowOuter::SetOnafterscriptexecute(mozilla::dom::EventHandlerNonNull*)
Unexecuted instantiation: nsGlobalWindowOuter::SetOnblur(mozilla::dom::EventHandlerNonNull*)
Unexecuted instantiation: nsGlobalWindowOuter::SetOnfocus(mozilla::dom::EventHandlerNonNull*)
Unexecuted instantiation: nsGlobalWindowOuter::SetOnfocusin(mozilla::dom::EventHandlerNonNull*)
Unexecuted instantiation: nsGlobalWindowOuter::SetOnfocusout(mozilla::dom::EventHandlerNonNull*)
Unexecuted instantiation: nsGlobalWindowOuter::SetOnload(mozilla::dom::EventHandlerNonNull*)
Unexecuted instantiation: nsGlobalWindowOuter::SetOnresize(mozilla::dom::EventHandlerNonNull*)
Unexecuted instantiation: nsGlobalWindowOuter::SetOnscroll(mozilla::dom::EventHandlerNonNull*)
Unexecuted instantiation: nsGlobalWindowOuter::SetOnafterprint(mozilla::dom::EventHandlerNonNull*)
Unexecuted instantiation: nsGlobalWindowOuter::SetOnbeforeprint(mozilla::dom::EventHandlerNonNull*)
Unexecuted instantiation: nsGlobalWindowOuter::SetOnhashchange(mozilla::dom::EventHandlerNonNull*)
Unexecuted instantiation: nsGlobalWindowOuter::SetOnlanguagechange(mozilla::dom::EventHandlerNonNull*)
Unexecuted instantiation: nsGlobalWindowOuter::SetOnmessage(mozilla::dom::EventHandlerNonNull*)
Unexecuted instantiation: nsGlobalWindowOuter::SetOnmessageerror(mozilla::dom::EventHandlerNonNull*)
Unexecuted instantiation: nsGlobalWindowOuter::SetOnoffline(mozilla::dom::EventHandlerNonNull*)
Unexecuted instantiation: nsGlobalWindowOuter::SetOnonline(mozilla::dom::EventHandlerNonNull*)
Unexecuted instantiation: nsGlobalWindowOuter::SetOnpagehide(mozilla::dom::EventHandlerNonNull*)
Unexecuted instantiation: nsGlobalWindowOuter::SetOnpageshow(mozilla::dom::EventHandlerNonNull*)
Unexecuted instantiation: nsGlobalWindowOuter::SetOnpopstate(mozilla::dom::EventHandlerNonNull*)
Unexecuted instantiation: nsGlobalWindowOuter::SetOnstorage(mozilla::dom::EventHandlerNonNull*)
Unexecuted instantiation: nsGlobalWindowOuter::SetOnunload(mozilla::dom::EventHandlerNonNull*)
Unexecuted instantiation: nsGlobalWindowOuter::SetOndevicemotion(mozilla::dom::EventHandlerNonNull*)
Unexecuted instantiation: nsGlobalWindowOuter::SetOndeviceorientation(mozilla::dom::EventHandlerNonNull*)
Unexecuted instantiation: nsGlobalWindowOuter::SetOnabsolutedeviceorientation(mozilla::dom::EventHandlerNonNull*)
Unexecuted instantiation: nsGlobalWindowOuter::SetOndeviceproximity(mozilla::dom::EventHandlerNonNull*)
Unexecuted instantiation: nsGlobalWindowOuter::SetOnuserproximity(mozilla::dom::EventHandlerNonNull*)
Unexecuted instantiation: nsGlobalWindowOuter::SetOndevicelight(mozilla::dom::EventHandlerNonNull*)
Unexecuted instantiation: nsGlobalWindowOuter::SetOnvrdisplayactivate(mozilla::dom::EventHandlerNonNull*)
Unexecuted instantiation: nsGlobalWindowOuter::SetOnvrdisplaydeactivate(mozilla::dom::EventHandlerNonNull*)
Unexecuted instantiation: nsGlobalWindowOuter::SetOnvrdisplayconnect(mozilla::dom::EventHandlerNonNull*)
Unexecuted instantiation: nsGlobalWindowOuter::SetOnvrdisplaydisconnect(mozilla::dom::EventHandlerNonNull*)
Unexecuted instantiation: nsGlobalWindowOuter::SetOnvrdisplaypresentchange(mozilla::dom::EventHandlerNonNull*)
Unexecuted instantiation: nsGlobalWindowOuter::SetOnappinstalled(mozilla::dom::EventHandlerNonNull*)
Unexecuted instantiation: nsGlobalWindowOuter::SetOntouchstart(mozilla::dom::EventHandlerNonNull*)
Unexecuted instantiation: nsGlobalWindowOuter::SetOntouchend(mozilla::dom::EventHandlerNonNull*)
Unexecuted instantiation: nsGlobalWindowOuter::SetOntouchmove(mozilla::dom::EventHandlerNonNull*)
Unexecuted instantiation: nsGlobalWindowOuter::SetOntouchcancel(mozilla::dom::EventHandlerNonNull*)
Unexecuted instantiation: nsGlobalWindowOuter::SetOntransitionstart(mozilla::dom::EventHandlerNonNull*)
Unexecuted instantiation: nsGlobalWindowOuter::SetOntransitionrun(mozilla::dom::EventHandlerNonNull*)
Unexecuted instantiation: nsGlobalWindowOuter::SetOntransitionend(mozilla::dom::EventHandlerNonNull*)
Unexecuted instantiation: nsGlobalWindowOuter::SetOntransitioncancel(mozilla::dom::EventHandlerNonNull*)
Unexecuted instantiation: nsGlobalWindowOuter::SetOnanimationstart(mozilla::dom::EventHandlerNonNull*)
Unexecuted instantiation: nsGlobalWindowOuter::SetOnanimationend(mozilla::dom::EventHandlerNonNull*)
Unexecuted instantiation: nsGlobalWindowOuter::SetOnanimationiteration(mozilla::dom::EventHandlerNonNull*)
Unexecuted instantiation: nsGlobalWindowOuter::SetOnanimationcancel(mozilla::dom::EventHandlerNonNull*)
Unexecuted instantiation: nsGlobalWindowOuter::SetOnwebkitAnimationEnd(mozilla::dom::EventHandlerNonNull*)
Unexecuted instantiation: nsGlobalWindowOuter::SetOnwebkitAnimationIteration(mozilla::dom::EventHandlerNonNull*)
Unexecuted instantiation: nsGlobalWindowOuter::SetOnwebkitAnimationStart(mozilla::dom::EventHandlerNonNull*)
Unexecuted instantiation: nsGlobalWindowOuter::SetOnwebkitTransitionEnd(mozilla::dom::EventHandlerNonNull*)
Unexecuted instantiation: nsGlobalWindowOuter::SetOnwebkitanimationend(mozilla::dom::EventHandlerNonNull*)
Unexecuted instantiation: nsGlobalWindowOuter::SetOnwebkitanimationiteration(mozilla::dom::EventHandlerNonNull*)
Unexecuted instantiation: nsGlobalWindowOuter::SetOnwebkitanimationstart(mozilla::dom::EventHandlerNonNull*)
Unexecuted instantiation: nsGlobalWindowOuter::SetOnwebkittransitionend(mozilla::dom::EventHandlerNonNull*)
518
#define ERROR_EVENT(name_, id_, type_, struct_)                               \
519
  mozilla::dom::OnErrorEventHandlerNonNull* GetOn##name_()                    \
520
0
  {                                                                           \
521
0
    mozilla::EventListenerManager* elm = GetExistingListenerManager();        \
522
0
    return elm ? elm->GetOnErrorEventHandler() : nullptr;                     \
523
0
  }                                                                           \
524
  void SetOn##name_(mozilla::dom::OnErrorEventHandlerNonNull* handler)        \
525
0
  {                                                                           \
526
0
    mozilla::EventListenerManager* elm = GetOrCreateListenerManager();        \
527
0
    if (elm) {                                                                \
528
0
      elm->SetEventHandler(handler);                                          \
529
0
    }                                                                         \
530
0
  }
531
#define BEFOREUNLOAD_EVENT(name_, id_, type_, struct_)                        \
532
  mozilla::dom::OnBeforeUnloadEventHandlerNonNull* GetOn##name_()             \
533
0
  {                                                                           \
534
0
    mozilla::EventListenerManager* elm = GetExistingListenerManager();        \
535
0
    return elm ? elm->GetOnBeforeUnloadEventHandler() : nullptr;              \
536
0
  }                                                                           \
537
  void SetOn##name_(mozilla::dom::OnBeforeUnloadEventHandlerNonNull* handler) \
538
0
  {                                                                           \
539
0
    mozilla::EventListenerManager* elm = GetOrCreateListenerManager();        \
540
0
    if (elm) {                                                                \
541
0
      elm->SetEventHandler(handler);                                          \
542
0
    }                                                                         \
543
0
  }
544
#define WINDOW_ONLY_EVENT EVENT
545
#define TOUCH_EVENT EVENT
546
#include "mozilla/EventNameList.h"
547
#undef TOUCH_EVENT
548
#undef WINDOW_ONLY_EVENT
549
#undef BEFOREUNLOAD_EVENT
550
#undef ERROR_EVENT
551
#undef EVENT
552
553
  nsISupports* GetParentObject()
554
0
  {
555
0
    return nullptr;
556
0
  }
557
558
  nsIDocument* GetDocument()
559
0
  {
560
0
    return GetDoc();
561
0
  }
562
  void GetNameOuter(nsAString& aName);
563
  void SetNameOuter(const nsAString& aName, mozilla::ErrorResult& aError);
564
  mozilla::dom::Location* GetLocation() override;
565
  void GetStatusOuter(nsAString& aStatus);
566
  void SetStatusOuter(const nsAString& aStatus);
567
  void CloseOuter(bool aTrustedCaller);
568
  nsresult Close() override;
569
  bool GetClosedOuter();
570
  bool Closed() override;
571
  void StopOuter(mozilla::ErrorResult& aError);
572
  void FocusOuter(mozilla::ErrorResult& aError);
573
  nsresult Focus() override;
574
  void BlurOuter();
575
  already_AddRefed<nsPIDOMWindowOuter> GetFramesOuter();
576
  nsDOMWindowList* GetFrames() final;
577
  uint32_t Length();
578
  already_AddRefed<nsPIDOMWindowOuter> GetTopOuter();
579
580
  nsresult GetPrompter(nsIPrompt** aPrompt) override;
581
protected:
582
  explicit nsGlobalWindowOuter();
583
  nsPIDOMWindowOuter* GetOpenerWindowOuter();
584
  // Initializes the mWasOffline member variable
585
  void InitWasOffline();
586
public:
587
  nsPIDOMWindowOuter*
588
  GetSanitizedOpener(nsPIDOMWindowOuter* aOpener);
589
590
  already_AddRefed<nsPIDOMWindowOuter> GetOpener() override;
591
  already_AddRefed<nsPIDOMWindowOuter> GetParentOuter();
592
  already_AddRefed<nsPIDOMWindowOuter> GetParent() override;
593
  nsPIDOMWindowOuter* GetScriptableParent() override;
594
  nsPIDOMWindowOuter* GetScriptableParentOrNull() override;
595
  mozilla::dom::Element*
596
  GetFrameElementOuter(nsIPrincipal& aSubjectPrincipal);
597
  mozilla::dom::Element* GetFrameElement() override;
598
  already_AddRefed<nsPIDOMWindowOuter>
599
  OpenOuter(const nsAString& aUrl,
600
            const nsAString& aName,
601
            const nsAString& aOptions,
602
            mozilla::ErrorResult& aError);
603
  nsresult Open(const nsAString& aUrl, const nsAString& aName,
604
                const nsAString& aOptions,
605
                nsDocShellLoadInfo* aLoadInfo,
606
                bool aForceNoOpener,
607
                nsPIDOMWindowOuter **_retval) override;
608
  mozilla::dom::Navigator* GetNavigator() override;
609
610
#if defined(MOZ_WIDGET_ANDROID)
611
  int16_t Orientation(mozilla::dom::CallerType aCallerType) const;
612
#endif
613
614
protected:
615
  bool AlertOrConfirm(bool aAlert, const nsAString& aMessage,
616
                      nsIPrincipal& aSubjectPrincipal,
617
                      mozilla::ErrorResult& aError);
618
619
public:
620
  void AlertOuter(const nsAString& aMessage,
621
                  nsIPrincipal& aSubjectPrincipal,
622
                  mozilla::ErrorResult& aError);
623
  bool ConfirmOuter(const nsAString& aMessage,
624
                    nsIPrincipal& aSubjectPrincipal,
625
                    mozilla::ErrorResult& aError);
626
  void PromptOuter(const nsAString& aMessage, const nsAString& aInitial,
627
                   nsAString& aReturn,
628
                   nsIPrincipal& aSubjectPrincipal,
629
                   mozilla::ErrorResult& aError);
630
  void PrintOuter(mozilla::ErrorResult& aError);
631
  mozilla::dom::Selection* GetSelectionOuter();
632
  already_AddRefed<mozilla::dom::Selection> GetSelection() override;
633
  already_AddRefed<mozilla::dom::MediaQueryList> MatchMediaOuter(
634
    const nsAString& aQuery,
635
    mozilla::dom::CallerType aCallerType);
636
  nsScreen* GetScreen();
637
  void MoveToOuter(int32_t aXPos, int32_t aYPos,
638
                   mozilla::dom::CallerType aCallerType,
639
                   mozilla::ErrorResult& aError);
640
  void MoveByOuter(int32_t aXDif, int32_t aYDif,
641
                   mozilla::dom::CallerType aCallerType,
642
                   mozilla::ErrorResult& aError);
643
  nsresult MoveBy(int32_t aXDif, int32_t aYDif) override;
644
  void ResizeToOuter(int32_t aWidth, int32_t aHeight,
645
                     mozilla::dom::CallerType aCallerType,
646
                     mozilla::ErrorResult& aError);
647
  void ResizeByOuter(int32_t aWidthDif, int32_t aHeightDif,
648
                     mozilla::dom::CallerType aCallerType,
649
                     mozilla::ErrorResult& aError);
650
  double GetScrollXOuter();
651
  double GetScrollYOuter();
652
653
  void SizeToContentOuter(mozilla::dom::CallerType aCallerType,
654
                          mozilla::ErrorResult& aError);
655
  nsIControllers* GetControllersOuter(mozilla::ErrorResult& aError);
656
  nsresult GetControllers(nsIControllers** aControllers) override;
657
  mozilla::dom::Element* GetRealFrameElementOuter();
658
  float GetMozInnerScreenXOuter(mozilla::dom::CallerType aCallerType);
659
  float GetMozInnerScreenYOuter(mozilla::dom::CallerType aCallerType);
660
  double GetDevicePixelRatioOuter(mozilla::dom::CallerType aCallerType);
661
  bool GetFullscreenOuter();
662
  bool GetFullScreen() override;
663
  void SetFullscreenOuter(bool aFullscreen, mozilla::ErrorResult& aError);
664
  nsresult SetFullScreen(bool aFullscreen) override;
665
  bool FindOuter(const nsAString& aString, bool aCaseSensitive, bool aBackwards,
666
                 bool aWrapAround, bool aWholeWord, bool aSearchInFrames,
667
                 bool aShowDialog, mozilla::ErrorResult& aError);
668
  uint64_t GetMozPaintCountOuter();
669
670
  bool ShouldResistFingerprinting();
671
672
  already_AddRefed<nsPIDOMWindowOuter>
673
  OpenDialogOuter(JSContext* aCx,
674
                  const nsAString& aUrl,
675
                  const nsAString& aName,
676
                  const nsAString& aOptions,
677
                  const mozilla::dom::Sequence<JS::Value>& aExtraArgument,
678
                  mozilla::ErrorResult& aError);
679
  nsresult OpenDialog(const nsAString& aUrl, const nsAString& aName,
680
                      const nsAString& aOptions,
681
                      nsISupports* aExtraArgument,
682
                      nsPIDOMWindowOuter** _retval) override;
683
  void UpdateCommands(const nsAString& anAction, mozilla::dom::Selection* aSel,
684
                      int16_t aReason) override;
685
686
  already_AddRefed<nsPIDOMWindowOuter>
687
  GetContentInternal(mozilla::ErrorResult& aError,
688
                     mozilla::dom::CallerType aCallerType);
689
  void GetContentOuter(JSContext* aCx,
690
                       JS::MutableHandle<JSObject*> aRetval,
691
                       mozilla::dom::CallerType aCallerType,
692
                       mozilla::ErrorResult& aError);
693
  already_AddRefed<nsPIDOMWindowOuter> GetContent()
694
0
  {
695
0
    nsCOMPtr<nsPIDOMWindowOuter> win =
696
0
      GetContentInternal(mozilla::IgnoreErrors(),
697
0
                         mozilla::dom::CallerType::System);
698
0
    return win.forget();
699
0
  }
700
701
  // ChromeWindow bits.  Do NOT call these unless your window is in
702
  // fact chrome.
703
  nsIBrowserDOMWindow* GetBrowserDOMWindowOuter();
704
  void SetBrowserDOMWindowOuter(nsIBrowserDOMWindow* aBrowserWindow);
705
  void SetCursorOuter(const nsAString& aCursor, mozilla::ErrorResult& aError);
706
707
  void GetDialogArgumentsOuter(JSContext* aCx, JS::MutableHandle<JS::Value> aRetval,
708
                               nsIPrincipal& aSubjectPrincipal,
709
                               mozilla::ErrorResult& aError);
710
  void GetDialogArguments(JSContext* aCx, JS::MutableHandle<JS::Value> aRetval,
711
                          nsIPrincipal& aSubjectPrincipal,
712
                          mozilla::ErrorResult& aError);
713
  void GetReturnValueOuter(JSContext* aCx, JS::MutableHandle<JS::Value> aReturnValue,
714
                           nsIPrincipal& aSubjectPrincipal,
715
                           mozilla::ErrorResult& aError);
716
  void GetReturnValue(JSContext* aCx, JS::MutableHandle<JS::Value> aReturnValue,
717
                      nsIPrincipal& aSubjectPrincipal,
718
                      mozilla::ErrorResult& aError);
719
  void SetReturnValueOuter(JSContext* aCx, JS::Handle<JS::Value> aReturnValue,
720
                           nsIPrincipal& aSubjectPrincipal,
721
                           mozilla::ErrorResult& aError);
722
  void SetReturnValue(JSContext* aCx, JS::Handle<JS::Value> aReturnValue,
723
                      nsIPrincipal& aSubjectPrincipal,
724
                      mozilla::ErrorResult& aError);
725
726
  already_AddRefed<nsWindowRoot> GetWindowRootOuter();
727
728
  nsIDOMWindowUtils* WindowUtils();
729
730
  virtual bool IsInSyncOperation() override
731
0
  {
732
0
    return GetExtantDoc() && GetExtantDoc()->IsInSyncOperation();
733
0
  }
734
735
public:
736
  int32_t GetInnerWidthOuter(mozilla::ErrorResult& aError);
737
protected:
738
  nsresult GetInnerWidth(int32_t* aWidth) override;
739
  void SetInnerWidthOuter(int32_t aInnerWidth,
740
                          mozilla::dom::CallerType aCallerType,
741
                          mozilla::ErrorResult& aError);
742
public:
743
  int32_t GetInnerHeightOuter(mozilla::ErrorResult& aError);
744
protected:
745
  nsresult GetInnerHeight(int32_t* aHeight) override;
746
  void SetInnerHeightOuter(int32_t aInnerHeight,
747
                           mozilla::dom::CallerType aCallerType,
748
                           mozilla::ErrorResult& aError);
749
  int32_t GetScreenXOuter(mozilla::dom::CallerType aCallerType,
750
                          mozilla::ErrorResult& aError);
751
  void SetScreenXOuter(int32_t aScreenX,
752
                       mozilla::dom::CallerType aCallerType,
753
                       mozilla::ErrorResult& aError);
754
  int32_t GetScreenYOuter(mozilla::dom::CallerType aCallerType,
755
                          mozilla::ErrorResult& aError);
756
  void SetScreenYOuter(int32_t aScreenY,
757
                       mozilla::dom::CallerType aCallerType,
758
                       mozilla::ErrorResult& aError);
759
  int32_t GetOuterWidthOuter(mozilla::dom::CallerType aCallerType,
760
                             mozilla::ErrorResult& aError);
761
  void SetOuterWidthOuter(int32_t aOuterWidth,
762
                          mozilla::dom::CallerType aCallerType,
763
                          mozilla::ErrorResult& aError);
764
  int32_t GetOuterHeightOuter(mozilla::dom::CallerType aCallerType,
765
                              mozilla::ErrorResult& aError);
766
  void SetOuterHeightOuter(int32_t aOuterHeight,
767
                           mozilla::dom::CallerType aCallerType,
768
                           mozilla::ErrorResult& aError);
769
770
  // Array of idle observers that are notified of idle events.
771
  nsTObserverArray<IdleObserverHolder> mIdleObservers;
772
773
  // Idle timer used for function callbacks to notify idle observers.
774
  nsCOMPtr<nsITimer> mIdleTimer;
775
776
  // Idle fuzz time added to idle timer callbacks.
777
  uint32_t mIdleFuzzFactor;
778
779
  // Index in mArrayIdleObservers
780
  // Next idle observer to notify user idle status
781
  int32_t mIdleCallbackIndex;
782
783
  // If false then the topic is "active"
784
  // If true then the topic is "idle"
785
  bool mCurrentlyIdle;
786
787
  // Set to true when a fuzz time needs to be applied
788
  // to active notifications to the idle observer.
789
  bool mAddActiveEventFuzzTime;
790
791
  nsCOMPtr <nsIIdleService> mIdleService;
792
793
  RefPtr<mozilla::dom::WakeLock> mWakeLock;
794
795
  friend class HashchangeCallback;
796
  friend class mozilla::dom::BarProp;
797
798
  // Object Management
799
  virtual ~nsGlobalWindowOuter();
800
  void DropOuterWindowDocs();
801
  void CleanUp();
802
  void ClearControllers();
803
  // Outer windows only.
804
  void FinalClose();
805
806
  inline void MaybeClearInnerWindow(nsGlobalWindowInner* aExpectedInner);
807
808
  nsGlobalWindowInner *CallerInnerWindow();
809
810
  // Get the parent, returns null if this is a toplevel window
811
  nsPIDOMWindowOuter* GetParentInternal();
812
813
public:
814
  // popup tracking
815
  bool IsPopupSpamWindow();
816
817
  // Outer windows only.
818
  void SetIsPopupSpamWindow(bool aIsPopupSpam);
819
820
protected:
821
  // Window Control Functions
822
823
  // Outer windows only.
824
  virtual nsresult
825
  OpenNoNavigate(const nsAString& aUrl,
826
                 const nsAString& aName,
827
                 const nsAString& aOptions,
828
                 nsPIDOMWindowOuter** _retval) override;
829
830
private:
831
  /**
832
   * @param aUrl the URL we intend to load into the window.  If aNavigate is
833
   *        true, we'll actually load this URL into the window. Otherwise,
834
   *        aUrl is advisory; OpenInternal will not load the URL into the
835
   *        new window.
836
   *
837
   * @param aName the name to use for the new window
838
   *
839
   * @param aOptions the window options to use for the new window
840
   *
841
   * @param aDialog true when called from variants of OpenDialog.  If this is
842
   *        true, this method will skip popup blocking checks.  The aDialog
843
   *        argument is passed on to the window watcher.
844
   *
845
   * @param aCalledNoScript true when called via the [noscript] open()
846
   *        and openDialog() methods.  When this is true, we do NOT want to use
847
   *        the JS stack for things like caller determination.
848
   *
849
   * @param aDoJSFixups true when this is the content-accessible JS version of
850
   *        window opening.  When true, popups do not cause us to throw, we save
851
   *        the caller's principal in the new window for later consumption, and
852
   *        we make sure that there is a document in the newly-opened window.
853
   *        Note that this last will only be done if the newly-opened window is
854
   *        non-chrome.
855
   *
856
   * @param aNavigate true if we should navigate to the provided URL, false
857
   *        otherwise.  When aNavigate is false, we also skip our can-load
858
   *        security check, on the assumption that whoever *actually* loads this
859
   *        page will do their own security check.
860
   *
861
   * @param argv The arguments to pass to the new window.  The first
862
   *        three args, if present, will be aUrl, aName, and aOptions.  So this
863
   *        param only matters if there are more than 3 arguments.
864
   *
865
   * @param aExtraArgument Another way to pass arguments in.  This is mutually
866
   *        exclusive with the argv approach.
867
   *
868
   * @param aLoadInfo to be passed on along to the windowwatcher.
869
   *
870
   * @param aForceNoOpener if true, will act as if "noopener" were passed in
871
   *                       aOptions, but without affecting any other window
872
   *                       features.
873
   *
874
   * @param aReturn [out] The window that was opened, if any.  Will be null if
875
   *                      aForceNoOpener is true of if aOptions contains
876
   *                      "noopener".
877
   *
878
   * Outer windows only.
879
   */
880
  nsresult OpenInternal(const nsAString& aUrl,
881
                        const nsAString& aName,
882
                        const nsAString& aOptions,
883
                        bool aDialog,
884
                        bool aContentModal,
885
                        bool aCalledNoScript,
886
                        bool aDoJSFixups,
887
                        bool aNavigate,
888
                        nsIArray *argv,
889
                        nsISupports *aExtraArgument,
890
                        nsDocShellLoadInfo* aLoadInfo,
891
                        bool aForceNoOpener,
892
                        nsPIDOMWindowOuter **aReturn);
893
894
  // Checks that the channel was loaded by the URI currently loaded in aDoc
895
  static bool SameLoadingURI(nsIDocument *aDoc, nsIChannel *aChannel);
896
897
public:
898
  // Helper Functions
899
  already_AddRefed<nsIDocShellTreeOwner> GetTreeOwner();
900
  already_AddRefed<nsIBaseWindow> GetTreeOwnerWindow();
901
  already_AddRefed<nsIWebBrowserChrome> GetWebBrowserChrome();
902
  nsresult SecurityCheckURL(const char *aURL, nsIURI** aURI);
903
904
  bool PopupWhitelisted();
905
  PopupControlState RevisePopupAbuseLevel(PopupControlState);
906
  void     FireAbuseEvents(const nsAString &aPopupURL,
907
                           const nsAString &aPopupWindowName,
908
                           const nsAString &aPopupWindowFeatures);
909
910
private:
911
  void ReportLargeAllocStatus();
912
913
public:
914
  void FlushPendingNotifications(mozilla::FlushType aType);
915
916
  // Outer windows only.
917
  void EnsureReflowFlushAndPaint();
918
  void CheckSecurityWidthAndHeight(int32_t* width, int32_t* height,
919
                                   mozilla::dom::CallerType aCallerType);
920
  void CheckSecurityLeftAndTop(int32_t* left, int32_t* top,
921
                               mozilla::dom::CallerType aCallerType);
922
923
  // Outer windows only.
924
  // Arguments to this function should have values in app units
925
  void SetCSSViewportWidthAndHeight(nscoord width, nscoord height);
926
  // Arguments to this function should have values in device pixels
927
  nsresult SetDocShellWidthAndHeight(int32_t width, int32_t height);
928
929
  static bool CanSetProperty(const char *aPrefName);
930
931
  static void MakeScriptDialogTitle(nsAString& aOutTitle,
932
                                    nsIPrincipal* aSubjectPrincipal);
933
934
  // Outer windows only.
935
  bool CanMoveResizeWindows(mozilla::dom::CallerType aCallerType);
936
937
  // If aDoFlush is true, we'll flush our own layout; otherwise we'll try to
938
  // just flush our parent and only flush ourselves if we think we need to.
939
  // Outer windows only.
940
  mozilla::CSSPoint GetScrollXY(bool aDoFlush);
941
942
  int32_t GetScrollBoundaryOuter(mozilla::Side aSide);
943
944
  // Outer windows only.
945
  nsresult GetInnerSize(mozilla::CSSIntSize& aSize);
946
  nsIntSize GetOuterSize(mozilla::dom::CallerType aCallerType,
947
                         mozilla::ErrorResult& aError);
948
  void SetOuterSize(int32_t aLengthCSSPixels, bool aIsWidth,
949
                    mozilla::dom::CallerType aCallerType,
950
                    mozilla::ErrorResult& aError);
951
  nsRect GetInnerScreenRect();
952
953
  bool IsFrame();
954
955
  // Outer windows only.
956
  // If aLookForCallerOnJSStack is true, this method will look at the JS stack
957
  // to determine who the caller is.  If it's false, it'll use |this| as the
958
  // caller.
959
  bool WindowExists(const nsAString& aName, bool aForceNoOpener,
960
                    bool aLookForCallerOnJSStack);
961
962
  already_AddRefed<nsIWidget> GetMainWidget();
963
  nsIWidget* GetNearestWidget() const;
964
965
  bool IsInModalState();
966
967
  bool HasStorageAccess() const
968
0
  {
969
0
    return mHasStorageAccess;
970
0
  }
971
  void SetHasStorageAccess(bool aHasStorageAccess)
972
0
  {
973
0
    mHasStorageAccess = aHasStorageAccess;
974
0
  }
975
976
  // Convenience functions for the many methods that need to scale
977
  // from device to CSS pixels or vice versa.  Note: if a presentation
978
  // context is not available, they will assume a 1:1 ratio.
979
  int32_t DevToCSSIntPixels(int32_t px);
980
  int32_t CSSToDevIntPixels(int32_t px);
981
  nsIntSize DevToCSSIntPixels(nsIntSize px);
982
  nsIntSize CSSToDevIntPixels(nsIntSize px);
983
984
  virtual void SetFocusedElement(mozilla::dom::Element* aElement,
985
                                 uint32_t aFocusMethod = 0,
986
                                 bool aNeedsFocus = false) override;
987
988
  virtual uint32_t GetFocusMethod() override;
989
990
  virtual bool ShouldShowFocusRing() override;
991
992
  virtual void SetKeyboardIndicators(UIStateChangeType aShowAccelerators,
993
                                     UIStateChangeType aShowFocusRings) override;
994
995
public:
996
  virtual already_AddRefed<nsPIWindowRoot> GetTopWindowRoot() override;
997
998
protected:
999
  void NotifyWindowIDDestroyed(const char* aTopic);
1000
1001
  void ClearStatus();
1002
1003
  virtual void UpdateParentTarget() override;
1004
1005
  void InitializeShowFocusRings();
1006
1007
protected:
1008
  // Helper for getComputedStyle and getDefaultComputedStyle
1009
  already_AddRefed<nsICSSDeclaration>
1010
    GetComputedStyleHelperOuter(mozilla::dom::Element& aElt,
1011
                                const nsAString& aPseudoElt,
1012
                                bool aDefaultStylesOnly);
1013
1014
  // Outer windows only.
1015
  void PreloadLocalStorage();
1016
1017
  // Returns CSS pixels based on primary screen.  Outer windows only.
1018
  mozilla::CSSIntPoint GetScreenXY(mozilla::dom::CallerType aCallerType,
1019
                                   mozilla::ErrorResult& aError);
1020
1021
  void PostMessageMozOuter(JSContext* aCx, JS::Handle<JS::Value> aMessage,
1022
                           const nsAString& aTargetOrigin,
1023
                           JS::Handle<JS::Value> aTransfer,
1024
                           nsIPrincipal& aSubjectPrincipal,
1025
                           mozilla::ErrorResult& aError);
1026
1027
  // Ask the user if further dialogs should be blocked, if dialogs are currently
1028
  // being abused. This is used in the cases where we have no modifiable UI to
1029
  // show, in that case we show a separate dialog to ask this question.
1030
  bool ConfirmDialogIfNeeded();
1031
1032
  // Helper called after moving/resizing, to update docShell's presContext
1033
  // if we have caused a resolution change by moving across monitors.
1034
  void CheckForDPIChange();
1035
1036
private:
1037
  enum class SecureContextFlags {
1038
    eDefault,
1039
    eIgnoreOpener
1040
  };
1041
  // Called only on outer windows to compute the value that will be returned by
1042
  // IsSecureContext() for the inner window that corresponds to aDocument.
1043
  bool ComputeIsSecureContext(nsIDocument* aDocument,
1044
                              SecureContextFlags aFlags =
1045
                                SecureContextFlags::eDefault);
1046
1047
  // nsPIDOMWindow{Inner,Outer} should be able to see these helper methods.
1048
  friend class nsPIDOMWindowInner;
1049
  friend class nsPIDOMWindowOuter;
1050
1051
  mozilla::dom::TabGroup* TabGroupOuter();
1052
1053
  void SetIsBackgroundInternal(bool aIsBackground);
1054
1055
  nsresult GetInterfaceInternal(const nsIID& aIID, void** aSink);
1056
1057
  void MaybeAllowStorageForOpenedWindow(nsIURI* aURI);
1058
1059
public:
1060
  // Dispatch a runnable related to the global.
1061
  virtual nsresult Dispatch(mozilla::TaskCategory aCategory,
1062
                            already_AddRefed<nsIRunnable>&& aRunnable) override;
1063
1064
  virtual nsISerialEventTarget*
1065
  EventTargetFor(mozilla::TaskCategory aCategory) const override;
1066
1067
  virtual mozilla::AbstractThread*
1068
  AbstractMainThreadFor(mozilla::TaskCategory aCategory) override;
1069
protected:
1070
  bool                          mFullscreen : 1;
1071
  bool                          mFullscreenMode : 1;
1072
  bool                          mIsClosed : 1;
1073
  bool                          mInClose : 1;
1074
  // mHavePendingClose means we've got a termination function set to
1075
  // close us when the JS stops executing or that we have a close
1076
  // event posted.  If this is set, just ignore window.close() calls.
1077
  bool                          mHavePendingClose : 1;
1078
  bool                          mHadOriginalOpener : 1;
1079
  bool                          mIsPopupSpam : 1;
1080
1081
  // Indicates whether scripts are allowed to close this window.
1082
  bool                          mBlockScriptedClosingFlag : 1;
1083
1084
  // Window offline status. Checked to see if we need to fire offline event
1085
  bool                          mWasOffline : 1;
1086
1087
  // Indicates whether we're in the middle of creating an initializing
1088
  // a new inner window object.
1089
  bool                          mCreatingInnerWindow : 1;
1090
1091
  // Fast way to tell if this is a chrome window (without having to QI).
1092
  bool                          mIsChrome : 1;
1093
1094
  // whether scripts may close the window,
1095
  // even if "dom.allow_scripts_to_close_windows" is false.
1096
  bool                   mAllowScriptsToClose : 1;
1097
1098
  bool mTopLevelOuterContentWindow : 1;
1099
1100
  // whether storage access has been granted to this frame.
1101
  bool mHasStorageAccess : 1;
1102
1103
  nsCOMPtr<nsIScriptContext>    mContext;
1104
  nsWeakPtr                     mOpener;
1105
  nsCOMPtr<nsIControllers>      mControllers;
1106
1107
  // For |window.arguments|, via |openDialog|.
1108
  nsCOMPtr<nsIArray>            mArguments;
1109
1110
  RefPtr<nsDOMWindowList>     mFrames;
1111
  RefPtr<nsDOMWindowUtils>      mWindowUtils;
1112
  nsString                      mStatus;
1113
1114
  RefPtr<mozilla::dom::Storage> mLocalStorage;
1115
1116
  nsCOMPtr<nsIPrincipal> mDocumentPrincipal;
1117
1118
  uint32_t mSerial;
1119
1120
#ifdef DEBUG
1121
  bool mSetOpenerWindowCalled;
1122
  nsCOMPtr<nsIURI> mLastOpenedURI;
1123
#endif
1124
1125
  bool mCleanedUp;
1126
1127
  // It's useful when we get matched EnterModalState/LeaveModalState calls, in
1128
  // which case the outer window is responsible for unsuspending events on the
1129
  // document. If we don't (for example, if the outer window is closed before
1130
  // the LeaveModalState call), then the inner window whose mDoc is our
1131
  // mSuspendedDoc is responsible for unsuspending it.
1132
  nsCOMPtr<nsIDocument> mSuspendedDoc;
1133
1134
#ifdef DEBUG
1135
  // This member is used in the debug only assertions in TabGroup()
1136
  // to catch cyclic parent/opener trees and not overflow the stack.
1137
  bool mIsValidatingTabGroup;
1138
#endif
1139
1140
  // This is the CC generation the last time we called CanSkip.
1141
  uint32_t mCanSkipCCGeneration;
1142
1143
  // When non-zero, the document should receive a vrdisplayactivate event
1144
  // after loading.  The value is the ID of the VRDisplay that content should
1145
  // begin presentation on.
1146
  uint32_t mAutoActivateVRDisplayID;
1147
1148
  static OuterWindowByIdTable* sOuterWindowsById;
1149
1150
  // Members in the mChromeFields member should only be used in chrome windows.
1151
  // All accesses to this field should be guarded by a check of mIsChrome.
1152
  struct ChromeFields {
1153
    nsCOMPtr<nsIBrowserDOMWindow> mBrowserDOMWindow;
1154
    // A weak pointer to the nsPresShell that we are doing fullscreen for.
1155
    // The pointer being set indicates we've set the IsInFullscreenChange
1156
    // flag on this pres shell.
1157
    nsWeakPtr mFullscreenPresShell;
1158
  } mChromeFields;
1159
1160
  friend class nsDOMScriptableHelper;
1161
  friend class nsDOMWindowUtils;
1162
  friend class mozilla::dom::PostMessageEvent;
1163
  friend class DesktopNotification;
1164
  friend class mozilla::dom::TimeoutManager;
1165
  friend class IdleRequestExecutor;
1166
  friend class nsGlobalWindowInner;
1167
};
1168
1169
// XXX: EWW - This is an awful hack - let's not do this
1170
#include "nsGlobalWindowInner.h"
1171
1172
inline nsISupports*
1173
ToSupports(nsGlobalWindowOuter *p)
1174
0
{
1175
0
  return static_cast<mozilla::dom::EventTarget*>(p);
1176
0
}
1177
1178
inline nsISupports*
1179
ToCanonicalSupports(nsGlobalWindowOuter *p)
1180
0
{
1181
0
  return static_cast<mozilla::dom::EventTarget*>(p);
1182
0
}
1183
1184
inline nsIGlobalObject*
1185
nsGlobalWindowOuter::GetOwnerGlobal() const
1186
0
{
1187
0
  return GetCurrentInnerWindowInternal();
1188
0
}
1189
1190
inline nsGlobalWindowOuter*
1191
nsGlobalWindowOuter::GetTopInternal()
1192
0
{
1193
0
  nsCOMPtr<nsPIDOMWindowOuter> top = GetTop();
1194
0
  if (top) {
1195
0
    return nsGlobalWindowOuter::Cast(top);
1196
0
  }
1197
0
  return nullptr;
1198
0
}
1199
1200
inline nsGlobalWindowOuter*
1201
nsGlobalWindowOuter::GetScriptableTopInternal()
1202
0
{
1203
0
  nsPIDOMWindowOuter* top = GetScriptableTop();
1204
0
  return nsGlobalWindowOuter::Cast(top);
1205
0
}
1206
1207
inline nsIScriptContext*
1208
nsGlobalWindowOuter::GetContextInternal()
1209
0
{
1210
0
  return mContext;
1211
0
}
1212
1213
inline nsGlobalWindowOuter*
1214
nsGlobalWindowOuter::GetOuterWindowInternal()
1215
0
{
1216
0
  return nsGlobalWindowOuter::Cast(GetOuterWindow());
1217
0
}
1218
1219
inline nsGlobalWindowInner*
1220
nsGlobalWindowOuter::GetCurrentInnerWindowInternal() const
1221
0
{
1222
0
  return nsGlobalWindowInner::Cast(mInnerWindow);
1223
0
}
1224
1225
inline nsGlobalWindowInner*
1226
nsGlobalWindowOuter::EnsureInnerWindowInternal()
1227
0
{
1228
0
  return nsGlobalWindowInner::Cast(AsOuter()->EnsureInnerWindow());
1229
0
}
1230
1231
inline bool
1232
nsGlobalWindowOuter::IsTopLevelWindow()
1233
0
{
1234
0
  nsPIDOMWindowOuter* parentWindow = GetScriptableTop();
1235
0
  return parentWindow == this->AsOuter();
1236
0
}
1237
1238
inline bool
1239
nsGlobalWindowOuter::IsPopupSpamWindow()
1240
0
{
1241
0
  return mIsPopupSpam;
1242
0
}
1243
1244
inline bool
1245
nsGlobalWindowOuter::IsFrame()
1246
0
{
1247
0
  return GetParentInternal() != nullptr;
1248
0
}
1249
1250
inline void
1251
nsGlobalWindowOuter::MaybeClearInnerWindow(nsGlobalWindowInner* aExpectedInner)
1252
0
{
1253
0
  if(mInnerWindow == aExpectedInner->AsInner()) {
1254
0
    mInnerWindow = nullptr;
1255
0
  }
1256
0
}
1257
1258
/* factory function */
1259
inline already_AddRefed<nsGlobalWindowOuter>
1260
NS_NewScriptGlobalObject(bool aIsChrome)
1261
0
{
1262
0
  return nsGlobalWindowOuter::Create(aIsChrome);
1263
0
}
1264
1265
#endif /* nsGlobalWindowOuter_h___ */