Changeset 218652 in webkit


Ignore:
Timestamp:
Jun 21, 2017 2:32:44 PM (7 years ago)
Author:
commit-queue@webkit.org
Message:

Web Inspector: Using "break on all exceptions" when throwing stack overflow hangs inspector
https://bugs.webkit.org/show_bug.cgi?id=172432
<rdar://problem/29870873>

Patch by Joseph Pecoraro <Joseph Pecoraro> on 2017-06-21
Reviewed by Saam Barati.

Source/JavaScriptCore:

Avoid pausing on StackOverflow and OutOfMemory errors to avoid a hang.
We will proceed to improve debugging of these cases in the follow-up bugs.

  • debugger/Debugger.cpp:

(JSC::Debugger::exception):
Ignore pausing on these errors.

  • runtime/ErrorInstance.h:

(JSC::ErrorInstance::setStackOverflowError):
(JSC::ErrorInstance::isStackOverflowError):
(JSC::ErrorInstance::setOutOfMemoryError):
(JSC::ErrorInstance::isOutOfMemoryError):

  • runtime/ExceptionHelpers.cpp:

(JSC::createStackOverflowError):

  • runtime/Error.cpp:

(JSC::createOutOfMemoryError):
Mark these kinds of errors.

LayoutTests:

  • inspector/debugger/no-pause-out-of-memory-exception-expected.txt: Added.
  • inspector/debugger/no-pause-out-of-memory-exception.html: Added.
  • inspector/debugger/no-pause-stack-overflow-exception-expected.txt: Added.
  • inspector/debugger/no-pause-stack-overflow-exception.html: Added.
Location:
trunk
Files:
4 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r218651 r218652  
     12017-06-21  Joseph Pecoraro  <pecoraro@apple.com>
     2
     3        Web Inspector: Using "break on all exceptions" when throwing stack overflow hangs inspector
     4        https://bugs.webkit.org/show_bug.cgi?id=172432
     5        <rdar://problem/29870873>
     6
     7        Reviewed by Saam Barati.
     8
     9        * inspector/debugger/no-pause-out-of-memory-exception-expected.txt: Added.
     10        * inspector/debugger/no-pause-out-of-memory-exception.html: Added.
     11        * inspector/debugger/no-pause-stack-overflow-exception-expected.txt: Added.
     12        * inspector/debugger/no-pause-stack-overflow-exception.html: Added.
     13
    1142017-06-20  Simon Fraser  <simon.fraser@apple.com>
    215
  • trunk/Source/JavaScriptCore/ChangeLog

    r218641 r218652  
     12017-06-21  Joseph Pecoraro  <pecoraro@apple.com>
     2
     3        Web Inspector: Using "break on all exceptions" when throwing stack overflow hangs inspector
     4        https://bugs.webkit.org/show_bug.cgi?id=172432
     5        <rdar://problem/29870873>
     6
     7        Reviewed by Saam Barati.
     8
     9        Avoid pausing on StackOverflow and OutOfMemory errors to avoid a hang.
     10        We will proceed to improve debugging of these cases in the follow-up bugs.
     11
     12        * debugger/Debugger.cpp:
     13        (JSC::Debugger::exception):
     14        Ignore pausing on these errors.
     15
     16        * runtime/ErrorInstance.h:
     17        (JSC::ErrorInstance::setStackOverflowError):
     18        (JSC::ErrorInstance::isStackOverflowError):
     19        (JSC::ErrorInstance::setOutOfMemoryError):
     20        (JSC::ErrorInstance::isOutOfMemoryError):
     21        * runtime/ExceptionHelpers.cpp:
     22        (JSC::createStackOverflowError):
     23        * runtime/Error.cpp:
     24        (JSC::createOutOfMemoryError):
     25        Mark these kinds of errors.
     26
    1272017-06-21  Saam Barati  <sbarati@apple.com>
    228
  • trunk/Source/JavaScriptCore/debugger/Debugger.cpp

    r216428 r218652  
    758758        return;
    759759
     760    if (JSObject* object = jsDynamicCast<JSObject*>(m_vm, exception)) {
     761        if (object->isErrorInstance()) {
     762            ErrorInstance* error = static_cast<ErrorInstance*>(object);
     763            // FIXME: <https://webkit.org/b/173625> Web Inspector: Should be able to pause and debug a StackOverflow Exception
     764            // FIXME: <https://webkit.org/b/173627> Web Inspector: Should be able to pause and debug an OutOfMemory Exception
     765            if (error->isStackOverflowError() || error->isOutOfMemoryError())
     766                return;
     767        }
     768    }
     769
    760770    PauseReasonDeclaration reason(*this, PausedForException);
    761771    if (m_pauseOnExceptionsState == PauseOnAllExceptions || (m_pauseOnExceptionsState == PauseOnUncaughtExceptions && !hasCatchHandler)) {
  • trunk/Source/JavaScriptCore/runtime/Error.cpp

    r217108 r218652  
    3131#include "Interpreter.h"
    3232#include "JSArray.h"
     33#include "JSCInlines.h"
    3334#include "JSFunction.h"
    3435#include "JSGlobalObject.h"
    3536#include "JSObject.h"
    3637#include "JSString.h"
    37 #include "JSCInlines.h"
    3838#include "NativeErrorConstructor.h"
    3939#include "SourceCode.h"
     
    311311JSObject* createOutOfMemoryError(ExecState* exec)
    312312{
    313     return createError(exec, ASCIILiteral("Out of memory"), nullptr);
     313    auto* error = createError(exec, ASCIILiteral("Out of memory"), nullptr);
     314    jsCast<ErrorInstance*>(error)->setOutOfMemoryError();
     315    return error;
    314316}
    315317
  • trunk/Source/JavaScriptCore/runtime/ErrorInstance.h

    r208952 r218652  
    6262    void clearRuntimeTypeForCause() { m_runtimeTypeForCause = TypeNothing; }
    6363
     64    void setStackOverflowError() { m_stackOverflowError = true; }
     65    bool isStackOverflowError() const { return m_stackOverflowError; }
     66    void setOutOfMemoryError() { m_outOfMemoryError = true; }
     67    bool isOutOfMemoryError() const { return m_outOfMemoryError; }
     68
    6469    JS_EXPORT_PRIVATE String sanitizedToString(ExecState*);
    6570
     
    7176    SourceAppender m_sourceAppender { nullptr };
    7277    RuntimeType m_runtimeTypeForCause { TypeNothing };
     78    bool m_stackOverflowError { false };
     79    bool m_outOfMemoryError { false };
    7380};
    7481
  • trunk/Source/JavaScriptCore/runtime/ExceptionHelpers.cpp

    r217108 r218652  
    3030#include "ExceptionHelpers.h"
    3131
     32#include "CallFrame.h"
    3233#include "CodeBlock.h"
    33 #include "CallFrame.h"
    3434#include "ErrorHandlingScope.h"
    3535#include "Exception.h"
     36#include "Interpreter.h"
     37#include "JSCInlines.h"
    3638#include "JSGlobalObjectFunctions.h"
    37 #include "Interpreter.h"
    3839#include "Nodes.h"
    39 #include "JSCInlines.h"
    4040#include "RuntimeType.h"
    4141#include <wtf/text/StringBuilder.h>
     
    7575JSObject* createStackOverflowError(ExecState* exec, JSGlobalObject* globalObject)
    7676{
    77     return createRangeError(exec, globalObject, ASCIILiteral("Maximum call stack size exceeded."));
     77    auto* error = createRangeError(exec, globalObject, ASCIILiteral("Maximum call stack size exceeded."));
     78    jsCast<ErrorInstance*>(error)->setStackOverflowError();
     79    return error;
    7880}
    7981
Note: See TracChangeset for help on using the changeset viewer.