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

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: rebase Created 5 years, 10 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 | « 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 8716b4a0d8550d184676ccbcff4630e34b763227..f2fffa2182a1be05d6dc4313c0c51f82c5bcff2a 100644
--- a/src/api.cc
+++ b/src/api.cc
@@ -5431,17 +5431,19 @@ inline Local<String> NewString(Isolate* v8_isolate,
String::NewStringType type,
int length) {
i::Isolate* isolate = reinterpret_cast<internal::Isolate*>(v8_isolate);
+ ON_BAILOUT(isolate, location, return Local<String>());
LOG_API(isolate, env);
if (length == 0) {
return String::Empty(v8_isolate);
}
ENTER_V8(isolate);
if (length == -1) length = StringLength(data);
- // We do not expect this to fail. Change this if it does.
- 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>());
return Utils::ToLocal(result);
}
« 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
This is Rietveld 408576698