Revision: 20705
Author:   [email protected]
Date:     Mon Apr 14 08:27:00 2014 UTC
Log: Allow GetScriptNameOrSourceURL to be called with exception pending.

[email protected], [email protected]

Review URL: https://codereview.chromium.org/235943006
http://code.google.com/p/v8/source/detail?r=20705

Modified:
 /branches/bleeding_edge/src/handles.cc
 /branches/bleeding_edge/test/cctest/test-api.cc

=======================================
--- /branches/bleeding_edge/src/handles.cc      Fri Apr 11 12:47:34 2014 UTC
+++ /branches/bleeding_edge/src/handles.cc      Mon Apr 14 08:27:00 2014 UTC
@@ -399,10 +399,11 @@
   ASSERT(property->IsJSFunction());
   Handle<JSFunction> method = Handle<JSFunction>::cast(property);
   Handle<Object> result;
-  ASSIGN_RETURN_ON_EXCEPTION_VALUE(
-      isolate, result,
-      Execution::TryCall(method, script_wrapper, 0, NULL),
-      isolate->factory()->undefined_value());
+ // Do not check against pending exception, since this function may be called
+  // when an exception has already been pending.
+ if (!Execution::TryCall(method, script_wrapper, 0, NULL).ToHandle(&result)) {
+    return isolate->factory()->undefined_value();
+  }
   return result;
 }

=======================================
--- /branches/bleeding_edge/test/cctest/test-api.cc Mon Apr 14 07:35:46 2014 UTC +++ /branches/bleeding_edge/test/cctest/test-api.cc Mon Apr 14 08:27:00 2014 UTC
@@ -22428,3 +22428,16 @@
   CompileRun("Object.getPrototypeOf(friend);");
   CHECK_EQ(2, named_access_count);
 }
+
+
+TEST(CaptureStackTraceForStackOverflow) {
+  v8::internal::FLAG_stack_size = 150;
+  LocalContext current;
+  v8::Isolate* isolate = current->GetIsolate();
+  v8::HandleScope scope(isolate);
+  V8::SetCaptureStackTraceForUncaughtExceptions(
+      true, 10, v8::StackTrace::kDetailed);
+  v8::TryCatch try_catch;
+  CompileRun("(function f(x) { f(x+1); })(0)");
+  CHECK(try_catch.HasCaught());
+}

--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to