diff --git a/netwerk/test/fuzz/TestHttpFuzzing.cpp b/netwerk/test/fuzz/TestHttpFuzzing.cpp index c6db4769bfa4..e0028ffdf5dd 100644 --- a/netwerk/test/fuzz/TestHttpFuzzing.cpp +++ b/netwerk/test/fuzz/TestHttpFuzzing.cpp @@ -218,6 +218,16 @@ static int FuzzingRunNetworkHttp(const uint8_t* data, size_t size) { // Wait for StopRequest gStreamListener->waitUntilDone(); + bool mainPingBack = false; + + NS_DispatchBackgroundTask(NS_NewRunnableFunction("Dummy", [&]() { + NS_DispatchToMainThread(NS_NewRunnableFunction("Dummy", [&]() { + mainPingBack = true; + })); + })); + + SpinEventLoopUntil([&]() -> bool { return mainPingBack; }); + channelRef = do_GetWeakReference(gHttpChannel); }