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

Unified Diff: Source/bindings/v8/custom/V8HTMLOptionsCollectionCustom.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/V8HTMLOptionsCollectionCustom.cpp
diff --git a/Source/bindings/v8/custom/V8HTMLOptionsCollectionCustom.cpp b/Source/bindings/v8/custom/V8HTMLOptionsCollectionCustom.cpp
index 094bf4acc8ba176b6118dd56fbf6175bf91075ab..a7fa8d2ccc488a073ad4614a33e5dbe187768084 100644
--- a/Source/bindings/v8/custom/V8HTMLOptionsCollectionCustom.cpp
+++ b/Source/bindings/v8/custom/V8HTMLOptionsCollectionCustom.cpp
@@ -34,7 +34,6 @@
#include "V8HTMLOptionElement.h"
#include "V8Node.h"
#include "V8NodeList.h"
-#include "bindings/v8/ExceptionMessages.h"
#include "bindings/v8/ExceptionState.h"
#include "bindings/v8/V8Binding.h"
#include "core/dom/ExceptionCode.h"
@@ -83,12 +82,11 @@ void V8HTMLOptionsCollection::addMethodCustom(const v8::FunctionCallbackInfo<v8:
if (info.Length() < 2) {
imp->add(option, exceptionState);
} else {
- bool ok;
- V8TRYCATCH_VOID(int, index, toInt32(info[1], ok));
- if (!ok)
- exceptionState.throwTypeError("The index provided could not be interpreted as an integer.");
- else
- imp->add(option, index, exceptionState);
+ int index = toInt32(info[1], exceptionState);
+ if (exceptionState.throwIfNeeded())
+ return;
+
+ imp->add(option, index, exceptionState);
}
}
« no previous file with comments | « Source/bindings/v8/custom/V8BiquadFilterNodeCustom.cpp ('k') | Source/bindings/v8/custom/V8OscillatorNodeCustom.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698