nsGlobalWindowOuter.h (43607B)
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 "nsHashKeys.h" 11 #include "nsInterfaceHashtable.h" 12 #include "nsNodeInfoManager.h" 13 #include "nsPIDOMWindow.h" 14 #include "nsRefPtrHashtable.h" 15 #include "nsTHashtable.h" 16 17 // Local Includes 18 // Helper Classes 19 #include "nsCOMPtr.h" 20 #include "nsCycleCollectionParticipant.h" 21 #include "nsTHashMap.h" 22 #include "nsWeakReference.h" 23 24 // Interfaces Needed 25 #include "Units.h" 26 #include "X11UndefineNone.h" 27 #include "mozilla/Attributes.h" 28 #include "mozilla/EventListenerManager.h" 29 #include "mozilla/FlushType.h" 30 #include "mozilla/dom/BindingDeclarations.h" 31 #include "mozilla/dom/BrowsingContext.h" 32 #include "mozilla/dom/ChromeMessageBroadcaster.h" 33 #include "mozilla/dom/EventTarget.h" 34 #include "mozilla/dom/ImageBitmapSource.h" 35 #include "mozilla/dom/PopupBlocker.h" 36 #include "mozilla/dom/StorageEvent.h" 37 #include "mozilla/dom/StorageEventBinding.h" 38 #include "mozilla/dom/WindowBinding.h" 39 #include "nsCheapSets.h" 40 #include "nsComponentManagerUtils.h" 41 #include "nsIBrowserDOMWindow.h" 42 #include "nsIInterfaceRequestor.h" 43 #include "nsIPrincipal.h" 44 #include "nsIScriptGlobalObject.h" 45 #include "nsIScriptObjectPrincipal.h" 46 #include "nsSize.h" 47 #include "nsWrapperCacheInlines.h" 48 #include "prclist.h" 49 50 class nsDocShell; 51 class nsIArray; 52 class nsIBaseWindow; 53 class nsIContent; 54 class nsICSSDeclaration; 55 class nsIDocShellTreeOwner; 56 class nsIDOMWindowUtils; 57 class nsIControllers; 58 class nsIPrintSettings; 59 class nsIScriptContext; 60 class nsIScriptTimeoutHandler; 61 class nsIBrowserChild; 62 class nsITimeoutHandler; 63 class nsIWebBrowserChrome; 64 class nsIWebProgressListener; 65 class mozIDOMWindowProxy; 66 67 class nsDocShellLoadState; 68 class nsScreen; 69 class nsHistory; 70 class nsGlobalWindowObserver; 71 class nsGlobalWindowInner; 72 class nsDOMWindowUtils; 73 struct nsRect; 74 class nsWindowRoot; 75 class nsWindowSizes; 76 77 namespace mozilla { 78 class AbstractThread; 79 class DOMEventTargetHelper; 80 class ErrorResult; 81 template <typename V, typename E> 82 class Result; 83 class ThrottledEventQueue; 84 class ScrollContainerFrame; 85 namespace dom { 86 class BarProp; 87 struct ChannelPixelLayout; 88 class Console; 89 class Crypto; 90 class CustomElementRegistry; 91 class DocGroup; 92 class Document; 93 class External; 94 class Function; 95 class Gamepad; 96 enum class ImageBitmapFormat : uint8_t; 97 class IntlUtils; 98 class Location; 99 class MediaQueryList; 100 class Navigator; 101 class Promise; 102 class PostMessageData; 103 class PostMessageEvent; 104 class PrintPreviewResultInfo; 105 struct RequestInit; 106 class Selection; 107 struct SizeToContentConstraints; 108 class SpeechSynthesis; 109 class Timeout; 110 class U2F; 111 class VRDisplay; 112 enum class VRDisplayEventReason : uint8_t; 113 class VREventObserver; 114 class WakeLock; 115 class Worklet; 116 namespace cache { 117 class CacheStorage; 118 } // namespace cache 119 class IDBFactory; 120 } // namespace dom 121 namespace layout { 122 class RemotePrintJobChild; 123 } // namespace layout 124 } // namespace mozilla 125 126 extern const JSClass OuterWindowProxyClass; 127 128 //***************************************************************************** 129 // nsGlobalWindowOuter 130 //***************************************************************************** 131 132 // nsGlobalWindowOuter inherits PRCList for maintaining a list of all inner 133 // windows still in memory for any given outer window. This list is needed to 134 // ensure that mOuterWindow doesn't end up dangling. The nature of PRCList means 135 // that the window itself is always in the list, and an outer window's list will 136 // also contain all inner window objects that are still in memory (and in 137 // reality all inner window object's lists also contain its outer and all other 138 // inner windows belonging to the same outer window, but that's an unimportant 139 // side effect of inheriting PRCList). 140 141 class nsGlobalWindowOuter final : public mozilla::dom::EventTarget, 142 public nsPIDOMWindowOuter, 143 private nsIDOMWindow, 144 public nsIScriptGlobalObject, 145 public nsIScriptObjectPrincipal, 146 public nsSupportsWeakReference, 147 public nsIInterfaceRequestor, 148 public PRCListStr { 149 public: 150 using OuterWindowByIdTable = 151 nsTHashMap<nsUint64HashKey, nsGlobalWindowOuter*>; 152 153 using PrintPreviewResolver = 154 std::function<void(const mozilla::dom::PrintPreviewResultInfo&)>; 155 156 static void AssertIsOnMainThread() 157 #ifdef DEBUG 158 ; 159 #else 160 { 161 } 162 #endif 163 164 static nsGlobalWindowOuter* Cast(nsPIDOMWindowOuter* aPIWin) { 165 return static_cast<nsGlobalWindowOuter*>(aPIWin); 166 } 167 static const nsGlobalWindowOuter* Cast(const nsPIDOMWindowOuter* aPIWin) { 168 return static_cast<const nsGlobalWindowOuter*>(aPIWin); 169 } 170 static nsGlobalWindowOuter* Cast(mozIDOMWindowProxy* aWin) { 171 return Cast(nsPIDOMWindowOuter::From(aWin)); 172 } 173 174 bool IsOuterWindow() const final { return true; } // Overriding EventTarget 175 176 static nsGlobalWindowOuter* GetOuterWindowWithId(uint64_t aWindowID) { 177 AssertIsOnMainThread(); 178 179 if (!sOuterWindowsById) { 180 return nullptr; 181 } 182 183 nsGlobalWindowOuter* outerWindow = sOuterWindowsById->Get(aWindowID); 184 return outerWindow; 185 } 186 187 static OuterWindowByIdTable* GetWindowsTable() { 188 AssertIsOnMainThread(); 189 190 return sOuterWindowsById; 191 } 192 193 static nsGlobalWindowOuter* FromSupports(nsISupports* supports) { 194 // Make sure this matches the casts we do in QueryInterface(). 195 return (nsGlobalWindowOuter*)(mozilla::dom::EventTarget*)supports; 196 } 197 198 static already_AddRefed<nsGlobalWindowOuter> Create(nsDocShell* aDocShell, 199 bool aIsChrome); 200 201 // public methods 202 nsPIDOMWindowOuter* GetPrivateParent(); 203 204 // callback for close event 205 void ReallyCloseWindow(); 206 207 // nsISupports 208 NS_DECL_ISUPPORTS_INHERITED 209 NS_IMETHOD_(void) DeleteCycleCollectable() override; 210 211 // nsWrapperCache 212 virtual JSObject* WrapObject(JSContext* cx, 213 JS::Handle<JSObject*> aGivenProto) override { 214 return EnsureInnerWindow() ? GetWrapper() : nullptr; 215 } 216 217 // nsIGlobalObject 218 bool ShouldResistFingerprinting(RFPTarget aTarget) const final; 219 mozilla::OriginTrials Trials() const final; 220 mozilla::dom::FontFaceSet* GetFonts() final; 221 222 // nsIGlobalJSObjectHolder 223 JSObject* GetGlobalJSObject() final { return GetWrapper(); } 224 JSObject* GetGlobalJSObjectPreserveColor() const final { 225 return GetWrapperPreserveColor(); 226 } 227 228 virtual nsresult EnsureScriptEnvironment() override; 229 230 virtual nsIScriptContext* GetScriptContext() override; 231 232 void PoisonOuterWindowProxy(JSObject* aObject); 233 234 virtual bool IsBlackForCC(bool aTracingNeeded = true) override; 235 236 // nsIScriptObjectPrincipal 237 virtual nsIPrincipal* GetPrincipal() override; 238 239 virtual nsIPrincipal* GetEffectiveCookiePrincipal() override; 240 241 virtual nsIPrincipal* GetEffectiveStoragePrincipal() override; 242 243 virtual nsIPrincipal* PartitionedPrincipal() override; 244 245 // nsIDOMWindow 246 NS_DECL_NSIDOMWINDOW 247 248 mozilla::dom::ChromeMessageBroadcaster* GetMessageManager(); 249 mozilla::dom::ChromeMessageBroadcaster* GetGroupMessageManager( 250 const nsAString& aGroup); 251 252 nsresult OpenJS(const nsACString& aUrl, const nsAString& aName, 253 const nsAString& aOptions, 254 mozilla::dom::BrowsingContext** _retval); 255 256 virtual mozilla::EventListenerManager* GetExistingListenerManager() 257 const override; 258 259 virtual mozilla::EventListenerManager* GetOrCreateListenerManager() override; 260 261 bool ComputeDefaultWantsUntrusted(mozilla::ErrorResult& aRv) final; 262 263 virtual nsPIDOMWindowOuter* GetOwnerGlobalForBindingsInternal() override; 264 265 virtual nsIGlobalObject* GetOwnerGlobal() const override; 266 267 EventTarget* GetTargetForEventTargetChain() override; 268 269 using mozilla::dom::EventTarget::DispatchEvent; 270 bool DispatchEvent(mozilla::dom::Event& aEvent, 271 mozilla::dom::CallerType aCallerType, 272 mozilla::ErrorResult& aRv) override; 273 274 void GetEventTargetParent(mozilla::EventChainPreVisitor& aVisitor) override; 275 276 nsresult PostHandleEvent(mozilla::EventChainPostVisitor& aVisitor) override; 277 278 // nsPIDOMWindow 279 virtual nsPIDOMWindowOuter* GetPrivateRoot() override; 280 281 // Outer windows only. 282 virtual void SetIsBackground(bool aIsBackground) override; 283 virtual void SetChromeEventHandler( 284 mozilla::dom::EventTarget* aChromeEventHandler) override; 285 286 // Outer windows only. 287 virtual void SetInitialPrincipal(nsIPrincipal* aNewWindowPrincipal) override; 288 289 virtual already_AddRefed<nsISupports> SaveWindowState() override; 290 MOZ_CAN_RUN_SCRIPT_BOUNDARY virtual nsresult RestoreWindowState( 291 nsISupports* aState) override; 292 293 virtual bool IsSuspended() const override; 294 virtual bool IsFrozen() const override; 295 296 virtual nsresult FireDelayedDOMEvents(bool aIncludeSubWindows) override; 297 298 // Outer windows only. 299 bool WouldReuseInnerWindow(Document* aNewDocument); 300 301 void DetachFromDocShell(bool aIsBeingDiscarded); 302 303 // aState is only non-null if we are restoring from the bfcache. 304 // aForceReuseInnerWindow is only true if we are being triggered via XSLT. 305 // aActor is only non-null if the new document is about:blank. 306 virtual nsresult SetNewDocument( 307 Document* aDocument, nsISupports* aState, bool aForceReuseInnerWindow, 308 mozilla::dom::WindowGlobalChild* aActor = nullptr) override; 309 310 // Outer windows only. 311 static void PrepareForProcessChange(JSObject* aProxy); 312 313 // Outer windows only. 314 void DispatchDOMWindowCreated(); 315 316 // Outer windows only. 317 virtual void EnsureSizeAndPositionUpToDate() override; 318 319 virtual void SuppressEventHandling() override; 320 virtual void UnsuppressEventHandling() override; 321 322 MOZ_CAN_RUN_SCRIPT_BOUNDARY virtual nsGlobalWindowOuter* EnterModalState() 323 override; 324 virtual void LeaveModalState() override; 325 326 // Outer windows only. 327 virtual bool CanClose() override; 328 virtual void ForceClose() override; 329 330 // Outer windows only. 331 virtual bool DispatchCustomEvent( 332 const nsAString& aEventName, 333 mozilla::ChromeOnlyDispatch aChromeOnlyDispatch) override; 334 335 // For accessing protected field mFullscreen 336 friend class FullscreenTransitionTask; 337 338 // Outer windows only. 339 nsresult SetFullscreenInternal(FullscreenReason aReason, 340 bool aIsFullscreen) final; 341 void FullscreenWillChange(bool aIsFullscreen) final; 342 void FinishFullscreenChange(bool aIsFullscreen) final; 343 void ForceFullScreenInWidget() final; 344 void MacFullscreenMenubarOverlapChanged( 345 mozilla::DesktopCoord aOverlapAmount) final; 346 bool SetWidgetFullscreen(FullscreenReason aReason, bool aIsFullscreen, 347 nsIWidget* aWidget); 348 bool Fullscreen() const; 349 350 // nsIInterfaceRequestor 351 NS_DECL_NSIINTERFACEREQUESTOR 352 353 mozilla::dom::Nullable<mozilla::dom::WindowProxyHolder> IndexedGetterOuter( 354 uint32_t aIndex); 355 356 already_AddRefed<nsPIDOMWindowOuter> GetInProcessTop() override; 357 // Similar to GetInProcessTop() except that it stops at content frames that 358 // an extension has permission to access. This is used by the third-party 359 // util service in order to determine the top window for a channel which is 360 // used in third-partiness checks. 361 already_AddRefed<nsPIDOMWindowOuter> 362 GetTopExcludingExtensionAccessibleContentFrames(nsIURI* aURIBeingLoaded); 363 nsPIDOMWindowOuter* GetInProcessScriptableTop() override; 364 inline nsGlobalWindowOuter* GetInProcessTopInternal(); 365 366 inline nsGlobalWindowOuter* GetInProcessScriptableTopInternal(); 367 368 already_AddRefed<mozilla::dom::BrowsingContext> GetChildWindow( 369 const nsAString& aName); 370 371 // Returns true if we've reached the state in windows of this BC group 372 // where we ask the user if further dialogs should be blocked. 373 // 374 // This function is implemented in terms of 375 // BrowsingContextGroup::DialogsAreBeingAbused. 376 bool ShouldPromptToBlockDialogs(); 377 378 // These functions are used for controlling and determining whether dialogs 379 // (alert, prompt, confirm) are currently allowed in this browsing context 380 // group. If you want to temporarily disable dialogs, please use 381 // TemporarilyDisableDialogs, not EnableDialogs/DisableDialogs, because 382 // correctly determining whether to re-enable dialogs is actually quite 383 // difficult. 384 void EnableDialogs(); 385 void DisableDialogs(); 386 // Outer windows only. 387 bool AreDialogsEnabled(); 388 389 class MOZ_RAII TemporarilyDisableDialogs { 390 public: 391 explicit TemporarilyDisableDialogs(mozilla::dom::BrowsingContext* aBC); 392 ~TemporarilyDisableDialogs(); 393 394 private: 395 // This is the browsing context group whose dialog state we messed 396 // with. We just want to keep it alive, because we plan to poke at its 397 // members in our destructor. 398 RefPtr<mozilla::dom::BrowsingContextGroup> mGroup; 399 // This is not a AutoRestore<bool> because that would require careful 400 // member destructor ordering, which is a bit fragile. This way we can 401 // explicitly restore things before we drop our ref to mGroup. 402 bool mSavedDialogsEnabled = false; 403 }; 404 friend class TemporarilyDisableDialogs; 405 406 nsIScriptContext* GetContextInternal(); 407 408 bool IsCreatingInnerWindow() const { return mCreatingInnerWindow; } 409 410 bool IsChromeWindow() const { return mIsChrome; } 411 412 // GetScrollContainerFrame does not flush. Callers should do it themselves as 413 // needed, depending on which info they actually want off the scroll container 414 // frame. 415 mozilla::ScrollContainerFrame* GetScrollContainerFrame(); 416 417 // Outer windows only. 418 void UnblockScriptedClosing(); 419 420 static void Init(); 421 static void ShutDown(); 422 static bool IsCallerChrome(); 423 424 friend class WindowStateHolder; 425 426 NS_DECL_CYCLE_COLLECTION_SKIPPABLE_SCRIPT_HOLDER_CLASS_AMBIGUOUS( 427 nsGlobalWindowOuter, mozilla::dom::EventTarget) 428 429 virtual bool TakeFocus(bool aFocus, uint32_t aFocusMethod) override; 430 virtual void SetReadyForFocus() override; 431 virtual void PageHidden(bool aIsEnteringBFCacheInParent) override; 432 433 /** 434 * Set a arguments for this window. This will be set on the window 435 * right away (if there's an existing document) and it will also be 436 * installed on the window when the next document is loaded. 437 * 438 * This function passes |arguments| back from nsWindowWatcher to 439 * nsGlobalWindow. 440 */ 441 nsresult SetArguments(nsIArray* aArguments); 442 443 bool IsClosedOrClosing() { 444 return (mIsClosed || mInClose || mHavePendingClose || mCleanedUp); 445 } 446 447 bool IsCleanedUp() const { return mCleanedUp; } 448 449 virtual void FirePopupBlockedEvent( 450 nsIURI* aPopupURI, const nsAString& aPopupWindowName, 451 const nsAString& aPopupWindowFeatures) override; 452 virtual void FireRedirectBlockedEvent(nsIURI* aRedirectURI) override; 453 454 void AddSizeOfIncludingThis(nsWindowSizes& aWindowSizes) const; 455 456 void AllowScriptsToClose() { mAllowScriptsToClose = true; } 457 458 // Outer windows only. 459 uint32_t GetAutoActivateVRDisplayID(); 460 // Outer windows only. 461 void SetAutoActivateVRDisplayID(uint32_t aAutoActivateVRDisplayID); 462 463 #define EVENT(name_, id_, type_, struct_) \ 464 mozilla::dom::EventHandlerNonNull* GetOn##name_() { \ 465 mozilla::EventListenerManager* elm = GetExistingListenerManager(); \ 466 return elm ? elm->GetEventHandler(nsGkAtoms::on##name_) : nullptr; \ 467 } \ 468 void SetOn##name_(mozilla::dom::EventHandlerNonNull* handler) { \ 469 mozilla::EventListenerManager* elm = GetOrCreateListenerManager(); \ 470 if (elm) { \ 471 elm->SetEventHandler(nsGkAtoms::on##name_, handler); \ 472 } \ 473 } 474 #define ERROR_EVENT(name_, id_, type_, struct_) \ 475 mozilla::dom::OnErrorEventHandlerNonNull* GetOn##name_() { \ 476 mozilla::EventListenerManager* elm = GetExistingListenerManager(); \ 477 return elm ? elm->GetOnErrorEventHandler() : nullptr; \ 478 } \ 479 void SetOn##name_(mozilla::dom::OnErrorEventHandlerNonNull* handler) { \ 480 mozilla::EventListenerManager* elm = GetOrCreateListenerManager(); \ 481 if (elm) { \ 482 elm->SetEventHandler(handler); \ 483 } \ 484 } 485 #define BEFOREUNLOAD_EVENT(name_, id_, type_, struct_) \ 486 mozilla::dom::OnBeforeUnloadEventHandlerNonNull* GetOn##name_() { \ 487 mozilla::EventListenerManager* elm = GetExistingListenerManager(); \ 488 return elm ? elm->GetOnBeforeUnloadEventHandler() : nullptr; \ 489 } \ 490 void SetOn##name_( \ 491 mozilla::dom::OnBeforeUnloadEventHandlerNonNull* handler) { \ 492 mozilla::EventListenerManager* elm = GetOrCreateListenerManager(); \ 493 if (elm) { \ 494 elm->SetEventHandler(handler); \ 495 } \ 496 } 497 #define WINDOW_ONLY_EVENT EVENT 498 #define TOUCH_EVENT EVENT 499 #include "mozilla/EventNameList.h" 500 #undef TOUCH_EVENT 501 #undef WINDOW_ONLY_EVENT 502 #undef BEFOREUNLOAD_EVENT 503 #undef ERROR_EVENT 504 #undef EVENT 505 506 nsISupports* GetParentObject() { return nullptr; } 507 508 Document* GetDocument() { return GetDoc(); } 509 void GetNameOuter(nsAString& aName); 510 void SetNameOuter(const nsAString& aName, mozilla::ErrorResult& aError); 511 mozilla::dom::Location* GetLocation() override; 512 void GetStatusOuter(nsAString& aStatus); 513 void SetStatusOuter(const nsAString& aStatus); 514 void CloseOuter(bool aTrustedCaller); 515 nsresult Close() override; 516 bool GetClosedOuter(); 517 bool Closed() override; 518 void StopOuter(mozilla::ErrorResult& aError); 519 // TODO: Convert FocusOuter() to MOZ_CAN_RUN_SCRIPT and get rid of the 520 // kungFuDeathGrip in it. 521 MOZ_CAN_RUN_SCRIPT_BOUNDARY void FocusOuter( 522 mozilla::dom::CallerType aCallerType, bool aFromOtherProcess, 523 uint64_t aActionId); 524 nsresult Focus(mozilla::dom::CallerType aCallerType) override; 525 // TODO: Convert BlurOuter() to MOZ_CAN_RUN_SCRIPT and get rid of the 526 // kungFuDeathGrip in it. 527 MOZ_CAN_RUN_SCRIPT_BOUNDARY void BlurOuter( 528 mozilla::dom::CallerType aCallerType); 529 mozilla::dom::WindowProxyHolder GetFramesOuter(); 530 uint32_t Length(); 531 mozilla::dom::Nullable<mozilla::dom::WindowProxyHolder> GetTopOuter(); 532 533 nsresult GetPrompter(nsIPrompt** aPrompt) override; 534 535 protected: 536 mozilla::dom::Nullable<mozilla::dom::WindowProxyHolder> 537 GetOpenerWindowOuter(); 538 // Initializes the mWasOffline member variable 539 void InitWasOffline(); 540 541 public: 542 nsPIDOMWindowOuter* GetSameProcessOpener(); 543 already_AddRefed<mozilla::dom::BrowsingContext> GetOpenerBrowsingContext(); 544 mozilla::dom::Nullable<mozilla::dom::WindowProxyHolder> GetOpener() override; 545 mozilla::dom::Nullable<mozilla::dom::WindowProxyHolder> GetParentOuter(); 546 already_AddRefed<nsPIDOMWindowOuter> GetInProcessParent() override; 547 nsPIDOMWindowOuter* GetInProcessScriptableParent() override; 548 nsPIDOMWindowOuter* GetInProcessScriptableParentOrNull() override; 549 mozilla::dom::Element* GetFrameElement(nsIPrincipal& aSubjectPrincipal); 550 mozilla::dom::Element* GetFrameElement() override; 551 mozilla::dom::Nullable<mozilla::dom::WindowProxyHolder> OpenOuter( 552 const nsAString& aUrl, const nsAString& aName, const nsAString& aOptions, 553 mozilla::ErrorResult& aError); 554 nsresult Open(const nsACString& aUrl, const nsAString& aName, 555 const nsAString& aOptions, nsDocShellLoadState* aLoadState, 556 bool aForceNoOpener, 557 mozilla::dom::BrowsingContext** _retval) override; 558 mozilla::dom::Navigator* GetNavigator() override; 559 560 protected: 561 bool AlertOrConfirm(bool aAlert, const nsAString& aMessage, 562 nsIPrincipal& aSubjectPrincipal, 563 mozilla::ErrorResult& aError); 564 565 public: 566 void AlertOuter(const nsAString& aMessage, nsIPrincipal& aSubjectPrincipal, 567 mozilla::ErrorResult& aError); 568 bool ConfirmOuter(const nsAString& aMessage, nsIPrincipal& aSubjectPrincipal, 569 mozilla::ErrorResult& aError); 570 void PromptOuter(const nsAString& aMessage, const nsAString& aInitial, 571 nsAString& aReturn, nsIPrincipal& aSubjectPrincipal, 572 mozilla::ErrorResult& aError); 573 574 MOZ_CAN_RUN_SCRIPT void PrintOuter(mozilla::ErrorResult& aError); 575 576 enum class IsPreview : bool { No, Yes }; 577 enum class IsForWindowDotPrint : bool { No, Yes }; 578 MOZ_CAN_RUN_SCRIPT mozilla::dom::Nullable<mozilla::dom::WindowProxyHolder> 579 Print(nsIPrintSettings*, 580 mozilla::layout::RemotePrintJobChild* aRemotePrintJob, 581 nsIWebProgressListener*, nsIDocShell*, IsPreview, IsForWindowDotPrint, 582 PrintPreviewResolver&&, RefPtr<mozilla::dom::BrowsingContext>*, 583 mozilla::ErrorResult&); 584 mozilla::dom::Selection* GetSelectionOuter(); 585 already_AddRefed<mozilla::dom::Selection> GetSelection() override; 586 nsScreen* GetScreen(); 587 void MoveToOuter(int32_t aXPos, int32_t aYPos, 588 mozilla::dom::CallerType aCallerType, 589 mozilla::ErrorResult& aError); 590 void MoveByOuter(int32_t aXDif, int32_t aYDif, 591 mozilla::dom::CallerType aCallerType, 592 mozilla::ErrorResult& aError); 593 nsresult MoveBy(int32_t aXDif, int32_t aYDif) override; 594 void ResizeToOuter(int32_t aWidth, int32_t aHeight, 595 mozilla::dom::CallerType aCallerType, 596 mozilla::ErrorResult& aError); 597 void ResizeByOuter(int32_t aWidthDif, int32_t aHeightDif, 598 mozilla::dom::CallerType aCallerType, 599 mozilla::ErrorResult& aError); 600 double GetScrollXOuter(); 601 double GetScrollYOuter(); 602 603 MOZ_CAN_RUN_SCRIPT_BOUNDARY 604 void SizeToContentOuter(const mozilla::dom::SizeToContentConstraints&, 605 mozilla::ErrorResult&); 606 nsIControllers* GetControllersOuter(mozilla::ErrorResult& aError); 607 nsresult GetControllers(nsIControllers** aControllers) override; 608 float GetMozInnerScreenXOuter(mozilla::dom::CallerType aCallerType); 609 float GetMozInnerScreenYOuter(mozilla::dom::CallerType aCallerType); 610 bool GetFullscreenOuter(); 611 bool GetFullScreen() override; 612 void SetFullscreenOuter(bool aFullscreen, mozilla::ErrorResult& aError); 613 nsresult SetFullScreen(bool aFullscreen) override; 614 bool FindOuter(const nsAString& aString, bool aCaseSensitive, bool aBackwards, 615 bool aWrapAround, bool aWholeWord, bool aSearchInFrames, 616 bool aShowDialog, mozilla::ErrorResult& aError); 617 618 mozilla::dom::Nullable<mozilla::dom::WindowProxyHolder> OpenDialogOuter( 619 JSContext* aCx, const nsAString& aUrl, const nsAString& aName, 620 const nsAString& aOptions, 621 const mozilla::dom::Sequence<JS::Value>& aExtraArgument, 622 mozilla::ErrorResult& aError); 623 nsresult OpenDialog(const nsACString& aUrl, const nsAString& aName, 624 const nsAString& aOptions, nsIArray* aArguments, 625 mozilla::dom::BrowsingContext** _retval) override; 626 void UpdateCommands(const nsAString& anAction) override; 627 628 already_AddRefed<mozilla::dom::BrowsingContext> GetContentInternal( 629 mozilla::dom::CallerType aCallerType, mozilla::ErrorResult& aError); 630 void GetContentOuter(JSContext* aCx, JS::MutableHandle<JSObject*> aRetval, 631 mozilla::dom::CallerType aCallerType, 632 mozilla::ErrorResult& aError); 633 634 // ChromeWindow bits. Do NOT call these unless your window is in 635 // fact chrome. 636 nsIBrowserDOMWindow* GetBrowserDOMWindow(); 637 void SetBrowserDOMWindowOuter(nsIBrowserDOMWindow* aBrowserWindow); 638 void SetCursorOuter(const nsACString& aCursor, mozilla::ErrorResult& aError); 639 640 already_AddRefed<nsWindowRoot> GetWindowRootOuter(); 641 642 nsIDOMWindowUtils* WindowUtils(); 643 644 virtual bool IsInSyncOperation() override; 645 646 public: 647 MOZ_CAN_RUN_SCRIPT double GetInnerWidthOuter(mozilla::ErrorResult& aError); 648 649 protected: 650 MOZ_CAN_RUN_SCRIPT nsresult GetInnerWidth(double* aInnerWidth) override; 651 652 public: 653 MOZ_CAN_RUN_SCRIPT double GetInnerHeightOuter(mozilla::ErrorResult& aError); 654 655 protected: 656 MOZ_CAN_RUN_SCRIPT nsresult GetInnerHeight(double* aInnerHeight) override; 657 int32_t GetScreenXOuter(mozilla::dom::CallerType aCallerType, 658 mozilla::ErrorResult& aError); 659 int32_t GetScreenYOuter(mozilla::dom::CallerType aCallerType, 660 mozilla::ErrorResult& aError); 661 int32_t GetOuterWidthOuter(mozilla::dom::CallerType aCallerType, 662 mozilla::ErrorResult& aError); 663 int32_t GetOuterHeightOuter(mozilla::dom::CallerType aCallerType, 664 mozilla::ErrorResult& aError); 665 666 friend class HashchangeCallback; 667 friend class mozilla::dom::BarProp; 668 669 // Object Management 670 virtual ~nsGlobalWindowOuter(); 671 void DropOuterWindowDocs(); 672 void CleanUp(); 673 void ClearControllers(); 674 // Outer windows only. 675 void FinalClose(); 676 677 inline void MaybeClearInnerWindow(nsPIDOMWindowInner* aExpectedInner); 678 679 // Get the parent, returns null if this is a toplevel window 680 nsPIDOMWindowOuter* GetInProcessParentInternal(); 681 682 protected: 683 // Window Control Functions 684 685 // Outer windows only. 686 virtual nsresult OpenNoNavigate( 687 const nsACString& aUrl, const nsAString& aName, const nsAString& aOptions, 688 mozilla::dom::BrowsingContext** _retval) override; 689 690 private: 691 explicit nsGlobalWindowOuter(uint64_t aWindowID); 692 693 enum class PrintKind : uint8_t { None, InternalPrint, WindowDotPrint }; 694 695 /** 696 * @param aUrl the URL we intend to load into the window. If aNavigate is 697 * true, we'll actually load this URL into the window. Otherwise, 698 * aUrl is advisory; OpenInternal will not load the URL into the 699 * new window. 700 * 701 * @param aName the name to use for the new window 702 * 703 * @param aOptions the window options to use for the new window 704 * 705 * @param aDialog true when called from variants of OpenDialog. If this is 706 * true, this method will skip popup blocking checks. The aDialog 707 * argument is passed on to the window watcher. 708 * 709 * @param aCalledNoScript true when called via the [noscript] open() 710 * and openDialog() methods. When this is true, we do NOT want to use 711 * the JS stack for things like caller determination. 712 * 713 * @param aDoJSFixups true when this is the content-accessible JS version of 714 * window opening. When true, popups do not cause us to throw, we save 715 * the caller's principal in the new window for later consumption, and 716 * we make sure that there is a document in the newly-opened window. 717 * Note that this last will only be done if the newly-opened window is 718 * non-chrome. 719 * 720 * @param aNavigate true if we should navigate to the provided URL, false 721 * otherwise. When aNavigate is false, we also skip our can-load 722 * security check, on the assumption that whoever *actually* loads this 723 * page will do their own security check. 724 * 725 * @param aArguments The arguments to pass to the new window. The first three 726 * args, if present, will be aUrl, aName, and aOptions. So 727 * this param only matters if there are more than 3 728 * arguments. 729 * 730 * @param aLoadState to be passed on along to the windowwatcher. 731 * 732 * @param aForceNoOpener if true, will act as if "noopener" were passed in 733 * aOptions, but without affecting any other window 734 * features. 735 * 736 * @param aPrintKind Whether this is a browser created for printing, and 737 * if so for which kind of print. 738 * 739 * @param aReturn [out] The window that was opened, if any. Will be null if 740 * aForceNoOpener is true of if aOptions contains 741 * "noopener". 742 * 743 * Outer windows only. 744 */ 745 nsresult OpenInternal(const nsACString& aUrl, const nsAString& aName, 746 const nsAString& aOptions, bool aDialog, 747 bool aCalledNoScript, bool aDoJSFixups, bool aNavigate, 748 nsIArray* aArguments, nsDocShellLoadState* aLoadState, 749 bool aForceNoOpener, PrintKind aPrintKind, 750 mozilla::dom::BrowsingContext** aReturn); 751 752 mozilla::Result<already_AddRefed<nsIURI>, nsresult> 753 URIfromURLAndMaybeDoSecurityCheck(const nsACString& aURL, 754 bool aSecurityCheck); 755 756 public: 757 mozilla::dom::PopupBlocker::PopupControlState RevisePopupAbuseLevel( 758 mozilla::dom::PopupBlocker::PopupControlState aState); 759 760 void FlushPendingNotifications(mozilla::FlushType aType); 761 762 // Outer windows only. 763 void EnsureReflowFlushAndPaint(); 764 void CheckSecurityWidthAndHeight(int32_t* width, int32_t* height, 765 mozilla::dom::CallerType aCallerType); 766 void CheckSecurityLeftAndTop(int32_t* left, int32_t* top, 767 mozilla::dom::CallerType aCallerType); 768 769 // Outer windows only. 770 // Arguments to this function should have values in app units 771 void SetCSSViewportWidthAndHeight(nscoord width, nscoord height); 772 773 static bool CanSetProperty(const char* aPrefName); 774 775 static void MakeMessageWithPrincipal(nsAString& aOutMessage, 776 nsIPrincipal* aSubjectPrincipal, 777 bool aUseHostPort, 778 const char* aNullMessage, 779 const char* aContentMessage, 780 const char* aFallbackMessage); 781 782 // Outer windows only. 783 MOZ_CAN_RUN_SCRIPT_BOUNDARY 784 bool CanMoveResizeWindows(mozilla::dom::CallerType aCallerType, bool aIsMove, 785 mozilla::ErrorResult& aError); 786 787 // If aDoFlush is true, we'll flush our own layout; otherwise we'll try to 788 // just flush our parent and only flush ourselves if we think we need to. 789 // Outer windows only. 790 mozilla::CSSPoint GetScrollXY(bool aDoFlush); 791 792 int32_t GetScrollBoundaryOuter(mozilla::Side aSide); 793 794 // Outer windows only. 795 MOZ_CAN_RUN_SCRIPT nsresult GetInnerSize(mozilla::CSSSize& aSize); 796 mozilla::CSSIntSize GetOuterSize(mozilla::dom::CallerType aCallerType, 797 mozilla::ErrorResult& aError); 798 nsRect GetInnerScreenRect(); 799 static mozilla::Maybe<mozilla::CSSIntSize> GetRDMDeviceSize( 800 const Document& aDocument); 801 802 // Outer windows only. 803 // If aLookForCallerOnJSStack is true, this method will look at the JS stack 804 // to determine who the caller is. If it's false, it'll use |this| as the 805 // caller. 806 bool WindowExists(const nsAString& aName, bool aForceNoOpener, 807 bool aLookForCallerOnJSStack); 808 809 already_AddRefed<nsIWidget> GetMainWidget(); 810 nsIWidget* GetNearestWidget() const; 811 812 bool IsInModalState(); 813 814 // Convenience functions for the methods which call methods of nsIBaseWindow 815 // because it takes/returns device pixels. Unfortunately, mPresContext may 816 // have older scale value for the corresponding widget. Therefore, these 817 // helper methods convert between CSS pixels and device pixels with aWindow. 818 // 819 // FIXME(emilio): Seems like updating the pres context dpi sync shouldn't be 820 // all that much work and should avoid some hackiness? 821 mozilla::CSSToLayoutDeviceScale CSSToDevScaleForBaseWindow(nsIBaseWindow*); 822 823 void SetFocusedElement(mozilla::dom::Element* aElement, 824 uint32_t aFocusMethod = 0, 825 bool aNeedsFocus = false) override; 826 827 uint32_t GetFocusMethod() override; 828 829 bool ShouldShowFocusRing() override; 830 831 public: 832 already_AddRefed<nsPIWindowRoot> GetTopWindowRoot() override; 833 834 protected: 835 void NotifyWindowIDDestroyed(const char* aTopic); 836 837 void ClearStatus(); 838 839 void UpdateParentTarget() override; 840 841 protected: 842 // Helper for getComputedStyle and getDefaultComputedStyle 843 already_AddRefed<nsDOMCSSDeclaration> GetComputedStyleHelperOuter( 844 mozilla::dom::Element& aElt, const nsAString& aPseudoElt, 845 bool aDefaultStylesOnly, mozilla::ErrorResult& aRv); 846 847 // Outer windows only. 848 void PreloadLocalStorage(); 849 850 mozilla::CSSPoint ScreenEdgeSlop(); 851 mozilla::CSSCoord ScreenEdgeSlopX() { return ScreenEdgeSlop().X(); } 852 mozilla::CSSCoord ScreenEdgeSlopY() { return ScreenEdgeSlop().Y(); } 853 854 // Returns CSS pixels based on primary screen. Outer windows only. 855 mozilla::CSSIntPoint GetScreenXY(mozilla::dom::CallerType aCallerType, 856 mozilla::ErrorResult& aError); 857 858 void PostMessageMozOuter(JSContext* aCx, JS::Handle<JS::Value> aMessage, 859 const nsAString& aTargetOrigin, 860 JS::Handle<JS::Value> aTransfer, 861 nsIPrincipal& aSubjectPrincipal, 862 mozilla::ErrorResult& aError); 863 864 public: 865 /** 866 * Compute the principal to use for checking against the target principal in a 867 * postMessage call. 868 * 869 * @param aTargetOrigin The value passed as the targetOrigin argument to the 870 * postMessage call. 871 * 872 * @param aTargetOriginURI The origin of the URI contained in aTargetOrigin 873 * (see GatherPostMessageData). 874 * 875 * @param aCallerPrincipal The principal of the incumbent global of the 876 * postMessage call (see GatherPostMessageData). 877 * 878 * @param aSubjectPrincipal The subject principal for the postMessage call. 879 * 880 * @param aProvidedPrincipal [out] The principal to use for checking against 881 * the target's principal. 882 * 883 * @return Whether the postMessage call should continue or return now. 884 */ 885 bool GetPrincipalForPostMessage(const nsAString& aTargetOrigin, 886 nsIURI* aTargetOriginURI, 887 nsIPrincipal* aCallerPrincipal, 888 nsIPrincipal& aSubjectPrincipal, 889 nsIPrincipal** aProvidedPrincipal); 890 891 private: 892 /** 893 * Gather the necessary data from the caller for a postMessage call. 894 * 895 * @param aCx The JSContext. 896 * 897 * @param aTargetOrigin The value passed as the targetOrigin argument to the 898 * postMessage call. 899 * 900 * @param aSource [out] The browsing context for the incumbent global. 901 * 902 * @param aOrigin [out] The value to use for the origin property of the 903 * MessageEvent object. 904 * 905 * @param aTargetOriginURI [out] The origin of the URI contained in 906 * aTargetOrigin, null if aTargetOrigin is "/" or "*". 907 * 908 * @param aCallerPrincipal [out] The principal of the incumbent global of the 909 * postMessage call. 910 * 911 * @param aCallerInnerWindow [out] Inner window of the caller of 912 * postMessage, or null if the incumbent global is not a Window. 913 * 914 * @param aCallerURI [out] The URI of the document of the incumbent 915 * global if it's a Window, null otherwise. 916 * 917 * @param aCallerAgentCluterId [out] If a non-nullptr is passed, it would 918 * return the caller's agent cluster id. 919 * 920 * @param aScriptLocation [out] If we do not have a caller's URI, then 921 * use script location as a sourcename for creating an error object. 922 * 923 * @param aError [out] The error, if any. 924 * 925 * @return Whether the postMessage call should continue or return now. 926 */ 927 static bool GatherPostMessageData( 928 JSContext* aCx, const nsAString& aTargetOrigin, 929 mozilla::dom::BrowsingContext** aSource, nsAString& aOrigin, 930 nsIURI** aTargetOriginURI, nsIPrincipal** aCallerPrincipal, 931 nsGlobalWindowInner** aCallerInnerWindow, nsIURI** aCallerURI, 932 mozilla::Maybe<nsID>* aCallerAgentClusterId, nsACString* aScriptLocation, 933 mozilla::ErrorResult& aError); 934 935 // Helper called after moving/resizing, to update docShell's presContext 936 // if we have caused a resolution change by moving across monitors. 937 void CheckForDPIChange(); 938 939 private: 940 enum class SecureContextFlags { eDefault, eIgnoreOpener }; 941 // Called only on outer windows to compute the value that will be returned by 942 // IsSecureContext() for the inner window that corresponds to aDocument. 943 bool ComputeIsSecureContext( 944 Document* aDocument, 945 SecureContextFlags aFlags = SecureContextFlags::eDefault); 946 947 void SetDocShell(nsDocShell* aDocShell); 948 949 // nsPIDOMWindow{Inner,Outer} should be able to see these helper methods. 950 friend class nsPIDOMWindowInner; 951 friend class nsPIDOMWindowOuter; 952 953 void SetIsBackgroundInternal(bool aIsBackground); 954 955 nsresult GetInterfaceInternal(const nsIID& aIID, void** aSink); 956 957 void MaybeAllowStorageForOpenedWindow(nsIURI* aURI); 958 959 void MaybeResetWindowName(Document* aNewDocument); 960 961 public: 962 bool DelayedPrintUntilAfterLoad() const { 963 return mDelayedPrintUntilAfterLoad; 964 } 965 966 bool DelayedCloseForPrinting() const { return mDelayedCloseForPrinting; } 967 968 void StopDelayingPrintingUntilAfterLoad() { 969 mShouldDelayPrintUntilAfterLoad = false; 970 } 971 972 // Dispatch a runnable related to the global. 973 nsresult Dispatch(already_AddRefed<nsIRunnable>&&) const final; 974 nsISerialEventTarget* SerialEventTarget() const final; 975 976 protected: 977 nsresult ProcessWidgetFullscreenRequest(FullscreenReason aReason, 978 bool aFullscreen); 979 980 // Indicates whether browser window should be in fullscreen mode and the 981 // reason, e.g. browser fullscreen mode or DOM fullscreen API, which should 982 // never be ForForceExitFullscreen. Nothing if browser window should not be in 983 // fullscreen mode. 984 mozilla::Maybe<FullscreenReason> mFullscreen; 985 986 // Indicates whether new fullscreen request have been made when previous 987 // fullscreen request is still in-process. 988 bool mFullscreenHasChangedDuringProcessing : 1; 989 990 using FullscreenRequest = struct FullscreenRequest { 991 FullscreenRequest(FullscreenReason aReason, bool aFullscreen) 992 : mReason(aReason), mFullscreen(aFullscreen) { 993 MOZ_ASSERT( 994 mReason != FullscreenReason::ForForceExitFullscreen || !mFullscreen, 995 "FullscreenReason::ForForceExitFullscreen can only be used with " 996 "exiting fullscreen"); 997 } 998 FullscreenReason mReason; 999 bool mFullscreen : 1; 1000 }; 1001 // The current in-process fullscreen request. Nothing if there is no 1002 // in-process request. 1003 mozilla::Maybe<FullscreenRequest> mInProcessFullscreenRequest; 1004 1005 bool mForceFullScreenInWidget : 1; 1006 bool mIsClosed : 1; 1007 bool mInClose : 1; 1008 // mHavePendingClose means we've got a termination function set to 1009 // close us when the JS stops executing or that we have a close 1010 // event posted. If this is set, just ignore window.close() calls. 1011 bool mHavePendingClose : 1; 1012 1013 // Indicates whether scripts are allowed to close this window. 1014 bool mBlockScriptedClosingFlag : 1; 1015 1016 // Window offline status. Checked to see if we need to fire offline event 1017 bool mWasOffline : 1; 1018 1019 // Indicates whether we're in the middle of creating an initializing 1020 // a new inner window object. 1021 bool mCreatingInnerWindow : 1; 1022 1023 // Fast way to tell if this is a chrome window (without having to QI). 1024 bool mIsChrome : 1; 1025 1026 // whether scripts may close the window, 1027 // even if "dom.allow_scripts_to_close_windows" is false. 1028 bool mAllowScriptsToClose : 1; 1029 1030 bool mTopLevelOuterContentWindow : 1; 1031 1032 // Whether we've delayed a print until after load. 1033 bool mDelayedPrintUntilAfterLoad : 1; 1034 // Whether we've delayed a close() operation because there was a pending 1035 // print() operation. 1036 bool mDelayedCloseForPrinting : 1; 1037 // Whether we should delay printing until after load. 1038 bool mShouldDelayPrintUntilAfterLoad : 1; 1039 1040 nsCOMPtr<nsIScriptContext> mContext; 1041 nsCOMPtr<nsIControllers> mControllers; 1042 1043 // For |window.arguments|, via |openDialog|. 1044 nsCOMPtr<nsIArray> mArguments; 1045 1046 RefPtr<nsDOMWindowUtils> mWindowUtils; 1047 nsString mStatus; 1048 1049 RefPtr<mozilla::dom::Storage> mLocalStorage; 1050 1051 nsCOMPtr<nsIPrincipal> mDocumentPrincipal; 1052 nsCOMPtr<nsIPrincipal> mDocumentCookiePrincipal; 1053 nsCOMPtr<nsIPrincipal> mDocumentStoragePrincipal; 1054 nsCOMPtr<nsIPrincipal> mDocumentPartitionedPrincipal; 1055 1056 #ifdef DEBUG 1057 uint32_t mSerial; 1058 1059 bool mSetOpenerWindowCalled; 1060 nsCOMPtr<nsIURI> mLastOpenedURI; 1061 #endif 1062 1063 bool mCleanedUp; 1064 1065 // It's useful when we get matched EnterModalState/LeaveModalState calls, in 1066 // which case the outer window is responsible for unsuspending events on the 1067 // documents. If we don't (for example, if the outer window is closed before 1068 // the LeaveModalState call), then the inner window whose mDoc is in our 1069 // mSuspendedDocs is responsible for unsuspending. 1070 nsTArray<RefPtr<Document>> mSuspendedDocs; 1071 1072 // This is the CC generation the last time we called CanSkip. 1073 uint32_t mCanSkipCCGeneration; 1074 1075 // When non-zero, the document should receive a vrdisplayactivate event 1076 // after loading. The value is the ID of the VRDisplay that content should 1077 // begin presentation on. 1078 uint32_t mAutoActivateVRDisplayID; 1079 1080 static OuterWindowByIdTable* sOuterWindowsById; 1081 1082 // Members in the mChromeFields member should only be used in chrome windows. 1083 // All accesses to this field should be guarded by a check of mIsChrome. 1084 struct ChromeFields { 1085 nsCOMPtr<nsIBrowserDOMWindow> mBrowserDOMWindow; 1086 // A weak pointer to the PresShell that we are doing fullscreen for. 1087 // The pointer being set indicates we've set the IsInFullscreenChange 1088 // flag on this pres shell. 1089 nsWeakPtr mFullscreenPresShell; 1090 } mChromeFields; 1091 1092 // Whether the chrome window is currently in a full screen transition. This 1093 // flag is updated from FullscreenTransitionTask. 1094 bool mIsInFullScreenTransition = false; 1095 1096 friend class nsDOMWindowUtils; 1097 friend class mozilla::dom::BrowsingContext; 1098 friend class mozilla::dom::PostMessageEvent; 1099 friend class mozilla::dom::TimeoutManager; 1100 friend class nsGlobalWindowInner; 1101 }; 1102 1103 inline nsISupports* ToSupports(nsGlobalWindowOuter* p) { 1104 return static_cast<mozilla::dom::EventTarget*>(p); 1105 } 1106 1107 inline nsISupports* ToCanonicalSupports(nsGlobalWindowOuter* p) { 1108 return static_cast<mozilla::dom::EventTarget*>(p); 1109 } 1110 1111 inline nsGlobalWindowOuter* nsGlobalWindowOuter::GetInProcessTopInternal() { 1112 nsCOMPtr<nsPIDOMWindowOuter> top = GetInProcessTop(); 1113 if (top) { 1114 return nsGlobalWindowOuter::Cast(top); 1115 } 1116 return nullptr; 1117 } 1118 1119 inline nsGlobalWindowOuter* 1120 nsGlobalWindowOuter::GetInProcessScriptableTopInternal() { 1121 nsPIDOMWindowOuter* top = GetInProcessScriptableTop(); 1122 return nsGlobalWindowOuter::Cast(top); 1123 } 1124 1125 inline nsIScriptContext* nsGlobalWindowOuter::GetContextInternal() { 1126 return mContext; 1127 } 1128 1129 inline void nsGlobalWindowOuter::MaybeClearInnerWindow( 1130 nsPIDOMWindowInner* aExpectedInner) { 1131 if (mInnerWindow == aExpectedInner) { 1132 mInnerWindow = nullptr; 1133 } 1134 } 1135 1136 #endif /* nsGlobalWindowOuter_h___ */