Skip to content

Commit

Permalink
fast/frames/sandboxed-iframe-scripting is flakey
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=112482

Reviewed by Simon Fraser.

Tests that rely on multiple 'iframe' elements loading in a specific
order are a Bad Idea™. This patch splits
'fast/frames/sandboxed-iframe-scripting.html' out into five tests, and
changes two of them (#2 and #4) to use message passing in order to
test in a way that 'js-test-{pre,post}' can cleanly report.

* fast/frames/sandboxed-iframe-scripting-01-expected.txt: Added.
* fast/frames/sandboxed-iframe-scripting-01.html: Added.
* fast/frames/sandboxed-iframe-scripting-02-expected.txt: Added.
* fast/frames/sandboxed-iframe-scripting-02.html: Added.
* fast/frames/sandboxed-iframe-scripting-03-expected.txt: Added.
* fast/frames/sandboxed-iframe-scripting-03.html: Added.
* fast/frames/sandboxed-iframe-scripting-04-expected.txt: Added.
* fast/frames/sandboxed-iframe-scripting-04.html: Added.
* fast/frames/sandboxed-iframe-scripting-05-expected.txt: Added.
* fast/frames/sandboxed-iframe-scripting-05.html: Added.
* fast/frames/sandboxed-iframe-scripting-expected.txt: Removed.
* fast/frames/sandboxed-iframe-scripting.html: Removed.
* platform/mac/TestExpectations:
    Remove the skipped test, since it no longer exists.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@145993 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
[email protected] committed Mar 16, 2013
1 parent db54adc commit 3707188
Show file tree
Hide file tree
Showing 14 changed files with 238 additions and 61 deletions.
28 changes: 28 additions & 0 deletions LayoutTests/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,31 @@
2013-03-16 Mike West <[email protected]>

fast/frames/sandboxed-iframe-scripting is flakey
https://bugs.webkit.org/show_bug.cgi?id=112482

Reviewed by Simon Fraser.

Tests that rely on multiple 'iframe' elements loading in a specific
order are a Bad Idea™. This patch splits
'fast/frames/sandboxed-iframe-scripting.html' out into five tests, and
changes two of them (#2 and #4) to use message passing in order to
test in a way that 'js-test-{pre,post}' can cleanly report.

* fast/frames/sandboxed-iframe-scripting-01-expected.txt: Added.
* fast/frames/sandboxed-iframe-scripting-01.html: Added.
* fast/frames/sandboxed-iframe-scripting-02-expected.txt: Added.
* fast/frames/sandboxed-iframe-scripting-02.html: Added.
* fast/frames/sandboxed-iframe-scripting-03-expected.txt: Added.
* fast/frames/sandboxed-iframe-scripting-03.html: Added.
* fast/frames/sandboxed-iframe-scripting-04-expected.txt: Added.
* fast/frames/sandboxed-iframe-scripting-04.html: Added.
* fast/frames/sandboxed-iframe-scripting-05-expected.txt: Added.
* fast/frames/sandboxed-iframe-scripting-05.html: Added.
* fast/frames/sandboxed-iframe-scripting-expected.txt: Removed.
* fast/frames/sandboxed-iframe-scripting.html: Removed.
* platform/mac/TestExpectations:
Remove the skipped test, since it no longer exists.

2013-03-16 Jochen Eisinger <[email protected]>

Update test expectations for content shell.
Expand Down
11 changes: 11 additions & 0 deletions LayoutTests/fast/frames/sandboxed-iframe-scripting-01-expected.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Verify that sandboxed frames with sandbox='allow-scripts' can execute script.

On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".


PASS disallowedExecuted is 0
PASS allowedExecuted is 1
PASS successfullyParsed is true

TEST COMPLETE

25 changes: 25 additions & 0 deletions LayoutTests/fast/frames/sandboxed-iframe-scripting-01.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<!DOCTYPE html>
<html>
<head>
<script src="../js/resources/js-test-pre.js"></script>
<script>
var allowedExecuted = 0;
var disallowedExecuted = 0;
window.onload = function() {
shouldBe("disallowedExecuted", "0");
shouldBe("allowedExecuted", "1");

isSuccessfullyParsed();
};
</script>
</head>
<body>
<iframe sandbox="allow-same-origin allow-scripts"
src="javascript: ++window.top.allowedExecuted;">
</iframe>
<script>
description("Verify that sandboxed frames with sandbox='allow-scripts' can execute script.");
</script>
</body>
</html>

12 changes: 12 additions & 0 deletions LayoutTests/fast/frames/sandboxed-iframe-scripting-02-expected.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
ALERT: PASS: Executed script in data URL
Verify that sandboxed frames with sandbox='allow-scripts' can execute script from data: URLs.

On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".


PASS disallowedExecuted is 0
PASS allowedExecuted is 1
PASS successfullyParsed is true

TEST COMPLETE

35 changes: 35 additions & 0 deletions LayoutTests/fast/frames/sandboxed-iframe-scripting-02.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<!DOCTYPE html>
<html>
<head>
<script src="../js/resources/js-test-pre.js"></script>
<script>
window.jsTestIsAsync = true;

var allowedExecuted = 0;
var disallowedExecuted = 0;
window.addEventListener('message', function () {
allowedExecuted++;

finish();
});

function finish() {
shouldBe("disallowedExecuted", "0");
shouldBe("allowedExecuted", "1");

finishJSTest();
};
</script>
<script src="../js/resources/js-test-post.js"></script>
</head>
<body>
<iframe sandbox="allow-same-origin allow-scripts"
src="data:text/html,<script>alert('PASS: Executed script in data URL');window.parent.postMessage({'pass': true}, '*');</script>">
</iframe>
<script>
description("Verify that sandboxed frames with sandbox='allow-scripts' can execute script from data: URLs.");
</script>
</body>
</html>


12 changes: 12 additions & 0 deletions LayoutTests/fast/frames/sandboxed-iframe-scripting-03-expected.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
CONSOLE MESSAGE: Blocked script execution in 'about:blank' because the document's frame is sandboxed and the 'allow-scripts' permission is not set.
Verify that sandboxed frames without sandbox='allow-scripts' cannot execute script.

On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".


PASS disallowedExecuted is 0
PASS allowedExecuted is 0
PASS successfullyParsed is true

TEST COMPLETE

27 changes: 27 additions & 0 deletions LayoutTests/fast/frames/sandboxed-iframe-scripting-03.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<!DOCTYPE html>
<html>
<head>
<script src="../js/resources/js-test-pre.js"></script>
<script>
var allowedExecuted = 0;
var disallowedExecuted = 0;
window.onload = function() {
shouldBe("disallowedExecuted", "0");
shouldBe("allowedExecuted", "0");

isSuccessfullyParsed();
};
</script>
</head>
<body>
<iframe sandbox="allow-same-origin"
src="javascript: ++window.top.disallowedExecuted;">
</iframe>
<script>
description("Verify that sandboxed frames without sandbox='allow-scripts' cannot execute script.");
</script>
</body>
</html>



12 changes: 12 additions & 0 deletions LayoutTests/fast/frames/sandboxed-iframe-scripting-04-expected.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
CONSOLE MESSAGE: Blocked script execution in 'data:text/html,<script>alert('FAIL: Executed script without allow-scripts in data URL');window.parent.postMessage({'fail': true}, '*');</script>' because the document's frame is sandboxed and the 'allow-scripts' permission is not set.
Verify that sandboxed frames without sandbox='allow-scripts' cannot execute script from data: URLs.

On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".


PASS disallowedExecuted is 0
PASS allowedExecuted is 0
PASS successfullyParsed is true

TEST COMPLETE

38 changes: 38 additions & 0 deletions LayoutTests/fast/frames/sandboxed-iframe-scripting-04.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<!DOCTYPE html>
<html>
<head>
<script src="../js/resources/js-test-pre.js"></script>
<script>
window.jsTestIsAsync = true;

var allowedExecuted = 0;
var disallowedExecuted = 0;
window.addEventListener('message', function () {
disallowedExecuted++;

finish();
});

function finish() {
shouldBe("disallowedExecuted", "0");
shouldBe("allowedExecuted", "0");

finishJSTest();
};
</script>
<script src="../js/resources/js-test-post.js"></script>
</head>
<body>
<iframe sandbox="allow-same-origin"
onload="finish()"
src="data:text/html,<script>alert('FAIL: Executed script without allow-scripts in data URL');window.parent.postMessage({'fail': true}, '*');</script>">
</iframe>
<script>
description("Verify that sandboxed frames without sandbox='allow-scripts' cannot execute script from data: URLs.");
</script>
</body>
</html>




11 changes: 11 additions & 0 deletions LayoutTests/fast/frames/sandboxed-iframe-scripting-05-expected.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Verify that adding a sandbox attribute at runtime does not effect the iframe's current state.

On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".


PASS disallowedExecuted is 0
PASS allowedExecuted is 2
PASS successfullyParsed is true

TEST COMPLETE

27 changes: 27 additions & 0 deletions LayoutTests/fast/frames/sandboxed-iframe-scripting-05.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<!DOCTYPE html>
<html>
<head>
<script src="../js/resources/js-test-pre.js"></script>
<script>
var allowedExecuted = 0;
var disallowedExecuted = 0;
window.onload = function() {
shouldBe("disallowedExecuted", "0");
shouldBe("allowedExecuted", "2");

isSuccessfullyParsed();
};
</script>
</head>
<body>
<iframe id="frame" src="resources/sandboxed-iframe-script-dynamic.html"></iframe>
<script>
description("Verify that adding a sandbox attribute at runtime does not effect the iframe's current state.");
</script>
</body>
</html>





14 changes: 0 additions & 14 deletions LayoutTests/fast/frames/sandboxed-iframe-scripting-expected.txt

This file was deleted.

45 changes: 0 additions & 45 deletions LayoutTests/fast/frames/sandboxed-iframe-scripting.html

This file was deleted.

2 changes: 0 additions & 2 deletions LayoutTests/platform/mac/TestExpectations
Original file line number Diff line number Diff line change
Expand Up @@ -1350,8 +1350,6 @@ webkit.org/b/104954 http/tests/canvas/canvas-slow-font-loading.html [ ImageOnlyF

webkit.org/b/104962 platform/mac/fast/loader/file-url-mimetypes-2.html [ Failure ]

webkit.org/b/112482 fast/frames/sandboxed-iframe-scripting.html [ Failure Pass ]

webkit.org/b/105601 svg/zoom/page/zoom-replaced-intrinsic-ratio-001.htm [ Crash Pass ]

webkit.org/b/105603 http/tests/cookies/single-quoted-value.html [ Failure Pass ]
Expand Down

0 comments on commit 3707188

Please sign in to comment.