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

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: addressed comment 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..8daeacaa6b4a143aa0011c47d231c1aa237dca67 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,10 @@ MaybeHandle<String> MessageTemplate::FormatMessage(int template_index,
#undef CASE
case kLastMessage:
default:
- UNREACHABLE();
- template_string = "";
- break;
+ isolate->ThrowIllegalOperation();
+ return MaybeHandle<String>();
}
- 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