Commit 6caa131e authored by Leszek Swirski's avatar Leszek Swirski Committed by Commit Bot

[script-streaming] Fix weak access to loader clent

The ResponseBodyLoaderClient is held weakly by the script streaming
SourceStream class, which means we have to manually check for a null
client when notifying it that we've received data.

Bug: 1098874
Change-Id: I9e2b307a5fcc5fe13f489773a3657f55ba0c1180
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2287310Reviewed-by: default avatarMarja Hölttä <marja@chromium.org>
Commit-Queue: Leszek Swirski <leszeks@chromium.org>
Cr-Commit-Position: refs/heads/master@{#786205}
parent 2ed7f658
......@@ -233,6 +233,11 @@ class SourceStream : public v8::ScriptCompiler::ExternalSourceStream {
ResponseBodyLoaderClient* response_body_loader_client,
std::unique_ptr<char[]> data,
uint32_t data_size) {
// The response_body_loader_client is held weakly, so it may be dead by the
// time this callback is called. If so, we can simply drop this chunk.
if (!response_body_loader_client)
return;
response_body_loader_client->DidReceiveData(
base::make_span(data.get(), data_size));
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment