Diff
Modified: trunk/LayoutTests/ChangeLog (147871 => 147872)
--- trunk/LayoutTests/ChangeLog 2013-04-07 18:37:39 UTC (rev 147871)
+++ trunk/LayoutTests/ChangeLog 2013-04-07 18:47:20 UTC (rev 147872)
@@ -1,3 +1,25 @@
+2013-04-07 Oliver Hunt <[email protected]>
+
+ Inspector should display information about non-object exceptions
+ https://bugs.webkit.org/show_bug.cgi?id=114123
+
+ Reviewed by Adele Peterson.
+
+ All these tests throw primitives as exceptions, and now they have source
+ and line number information
+
+ * fast/dom/exception-getting-event-handler-expected.txt:
+ * fast/dom/_javascript_-url-exception-isolation-expected.txt:
+ * fast/dom/nested-script-exceptions-expected.txt:
+ * fast/events/onerror-no-constructor-expected.txt:
+ * fast/events/window-onerror13-expected.txt:
+ * fast/events/window-onerror16-expected.txt:
+ * fast/events/window-onerror2-expected.txt:
+ * fast/events/window-onerror8-expected.txt:
+ * fast/js/uncaught-exception-line-number-expected.txt:
+ * fast/sub-pixel/inline-block-with-padding-expected.txt:
+ * platform/mac/fast/AppleScript/001-expected.txt:
+
2013-04-07 Robert Hogan <[email protected]>
table element may get larger when its contents are recreated
Modified: trunk/LayoutTests/fast/dom/exception-getting-event-handler-expected.txt (147871 => 147872)
--- trunk/LayoutTests/fast/dom/exception-getting-event-handler-expected.txt 2013-04-07 18:37:39 UTC (rev 147871)
+++ trunk/LayoutTests/fast/dom/exception-getting-event-handler-expected.txt 2013-04-07 18:47:20 UTC (rev 147872)
@@ -1,4 +1,4 @@
-CONSOLE MESSAGE: 42
+CONSOLE MESSAGE: line 12: 42
This test checks that an exception thrown when getting the handleEvent property of an event listener does not crash.
PASS: You didn't crash.
Modified: trunk/LayoutTests/fast/dom/_javascript_-url-exception-isolation-expected.txt (147871 => 147872)
--- trunk/LayoutTests/fast/dom/_javascript_-url-exception-isolation-expected.txt 2013-04-07 18:37:39 UTC (rev 147871)
+++ trunk/LayoutTests/fast/dom/_javascript_-url-exception-isolation-expected.txt 2013-04-07 18:47:20 UTC (rev 147872)
@@ -1,4 +1,4 @@
-CONSOLE MESSAGE: 42
+CONSOLE MESSAGE: line 1: 42
CONSOLE MESSAGE: line 1: SyntaxError: Unexpected token '<'
Exceptions thrown in _javascript_ URLs should not propagate to the main script.
Modified: trunk/LayoutTests/fast/dom/nested-script-exceptions-expected.txt (147871 => 147872)
--- trunk/LayoutTests/fast/dom/nested-script-exceptions-expected.txt 2013-04-07 18:37:39 UTC (rev 147871)
+++ trunk/LayoutTests/fast/dom/nested-script-exceptions-expected.txt 2013-04-07 18:47:20 UTC (rev 147872)
@@ -1,2 +1,2 @@
-CONSOLE MESSAGE: Badness 10,000
+CONSOLE MESSAGE: line 1: Badness 10,000
This test checks that exceptions in nested scripts are logged properly. An exception named "Badness 10,000" should be logged properly.
Modified: trunk/LayoutTests/fast/events/onerror-no-constructor-expected.txt (147871 => 147872)
--- trunk/LayoutTests/fast/events/onerror-no-constructor-expected.txt 2013-04-07 18:37:39 UTC (rev 147871)
+++ trunk/LayoutTests/fast/events/onerror-no-constructor-expected.txt 2013-04-07 18:47:20 UTC (rev 147872)
@@ -1,3 +1,3 @@
CONSOLE MESSAGE: line 8: FAIL
-CONSOLE MESSAGE: PASS if this is reported as an uncaught exception.
+CONSOLE MESSAGE: line 20: PASS if this is reported as an uncaught exception.
Modified: trunk/LayoutTests/fast/events/window-onerror13-expected.txt (147871 => 147872)
--- trunk/LayoutTests/fast/events/window-onerror13-expected.txt 2013-04-07 18:37:39 UTC (rev 147871)
+++ trunk/LayoutTests/fast/events/window-onerror13-expected.txt 2013-04-07 18:47:20 UTC (rev 147872)
@@ -1,4 +1,4 @@
-CONSOLE MESSAGE: An Error
+CONSOLE MESSAGE: line 24: An Error
Test that error is treated as not handled when window.onerror return value is not 'true'. Bug 67119.
Uncaught error should be printed in console when window.onerror returns not true.
Modified: trunk/LayoutTests/fast/events/window-onerror16-expected.txt (147871 => 147872)
--- trunk/LayoutTests/fast/events/window-onerror16-expected.txt 2013-04-07 18:37:39 UTC (rev 147871)
+++ trunk/LayoutTests/fast/events/window-onerror16-expected.txt 2013-04-07 18:47:20 UTC (rev 147872)
@@ -1,4 +1,4 @@
-CONSOLE MESSAGE: An Error
+CONSOLE MESSAGE: line 25: An Error
Test that error is treated as not handled when window.onerror return value is 'false'. Bug 67119.
window.onerror invoked. Uncaught error should be printed in console
Modified: trunk/LayoutTests/fast/events/window-onerror2-expected.txt (147871 => 147872)
--- trunk/LayoutTests/fast/events/window-onerror2-expected.txt 2013-04-07 18:37:39 UTC (rev 147871)
+++ trunk/LayoutTests/fast/events/window-onerror2-expected.txt 2013-04-07 18:47:20 UTC (rev 147872)
@@ -1,6 +1,6 @@
Test that uncaught exceptions will be reported to the window.onerror handler. Bug 8519.
Main frame window.onerror: Error: Inline script exception at window-onerror2.html:34
-Main frame window.onerror: Exception in onload at undefined:0
+Main frame window.onerror: Exception in onload at window-onerror2.html:2
Main frame window.onerror: Error: Exception in setTimeout at window-onerror2.html:29
Modified: trunk/LayoutTests/fast/events/window-onerror8-expected.txt (147871 => 147872)
--- trunk/LayoutTests/fast/events/window-onerror8-expected.txt 2013-04-07 18:37:39 UTC (rev 147871)
+++ trunk/LayoutTests/fast/events/window-onerror8-expected.txt 2013-04-07 18:47:20 UTC (rev 147872)
@@ -1,5 +1,5 @@
Test that window.onerror is called on window object. Bug 8519.
-Main frame window.onerror: 2010 at undefined:0
+Main frame window.onerror: 2010 at window-onerror8.html:24
PASSED: this === window
Modified: trunk/LayoutTests/fast/js/uncaught-exception-line-number-expected.txt (147871 => 147872)
--- trunk/LayoutTests/fast/js/uncaught-exception-line-number-expected.txt 2013-04-07 18:37:39 UTC (rev 147871)
+++ trunk/LayoutTests/fast/js/uncaught-exception-line-number-expected.txt 2013-04-07 18:47:20 UTC (rev 147872)
@@ -1,3 +1,3 @@
-CONSOLE MESSAGE: uh oh, an exception!
+CONSOLE MESSAGE: line 11: uh oh, an exception!
This tests that uncaught exceptions have the right line numbers, for example for display in the _javascript_ error console. To run the test manually, look in the JS console for an uncaught exception on line 11.
Modified: trunk/LayoutTests/fast/sub-pixel/inline-block-with-padding-expected.txt (147871 => 147872)
--- trunk/LayoutTests/fast/sub-pixel/inline-block-with-padding-expected.txt 2013-04-07 18:37:39 UTC (rev 147871)
+++ trunk/LayoutTests/fast/sub-pixel/inline-block-with-padding-expected.txt 2013-04-07 18:47:20 UTC (rev 147872)
@@ -1,4 +1,4 @@
-PASS links[0].offsetWidth is within 1 of 167
+PASS links[0].offsetWidth is within 1 of 175
Both links should render the same and not wrap.
This shouldn't wrap
Modified: trunk/LayoutTests/platform/mac/fast/AppleScript/001-expected.txt (147871 => 147872)
--- trunk/LayoutTests/platform/mac/fast/AppleScript/001-expected.txt 2013-04-07 18:37:39 UTC (rev 147871)
+++ trunk/LayoutTests/platform/mac/fast/AppleScript/001-expected.txt 2013-04-07 18:47:20 UTC (rev 147872)
@@ -1,4 +1,4 @@
-CONSOLE MESSAGE: this is an exception
+CONSOLE MESSAGE: line 1: this is an exception
An automated test for basic AppleScript "do _javascript_" support.
4 ('long')
4 ('long')
Modified: trunk/Source/_javascript_Core/ChangeLog (147871 => 147872)
--- trunk/Source/_javascript_Core/ChangeLog 2013-04-07 18:37:39 UTC (rev 147871)
+++ trunk/Source/_javascript_Core/ChangeLog 2013-04-07 18:47:20 UTC (rev 147872)
@@ -1,3 +1,20 @@
+2013-04-07 Oliver Hunt <[email protected]>
+
+ Inspector should display information about non-object exceptions
+ https://bugs.webkit.org/show_bug.cgi?id=114123
+
+ Reviewed by Adele Peterson.
+
+ Make sure we store the right stack information, even when throwing
+ a primitive.
+
+ * interpreter/CallFrame.h:
+ (JSC::ExecState::clearSupplementaryExceptionInfo):
+ (ExecState):
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::addStackTraceIfNecessary):
+ (JSC::Interpreter::throwException):
+
2013-04-06 Oliver Hunt <[email protected]>
Unify the many and varied stack trace mechanisms, and make the result sane.
Modified: trunk/Source/_javascript_Core/interpreter/CallFrame.h (147871 => 147872)
--- trunk/Source/_javascript_Core/interpreter/CallFrame.h 2013-04-07 18:37:39 UTC (rev 147871)
+++ trunk/Source/_javascript_Core/interpreter/CallFrame.h 2013-04-07 18:47:20 UTC (rev 147872)
@@ -68,6 +68,11 @@
// But they're used in many places in legacy code, so they're not going away any time soon.
void clearException() { globalData().exception = JSValue(); }
+ void clearSupplementaryExceptionInfo()
+ {
+ globalData().exceptionStack = RefCountedArray<StackFrame>();
+ }
+
JSValue exception() const { return globalData().exception; }
bool hadException() const { return globalData().exception; }
Modified: trunk/Source/_javascript_Core/interpreter/Interpreter.cpp (147871 => 147872)
--- trunk/Source/_javascript_Core/interpreter/Interpreter.cpp 2013-04-07 18:37:39 UTC (rev 147871)
+++ trunk/Source/_javascript_Core/interpreter/Interpreter.cpp 2013-04-07 18:47:20 UTC (rev 147872)
@@ -761,9 +761,10 @@
Vector<StackFrame> stackTrace;
getStackTrace(&callFrame->globalData(), stackTrace);
-
+ globalData->exceptionStack = RefCountedArray<StackFrame>(stackTrace);
if (stackTrace.isEmpty() || !error.isObject())
return;
+
JSObject* errorObject = asObject(error);
JSGlobalObject* globalObject = 0;
if (isTerminatedExecutionException(error) || isInterruptedExecutionException(error))
@@ -810,6 +811,12 @@
}
isInterrupt = isInterruptedExecutionException(exception) || isTerminatedExecutionException(exception);
+ } else {
+ if (!callFrame->globalData().exceptionStack.size()) {
+ Vector<StackFrame> stack;
+ Interpreter::getStackTrace(&callFrame->globalData(), stack);
+ callFrame->globalData().exceptionStack = RefCountedArray<StackFrame>(stack);
+ }
}
if (Debugger* debugger = callFrame->dynamicGlobalObject()->debugger()) {
Modified: trunk/Source/WebCore/ChangeLog (147871 => 147872)
--- trunk/Source/WebCore/ChangeLog 2013-04-07 18:37:39 UTC (rev 147871)
+++ trunk/Source/WebCore/ChangeLog 2013-04-07 18:47:20 UTC (rev 147872)
@@ -1,3 +1,16 @@
+2013-04-07 Oliver Hunt <[email protected]>
+
+ Inspector should display information about non-object exceptions
+ https://bugs.webkit.org/show_bug.cgi?id=114123
+
+ Reviewed by Adele Peterson.
+
+ Make use of the stack trace for line information when we're reporting
+ an exception
+
+ * bindings/js/JSDOMBinding.cpp:
+ (WebCore::reportException):
+
2013-04-07 Robert Hogan <[email protected]>
table element may get larger when its contents are recreated
Modified: trunk/Source/WebCore/bindings/js/JSDOMBinding.cpp (147871 => 147872)
--- trunk/Source/WebCore/bindings/js/JSDOMBinding.cpp 2013-04-07 18:37:39 UTC (rev 147871)
+++ trunk/Source/WebCore/bindings/js/JSDOMBinding.cpp 2013-04-07 18:47:20 UTC (rev 147872)
@@ -147,11 +147,22 @@
Interpreter::ErrorHandlingMode mode(exec);
String errorMessage = exception.toString(exec)->value(exec);
- JSObject* exceptionObject = exception.toObject(exec);
- int lineNumber = exceptionObject->get(exec, Identifier(exec, "line")).toInt32(exec);
- String exceptionSourceURL = exceptionObject->get(exec, Identifier(exec, "sourceURL")).toString(exec)->value(exec);
+ int lineNumber = 0;
+ String exceptionSourceURL;
+
+ RefCountedArray<StackFrame> stackTrace = exec->globalData().exceptionStack;
exec->clearException();
+ exec->clearSupplementaryExceptionInfo();
+ if (exception.isObject()) {
+ JSObject* exceptionObject = exception.toObject(exec);
+ lineNumber = exceptionObject->get(exec, Identifier(exec, "line")).toInt32(exec);
+ exceptionSourceURL = exceptionObject->get(exec, Identifier(exec, "sourceURL")).toString(exec)->value(exec);
+ } else if (stackTrace.size()) {
+ lineNumber = stackTrace[0].line();
+ exceptionSourceURL = stackTrace[0].friendlySourceURL();
+ }
+
if (ExceptionBase* exceptionBase = toExceptionBase(exception))
errorMessage = exceptionBase->message() + ": " + exceptionBase->description();