Author: [EMAIL PROTECTED]
Date: Tue Oct 28 01:29:23 2008
New Revision: 616

Modified:
    branches/bleeding_edge/src/api.cc
    branches/bleeding_edge/src/top.cc

Log:
Work around issue 131 by checking for empty handles
in a few places.
Review URL: http://codereview.chromium.org/8828

Modified: branches/bleeding_edge/src/api.cc
==============================================================================
--- branches/bleeding_edge/src/api.cc   (original)
+++ branches/bleeding_edge/src/api.cc   Tue Oct 28 01:29:23 2008
@@ -230,7 +230,13 @@

  v8::Handle<Value> ThrowException(v8::Handle<v8::Value> value) {
    if (IsDeadCheck("v8::ThrowException()")) return v8::Handle<Value>();
-  i::Top::ScheduleThrow(*Utils::OpenHandle(*value));
+  // If we're passed an empty handle, we throw an undefined exception
+  // to deal more gracefully with out of memory situations.
+  if (value.IsEmpty()) {
+    i::Top::ScheduleThrow(i::Heap::undefined_value());
+  } else {
+    i::Top::ScheduleThrow(*Utils::OpenHandle(*value));
+  }
    return v8::Undefined();
  }


Modified: branches/bleeding_edge/src/top.cc
==============================================================================
--- branches/bleeding_edge/src/top.cc   (original)
+++ branches/bleeding_edge/src/top.cc   Tue Oct 28 01:29:23 2008
@@ -806,7 +806,7 @@
    if (report_exception) {
      if (message != NULL) {
        MessageHandler::ReportMessage(message);
-    } else {
+    } else if (!message_obj.is_null()) {
        MessageHandler::ReportMessage(location, message_obj);
      }
    }

--~--~---------~--~----~------------~-------~--~----~
v8-dev mailing list
v8-dev@googlegroups.com
http://groups.google.com/group/v8-dev
-~----------~----~----~----~------~----~------~--~---

Reply via email to