Index: Source/bindings/core/v8/custom/V8WindowCustom.cpp |
diff --git a/Source/bindings/core/v8/custom/V8WindowCustom.cpp b/Source/bindings/core/v8/custom/V8WindowCustom.cpp |
index 4a8d935ab28e4d63cfd619b54e033b0cebc8c6b1..cd38053741c40b59e361d5264c23dcdc410cc6e8 100644 |
--- a/Source/bindings/core/v8/custom/V8WindowCustom.cpp |
+++ b/Source/bindings/core/v8/custom/V8WindowCustom.cpp |
@@ -159,6 +159,13 @@ static bool isLegacyTargetOriginDesignation(v8::Handle<v8::Value> value) |
void V8Window::postMessageMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& info) |
{ |
+ ExceptionState exceptionState(ExceptionState::ExecutionContext, "postMessage", "Window", info.Holder(), info.GetIsolate()); |
+ if (UNLIKELY(info.Length() < 2)) { |
+ setMinimumArityTypeError(exceptionState, 2, info.Length()); |
+ exceptionState.throwIfNeeded(); |
+ return; |
+ } |
+ |
// None of these need to be RefPtr because info and context are guaranteed |
// to hold on to them. |
DOMWindow* window = V8Window::toImpl(info.Holder()); |
@@ -167,8 +174,6 @@ void V8Window::postMessageMethodCustom(const v8::FunctionCallbackInfo<v8::Value> |
ASSERT(window); |
UseCounter::countIfNotPrivateScript(info.GetIsolate(), window->frame(), UseCounter::WindowPostMessage); |
- ExceptionState exceptionState(ExceptionState::ExecutionContext, "postMessage", "Window", info.Holder(), info.GetIsolate()); |
- |
// If called directly by WebCore we don't have a calling context. |
if (!source) { |
exceptionState.throwTypeError("No active calling context exists."); |