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

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

Issue 934203002: Add [TypeChecking=Unrestricted] on Device Orientation interfaces (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: fix custom bindings logic Created 5 years, 10 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
« no previous file with comments | « no previous file | Source/bindings/modules/v8/custom/V8DeviceOrientationEventCustom.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 6bd9fdd8898b7db783613b164cc20856687ecedc..be8d12d3809aa2d30125558c971a5792ca2eb8dc 100644
--- a/Source/bindings/modules/v8/custom/V8DeviceMotionEventCustom.cpp
+++ b/Source/bindings/modules/v8/custom/V8DeviceMotionEventCustom.cpp
@@ -102,16 +102,24 @@ DeviceMotionData::RotationRate* readRotationRateArgument(v8::Local<v8::Value> va
void V8DeviceMotionEvent::initDeviceMotionEventMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& info)
{
+ ExceptionState exceptionState(ExceptionState::ExecutionContext, "initDeviceMotionEvent", "DeviceMotionEvent", info.Holder(), info.GetIsolate());
DeviceMotionEvent* impl = V8DeviceMotionEvent::toImpl(info.Holder());
v8::Isolate* isolate = info.GetIsolate();
- TOSTRING_VOID(V8StringResource<>, type, info[0]);
+ V8StringResource<> type(info[0]);
+ if (!type.prepare())
+ 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);
bool intervalProvided = !isUndefinedOrNull(info[6]);
- double interval = info[6]->NumberValue();
+ double interval = 0;
+ if (intervalProvided) {
+ interval = toRestrictedDouble(info[6], exceptionState);
+ if (exceptionState.throwIfNeeded())
+ return;
+ }
DeviceMotionData* deviceMotionData = DeviceMotionData::create(acceleration, accelerationIncludingGravity, rotationRate, intervalProvided, interval);
impl->initDeviceMotionEvent(type, bubbles, cancelable, deviceMotionData);
}
« no previous file with comments | « no previous file | Source/bindings/modules/v8/custom/V8DeviceOrientationEventCustom.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698