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

Unified Diff: Source/bindings/v8/custom/V8OscillatorNodeCustom.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
Index: Source/bindings/v8/custom/V8OscillatorNodeCustom.cpp
diff --git a/Source/bindings/v8/custom/V8OscillatorNodeCustom.cpp b/Source/bindings/v8/custom/V8OscillatorNodeCustom.cpp
index 7216a8ec56bf1902f009acc05391f8719b37a6cf..f6db41308d4f4d65a6563f5fba4ee5d69b0354e7 100644
--- a/Source/bindings/v8/custom/V8OscillatorNodeCustom.cpp
+++ b/Source/bindings/v8/custom/V8OscillatorNodeCustom.cpp
@@ -26,6 +26,7 @@
#if ENABLE(WEB_AUDIO)
#include "V8OscillatorNode.h"
+#include "bindings/v8/ExceptionState.h"
#include "bindings/v8/V8Binding.h"
#include "modules/webaudio/OscillatorNode.h"
@@ -33,14 +34,18 @@ namespace WebCore {
void V8OscillatorNode::typeAttributeSetterCustom(v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info)
{
+ ExceptionState exceptionState(ExceptionState::SetterContext, "type", "OscillatorNode", info.Holder(), info.GetIsolate());
v8::Handle<v8::Object> holder = info.Holder();
OscillatorNode* imp = V8OscillatorNode::toNative(holder);
if (value->IsNumber()) {
- bool ok = false;
- uint32_t type = toUInt32(value, ok);
- if (!ok || !imp->setType(type))
- throwTypeError("Illegal OscillatorNode type", info.GetIsolate());
+ uint32_t type = toUInt32(value, exceptionState);
+ if (exceptionState.throwIfNeeded())
+ return;
+ if (!imp->setType(type)) {
+ exceptionState.throwTypeError("Illegal OscillatorNode type");
+ exceptionState.throwIfNeeded();
+ }
return;
}
@@ -52,7 +57,8 @@ void V8OscillatorNode::typeAttributeSetterCustom(v8::Local<v8::Value> value, con
}
}
- throwTypeError("Illegal OscillatorNode type", info.GetIsolate());
+ exceptionState.throwTypeError("Illegal OscillatorNode type");
+ exceptionState.throwIfNeeded();
}
} // namespace WebCore
« no previous file with comments | « Source/bindings/v8/custom/V8HTMLOptionsCollectionCustom.cpp ('k') | Source/bindings/v8/custom/V8PannerNodeCustom.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698