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/. */
7 #ifndef dom_base_AutoSuppressEventHandlingAndSuspend_h
8 #define dom_base_AutoSuppressEventHandlingAndSuspend_h
10 #include "mozilla/dom/Document.h"
12 #include "nsPIDOMWindow.h"
15 namespace mozilla::dom
{
17 class BrowsingContext
;
18 class BrowsingContextGroup
;
21 * Suppresses event handling and suspends the active inner window for all
22 * in-process documents in a BrowsingContextGroup. This should be used while
23 * spinning the event loop for a synchronous operation (like `window.open()`)
24 * which affects operations in any other window in the same BrowsingContext
28 class MOZ_RAII AutoSuppressEventHandlingAndSuspend
{
30 explicit AutoSuppressEventHandlingAndSuspend(BrowsingContextGroup
* aGroup
);
31 ~AutoSuppressEventHandlingAndSuspend();
34 void SuppressBrowsingContext(BrowsingContext
* aBC
);
36 AutoTArray
<RefPtr
<Document
>, 16> mDocuments
;
37 AutoTArray
<nsCOMPtr
<nsPIDOMWindowInner
>, 16> mWindows
;
39 } // namespace mozilla::dom