Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(315)

Unified Diff: Source/bindings/core/v8/PostMessage.h

Issue 1025203002: Have postMessage()s throw TypeError on failed arity checks. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: tidy up incorrect postMessage() usage Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/bindings/core/v8/PostMessage.h
diff --git a/Source/bindings/core/v8/PostMessage.h b/Source/bindings/core/v8/PostMessage.h
index b4a381d35c5d9d723da24232182196634aabdd0e..b86a45c96a21aa340f198d4faeae8987bb13b495 100644
--- a/Source/bindings/core/v8/PostMessage.h
+++ b/Source/bindings/core/v8/PostMessage.h
@@ -23,6 +23,11 @@ template <class Type>
void postMessageMethodCommon(const char* interfaceName, Type* instance, const v8::FunctionCallbackInfo<v8::Value>& info)
{
ExceptionState exceptionState(ExceptionState::ExecutionContext, "postMessage", interfaceName, info.Holder(), info.GetIsolate());
+ if (UNLIKELY(info.Length() < 1)) {
+ setMinimumArityTypeError(exceptionState, 1, info.Length());
+ exceptionState.throwIfNeeded();
+ return;
+ }
MessagePortArray ports;
ArrayBufferArray arrayBuffers;
if (info.Length() > 1) {

Powered by Google App Engine
This is Rietveld 408576698