Implement Error.stack
https://bugs.webkit.org/show_bug.cgi?id=66994
Source/JavaScriptCore:
Reviewed by Gavin Barraclough.
Original patch by Juan Carlos Montemayor Elosua:
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.
Modified to be correct on ToT, with a variety of correctness,
performance, and security improvements.
(JSC::getCallerLine):
(JSC::getSourceURLFromCallFrame):
(JSC::getStackFrameCodeType):
(JSC::Interpreter::getStackTrace):
(JSC::Interpreter::throwException):
- interpreter/Interpreter.h:
(JSC::StackFrame::toString):
(GlobalObject::finishCreation):
(functionJSCStack):
(JSC::Parser::parse):
- runtime/CommonIdentifiers.h:
- runtime/Error.cpp:
(JSC::addErrorInfo):
LayoutTests:
Reviewed by Gavin Barraclough
Original patch by Juan Carlos Montemayor Elosua.
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: