Changeset 155471 in webkit for trunk/Source/JavaScriptCore


Ignore:
Timestamp:
Sep 10, 2013, 2:00:42 PM (12 years ago)
Author:
Joseph Pecoraro
Message:

Web Inspector: [JSC] Caught exception is treated as uncaught
https://bugs.webkit.org/show_bug.cgi?id=93607

Reviewed by Geoff Garen.

Source/JavaScriptCore:

Check up the entire call stack to see if there is an exception handler.

  • interpreter/Interpreter.cpp:

(JSC::GetExceptionHandlerFunctor::GetExceptionHandlerFunctor):
(JSC::GetExceptionHandlerFunctor::handler):
(JSC::GetExceptionHandlerFunctor::operator()):

LayoutTests:

Add tests for different inspector pause on exceptions states.

  • inspector-protocol/debugger/resources/exception.js: Added.
  • inspector-protocol/debugger/setPauseOnExceptions-all-expected.txt: Added.
  • inspector-protocol/debugger/setPauseOnExceptions-all.html: Added.
  • inspector-protocol/debugger/setPauseOnExceptions-none-expected.txt: Added.
  • inspector-protocol/debugger/setPauseOnExceptions-none.html: Added.
  • inspector-protocol/debugger/setPauseOnExceptions-uncaught-expected.txt: Added.
  • inspector-protocol/debugger/setPauseOnExceptions-uncaught.html: Added.
Location:
trunk/Source/JavaScriptCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r155466 r155471  
     12013-09-10  Joseph Pecoraro  <[email protected]>
     2
     3        Web Inspector: [JSC] Caught exception is treated as uncaught
     4        https://bugs.webkit.org/show_bug.cgi?id=93607
     5
     6        Reviewed by Geoff Garen.
     7
     8        Check up the entire call stack to see if there is an exception handler.
     9
     10        * interpreter/Interpreter.cpp:
     11        (JSC::GetExceptionHandlerFunctor::GetExceptionHandlerFunctor):
     12        (JSC::GetExceptionHandlerFunctor::handler):
     13        (JSC::GetExceptionHandlerFunctor::operator()):
     14
    1152013-09-10  Filip Pizlo  <[email protected]>
    216
  • trunk/Source/JavaScriptCore/interpreter/Interpreter.cpp

    r155081 r155471  
    567567}
    568568
     569class GetExceptionHandlerFunctor {
     570public:
     571    GetExceptionHandlerFunctor()
     572        : m_handler(0)
     573    {
     574    }
     575
     576    HandlerInfo* handler() { return m_handler; }
     577
     578    StackVisitor::Status operator()(StackVisitor& visitor)
     579    {
     580        CodeBlock* codeBlock = visitor->codeBlock();
     581        if (!codeBlock)
     582            return StackVisitor::Continue;
     583
     584        unsigned bytecodeOffset = visitor->bytecodeOffset();
     585        m_handler = codeBlock->handlerForBytecodeOffset(bytecodeOffset);
     586        if (m_handler)
     587            return StackVisitor::Done;
     588
     589        return StackVisitor::Continue;
     590    }
     591
     592private:
     593    HandlerInfo* m_handler;
     594};
     595
    569596class UnwindFunctor {
    570597public:
     
    628655        // Afterwards, the values are put back to continue processing this error.
    629656        ClearExceptionScope scope(&callFrame->vm());
    630        
    631657        DebuggerCallFrame debuggerCallFrame(callFrame, exceptionValue);
    632         bool hasHandler = codeBlock->handlerForBytecodeOffset(bytecodeOffset);
     658
     659        bool hasHandler;
     660        if (isTermination)
     661            hasHandler = false;
     662        else {
     663            GetExceptionHandlerFunctor functor;
     664            callFrame->iterate(functor);
     665            hasHandler = !!functor.handler();
     666        }
     667
    633668        debugger->exception(debuggerCallFrame, codeBlock->ownerExecutable()->sourceID(), codeBlock->lineNumberForBytecodeOffset(bytecodeOffset), 0, hasHandler);
    634669    }
Note: See TracChangeset for help on using the changeset viewer.