Chromium Code Reviews

Unified Diff: src/api.cc

Issue 867373003: Throw on range error when creating a string via API. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
« no previous file with comments | « include/v8.h ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/api.cc
diff --git a/src/api.cc b/src/api.cc
index 304d880d3da3017f3f21a8a3b39b3ccc9456c09f..a683add29bff17877b4a2b26adb960e0650e983b 100644
--- a/src/api.cc
+++ b/src/api.cc
@@ -5438,10 +5438,12 @@ inline Local<String> NewString(Isolate* v8_isolate,
ENTER_V8(isolate);
if (length == -1) length = StringLength(data);
// We do not expect this to fail. Change this if it does.
Jakob Kummerow 2015/02/10 16:00:19 nit: outdated comment
- i::Handle<i::String> result = NewString(
- isolate->factory(),
- type,
- i::Vector<const Char>(data, length)).ToHandleChecked();
+ EXCEPTION_PREAMBLE(isolate);
+ i::Handle<i::String> result;
+ has_pending_exception =
+ !NewString(isolate->factory(), type, i::Vector<const Char>(data, length))
+ .ToHandle(&result);
+ EXCEPTION_BAILOUT_CHECK(isolate, Local<String>());
if (type == String::kUndetectableString) {
result->MarkAsUndetectable();
}
« no previous file with comments | « include/v8.h ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine