From 878aa4ec9bd7222057e95d573ecf5d9db4016753 Mon Sep 17 00:00:00 2001 From: Christian Holler Date: Thu, 19 Dec 2019 18:48:37 +0000 Subject: [PATCH] Bug 1600130 - Sync HTTP fuzzing target with background thread. r=mayhemer Differential Revision: https://phabricator.services.mozilla.com/D56694 --HG-- extra : moz-landing-system : lando --- netwerk/test/fuzz/TestHttpFuzzing.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) 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); }