Index: Source/bindings/v8/custom/V8DedicatedWorkerGlobalScopeCustom.cpp |
diff --git a/Source/bindings/v8/custom/V8DedicatedWorkerGlobalScopeCustom.cpp b/Source/bindings/v8/custom/V8DedicatedWorkerGlobalScopeCustom.cpp |
index a356f03e4fef9ecea6c2e8f382852e21581cc1dc..480ae11821b95c9ff0f8cd92a48894f1a0c0149d 100644 |
--- a/Source/bindings/v8/custom/V8DedicatedWorkerGlobalScopeCustom.cpp |
+++ b/Source/bindings/v8/custom/V8DedicatedWorkerGlobalScopeCustom.cpp |
@@ -44,23 +44,21 @@ namespace WebCore { |
void V8DedicatedWorkerGlobalScope::postMessageMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& info) |
{ |
+ ExceptionState exceptionState(ExceptionState::ExecutionContext, "postMessage", "WorkerGlobalScope", info.Holder(), info.GetIsolate()); |
DedicatedWorkerGlobalScope* workerGlobalScope = V8DedicatedWorkerGlobalScope::toNative(info.Holder()); |
MessagePortArray ports; |
ArrayBufferArray arrayBuffers; |
if (info.Length() > 1) { |
const int transferablesArgIndex = 1; |
- bool notASequence = false; |
- if (!extractTransferables(info[transferablesArgIndex], ports, arrayBuffers, notASequence, info.GetIsolate())) { |
- if (notASequence) |
- throwTypeError(ExceptionMessages::failedToExecute("postMessage", "WorkerGlobalScope", ExceptionMessages::notAnArrayTypeArgumentOrValue(transferablesArgIndex + 1)), info.GetIsolate()); |
+ if (!extractTransferables(info[transferablesArgIndex], transferablesArgIndex, ports, arrayBuffers, exceptionState, info.GetIsolate())) { |
+ exceptionState.throwIfNeeded(); |
return; |
} |
} |
- bool didThrow = false; |
- RefPtr<SerializedScriptValue> message = SerializedScriptValue::create(info[0], &ports, &arrayBuffers, didThrow, info.GetIsolate()); |
- if (didThrow) |
+ RefPtr<SerializedScriptValue> message = SerializedScriptValue::create(info[0], &ports, &arrayBuffers, exceptionState, info.GetIsolate()); |
+ if (exceptionState.throwIfNeeded()) |
return; |
- ExceptionState exceptionState(info.Holder(), info.GetIsolate()); |
+ |
workerGlobalScope->postMessage(message.release(), &ports, exceptionState); |
exceptionState.throwIfNeeded(); |
} |