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

Unified Diff: Source/bindings/modules/v8/custom/V8DeviceOrientationEventCustom.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
Index: Source/bindings/modules/v8/custom/V8DeviceOrientationEventCustom.cpp
diff --git a/Source/bindings/modules/v8/custom/V8DeviceOrientationEventCustom.cpp b/Source/bindings/modules/v8/custom/V8DeviceOrientationEventCustom.cpp
index 4938c200b8802709530fb5ee3ca1fe3a1715446f..118d445969c431e17054c7388cb6ea061ec43d8a 100644
--- a/Source/bindings/modules/v8/custom/V8DeviceOrientationEventCustom.cpp
+++ b/Source/bindings/modules/v8/custom/V8DeviceOrientationEventCustom.cpp
@@ -34,18 +34,36 @@ namespace blink {
void V8DeviceOrientationEvent::initDeviceOrientationEventMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& info)
{
+ ExceptionState exceptionState(ExceptionState::ExecutionContext, "initDeviceOrientationEvent", "DeviceOrientationEvent", info.Holder(), info.GetIsolate());
DeviceOrientationEvent* impl = V8DeviceOrientationEvent::toImpl(info.Holder());
- TOSTRING_VOID(V8StringResource<>, type, info[0]);
+ V8StringResource<> type(info[0]);
+ if (!type.prepare())
+ return;
bool bubbles = info[1]->BooleanValue();
bool cancelable = info[2]->BooleanValue();
// If alpha, beta, gamma or absolute are null or undefined, mark them as not provided.
// Otherwise, use the standard JavaScript conversion.
bool alphaProvided = !isUndefinedOrNull(info[3]);
- double alpha = info[3]->NumberValue();
+ double alpha = 0;
+ if (alphaProvided) {
+ alpha = toRestrictedDouble(info[3], exceptionState);
+ if (exceptionState.throwIfNeeded())
+ return;
+ }
bool betaProvided = !isUndefinedOrNull(info[4]);
- double beta = info[4]->NumberValue();
+ double beta = 0;
+ if (betaProvided) {
+ beta = toRestrictedDouble(info[4], exceptionState);
+ if (exceptionState.throwIfNeeded())
+ return;
+ }
bool gammaProvided = !isUndefinedOrNull(info[5]);
- double gamma = info[5]->NumberValue();
+ double gamma = 0;
+ if (gammaProvided) {
+ gamma = toRestrictedDouble(info[5], exceptionState);
+ if (exceptionState.throwIfNeeded())
+ return;
+ }
bool absoluteProvided = !isUndefinedOrNull(info[6]);
bool absolute = info[6]->BooleanValue();
DeviceOrientationData* orientation = DeviceOrientationData::create(alphaProvided, alpha, betaProvided, beta, gammaProvided, gamma, absoluteProvided, absolute);

Powered by Google App Engine
This is Rietveld 408576698