• oliver@apple.com's avatar
    Implement Error.stack · 435c2e23
    oliver@apple.com authored
    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.
    
    * 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:
    
    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:
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@106407 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    435c2e23
CommonIdentifiers.h 4.07 KB