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

Unified Diff: third_party/WebKit/Source/bindings/tests/results/core/V8TestObject.cpp

Issue 2707243006: [SharedArrayBuffer] Prevent SharedArrayBuffer being used in Web APIs (Closed)
Patch Set: add some layout tests Created 3 years, 8 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: third_party/WebKit/Source/bindings/tests/results/core/V8TestObject.cpp
diff --git a/third_party/WebKit/Source/bindings/tests/results/core/V8TestObject.cpp b/third_party/WebKit/Source/bindings/tests/results/core/V8TestObject.cpp
index 83c57a50f3d6d5ac23d34f21b5d41da9f0c82426..74c5ff7270c3fa8afbe62f5c5f14a194842f3c51 100644
--- a/third_party/WebKit/Source/bindings/tests/results/core/V8TestObject.cpp
+++ b/third_party/WebKit/Source/bindings/tests/results/core/V8TestObject.cpp
@@ -61,6 +61,7 @@
#include "core/dom/DOMArrayBufferBase.h"
#include "core/dom/Document.h"
#include "core/dom/FlexibleArrayBufferView.h"
+#include "core/dom/NotShared.h"
#include "core/dom/TagCollection.h"
#include "core/dom/custom/V0CustomElementProcessingStack.h"
#include "core/frame/Deprecation.h"
@@ -1112,7 +1113,9 @@ static void float32ArrayAttributeAttributeSetter(v8::Local<v8::Value> v8Value, c
ExceptionState exceptionState(isolate, ExceptionState::SetterContext, "TestObject", "float32ArrayAttribute");
// Prepare the value to be set.
- DOMFloat32Array* cppValue = v8Value->IsFloat32Array() ? V8Float32Array::toImpl(v8::Local<v8::Float32Array>::Cast(v8Value)) : 0;
+ NotShared<DOMFloat32Array> cppValue = toNotShared<NotShared<DOMFloat32Array>>(info.GetIsolate(), v8Value, exceptionState);
+ if (exceptionState.hadException())
+ return;
// Type check per: http://heycam.github.io/webidl/#es-interface
if (!cppValue) {
@@ -1141,7 +1144,9 @@ static void uint8ArrayAttributeAttributeSetter(v8::Local<v8::Value> v8Value, con
ExceptionState exceptionState(isolate, ExceptionState::SetterContext, "TestObject", "uint8ArrayAttribute");
// Prepare the value to be set.
- DOMUint8Array* cppValue = v8Value->IsUint8Array() ? V8Uint8Array::toImpl(v8::Local<v8::Uint8Array>::Cast(v8Value)) : 0;
+ NotShared<DOMUint8Array> cppValue = toNotShared<NotShared<DOMUint8Array>>(info.GetIsolate(), v8Value, exceptionState);
+ if (exceptionState.hadException())
+ return;
// Type check per: http://heycam.github.io/webidl/#es-interface
if (!cppValue) {
@@ -4627,6 +4632,18 @@ static void arrayBufferViewMethodMethod(const v8::FunctionCallbackInfo<v8::Value
v8SetReturnValue(info, impl->arrayBufferViewMethod());
}
+static void arrayBufferViewMethodRaisesExceptionMethod(const v8::FunctionCallbackInfo<v8::Value>& info) {
+ ExceptionState exceptionState(info.GetIsolate(), ExceptionState::ExecutionContext, "TestObject", "arrayBufferViewMethodRaisesException");
+
+ TestObject* impl = V8TestObject::toImpl(info.Holder());
+
+ NotShared<TestArrayBufferView> result = impl->arrayBufferViewMethodRaisesException(exceptionState);
+ if (exceptionState.hadException()) {
+ return;
+ }
+ v8SetReturnValue(info, result);
+}
+
static void float32ArrayMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& info) {
TestObject* impl = V8TestObject::toImpl(info.Holder());
@@ -4673,7 +4690,7 @@ static void voidMethodArrayBufferOrNullArgMethod(const v8::FunctionCallbackInfo<
}
TestArrayBuffer* arrayBufferArg;
- arrayBufferArg = info[0]->IsArrayBuffer() ? V8ArrayBuffer::toImpl(v8::Local<v8::ArrayBuffer>::Cast(info[0])) : 0;
+ arrayBufferArg = V8ArrayBuffer::toImplWithTypeCheck(info.GetIsolate(), info[0]);
if (!arrayBufferArg && !isUndefinedOrNull(info[0])) {
V8ThrowException::throwTypeError(info.GetIsolate(), ExceptionMessages::failedToExecute("voidMethodArrayBufferOrNullArg", "TestObject", "parameter 1 is not of type 'ArrayBuffer'."));
@@ -4684,17 +4701,21 @@ static void voidMethodArrayBufferOrNullArgMethod(const v8::FunctionCallbackInfo<
}
static void voidMethodArrayBufferViewArgMethod(const v8::FunctionCallbackInfo<v8::Value>& info) {
+ ExceptionState exceptionState(info.GetIsolate(), ExceptionState::ExecutionContext, "TestObject", "voidMethodArrayBufferViewArg");
+
TestObject* impl = V8TestObject::toImpl(info.Holder());
if (UNLIKELY(info.Length() < 1)) {
- V8ThrowException::throwTypeError(info.GetIsolate(), ExceptionMessages::failedToExecute("voidMethodArrayBufferViewArg", "TestObject", ExceptionMessages::notEnoughArguments(1, info.Length())));
+ exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(1, info.Length()));
return;
}
- TestArrayBufferView* arrayBufferViewArg;
- arrayBufferViewArg = info[0]->IsArrayBufferView() ? V8ArrayBufferView::toImpl(v8::Local<v8::ArrayBufferView>::Cast(info[0])) : 0;
+ NotShared<TestArrayBufferView> arrayBufferViewArg;
+ arrayBufferViewArg = toNotShared<NotShared<TestArrayBufferView>>(info.GetIsolate(), info[0], exceptionState);
+ if (exceptionState.hadException())
+ return;
if (!arrayBufferViewArg) {
- V8ThrowException::throwTypeError(info.GetIsolate(), ExceptionMessages::failedToExecute("voidMethodArrayBufferViewArg", "TestObject", "parameter 1 is not of type 'ArrayBufferView'."));
+ exceptionState.throwTypeError("parameter 1 is not of type 'ArrayBufferView'.");
return;
}
@@ -4703,17 +4724,19 @@ static void voidMethodArrayBufferViewArgMethod(const v8::FunctionCallbackInfo<v8
}
static void voidMethodFlexibleArrayBufferViewArgMethod(const v8::FunctionCallbackInfo<v8::Value>& info) {
+ ExceptionState exceptionState(info.GetIsolate(), ExceptionState::ExecutionContext, "TestObject", "voidMethodFlexibleArrayBufferViewArg");
+
TestObject* impl = V8TestObject::toImpl(info.Holder());
if (UNLIKELY(info.Length() < 1)) {
- V8ThrowException::throwTypeError(info.GetIsolate(), ExceptionMessages::failedToExecute("voidMethodFlexibleArrayBufferViewArg", "TestObject", ExceptionMessages::notEnoughArguments(1, info.Length())));
+ exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(1, info.Length()));
return;
}
FlexibleArrayBufferView arrayBufferViewArg;
toFlexibleArrayBufferView(info.GetIsolate(), info[0], arrayBufferViewArg, allocateFlexibleArrayBufferViewStorage(info[0]));
if (!arrayBufferViewArg) {
- V8ThrowException::throwTypeError(info.GetIsolate(), ExceptionMessages::failedToExecute("voidMethodFlexibleArrayBufferViewArg", "TestObject", "parameter 1 is not of type 'ArrayBufferView'."));
+ exceptionState.throwTypeError("parameter 1 is not of type 'ArrayBufferView'.");
return;
}
@@ -4722,17 +4745,19 @@ static void voidMethodFlexibleArrayBufferViewArgMethod(const v8::FunctionCallbac
}
static void voidMethodFlexibleArrayBufferViewTypedArgMethod(const v8::FunctionCallbackInfo<v8::Value>& info) {
+ ExceptionState exceptionState(info.GetIsolate(), ExceptionState::ExecutionContext, "TestObject", "voidMethodFlexibleArrayBufferViewTypedArg");
+
TestObject* impl = V8TestObject::toImpl(info.Holder());
if (UNLIKELY(info.Length() < 1)) {
- V8ThrowException::throwTypeError(info.GetIsolate(), ExceptionMessages::failedToExecute("voidMethodFlexibleArrayBufferViewTypedArg", "TestObject", ExceptionMessages::notEnoughArguments(1, info.Length())));
+ exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(1, info.Length()));
return;
}
FlexibleFloat32ArrayView typedArrayBufferViewArg;
toFlexibleArrayBufferView(info.GetIsolate(), info[0], typedArrayBufferViewArg, allocateFlexibleArrayBufferViewStorage(info[0]));
if (!typedArrayBufferViewArg) {
- V8ThrowException::throwTypeError(info.GetIsolate(), ExceptionMessages::failedToExecute("voidMethodFlexibleArrayBufferViewTypedArg", "TestObject", "parameter 1 is not of type 'Float32Array'."));
+ exceptionState.throwTypeError("parameter 1 is not of type 'Float32Array'.");
return;
}
@@ -4741,17 +4766,21 @@ static void voidMethodFlexibleArrayBufferViewTypedArgMethod(const v8::FunctionCa
}
static void voidMethodFloat32ArrayArgMethod(const v8::FunctionCallbackInfo<v8::Value>& info) {
+ ExceptionState exceptionState(info.GetIsolate(), ExceptionState::ExecutionContext, "TestObject", "voidMethodFloat32ArrayArg");
+
TestObject* impl = V8TestObject::toImpl(info.Holder());
if (UNLIKELY(info.Length() < 1)) {
- V8ThrowException::throwTypeError(info.GetIsolate(), ExceptionMessages::failedToExecute("voidMethodFloat32ArrayArg", "TestObject", ExceptionMessages::notEnoughArguments(1, info.Length())));
+ exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(1, info.Length()));
return;
}
- DOMFloat32Array* float32ArrayArg;
- float32ArrayArg = info[0]->IsFloat32Array() ? V8Float32Array::toImpl(v8::Local<v8::Float32Array>::Cast(info[0])) : 0;
+ NotShared<DOMFloat32Array> float32ArrayArg;
+ float32ArrayArg = toNotShared<NotShared<DOMFloat32Array>>(info.GetIsolate(), info[0], exceptionState);
+ if (exceptionState.hadException())
+ return;
if (!float32ArrayArg) {
- V8ThrowException::throwTypeError(info.GetIsolate(), ExceptionMessages::failedToExecute("voidMethodFloat32ArrayArg", "TestObject", "parameter 1 is not of type 'Float32Array'."));
+ exceptionState.throwTypeError("parameter 1 is not of type 'Float32Array'.");
return;
}
@@ -4760,17 +4789,21 @@ static void voidMethodFloat32ArrayArgMethod(const v8::FunctionCallbackInfo<v8::V
}
static void voidMethodInt32ArrayArgMethod(const v8::FunctionCallbackInfo<v8::Value>& info) {
+ ExceptionState exceptionState(info.GetIsolate(), ExceptionState::ExecutionContext, "TestObject", "voidMethodInt32ArrayArg");
+
TestObject* impl = V8TestObject::toImpl(info.Holder());
if (UNLIKELY(info.Length() < 1)) {
- V8ThrowException::throwTypeError(info.GetIsolate(), ExceptionMessages::failedToExecute("voidMethodInt32ArrayArg", "TestObject", ExceptionMessages::notEnoughArguments(1, info.Length())));
+ exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(1, info.Length()));
return;
}
- DOMInt32Array* int32ArrayArg;
- int32ArrayArg = info[0]->IsInt32Array() ? V8Int32Array::toImpl(v8::Local<v8::Int32Array>::Cast(info[0])) : 0;
+ NotShared<DOMInt32Array> int32ArrayArg;
+ int32ArrayArg = toNotShared<NotShared<DOMInt32Array>>(info.GetIsolate(), info[0], exceptionState);
+ if (exceptionState.hadException())
+ return;
if (!int32ArrayArg) {
- V8ThrowException::throwTypeError(info.GetIsolate(), ExceptionMessages::failedToExecute("voidMethodInt32ArrayArg", "TestObject", "parameter 1 is not of type 'Int32Array'."));
+ exceptionState.throwTypeError("parameter 1 is not of type 'Int32Array'.");
return;
}
@@ -4779,17 +4812,21 @@ static void voidMethodInt32ArrayArgMethod(const v8::FunctionCallbackInfo<v8::Val
}
static void voidMethodUint8ArrayArgMethod(const v8::FunctionCallbackInfo<v8::Value>& info) {
+ ExceptionState exceptionState(info.GetIsolate(), ExceptionState::ExecutionContext, "TestObject", "voidMethodUint8ArrayArg");
+
TestObject* impl = V8TestObject::toImpl(info.Holder());
if (UNLIKELY(info.Length() < 1)) {
- V8ThrowException::throwTypeError(info.GetIsolate(), ExceptionMessages::failedToExecute("voidMethodUint8ArrayArg", "TestObject", ExceptionMessages::notEnoughArguments(1, info.Length())));
+ exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(1, info.Length()));
return;
}
- DOMUint8Array* uint8ArrayArg;
- uint8ArrayArg = info[0]->IsUint8Array() ? V8Uint8Array::toImpl(v8::Local<v8::Uint8Array>::Cast(info[0])) : 0;
+ NotShared<DOMUint8Array> uint8ArrayArg;
+ uint8ArrayArg = toNotShared<NotShared<DOMUint8Array>>(info.GetIsolate(), info[0], exceptionState);
+ if (exceptionState.hadException())
+ return;
if (!uint8ArrayArg) {
- V8ThrowException::throwTypeError(info.GetIsolate(), ExceptionMessages::failedToExecute("voidMethodUint8ArrayArg", "TestObject", "parameter 1 is not of type 'Uint8Array'."));
+ exceptionState.throwTypeError("parameter 1 is not of type 'Uint8Array'.");
return;
}
@@ -10858,6 +10895,10 @@ void V8TestObject::arrayBufferViewMethodMethodCallback(const v8::FunctionCallbac
TestObjectV8Internal::arrayBufferViewMethodMethod(info);
}
+void V8TestObject::arrayBufferViewMethodRaisesExceptionMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info) {
+ TestObjectV8Internal::arrayBufferViewMethodRaisesExceptionMethod(info);
+}
+
void V8TestObject::float32ArrayMethodMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info) {
TestObjectV8Internal::float32ArrayMethodMethod(info);
}
@@ -11963,6 +12004,7 @@ static const V8DOMConfiguration::MethodConfiguration V8TestObjectMethods[] = {
{"voidMethodNodeArg", V8TestObject::voidMethodNodeArgMethodCallback, 1, v8::None, V8DOMConfiguration::OnPrototype, V8DOMConfiguration::CheckHolder, V8DOMConfiguration::DoNotCheckAccess, V8DOMConfiguration::AllWorlds},
{"arrayBufferMethod", V8TestObject::arrayBufferMethodMethodCallback, 0, v8::None, V8DOMConfiguration::OnPrototype, V8DOMConfiguration::CheckHolder, V8DOMConfiguration::DoNotCheckAccess, V8DOMConfiguration::AllWorlds},
{"arrayBufferViewMethod", V8TestObject::arrayBufferViewMethodMethodCallback, 0, v8::None, V8DOMConfiguration::OnPrototype, V8DOMConfiguration::CheckHolder, V8DOMConfiguration::DoNotCheckAccess, V8DOMConfiguration::AllWorlds},
+ {"arrayBufferViewMethodRaisesException", V8TestObject::arrayBufferViewMethodRaisesExceptionMethodCallback, 0, v8::None, V8DOMConfiguration::OnPrototype, V8DOMConfiguration::CheckHolder, V8DOMConfiguration::DoNotCheckAccess, V8DOMConfiguration::AllWorlds},
{"float32ArrayMethod", V8TestObject::float32ArrayMethodMethodCallback, 0, v8::None, V8DOMConfiguration::OnPrototype, V8DOMConfiguration::CheckHolder, V8DOMConfiguration::DoNotCheckAccess, V8DOMConfiguration::AllWorlds},
{"int32ArrayMethod", V8TestObject::int32ArrayMethodMethodCallback, 0, v8::None, V8DOMConfiguration::OnPrototype, V8DOMConfiguration::CheckHolder, V8DOMConfiguration::DoNotCheckAccess, V8DOMConfiguration::AllWorlds},
{"uint8ArrayMethod", V8TestObject::uint8ArrayMethodMethodCallback, 0, v8::None, V8DOMConfiguration::OnPrototype, V8DOMConfiguration::CheckHolder, V8DOMConfiguration::DoNotCheckAccess, V8DOMConfiguration::AllWorlds},

Powered by Google App Engine
This is Rietveld 408576698