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

Unified Diff: src/d8.cc

Issue 793333003: Correct handling of exceptions occured during getting of exception stack trace. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 6 years 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-444805.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/d8.cc
diff --git a/src/d8.cc b/src/d8.cc
index 132891e2b8a694919c0643118dea5fd8ef82b403..2ef7162878713a6c0385c4c5c0ed6a190facb87b 100644
--- a/src/d8.cc
+++ b/src/d8.cc
@@ -587,24 +587,24 @@ Handle<String> Shell::ReadFromStdin(Isolate* isolate) {
void Shell::Load(const v8::FunctionCallbackInfo<v8::Value>& args) {
+ Isolate* isolate = args.GetIsolate();
for (int i = 0; i < args.Length(); i++) {
- HandleScope handle_scope(args.GetIsolate());
+ HandleScope handle_scope(isolate);
String::Utf8Value file(args[i]);
if (*file == NULL) {
- Throw(args.GetIsolate(), "Error loading file");
+ Throw(isolate, "Error loading file");
return;
}
- Handle<String> source = ReadFile(args.GetIsolate(), *file);
+ Handle<String> source = ReadFile(isolate, *file);
if (source.IsEmpty()) {
- Throw(args.GetIsolate(), "Error loading file");
+ Throw(isolate, "Error loading file");
return;
}
- if (!ExecuteString(args.GetIsolate(),
- source,
- String::NewFromUtf8(args.GetIsolate(), *file),
- false,
- true)) {
- Throw(args.GetIsolate(), "Error executing file");
+ if (!ExecuteString(isolate, source, String::NewFromUtf8(isolate, *file),
+ false, true)) {
+ // Exception is already reported, so clear it before throwing another one.
+ reinterpret_cast<i::Isolate*>(isolate)->clear_pending_exception();
Yang 2014/12/23 22:16:09 Can we assert that there is indeed a pending excep
+ Throw(isolate, "Error executing file");
return;
}
}
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-444805.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698