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

Unified Diff: src/messages.cc

Issue 1146923004: Throw illegal exception when formatting with invalid template index. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 7 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 | « no previous file | test/mjsunit/regress/regress-crbug-492526.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/messages.cc
diff --git a/src/messages.cc b/src/messages.cc
index c21f96c0187a91370c44f0b948a27fbaf68b6da9..8de00c6f4bf982423c71b3b8f2554b1f25a99314 100644
--- a/src/messages.cc
+++ b/src/messages.cc
@@ -312,6 +312,7 @@ MaybeHandle<String> MessageTemplate::FormatMessage(int template_index,
Handle<String> arg0,
Handle<String> arg1,
Handle<String> arg2) {
+ Isolate* isolate = arg0->GetIsolate();
const char* template_string;
switch (template_index) {
#define CASE(NAME, STRING) \
@@ -322,12 +323,11 @@ MaybeHandle<String> MessageTemplate::FormatMessage(int template_index,
#undef CASE
case kLastMessage:
default:
- UNREACHABLE();
- template_string = "";
+ isolate->ThrowIllegalOperation();
+ return MaybeHandle<String>();
break;
Igor Sheludko 2015/05/27 14:16:17 DBC: do we still need break here?
arv (Not doing code reviews) 2015/05/27 14:16:54 Nope. This break should be removed.
}
- Isolate* isolate = arg0->GetIsolate();
IncrementalStringBuilder builder(isolate);
unsigned int i = 0;
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-crbug-492526.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698