Backed out 3 changesets (bug 1867358) as per request. CLOSED TREE

Backed out changeset 0ce8fcf63e62 (bug 1867358)
Backed out changeset 6d9bf8dfbb4d (bug 1867358)
Backed out changeset e995a2b2ff4d (bug 1867358)
This commit is contained in:
Natalia Csoregi
2023-11-30 07:09:25 +02:00
parent 2d1dcff0f7
commit 291f10e001
3 changed files with 14 additions and 48 deletions

View File

@@ -42,11 +42,7 @@ NotificationController::NotificationController(DocAccessible* aDocument,
NotificationController::~NotificationController() {
NS_ASSERTION(!mDocument, "Controller wasn't shutdown properly!");
if (mDocument) {
Shutdown();
}
MOZ_RELEASE_ASSERT(mObservingState == eNotObservingRefresh,
"Must unregister before being destroyed");
if (mDocument) Shutdown();
}
////////////////////////////////////////////////////////////////////////////////
@@ -58,9 +54,7 @@ NS_IMPL_CYCLE_COLLECTING_NATIVE_RELEASE(NotificationController)
NS_IMPL_CYCLE_COLLECTION_CLASS(NotificationController)
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(NotificationController)
if (tmp->mDocument) {
tmp->Shutdown();
}
if (tmp->mDocument) tmp->Shutdown();
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(NotificationController)
@@ -85,13 +79,8 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
void NotificationController::Shutdown() {
if (mObservingState != eNotObservingRefresh &&
mPresShell->RemoveRefreshObserver(this, FlushType::Display)) {
// Note, this was our last chance to unregister, since we're about to
// clear mPresShell further down in this function.
mObservingState = eNotObservingRefresh;
}
MOZ_RELEASE_ASSERT(mObservingState == eNotObservingRefresh,
"Must unregister before being destroyed (and we just "
"passed our last change to unregister)");
// Shutdown handling child documents.
int32_t childDocCount = mHangingChildDocuments.Length();
@@ -681,17 +670,12 @@ void NotificationController::WillRefresh(mozilla::TimeStamp aTime) {
AUTO_PROFILER_LABEL("NotificationController::WillRefresh", A11Y);
// If mDocument is null, the document accessible that this notification
// controller was created for is now shut down. This means we've lost our
// ability to unregister ourselves, which is bad. (However, it also shouldn't
// be logically possible for us to get here with a null mDocument; the only
// thing that clears that pointer is our Shutdown() method, which first
// unregisters and fatally asserts if that fails).
MOZ_RELEASE_ASSERT(
// If the document accessible that notification collector was created for is
// now shut down, don't process notifications anymore.
NS_ASSERTION(
mDocument,
"The document was shut down while refresh observer is attached!");
if (ipc::ProcessChild::ExpectingShutdown()) {
if (!mDocument || ipc::ProcessChild::ExpectingShutdown()) {
return;
}
@@ -872,9 +856,7 @@ void NotificationController::WillRefresh(mozilla::TimeStamp aTime) {
nsTArray<RefPtr<DocAccessible>> newChildDocs;
for (uint32_t idx = 0; idx < hangingDocCnt; idx++) {
DocAccessible* childDoc = mHangingChildDocuments[idx];
if (childDoc->IsDefunct()) {
continue;
}
if (childDoc->IsDefunct()) continue;
if (IPCAccessibilityActive() && !mDocument->IPCDoc()) {
childDoc->Shutdown();
@@ -913,16 +895,12 @@ void NotificationController::WillRefresh(mozilla::TimeStamp aTime) {
uint32_t childDocCnt = mDocument->ChildDocumentCount(), childDocIdx = 0;
for (; childDocIdx < childDocCnt; childDocIdx++) {
DocAccessible* childDoc = mDocument->GetChildDocumentAt(childDocIdx);
if (!childDoc->HasLoadState(DocAccessible::eCompletelyLoaded)) {
break;
}
if (!childDoc->HasLoadState(DocAccessible::eCompletelyLoaded)) break;
}
if (childDocIdx == childDocCnt) {
mDocument->ProcessLoad();
if (!mDocument) {
return;
}
if (!mDocument) return;
}
}
@@ -952,9 +930,7 @@ void NotificationController::WillRefresh(mozilla::TimeStamp aTime) {
uint32_t notificationCount = notifications.Length();
for (uint32_t idx = 0; idx < notificationCount; idx++) {
notifications[idx]->Process();
if (!mDocument) {
return;
}
if (!mDocument) return;
}
if (ipc::ProcessChild::ExpectingShutdown()) {
@@ -1034,9 +1010,7 @@ void NotificationController::WillRefresh(mozilla::TimeStamp aTime) {
}
mObservingState = eRefreshObserving;
if (!mDocument) {
return;
}
if (!mDocument) return;
// Stop further processing if there are no new notifications of any kind or
// events and document load is processed.