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

Unified Diff: Source/bindings/v8/custom/V8PannerNodeCustom.cpp

Issue 121113004: Improve handling of failed integer type conversions. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase Created 6 years, 11 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 | « Source/bindings/v8/custom/V8OscillatorNodeCustom.cpp ('k') | Source/bindings/v8/custom/V8PromiseCustom.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/v8/custom/V8PannerNodeCustom.cpp
diff --git a/Source/bindings/v8/custom/V8PannerNodeCustom.cpp b/Source/bindings/v8/custom/V8PannerNodeCustom.cpp
index 5e10fda34cf61e9ae56cf9914a1021f9eeea4310..e6a14afac5308f9beaaaa5e562f8a20a3a64dfbc 100644
--- a/Source/bindings/v8/custom/V8PannerNodeCustom.cpp
+++ b/Source/bindings/v8/custom/V8PannerNodeCustom.cpp
@@ -26,6 +26,7 @@
#if ENABLE(WEB_AUDIO)
#include "V8PannerNode.h"
+#include "bindings/v8/ExceptionState.h"
#include "bindings/v8/V8Binding.h"
#include "modules/webaudio/PannerNode.h"
@@ -33,14 +34,17 @@ namespace WebCore {
void V8PannerNode::panningModelAttributeSetterCustom(v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info)
{
+ ExceptionState exceptionState(ExceptionState::SetterContext, "panningModel", "PannerNode", info.Holder(), info.GetIsolate());
PannerNode* imp = V8PannerNode::toNative(info.Holder());
if (value->IsNumber()) {
- bool ok = false;
- uint32_t model = toUInt32(value, ok);
- ASSERT(ok);
- if (!imp->setPanningModel(model))
- throwTypeError("Illegal panningModel", info.GetIsolate());
+ uint32_t model = toUInt32(value, exceptionState);
+ if (exceptionState.throwIfNeeded())
+ return;
+ if (!imp->setPanningModel(model)) {
+ exceptionState.throwTypeError("Illegal panningModel");
+ exceptionState.throwIfNeeded();
+ }
return;
}
@@ -52,19 +56,23 @@ void V8PannerNode::panningModelAttributeSetterCustom(v8::Local<v8::Value> value,
}
}
- throwTypeError("Illegal panningModel", info.GetIsolate());
+ exceptionState.throwTypeError("Illegal panningModel");
+ exceptionState.throwIfNeeded();
}
void V8PannerNode::distanceModelAttributeSetterCustom(v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info)
{
+ ExceptionState exceptionState(ExceptionState::SetterContext, "distanceModel", "PannerNode", info.Holder(), info.GetIsolate());
PannerNode* imp = V8PannerNode::toNative(info.Holder());
if (value->IsNumber()) {
- bool ok = false;
- uint32_t model = toUInt32(value, ok);
- ASSERT(ok);
- if (!imp->setDistanceModel(model))
- throwTypeError("Illegal distanceModel", info.GetIsolate());
+ uint32_t model = toUInt32(value, exceptionState);
+ if (exceptionState.throwIfNeeded())
+ return;
+ if (!imp->setDistanceModel(model)) {
+ exceptionState.throwTypeError("Illegal distanceModel");
+ exceptionState.throwIfNeeded();
+ }
return;
}
@@ -76,7 +84,8 @@ void V8PannerNode::distanceModelAttributeSetterCustom(v8::Local<v8::Value> value
}
}
- throwTypeError("Illegal distanceModel", info.GetIsolate());
+ exceptionState.throwTypeError("Illegal distanceModel");
+ exceptionState.throwIfNeeded();
}
} // namespace WebCore
« no previous file with comments | « Source/bindings/v8/custom/V8OscillatorNodeCustom.cpp ('k') | Source/bindings/v8/custom/V8PromiseCustom.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698