Diff
Modified: trunk/LayoutTests/ChangeLog (218651 => 218652)
--- trunk/LayoutTests/ChangeLog 2017-06-21 21:29:21 UTC (rev 218651)
+++ trunk/LayoutTests/ChangeLog 2017-06-21 21:32:44 UTC (rev 218652)
@@ -1,3 +1,16 @@
+2017-06-21 Joseph Pecoraro <[email protected]>
+
+ 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>
+
+ Reviewed by Saam Barati.
+
+ * 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.
+
2017-06-20 Simon Fraser <[email protected]>
Remove WILL_REVEAL_EDGE_EVENTS code
Added: trunk/LayoutTests/inspector/debugger/no-pause-out-of-memory-exception-expected.txt (0 => 218652)
--- trunk/LayoutTests/inspector/debugger/no-pause-out-of-memory-exception-expected.txt (rev 0)
+++ trunk/LayoutTests/inspector/debugger/no-pause-out-of-memory-exception-expected.txt 2017-06-21 21:32:44 UTC (rev 218652)
@@ -0,0 +1,9 @@
+CONSOLE MESSAGE: line 12: Error: Out of memory
+Test we do not pause on a OutOfMemory Exception.
+
+
+== Running test suite: Debugger.OutOfMemoryException
+-- Running test case: Debugger.OutOfMemoryException.NoPause
+Uncaught exception in test page: Error: Out of memory [no-pause-out-of-memory-exception.html:12]
+PASS: Should not pause on OutOfMemory Exception.
+
Added: trunk/LayoutTests/inspector/debugger/no-pause-out-of-memory-exception.html (0 => 218652)
--- trunk/LayoutTests/inspector/debugger/no-pause-out-of-memory-exception.html (rev 0)
+++ trunk/LayoutTests/inspector/debugger/no-pause-out-of-memory-exception.html 2017-06-21 21:32:44 UTC (rev 218652)
@@ -0,0 +1,54 @@
+<!doctype html>
+<html>
+<head>
+<script src=""
+<script>
+TestPage.allowUncaughtExceptions = true;
+TestPage.needToSanitizeUncaughtExceptionURLs = true;
+
+function triggerOutOfMemoryException() {
+ let s = "a";
+ while (true)
+ s += s;
+}
+
+window.addEventListener("error", (event) => {
+ TestPage.dispatchEventToFrontend("AfterError");
+});
+
+function test()
+{
+ WebInspector.debuggerManager.allExceptionsBreakpoint.disabled = false;
+
+ let suite = InspectorTest.createAsyncSuite("Debugger.OutOfMemoryException");
+
+ suite.addTestCase({
+ name: "Debugger.OutOfMemoryException.NoPause",
+ description: "Should not pause on a OutOfMemory Exception.",
+ test(resolve, reject) {
+ let paused = false;
+
+ WebInspector.debuggerManager.singleFireEventListener(WebInspector.DebuggerManager.Event.Paused, (event) => {
+ paused = true;
+ InspectorTest.fail("Should not pause.");
+ reject();
+ });
+
+ InspectorTest.singleFireEventListener("AfterError", (event) => {
+ if (!paused)
+ InspectorTest.pass("Should not pause on OutOfMemory Exception.");
+ resolve();
+ });
+
+ InspectorTest.evaluateInPage(`setTimeout(triggerOutOfMemoryException)`);
+ }
+ });
+
+ suite.runTestCasesAndFinish();
+}
+</script>
+</head>
+<body _onload_="runTest()">
+<p>Test we do not pause on a OutOfMemory Exception.</p>
+</body>
+</html>
Added: trunk/LayoutTests/inspector/debugger/no-pause-stack-overflow-exception-expected.txt (0 => 218652)
--- trunk/LayoutTests/inspector/debugger/no-pause-stack-overflow-exception-expected.txt (rev 0)
+++ trunk/LayoutTests/inspector/debugger/no-pause-stack-overflow-exception-expected.txt 2017-06-21 21:32:44 UTC (rev 218652)
@@ -0,0 +1,9 @@
+CONSOLE MESSAGE: line 10: RangeError: Maximum call stack size exceeded.
+Test we do not pause on a StackOverflow Exception.
+
+
+== Running test suite: Debugger.StackOverflowException
+-- Running test case: Debugger.StackOverflowException.NoPause
+Uncaught exception in test page: RangeError: Maximum call stack size exceeded. [no-pause-stack-overflow-exception.html:10]
+PASS: Should not pause on StackOverflow Exception.
+
Added: trunk/LayoutTests/inspector/debugger/no-pause-stack-overflow-exception.html (0 => 218652)
--- trunk/LayoutTests/inspector/debugger/no-pause-stack-overflow-exception.html (rev 0)
+++ trunk/LayoutTests/inspector/debugger/no-pause-stack-overflow-exception.html 2017-06-21 21:32:44 UTC (rev 218652)
@@ -0,0 +1,53 @@
+<!doctype html>
+<html>
+<head>
+<script src=""
+<script>
+TestPage.allowUncaughtExceptions = true;
+TestPage.needToSanitizeUncaughtExceptionURLs = true;
+
+function triggerStackOverflowException() {
+ function f() { f(); }
+ f();
+}
+
+window.addEventListener("error", (event) => {
+ TestPage.dispatchEventToFrontend("AfterError");
+});
+
+function test()
+{
+ WebInspector.debuggerManager.allExceptionsBreakpoint.disabled = false;
+
+ let suite = InspectorTest.createAsyncSuite("Debugger.StackOverflowException");
+
+ suite.addTestCase({
+ name: "Debugger.StackOverflowException.NoPause",
+ description: "Should not pause on a StackOverflow Exception.",
+ test(resolve, reject) {
+ let paused = false;
+
+ WebInspector.debuggerManager.singleFireEventListener(WebInspector.DebuggerManager.Event.Paused, (event) => {
+ paused = true;
+ InspectorTest.fail("Should not pause.");
+ reject();
+ });
+
+ InspectorTest.singleFireEventListener("AfterError", (event) => {
+ if (!paused)
+ InspectorTest.pass("Should not pause on StackOverflow Exception.");
+ resolve();
+ });
+
+ InspectorTest.evaluateInPage(`setTimeout(triggerStackOverflowException)`);
+ }
+ });
+
+ suite.runTestCasesAndFinish();
+}
+</script>
+</head>
+<body _onload_="runTest()">
+<p>Test we do not pause on a StackOverflow Exception.</p>
+</body>
+</html>
Modified: trunk/Source/_javascript_Core/ChangeLog (218651 => 218652)
--- trunk/Source/_javascript_Core/ChangeLog 2017-06-21 21:29:21 UTC (rev 218651)
+++ trunk/Source/_javascript_Core/ChangeLog 2017-06-21 21:32:44 UTC (rev 218652)
@@ -1,3 +1,29 @@
+2017-06-21 Joseph Pecoraro <[email protected]>
+
+ 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>
+
+ Reviewed by Saam Barati.
+
+ 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.
+
2017-06-21 Saam Barati <[email protected]>
Make it clear that regenerating ICs are holding the CodeBlock's lock by passing the locker as a parameter
Modified: trunk/Source/_javascript_Core/debugger/Debugger.cpp (218651 => 218652)
--- trunk/Source/_javascript_Core/debugger/Debugger.cpp 2017-06-21 21:29:21 UTC (rev 218651)
+++ trunk/Source/_javascript_Core/debugger/Debugger.cpp 2017-06-21 21:32:44 UTC (rev 218652)
@@ -757,6 +757,16 @@
if (m_isPaused)
return;
+ if (JSObject* object = jsDynamicCast<JSObject*>(m_vm, exception)) {
+ if (object->isErrorInstance()) {
+ ErrorInstance* error = static_cast<ErrorInstance*>(object);
+ // FIXME: <https://webkit.org/b/173625> Web Inspector: Should be able to pause and debug a StackOverflow Exception
+ // FIXME: <https://webkit.org/b/173627> Web Inspector: Should be able to pause and debug an OutOfMemory Exception
+ if (error->isStackOverflowError() || error->isOutOfMemoryError())
+ return;
+ }
+ }
+
PauseReasonDeclaration reason(*this, PausedForException);
if (m_pauseOnExceptionsState == PauseOnAllExceptions || (m_pauseOnExceptionsState == PauseOnUncaughtExceptions && !hasCatchHandler)) {
m_pauseAtNextOpportunity = true;
Modified: trunk/Source/_javascript_Core/runtime/Error.cpp (218651 => 218652)
--- trunk/Source/_javascript_Core/runtime/Error.cpp 2017-06-21 21:29:21 UTC (rev 218651)
+++ trunk/Source/_javascript_Core/runtime/Error.cpp 2017-06-21 21:32:44 UTC (rev 218652)
@@ -30,11 +30,11 @@
#include "FunctionPrototype.h"
#include "Interpreter.h"
#include "JSArray.h"
+#include "JSCInlines.h"
#include "JSFunction.h"
#include "JSGlobalObject.h"
#include "JSObject.h"
#include "JSString.h"
-#include "JSCInlines.h"
#include "NativeErrorConstructor.h"
#include "SourceCode.h"
#include "StackFrame.h"
@@ -310,7 +310,9 @@
JSObject* createOutOfMemoryError(ExecState* exec)
{
- return createError(exec, ASCIILiteral("Out of memory"), nullptr);
+ auto* error = createError(exec, ASCIILiteral("Out of memory"), nullptr);
+ jsCast<ErrorInstance*>(error)->setOutOfMemoryError();
+ return error;
}
Modified: trunk/Source/_javascript_Core/runtime/ErrorInstance.h (218651 => 218652)
--- trunk/Source/_javascript_Core/runtime/ErrorInstance.h 2017-06-21 21:29:21 UTC (rev 218651)
+++ trunk/Source/_javascript_Core/runtime/ErrorInstance.h 2017-06-21 21:32:44 UTC (rev 218652)
@@ -61,6 +61,11 @@
RuntimeType runtimeTypeForCause() const { return m_runtimeTypeForCause; }
void clearRuntimeTypeForCause() { m_runtimeTypeForCause = TypeNothing; }
+ void setStackOverflowError() { m_stackOverflowError = true; }
+ bool isStackOverflowError() const { return m_stackOverflowError; }
+ void setOutOfMemoryError() { m_outOfMemoryError = true; }
+ bool isOutOfMemoryError() const { return m_outOfMemoryError; }
+
JS_EXPORT_PRIVATE String sanitizedToString(ExecState*);
protected:
@@ -70,6 +75,8 @@
SourceAppender m_sourceAppender { nullptr };
RuntimeType m_runtimeTypeForCause { TypeNothing };
+ bool m_stackOverflowError { false };
+ bool m_outOfMemoryError { false };
};
} // namespace JSC
Modified: trunk/Source/_javascript_Core/runtime/ExceptionHelpers.cpp (218651 => 218652)
--- trunk/Source/_javascript_Core/runtime/ExceptionHelpers.cpp 2017-06-21 21:29:21 UTC (rev 218651)
+++ trunk/Source/_javascript_Core/runtime/ExceptionHelpers.cpp 2017-06-21 21:32:44 UTC (rev 218652)
@@ -29,14 +29,14 @@
#include "config.h"
#include "ExceptionHelpers.h"
+#include "CallFrame.h"
#include "CodeBlock.h"
-#include "CallFrame.h"
#include "ErrorHandlingScope.h"
#include "Exception.h"
+#include "Interpreter.h"
+#include "JSCInlines.h"
#include "JSGlobalObjectFunctions.h"
-#include "Interpreter.h"
#include "Nodes.h"
-#include "JSCInlines.h"
#include "RuntimeType.h"
#include <wtf/text/StringBuilder.h>
#include <wtf/text/StringView.h>
@@ -74,7 +74,9 @@
JSObject* createStackOverflowError(ExecState* exec, JSGlobalObject* globalObject)
{
- return createRangeError(exec, globalObject, ASCIILiteral("Maximum call stack size exceeded."));
+ auto* error = createRangeError(exec, globalObject, ASCIILiteral("Maximum call stack size exceeded."));
+ jsCast<ErrorInstance*>(error)->setStackOverflowError();
+ return error;
}
JSObject* createUndefinedVariableError(ExecState* exec, const Identifier& ident)