Title: [194946] branches/safari-601-branch

Diff

Modified: branches/safari-601-branch/LayoutTests/ChangeLog (194945 => 194946)


--- branches/safari-601-branch/LayoutTests/ChangeLog	2016-01-13 01:41:37 UTC (rev 194945)
+++ branches/safari-601-branch/LayoutTests/ChangeLog	2016-01-13 01:41:41 UTC (rev 194946)
@@ -1,5 +1,27 @@
 2016-01-12  Matthew Hanson  <matthew_han...@apple.com>
 
+        Merge r194704. rdar://problem/24043057
+
+    2016-01-06  Joseph Pecoraro  <pecor...@apple.com>
+
+            Web Inspector: CRASH Attempting to pause on CSP violation not inside of script
+            https://bugs.webkit.org/show_bug.cgi?id=152825
+            <rdar://problem/24021276>
+
+            Reviewed by Timothy Hatcher.
+
+            * http/tests/inspector/resources/inspector-test.js:
+            (TestPage.reportUncaughtException):
+            Allow a test to continue after uncaught exceptions.
+
+            * inspector/debugger/csp-exceptions-expected.txt: Added.
+            * inspector/debugger/csp-exceptions.html: Added.
+            * inspector/debugger/resources/csp-exception-iframe.html: Added.
+            Test a CSP exception that causes a pause and one outside of
+            script that does not pause (and does not crash).
+
+2016-01-12  Matthew Hanson  <matthew_han...@apple.com>
+
         Merge r194910. rdar://problem/24101255
 
     2016-01-11  Matthew Hanson  <matthew_han...@apple.com>

Modified: branches/safari-601-branch/LayoutTests/http/tests/inspector/inspector-test.js (194945 => 194946)


--- branches/safari-601-branch/LayoutTests/http/tests/inspector/inspector-test.js	2016-01-13 01:41:37 UTC (rev 194945)
+++ branches/safari-601-branch/LayoutTests/http/tests/inspector/inspector-test.js	2016-01-13 01:41:41 UTC (rev 194946)
@@ -143,6 +143,7 @@
     }
 }
 
+TestPage.allowUncaughtExceptions = false;
 InspectorTestProxy.needToSanitizeUncaughtExceptionURLs = false;
 
 InspectorTestProxy.reportUncaughtException = function(message, url, lineNumber)
@@ -159,7 +160,9 @@
 
     var result = "Uncaught exception in test page: " + message + " [" + url + ":" + lineNumber + "]";
     InspectorTestProxy.addResult(result);
-    InspectorTestProxy.completeTest();
+
+    if (!TestPage.allowUncaughtExceptions)
+        TestPage.completeTest();
 }
 
 // Catch syntax errors, type errors, and other exceptions. Run this before loading other files.

Added: branches/safari-601-branch/LayoutTests/inspector/debugger/csp-exceptions-expected.txt (0 => 194946)


--- branches/safari-601-branch/LayoutTests/inspector/debugger/csp-exceptions-expected.txt	                        (rev 0)
+++ branches/safari-601-branch/LayoutTests/inspector/debugger/csp-exceptions-expected.txt	2016-01-13 01:41:41 UTC (rev 194946)
@@ -0,0 +1,16 @@
+CONSOLE MESSAGE: line 11: EvalError: Refused to evaluate a string as _javascript_ because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src 'self' 'unsafe-inline'".
+
+CONSOLE MESSAGE: line 7: Refused to execute inline script because it violates the following Content Security Policy directive: "script-src 'none'".
+
+Test for the CSP exception handling when pause on all exceptions is enabled.
+
+
+== Running test suite: PauseOnCSPExceptionDoesNotCrash
+-- Running test case: TriggerCSPExceptionInsideOfScript
+PASS: CSP Exception caused by script evaluation should pause.
+Uncaught exception in test page: EvalError: Refused to evaluate a string as _javascript_ because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src 'self' 'unsafe-inline'".
+ [csp-exceptions.html:11]
+
+-- Running test case: TriggerCSPExceptionOutsideOfScript
+PASS: CSP Exception caused outside of script evaluation should not pause.
+

Added: branches/safari-601-branch/LayoutTests/inspector/debugger/csp-exceptions.html (0 => 194946)


--- branches/safari-601-branch/LayoutTests/inspector/debugger/csp-exceptions.html	                        (rev 0)
+++ branches/safari-601-branch/LayoutTests/inspector/debugger/csp-exceptions.html	2016-01-13 01:41:41 UTC (rev 194946)
@@ -0,0 +1,65 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta http-equiv="Content-Security-Policy" content="script-src 'self' 'unsafe-inline'">
+<script src=""
+<script>
+TestPage.allowUncaughtExceptions = true;
+TestPage.needToSanitizeUncaughtExceptionURLs = true;
+
+function triggerCSPExceptionInsideScript() {
+    eval("console.log('CSP should prevent this')");
+}
+
+function triggerCSPExceptionOutsideScript() {
+    let iframe = document.createElement("iframe");
+    iframe.src = ""
+    document.body.appendChild(iframe);
+}
+
+function test()
+{
+    let suite = InspectorTest.createAsyncSuite("PauseOnCSPExceptionDoesNotCrash");
+
+    suite.addTestCase({
+        name: "TriggerCSPExceptionInsideOfScript",
+        description: "Trigger a CSP Exception inside of script should pause.",
+        test: (resolve, reject) => {
+            InspectorTest.evaluateInPage("setTimeout(triggerCSPExceptionInsideScript)");
+            WebInspector.debuggerManager.singleFireEventListener(WebInspector.DebuggerManager.Event.Paused, (event) => {
+                InspectorTest.pass("CSP Exception caused by script evaluation should pause.");
+                WebInspector.debuggerManager.resume();
+            });
+            WebInspector.debuggerManager.singleFireEventListener(WebInspector.DebuggerManager.Event.Resumed, (event) => {
+                resolve();
+            });
+        }
+    });
+
+    suite.addTestCase({
+        name: "TriggerCSPExceptionOutsideOfScript",
+        description: "Trigger a CSP Exception outside of script should not pause or crash.",
+        test: (resolve, reject) => {
+            InspectorTest.evaluateInPage("setTimeout(triggerCSPExceptionOutsideScript)");
+            let tempPauseFailListener = WebInspector.debuggerManager.singleFireEventListener(WebInspector.DebuggerManager.Event.Paused, (event) => {
+                InspectorTest.fail("CSP Exception caused outside of script evaluation should not pause, but did.");
+                WebInspector.debuggerManager.resume();
+                reject();
+            });
+            WebInspector.logManager.addEventListener(WebInspector.LogManager.Event.MessageAdded, (event) => {
+                WebInspector.debuggerManager.removeEventListener(WebInspector.DebuggerManager.Event.Paused, tempPauseFailListener, null);
+                InspectorTest.pass("CSP Exception caused outside of script evaluation should not pause.");
+                resolve();
+            });
+        }
+    });
+
+    DebuggerAgent.setPauseOnExceptions("all");
+    suite.runTestCasesAndFinish();
+}
+</script>
+</head>
+<body _onload_="runTest()">
+<p>Test for the CSP exception handling when pause on all exceptions is enabled.</p>
+</body>
+</html>

Added: branches/safari-601-branch/LayoutTests/inspector/debugger/resources/csp-exception-iframe.html (0 => 194946)


--- branches/safari-601-branch/LayoutTests/inspector/debugger/resources/csp-exception-iframe.html	                        (rev 0)
+++ branches/safari-601-branch/LayoutTests/inspector/debugger/resources/csp-exception-iframe.html	2016-01-13 01:41:41 UTC (rev 194946)
@@ -0,0 +1,9 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta http-equiv="Content-Security-Policy" content="script-src 'none'">
+</head>
+<body>
+<script>console.log("CSP should prevent this");</script>
+</body>
+</html>

Modified: branches/safari-601-branch/LayoutTests/inspector/network/client-blocked-load.html (194945 => 194946)


--- branches/safari-601-branch/LayoutTests/inspector/network/client-blocked-load.html	2016-01-13 01:41:37 UTC (rev 194945)
+++ branches/safari-601-branch/LayoutTests/inspector/network/client-blocked-load.html	2016-01-13 01:41:41 UTC (rev 194946)
@@ -25,7 +25,7 @@
                 InspectorTest.expectThat(resource instanceof WebInspector.Resource, "Resource should be created.");
                 InspectorTest.expectThat(resource.url ="" "", "Request url should be rewritten to the null string.");
                 resource.singleFireEventListener(WebInspector.Resource.Event.LoadingDidFail, (event) => {
-                    InspectorTest.expectThat(true, "Resource load should fail.");
+                    InspectorTest.pass("Resource load should fail.");
                     resolve();
                 });
             });

Modified: branches/safari-601-branch/Source/_javascript_Core/ChangeLog (194945 => 194946)


--- branches/safari-601-branch/Source/_javascript_Core/ChangeLog	2016-01-13 01:41:37 UTC (rev 194945)
+++ branches/safari-601-branch/Source/_javascript_Core/ChangeLog	2016-01-13 01:41:41 UTC (rev 194946)
@@ -1,5 +1,21 @@
 2016-01-12  Matthew Hanson  <matthew_han...@apple.com>
 
+        Merge r194704. rdar://problem/24043057
+
+    2016-01-06  Joseph Pecoraro  <pecor...@apple.com>
+
+            Web Inspector: CRASH Attempting to pause on CSP violation not inside of script
+            https://bugs.webkit.org/show_bug.cgi?id=152825
+            <rdar://problem/24021276>
+
+            Reviewed by Timothy Hatcher.
+
+            * debugger/Debugger.cpp:
+            (JSC::Debugger::breakProgram):
+            We cannot pause if we are not evaluating _javascript_, so bail.
+
+2016-01-12  Matthew Hanson  <matthew_han...@apple.com>
+
         Merge r194908. rdar://problem/24101253
 
     2016-01-11  Matthew Hanson  <matthew_han...@apple.com>

Modified: branches/safari-601-branch/Source/_javascript_Core/debugger/Debugger.cpp (194945 => 194946)


--- branches/safari-601-branch/Source/_javascript_Core/debugger/Debugger.cpp	2016-01-13 01:41:37 UTC (rev 194945)
+++ branches/safari-601-branch/Source/_javascript_Core/debugger/Debugger.cpp	2016-01-13 01:41:41 UTC (rev 194946)
@@ -585,10 +585,12 @@
     if (m_isPaused)
         return;
 
+    if (!m_vm->topCallFrame)
+        return;
+
     m_pauseOnNextStatement = true;
     setSteppingMode(SteppingModeEnabled);
     m_currentCallFrame = m_vm->topCallFrame;
-    ASSERT(m_currentCallFrame);
     pauseIfNeeded(m_currentCallFrame);
 }
 

Modified: branches/safari-601-branch/Source/WebInspectorUI/ChangeLog (194945 => 194946)


--- branches/safari-601-branch/Source/WebInspectorUI/ChangeLog	2016-01-13 01:41:37 UTC (rev 194945)
+++ branches/safari-601-branch/Source/WebInspectorUI/ChangeLog	2016-01-13 01:41:41 UTC (rev 194946)
@@ -1,5 +1,24 @@
 2016-01-12  Matthew Hanson  <matthew_han...@apple.com>
 
+        Merge r194704. rdar://problem/24043057
+
+    2016-01-06  Joseph Pecoraro  <pecor...@apple.com>
+
+            Web Inspector: CRASH Attempting to pause on CSP violation not inside of script
+            https://bugs.webkit.org/show_bug.cgi?id=152825
+            <rdar://problem/24021276>
+
+            Reviewed by Timothy Hatcher.
+
+            * UserInterface/Test/TestHarness.js:
+            (TestHarness.prototype.expectThat):
+            (TestHarness.prototype.pass):
+            (TestHarness.prototype.fail):
+            Add a simple way to output a standard pass/fail message. These are
+            often nicer than expectThat(true, ...) or assert(false, ...).
+
+2016-01-12  Matthew Hanson  <matthew_han...@apple.com>
+
         Merge r194602. rdar://problem/24101260
 
     2016-01-05  Joseph Pecoraro  <pecor...@apple.com>
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to