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

Unified Diff: src/top.cc

Issue 194070: Fix crash during error reporting during bootstrapping. (Closed)
Patch Set: Created 11 years, 3 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 | « src/factory.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/top.cc
diff --git a/src/top.cc b/src/top.cc
index 5c22bcf3cd0ef9037a1c02c14607c206040d5aa1..039c29268f490ffa5a2c3b3d0c767ca3cccddb44 100644
--- a/src/top.cc
+++ b/src/top.cc
@@ -690,12 +690,17 @@ void Top::ComputeLocation(MessageLocation* target) {
void Top::ReportUncaughtException(Handle<Object> exception,
MessageLocation* location,
Handle<String> stack_trace) {
- Handle<Object> message =
- MessageHandler::MakeMessageObject("uncaught_exception",
- location,
- HandleVector<Object>(&exception, 1),
- stack_trace);
-
+ Handle<Object> message;
+ if (!Bootstrapper::IsActive()) {
+ // It's not safe to try to make message objects while the bootstrapper
+ // is active since the infrastructure may not have been properly
+ // initialized.
+ message =
+ MessageHandler::MakeMessageObject("uncaught_exception",
+ location,
+ HandleVector<Object>(&exception, 1),
+ stack_trace);
+ }
// Report the uncaught exception.
MessageHandler::ReportMessage(location, message);
}
@@ -769,10 +774,15 @@ void Top::DoThrow(Object* exception,
ComputeLocation(&potential_computed_location);
location = &potential_computed_location;
}
- Handle<String> stack_trace;
- if (FLAG_trace_exception) stack_trace = StackTrace();
- message_obj = MessageHandler::MakeMessageObject("uncaught_exception",
- location, HandleVector<Object>(&exception_handle, 1), stack_trace);
+ if (!Bootstrapper::IsActive()) {
+ // It's not safe to try to make message objects or collect stack
+ // traces while the bootstrapper is active since the infrastructure
+ // may not have been properly initialized.
+ Handle<String> stack_trace;
+ if (FLAG_trace_exception) stack_trace = StackTrace();
+ message_obj = MessageHandler::MakeMessageObject("uncaught_exception",
+ location, HandleVector<Object>(&exception_handle, 1), stack_trace);
+ }
}
// Save the message for reporting if the the exception remains uncaught.
« no previous file with comments | « src/factory.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698