Title: [153669] trunk
Revision
153669
Author
[email protected]
Date
2013-08-02 14:32:20 -0700 (Fri, 02 Aug 2013)

Log Message

Have vm's exceptionStack match java's vm's exceptionStack.
https://bugs.webkit.org/show_bug.cgi?id=119362

Source/_javascript_Core:

Patch by Chris Curtis <[email protected]> on 2013-08-02
Reviewed by Geoffrey Garen.

The error object's stack is only updated if it does not exist yet. This matches
the functionality of other browsers, and Java VMs.

* interpreter/Interpreter.cpp:
(JSC::Interpreter::addStackTraceIfNecessary):
(JSC::Interpreter::throwException):
* runtime/VM.cpp:
(JSC::VM::clearExceptionStack):
* runtime/VM.h:
(JSC::VM::lastExceptionStack):

LayoutTests:

Patch by Chris Curtis <[email protected]> on 2013-08-02
Reviewed by Geoffrey Garen.

All modifications to the tests below are column number changes. If the thrown
object was created by the user the column number references the error object,
otherwise it references the the throw.

* fast/events/window-onerror5-expected.txt:
* fast/js/line-column-numbers-expected.txt:
* fast/js/stack-trace-expected.txt:
* http/tests/workers/worker-importScriptsOnError-expected.txt:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (153668 => 153669)


--- trunk/LayoutTests/ChangeLog	2013-08-02 21:30:31 UTC (rev 153668)
+++ trunk/LayoutTests/ChangeLog	2013-08-02 21:32:20 UTC (rev 153669)
@@ -1,3 +1,19 @@
+2013-08-02  Chris Curtis  <[email protected]>
+
+        Have vm's exceptionStack match java's vm's exceptionStack.
+        https://bugs.webkit.org/show_bug.cgi?id=119362
+
+        Reviewed by Geoffrey Garen.
+        
+        All modifications to the tests below are column number changes. If the thrown 
+        object was created by the user the column number references the error object, 
+        otherwise it references the the throw.
+        
+        * fast/events/window-onerror5-expected.txt:
+        * fast/js/line-column-numbers-expected.txt:
+        * fast/js/stack-trace-expected.txt:
+        * http/tests/workers/worker-importScriptsOnError-expected.txt:
+
 2013-08-02  Simon Fraser  <[email protected]>
 
         webaudio/_javascript_audionode-downmix8-2channel-input.html sometimes asserts

Modified: trunk/LayoutTests/fast/events/window-onerror5-expected.txt (153668 => 153669)


--- trunk/LayoutTests/fast/events/window-onerror5-expected.txt	2013-08-02 21:30:31 UTC (rev 153668)
+++ trunk/LayoutTests/fast/events/window-onerror5-expected.txt	2013-08-02 21:32:20 UTC (rev 153669)
@@ -1,4 +1,4 @@
 Test that window.onerror is invoked for syntax error in eval. You should see a log record if window.onerror is working properly for this test.Bug 8519.
 
-Error caught successfully: SyntaxError: Unexpected EOF File: window-onerror5.html Line: 16 Column: 0
+Error caught successfully: SyntaxError: Unexpected EOF File: window-onerror5.html Line: 16 Column: 9
 

Modified: trunk/LayoutTests/fast/js/line-column-numbers-expected.txt (153668 => 153669)


--- trunk/LayoutTests/fast/js/line-column-numbers-expected.txt	2013-08-02 21:30:31 UTC (rev 153668)
+++ trunk/LayoutTests/fast/js/line-column-numbers-expected.txt	2013-08-02 21:32:20 UTC (rev 153669)
@@ -4,68 +4,68 @@
 
 
 --> Case 1 Stack Trace:
-    0   global code at line-column-numbers.html:40:36
+    0   global code at line-column-numbers.html:40:34
 
 --> Case 2 Stack Trace:
-    0   global code at line-column-numbers.html:44:40
+    0   global code at line-column-numbers.html:44:38
 
 --> Case 3 Stack Trace:
-    0   global code at line-column-numbers.html:48:32
+    0   global code at line-column-numbers.html:48:30
 
 --> Case 3 Stack Trace:
-    0   global code at line-column-numbers.html:48:113
+    0   global code at line-column-numbers.html:48:111
 
 --> Case 4 Stack Trace:
-    0   doThrow4 at line-column-numbers.html:54:44
+    0   doThrow4 at line-column-numbers.html:54:42
     1   global code at line-column-numbers.html:55:13
 
 --> Case 5 Stack Trace:
-    0   innerFunc at line-column-numbers.html:64:69
+    0   innerFunc at line-column-numbers.html:64:67
     1   doThrow5 at line-column-numbers.html:64:82
     2   global code at line-column-numbers.html:64:133
 
 --> Case 6 Stack Trace:
-    0   innerFunc at line-column-numbers.html:70:69
+    0   innerFunc at line-column-numbers.html:70:67
     1   doThrow6 at line-column-numbers.html:70:82
     2   global code at line-column-numbers.html:70:133
 
 --> Case 7 Stack Trace:
-    0    at line-column-numbers.html:75:51
+    0    at line-column-numbers.html:75:49
     1   global code at line-column-numbers.html:75:55
 
 --> Case 8 Stack Trace:
-    0    at line-column-numbers.html:78:59
+    0    at line-column-numbers.html:78:57
     1   global code at line-column-numbers.html:78:63
 
 --> Case 9 Stack Trace:
-    0    at line-column-numbers.html:82:55
+    0    at line-column-numbers.html:82:53
     1   global code at line-column-numbers.html:82:59
 
 --> Case 9 Stack Trace:
-    0    at line-column-numbers.html:82:157
+    0    at line-column-numbers.html:82:155
     1   global code at line-column-numbers.html:82:161
 
 --> Case 10 Stack Trace:
-    0    at line-column-numbers.html:89:26
+    0    at line-column-numbers.html:89:24
     1   global code at line-column-numbers.html:90:8
 
 --> Case 11 Stack Trace:
-    0    at line-column-numbers.html:101:41
+    0    at line-column-numbers.html:101:39
     1   doThrow11 at line-column-numbers.html:101:45
     2   global code at line-column-numbers.html:103:14
 
 --> Case 12 Stack Trace:
-    0    at line-column-numbers.html:112:53
+    0    at line-column-numbers.html:112:51
     1    at line-column-numbers.html:112:57
     2   global code at line-column-numbers.html:112:62
 
 --> Case 13 Stack Trace:
-    0    at line-column-numbers.html:118:53
+    0    at line-column-numbers.html:118:51
     1    at line-column-numbers.html:118:57
     2   global code at line-column-numbers.html:118:62
 
 --> Case 14 Stack Trace:
-    0    at line-column-numbers.html:124:76
+    0    at line-column-numbers.html:124:74
     1    at line-column-numbers.html:124:80
     2   doThrow14 at line-column-numbers.html:124:85
     3   global code at line-column-numbers.html:124:99
@@ -146,7 +146,7 @@
     1   global code at line-column-numbers.html:224:13
 
 --> Case 1 Stack Trace:
-    0   global code at line-column-numbers.js:3:28
+    0   global code at line-column-numbers.js:3:26
 
 --> Case 2 Stack Trace:
     0   global code at line-column-numbers.js:7:30

Modified: trunk/LayoutTests/fast/js/stack-trace-expected.txt (153668 => 153669)


--- trunk/LayoutTests/fast/js/stack-trace-expected.txt	2013-08-02 21:30:31 UTC (rev 153668)
+++ trunk/LayoutTests/fast/js/stack-trace-expected.txt	2013-08-02 21:32:20 UTC (rev 153669)
@@ -9,14 +9,14 @@
     2   global code at stack-trace.js:36:18
 
 --> Stack Trace:
-    0   inner at stack-trace.js:28:69
+    0   inner at stack-trace.js:28:44
     1    at eval code
     2   eval at [native code]
     3   evaler at stack-trace.js:29:29
     4   global code at stack-trace.js:39:13
 
 --> Stack Trace:
-    0   inner at stack-trace.js:28:69
+    0   inner at stack-trace.js:28:44
     1   outer at stack-trace.js:27:34
     2    at eval code
     3   eval at [native code]

Modified: trunk/LayoutTests/http/tests/workers/worker-importScriptsOnError-expected.txt (153668 => 153669)


--- trunk/LayoutTests/http/tests/workers/worker-importScriptsOnError-expected.txt	2013-08-02 21:30:31 UTC (rev 153668)
+++ trunk/LayoutTests/http/tests/workers/worker-importScriptsOnError-expected.txt	2013-08-02 21:32:20 UTC (rev 153669)
@@ -26,7 +26,7 @@
 cancelBubble: false,
 cancelable: true,
 clipboardData: undefined,
-colno: 0,
+colno: 14,
 currentTarget: [object Worker],
 defaultPrevented: false,
 eventPhase: 2,

Modified: trunk/Source/_javascript_Core/ChangeLog (153668 => 153669)


--- trunk/Source/_javascript_Core/ChangeLog	2013-08-02 21:30:31 UTC (rev 153668)
+++ trunk/Source/_javascript_Core/ChangeLog	2013-08-02 21:32:20 UTC (rev 153669)
@@ -1,3 +1,21 @@
+2013-08-02  Chris Curtis  <[email protected]>
+
+        Have vm's exceptionStack match java's vm's exceptionStack.
+        https://bugs.webkit.org/show_bug.cgi?id=119362
+
+        Reviewed by Geoffrey Garen.
+        
+        The error object's stack is only updated if it does not exist yet. This matches 
+        the functionality of other browsers, and Java VMs. 
+
+        * interpreter/Interpreter.cpp:
+        (JSC::Interpreter::addStackTraceIfNecessary):
+        (JSC::Interpreter::throwException):
+        * runtime/VM.cpp:
+        (JSC::VM::clearExceptionStack):
+        * runtime/VM.h:
+        (JSC::VM::lastExceptionStack):
+
 2013-08-02  Julien Brianceau  <[email protected]>
 
         REGRESSION(FTL): Fix mips implementation of ctiVMThrowTrampolineSlowpath.

Modified: trunk/Source/_javascript_Core/interpreter/Interpreter.cpp (153668 => 153669)


--- trunk/Source/_javascript_Core/interpreter/Interpreter.cpp	2013-08-02 21:30:31 UTC (rev 153668)
+++ trunk/Source/_javascript_Core/interpreter/Interpreter.cpp	2013-08-02 21:32:20 UTC (rev 153669)
@@ -574,20 +574,15 @@
     VM* vm = &callFrame->vm();
     ASSERT(callFrame == vm->topCallFrame || callFrame == callFrame->lexicalGlobalObject()->globalExec() || callFrame == callFrame->dynamicGlobalObject()->globalExec());
 
-    if (vm->exceptionStack().size()) {
-        if (!error.isObject() || asObject(error)->hasProperty(callFrame, vm->propertyNames->stack))
-            return;
-    }
-    
     Vector<StackFrame> stackTrace;
     vm->interpreter->getStackTrace(stackTrace);
     vm->exceptionStack() = RefCountedArray<StackFrame>(stackTrace);
     if (stackTrace.isEmpty() || !error.isObject())
         return;
 
-    // Note: 'error' might already have a stack property if it was created by the user (e.g. "new Error"). The stack
-    // now, as the error is thrown, might be different from the stack when it was created, so we overwrite it with
-    // the current stack unconditionally.
+    if (asObject(error)->hasProperty(callFrame, vm->propertyNames->stack))
+        return;
+    
     asObject(error)->putDirect(*vm, vm->propertyNames->stack, vm->interpreter->stackTraceAsString(vm->topCallFrame, stackTrace), ReadOnly | DontDelete);
 
 }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to