Skip to content

Commit

Permalink
Avoid calling SynchronousLoadData CompletionHandler more than once
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=270030
rdar://109257007

Reviewed by Chris Dumez.

In some situations, a NetworkResourceLoader may call its SynchronousLoadData's
delayedReply CompletionHandler more than once. This change returns early if we
hit that case. I'm leaving the debug assertion so we investigate if this starts
happening frequently.

* Source/WebKit/NetworkProcess/NetworkResourceLoader.cpp:
(WebKit::sendReplyToSynchronousRequest):

Canonical link: https://commits.webkit.org/275465@main
  • Loading branch information
sysrqb authored and Matthew Finkel committed Feb 28, 2024
1 parent 8a6f3a4 commit e336a8c
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Source/WebKit/NetworkProcess/NetworkResourceLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,9 @@ static void sendReplyToSynchronousRequest(NetworkResourceLoader::SynchronousLoad
ASSERT(data.delayedReply);
ASSERT(!data.response.isNull() || !data.error.isNull());

if (!data.delayedReply)
return;

Vector<uint8_t> responseBuffer;
if (buffer && buffer->size())
responseBuffer.append(buffer->makeContiguous()->data(), buffer->size());
Expand Down

0 comments on commit e336a8c

Please sign in to comment.