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

Unified Diff: Source/bindings/modules/v8/custom/V8DeviceMotionEventCustom.cpp

Issue 970403003: bindings: Use V8 MaybeLocal APIs in V8DeviceMotionEventCustom (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: 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/modules/v8/custom/V8DeviceMotionEventCustom.cpp
diff --git a/Source/bindings/modules/v8/custom/V8DeviceMotionEventCustom.cpp b/Source/bindings/modules/v8/custom/V8DeviceMotionEventCustom.cpp
index be8d12d3809aa2d30125558c971a5792ca2eb8dc..20b7077a17e2e20095f9603bc7ba179c208eeee4 100644
--- a/Source/bindings/modules/v8/custom/V8DeviceMotionEventCustom.cpp
+++ b/Source/bindings/modules/v8/custom/V8DeviceMotionEventCustom.cpp
@@ -34,13 +34,13 @@ namespace blink {
namespace {
-DeviceMotionData::Acceleration* readAccelerationArgument(v8::Local<v8::Value> value, v8::Isolate* isolate)
+DeviceMotionData::Acceleration* readAccelerationArgument(v8::Local<v8::Value> value, v8::Isolate* isolate, ExceptionState& exceptionState)
{
if (isUndefinedOrNull(value))
return nullptr;
- // Given the test above, this will always yield an object.
- v8::Local<v8::Object> object = value->ToObject(isolate);
+ v8::Local<v8::Object> object;
+ CALL_V8_MAYBELOCAL(object, isolate, value->ToObject(isolate->GetCurrentContext()), exceptionState, nullptr);
v8::Local<v8::Value> xValue = object->Get(v8AtomicString(isolate, "x"));
if (xValue.IsEmpty())
@@ -66,13 +66,13 @@ DeviceMotionData::Acceleration* readAccelerationArgument(v8::Local<v8::Value> va
return DeviceMotionData::Acceleration::create(canProvideX, x, canProvideY, y, canProvideZ, z);
}
-DeviceMotionData::RotationRate* readRotationRateArgument(v8::Local<v8::Value> value, v8::Isolate* isolate)
+DeviceMotionData::RotationRate* readRotationRateArgument(v8::Local<v8::Value> value, v8::Isolate* isolate, ExceptionState& exceptionState)
{
if (isUndefinedOrNull(value))
return nullptr;
- // Given the test above, this will always yield an object.
- v8::Local<v8::Object> object = value->ToObject(isolate);
+ v8::Local<v8::Object> object;
+ CALL_V8_MAYBELOCAL(object, isolate, value->ToObject(isolate->GetCurrentContext()), exceptionState, nullptr);
v8::Local<v8::Value> alphaValue = object->Get(v8AtomicString(isolate, "alpha"));
if (alphaValue.IsEmpty())
@@ -110,9 +110,12 @@ void V8DeviceMotionEvent::initDeviceMotionEventMethodCustom(const v8::FunctionCa
return;
bool bubbles = info[1]->BooleanValue();
bool cancelable = info[2]->BooleanValue();
- DeviceMotionData::Acceleration* acceleration = readAccelerationArgument(info[3], isolate);
- DeviceMotionData::Acceleration* accelerationIncludingGravity = readAccelerationArgument(info[4], isolate);
- DeviceMotionData::RotationRate* rotationRate = readRotationRateArgument(info[5], isolate);
+ DeviceMotionData::Acceleration* acceleration = readAccelerationArgument(info[3], isolate, exceptionState);
+ DeviceMotionData::Acceleration* accelerationIncludingGravity = readAccelerationArgument(info[4], isolate, exceptionState);
+ DeviceMotionData::RotationRate* rotationRate = readRotationRateArgument(info[5], isolate, exceptionState);
+ if (exceptionState.throwIfNeeded())
+ return;
+
bool intervalProvided = !isUndefinedOrNull(info[6]);
double interval = 0;
if (intervalProvided) {
« Source/bindings/core/v8/V8BindingMacros.h ('K') | « Source/bindings/core/v8/V8BindingMacros.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698