Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Fix handling of uncaught exceptions. (issue 11360193)
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  2 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
yang...@chromium.org  
View profile  
 More options Nov 12 2012, 11:12 am
From: yang...@chromium.org
Date: Mon, 12 Nov 2012 16:12:23 +0000
Local: Mon, Nov 12 2012 11:12 am
Subject: Fix handling of uncaught exceptions. (issue 11360193)
Reviewers: Sven Panne,

Message:
This fixes a problem caused by r12926. It turns out that uncaught exceptions
have to be attached as such to the message object passed to the embedder, as
opposed to turned into a string. Therefore, we turn the uncaught exception  
to a
string at the point where it is needed (in FormatMessage).

Description:
Fix handling of uncaught exceptions.

BUG=

Please review this at https://chromiumcodereview.appspot.com/11360193/

SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files:
   M src/isolate.cc
   M src/messages.js
   A + test/message/stacktrace.js
   A + test/message/stacktrace.out
   M test/mjsunit/mjsunit.js

Index: src/isolate.cc
diff --git a/src/isolate.cc b/src/isolate.cc
index  
eec5a54d737e902caddfcfe5679dcb33656c8dd1..4768d99c402600acb77528cc4487b1908 4aa25fa  
100644
--- a/src/isolate.cc
+++ b/src/isolate.cc
@@ -1228,14 +1228,7 @@ void Isolate::DoThrow(Object* exception,  
MessageLocation* location) {
                stack_trace_for_uncaught_exceptions_options_);
          }
        }
-      // Stringify custom error objects for the message object.
-      if (exception_handle->IsJSObject()  
&& !IsErrorObject(exception_handle)) {
-        bool failed = false;
-        exception_handle = Execution::ToString(exception_handle, &failed);
-        if (failed) {
-          exception_handle = factory()->LookupAsciiSymbol("exception");
-        }
-      }
+
        Handle<Object> message_obj = MessageHandler::MakeMessageObject(
            "uncaught_exception",
            location,
Index: src/messages.js
diff --git a/src/messages.js b/src/messages.js
index  
30f6682adab6c5c2cd91a96cbed1a07f9aca8604..1e3152373ccc2960c1adef7b42e5289ed ded378b  
100644
--- a/src/messages.js
+++ b/src/messages.js
@@ -276,6 +276,8 @@ function MakeGenericError(constructor, type, args) {
  // Helper functions; called from the runtime system.
  function FormatMessage(type, args) {
    var format = kMessages[type];
+  // If an exception was not caught, we turn it into a string for the  
message.
+  if (type == "uncaught_exception") args[0] = ToDetailString(args[0]);
    if (!format) return "<unknown message " + type + ">";
    return FormatString(format, args);
  }
Index: test/message/stacktrace.js
diff --git a/test/mjsunit/regress/regress-2373.js  
b/test/message/stacktrace.js
similarity index 95%
copy from test/mjsunit/regress/regress-2373.js
copy to test/message/stacktrace.js
index  
16a87ece6f57aee42d77171e8087db412610b0a3..9844dc101f1621b7905c0f0ce18d8e659 7708c9a  
100644
--- a/test/mjsunit/regress/regress-2373.js
+++ b/test/message/stacktrace.js
@@ -25,5 +25,4 @@
  // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

-var o = JSON.parse('{"a":2600753951}');
-assertEquals(2600753951, o.a);
+(function f() { throw new Error(); })();
Index: test/message/stacktrace.out
diff --git a/tools/testrunner/objects/__init__.py  
b/test/message/stacktrace.out
similarity index 91%
copy from tools/testrunner/objects/__init__.py
copy to test/message/stacktrace.out
index  
202a262709c95ba356e9e1ef6aa2f5256690a24a..3020e74f776892796415249498fe4a5af 405a01e  
100644
--- a/tools/testrunner/objects/__init__.py
+++ b/test/message/stacktrace.out
@@ -24,3 +24,11 @@
  # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+*%(basename)s:28: Error
+(function f() { throw new Error(); })();
+                      ^
+Error
+    at f (*%(basename)s:28:23)
+    at *%(basename)s:28:38
+
Index: test/mjsunit/mjsunit.js
diff --git a/test/mjsunit/mjsunit.js b/test/mjsunit/mjsunit.js
index  
25d7c004326ce3df03ebe83edb2f0becd5336bba..2c382201c4b19c0381c745f72d497285a ea860c7  
100644
--- a/test/mjsunit/mjsunit.js
+++ b/test/mjsunit/mjsunit.js
@@ -39,6 +39,7 @@ function MjsUnitAssertionError(message) {

  MjsUnitAssertionError.prototype.toString = function () {
+  print("abc");
    return this.message;
  };


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Yang Guo  
View profile  
 More options Nov 12 2012, 12:40 pm
From: Yang Guo <yang...@chromium.org>
Date: Mon, 12 Nov 2012 18:40:46 +0100
Local: Mon, Nov 12 2012 12:40 pm
Subject: Re: Fix handling of uncaught exceptions. (issue 11360193)

Never mind this :)


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »