Implement Error.stack
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 27 Sep 2011 17:58:55 +0000 (17:58 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 27 Sep 2011 17:58:55 +0000 (17:58 +0000)
commitf177874f27ebf438bbcd97a2b9af4a3ff1b8f330
treea233436ebc946ca0ae5e693050dcdd2c00433c70
parent2839bc0f55f6a96d78e16199cd12d3a7e7c5f9c3
Implement Error.stack
https://bugs.webkit.org/show_bug.cgi?id=66994

Patch by Juan Carlos Montemayor Elosua <j.mont@me.com> on 2011-09-27
Reviewed by Oliver Hunt.

Source/JavaScriptCore:

This patch utilizes topCallFrame to create a stack trace when
an error is thrown. Users will also be able to use the stack()
command in jsc to get arrays with stack trace information.

* JavaScriptCore.exp:
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
* interpreter/Interpreter.cpp:
(JSC::getCallerLine):
(JSC::getSourceURLFromCallFrame):
(JSC::getStackFrameCodeType):
(JSC::Interpreter::getStackTrace):
(JSC::Interpreter::throwException):
* interpreter/Interpreter.h:
(JSC::StackFrame::toString):
* jsc.cpp:
(GlobalObject::finishCreation):
(functionJSCStack):
* parser/Parser.h:
(JSC::Parser::parse):
* runtime/CommonIdentifiers.h:
* runtime/Error.cpp:
(JSC::addErrorInfo):
* runtime/Error.h:

LayoutTests:

Unit tests that contain both normal and special cases for stack trace
generation.

* fast/js/exception-properties-expected.txt:
* fast/js/script-tests/exception-properties.js:
* fast/js/script-tests/stack-trace.js: Added.
(printStack):
(hostThrower):
(callbacker):
(outer):
(inner):
(evaler):
(normalOuter):
(normalInner):
(scripterInner):
(scripterOuter):
* fast/js/stack-trace-expected.txt: Added.
* fast/js/stack-trace.html: Added.
* platform/chromium/test_expectations.txt:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@96131 268f45cc-cd09-0410-ab3c-d52691b4dbfc
17 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/js/exception-properties-expected.txt
LayoutTests/fast/js/script-tests/exception-properties.js
LayoutTests/fast/js/script-tests/stack-trace.js [new file with mode: 0644]
LayoutTests/fast/js/stack-trace-expected.txt [new file with mode: 0644]
LayoutTests/fast/js/stack-trace.html [new file with mode: 0644]
LayoutTests/platform/chromium/test_expectations.txt
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/JavaScriptCore.exp
Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def
Source/JavaScriptCore/interpreter/Interpreter.cpp
Source/JavaScriptCore/interpreter/Interpreter.h
Source/JavaScriptCore/jsc.cpp
Source/JavaScriptCore/parser/Parser.h
Source/JavaScriptCore/runtime/CommonIdentifiers.h
Source/JavaScriptCore/runtime/Error.cpp
Source/JavaScriptCore/runtime/Error.h