Skip to content
Permalink
Browse files
REGRESSION: LayoutTest inspector/debugger/csp-exceptions.html is a fl…
…aky failure

https://bugs.webkit.org/show_bug.cgi?id=165292
<rdar://problem/29471892>

Patch by Joseph Pecoraro <pecoraro@apple.com> on 2017-01-11
Reviewed by Geoffrey Garen.

* inspector/debugger/csp-exceptions-expected.txt:
* inspector/debugger/csp-exceptions.html:
* inspector/debugger/resources/csp-exception-iframe.html:
Improve the test to handle all console messages more carefully,
including outputing the console messages to test them as well.

* platform/mac-wk2/TestExpectations:
Unskip the test, it should no longer be flakey.

Canonical link: https://commits.webkit.org/184052@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@210611 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
JosephPecoraro authored and webkit-commit-queue committed Jan 12, 2017
1 parent 1cf3674 commit 5ea00f5c053ed45601cfff5b8331463e44653872
Showing 5 changed files with 36 additions and 6 deletions.
@@ -1,3 +1,20 @@
2017-01-11 Joseph Pecoraro <pecoraro@apple.com>

REGRESSION: LayoutTest inspector/debugger/csp-exceptions.html is a flaky failure
https://bugs.webkit.org/show_bug.cgi?id=165292
<rdar://problem/29471892>

Reviewed by Geoffrey Garen.

* inspector/debugger/csp-exceptions-expected.txt:
* inspector/debugger/csp-exceptions.html:
* inspector/debugger/resources/csp-exception-iframe.html:
Improve the test to handle all console messages more carefully,
including outputing the console messages to test them as well.

* platform/mac-wk2/TestExpectations:
Unskip the test, it should no longer be flakey.

2017-01-11 Brent Fulgham <bfulgham@apple.com>

Rebaseline two tests after r210599.
@@ -9,7 +9,10 @@ Test for the CSP exception handling when pause on all exceptions is enabled.
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]
PASS: CSP Exception Console Message: 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'".


-- Running test case: TriggerCSPExceptionOutsideOfScript
PASS: CSP Exception caused outside of script evaluation should not pause.
PASS: CSP Exception Console Message: Refused to execute a script because its hash, its nonce, or 'unsafe-inline' does not appear in the script-src directive of the Content Security Policy.

@@ -8,7 +8,7 @@
TestPage.needToSanitizeUncaughtExceptionURLs = true;

function triggerCSPExceptionInsideScript() {
eval("console.log('CSP should prevent this')");
eval("console.log('Inside Script - CSP should prevent this')");
}

function triggerCSPExceptionOutsideScript() {
@@ -28,7 +28,13 @@
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().then(resolve, reject);
WebInspector.debuggerManager.resume();
});

WebInspector.logManager.singleFireEventListener(WebInspector.LogManager.Event.MessageAdded, (event) => {
InspectorTest.assert(event.data.message.level === WebInspector.ConsoleMessage.MessageLevel.Error);
InspectorTest.pass("CSP Exception Console Message: " + event.data.message.messageText);
resolve();
});
}
});
@@ -38,20 +44,25 @@
description: "Trigger a CSP Exception outside of script should not pause or crash.",
test(resolve, reject) {
InspectorTest.evaluateInPage("setTimeout(triggerCSPExceptionOutsideScript)");
let didPause = false;
let tempPauseFailListener = WebInspector.debuggerManager.singleFireEventListener(WebInspector.DebuggerManager.Event.Paused, (event) => {
didPause = true;
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.logManager.singleFireEventListener(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.");
InspectorTest.assert(event.data.message.level === WebInspector.ConsoleMessage.MessageLevel.Error);
InspectorTest.expectFalse(didPause, "CSP Exception caused outside of script evaluation should not pause.");
InspectorTest.pass("CSP Exception Console Message: " + event.data.message.messageText);
resolve();
});
}
});

DebuggerAgent.setPauseOnExceptions("all");

suite.runTestCasesAndFinish();
}
</script>
@@ -4,6 +4,6 @@
<meta http-equiv="Content-Security-Policy" content="script-src 'none'">
</head>
<body>
<script>console.log("CSP should prevent this");</script>
<script>console.log("Inside Frame - CSP should prevent this");</script>
</body>
</html>
@@ -545,7 +545,6 @@ webkit.org/b/163932 inspector/css/pseudo-element-matches.html [ Pass Failure ]

webkit.org/b/163604 inspector/debugger/breakpoint-action-eval.html [ Pass Timeout ]
webkit.org/b/161774 inspector/debugger/breakpoint-columns.html [ Pass Failure ]
webkit.org/b/165292 inspector/debugger/csp-exceptions.html [ Pass Failure ]
webkit.org/b/159447 [ Debug ] inspector/debugger/tail-deleted-frames-from-vm-entry.html [ Pass Failure ]
webkit.org/b/165582 inspector/worker/debugger-scripts.html [ Pass Failure ]

0 comments on commit 5ea00f5

Please sign in to comment.