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

Unified Diff: third_party/WebKit/Source/bindings/core/v8/V8Binding.h

Issue 2265443002: Fix an overflow in valueAsDate setter of temporal input types. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: accept null Created 4 years, 4 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: third_party/WebKit/Source/bindings/core/v8/V8Binding.h
diff --git a/third_party/WebKit/Source/bindings/core/v8/V8Binding.h b/third_party/WebKit/Source/bindings/core/v8/V8Binding.h
index 004d117cdf342507c690aef9e70ea22916a9239e..b903b47d4f250286850a375f4398486d782c5edc 100644
--- a/third_party/WebKit/Source/bindings/core/v8/V8Binding.h
+++ b/third_party/WebKit/Source/bindings/core/v8/V8Binding.h
@@ -562,13 +562,15 @@ inline v8::Local<v8::Boolean> v8Boolean(bool value, v8::Isolate* isolate)
return value ? v8::True(isolate) : v8::False(isolate);
}
-inline double toCoreDate(v8::Isolate* isolate, v8::Local<v8::Value> object)
+inline double toCoreDate(v8::Isolate* isolate, v8::Local<v8::Value> object, ExceptionState& exceptionState)
{
- if (object->IsDate())
- return object.As<v8::Date>()->ValueOf();
- if (object->IsNumber())
- return object.As<v8::Number>()->Value();
- return std::numeric_limits<double>::quiet_NaN();
+ if (object->IsNull())
+ return std::numeric_limits<double>::quiet_NaN();
+ if (!object->IsDate()) {
+ exceptionState.throwTypeError("The provided value is not a Date.");
+ return 0;
+ }
+ return object.As<v8::Date>()->ValueOf();
}
inline v8::MaybeLocal<v8::Value> v8DateOrNaN(v8::Isolate* isolate, double value)

Powered by Google App Engine
This is Rietveld 408576698