From 9469a9b8251972e0a53994685ae7a688f28ce843 Mon Sep 17 00:00:00 2001 From: Noemi Erli Date: Wed, 26 May 2021 04:34:26 +0300 Subject: [PATCH] Backed out changeset 4c53c4da7ece (bug 1677555) for causing multiple failures in imgRequestProxy.cpp CLOSED TREE --- layout/style/nsStyleStruct.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/layout/style/nsStyleStruct.cpp b/layout/style/nsStyleStruct.cpp index bf4ed243042a..92e4ae34e28a 100644 --- a/layout/style/nsStyleStruct.cpp +++ b/layout/style/nsStyleStruct.cpp @@ -188,10 +188,13 @@ class StyleImageRequestCleanupTask final : public mozilla::Runnable { // This is defined here for parallelism with LoadURI. void Gecko_LoadData_Drop(StyleLoadData* aData) { if (aData->resolved_image) { - // We want to dispatch this async to prevent reentrancy issues, as - // imgRequestProxy going away can destroy documents, etc, see bug 1677555. auto task = MakeRefPtr(*aData); - SchedulerGroup::Dispatch(TaskCategory::Other, task.forget()); + if (NS_IsMainThread()) { + task->Run(); + } else { + // if Resolve was not called at some point, mDocGroup is not set. + SchedulerGroup::Dispatch(TaskCategory::Other, task.forget()); + } } // URIs are safe to refcount from any thread.