| Index: third_party/WebKit/Source/modules/fetch/ReadableStreamDataConsumerHandle.cpp
|
| diff --git a/third_party/WebKit/Source/modules/fetch/ReadableStreamDataConsumerHandle.cpp b/third_party/WebKit/Source/modules/fetch/ReadableStreamDataConsumerHandle.cpp
|
| index 639665ede11d54291dd5e5b3380d8677997c8a63..40be088a6058fef84d68695673a0d922b9644df9 100644
|
| --- a/third_party/WebKit/Source/modules/fetch/ReadableStreamDataConsumerHandle.cpp
|
| +++ b/third_party/WebKit/Source/modules/fetch/ReadableStreamDataConsumerHandle.cpp
|
| @@ -12,8 +12,10 @@
|
| #include "bindings/core/v8/V8BindingMacros.h"
|
| #include "bindings/core/v8/V8IteratorResultValue.h"
|
| #include "bindings/core/v8/V8Uint8Array.h"
|
| +#include "bindings/core/v8/WorkerOrWorkletScriptController.h"
|
| #include "core/dom/DOMTypedArray.h"
|
| #include "core/streams/ReadableStreamOperations.h"
|
| +#include "core/workers/WorkerGlobalScope.h"
|
| #include "public/platform/Platform.h"
|
| #include "public/platform/WebTaskRunner.h"
|
| #include "public/platform/WebThread.h"
|
| @@ -27,6 +29,20 @@
|
|
|
| namespace blink {
|
|
|
| +namespace {
|
| +
|
| +bool isTerminating(ScriptState* scriptState)
|
| +{
|
| + ExecutionContext* executionContext = scriptState->getExecutionContext();
|
| + if (!executionContext)
|
| + return true;
|
| + if (!executionContext->isWorkerGlobalScope())
|
| + return false;
|
| + return toWorkerGlobalScope(executionContext)->scriptController()->isExecutionTerminating();
|
| +}
|
| +
|
| +} // namespace
|
| +
|
| using Result = WebDataConsumerHandle::Result;
|
| using Flags = WebDataConsumerHandle::Flags;
|
|
|
| @@ -49,7 +65,12 @@ public:
|
| bool done;
|
| v8::Local<v8::Value> item = v.v8Value();
|
| ASSERT(item->IsObject());
|
| - v8::Local<v8::Value> value = v8CallOrCrash(v8UnpackIteratorResult(v.getScriptState(), item.As<v8::Object>(), &done));
|
| + if (isTerminating(v.getScriptState()))
|
| + return ScriptValue();
|
| + v8::MaybeLocal<v8::Value> maybeValue = v8UnpackIteratorResult(v.getScriptState(), item.As<v8::Object>(), &done);
|
| + if (isTerminating(v.getScriptState()))
|
| + return ScriptValue();
|
| + v8::Local<v8::Value> value = v8CallOrCrash(maybeValue);
|
| if (done) {
|
| readingContext->onReadDone();
|
| return v;
|
|
|