Bug 1769547 - Do not MOZ_CRASH() on missing process r=nika
[gecko.git] / accessible / windows / msaa / RootAccessibleWrap.cpp
blob3a2477e8774033d69bd5f71321f3f795ad7230f7
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #include "RootAccessibleWrap.h"
8 #include "Compatibility.h"
9 #include "mozilla/PresShell.h"
10 #include "nsCoreUtils.h"
11 #include "nsWinUtils.h"
13 using namespace mozilla;
14 using namespace mozilla::a11y;
16 ////////////////////////////////////////////////////////////////////////////////
17 // Constructor/destructor
19 RootAccessibleWrap::RootAccessibleWrap(dom::Document* aDocument,
20 PresShell* aPresShell)
21 : RootAccessible(aDocument, aPresShell) {}
23 RootAccessibleWrap::~RootAccessibleWrap() {}
25 ////////////////////////////////////////////////////////////////////////////////
26 // RootAccessible
28 void RootAccessibleWrap::DocumentActivated(DocAccessible* aDocument) {
29 // This check will never work with e10s enabled, in other words, as of
30 // Firefox 57.
31 if (Compatibility::IsDolphin() &&
32 nsCoreUtils::IsTopLevelContentDocInProcess(aDocument->DocumentNode())) {
33 MOZ_ASSERT(XRE_IsParentProcess());
34 uint32_t count = mChildDocuments.Length();
35 for (uint32_t idx = 0; idx < count; idx++) {
36 DocAccessible* childDoc = mChildDocuments[idx];
37 HWND childDocHWND = static_cast<HWND>(childDoc->GetNativeWindow());
38 if (childDoc != aDocument)
39 nsWinUtils::HideNativeWindow(childDocHWND);
40 else
41 nsWinUtils::ShowNativeWindow(childDocHWND);