mirror of
https://github.com/servo/servo.git
synced 2025-09-16 09:58:23 +01:00
Update web-platform-tests to revision 58eb04cecbbec2e18531ab440225e38944a9c444
This commit is contained in:
parent
25e8bf69e6
commit
665817d2a6
35333 changed files with 1818077 additions and 16036 deletions
|
@ -1,37 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>single-frame-self-allowed</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="../support/logTest.sub.js?logs=[]"></script>
|
||||
<script src='../support/alertAssert.sub.js?alerts=["PASS"]'></script>
|
||||
<!-- enforcing policy:
|
||||
connect-src 'self' 'none'; script-src 'self' 'unsafe-inline'; frame-src 'self';
|
||||
-->
|
||||
<script>
|
||||
function onMessage(event) {
|
||||
if(event.data == "start test") {
|
||||
startTest();
|
||||
} else {
|
||||
alert_assert(event.data);
|
||||
}
|
||||
}
|
||||
|
||||
window.addEventListener(
|
||||
"message",
|
||||
onMessage,
|
||||
false);
|
||||
|
||||
function startTest() {
|
||||
window.frames['frame1'].frames['deepframe'].postMessage("hello deep frame", "*");
|
||||
}
|
||||
function done() { alert_assert("PASS"); }
|
||||
setTimeout(done(), 1);
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<iframe src='http://{{host}}:{{ports[http][0]}}/content-security-policy/frame-ancestors/intermediate-reporting-frame-allows-self.sub.html?subframe=http://{{host}}:{{ports[http][0]}}/content-security-policy/frame-ancestors/reporting-frame-allows-none.html' name="frame1"></iframe>
|
||||
<div id="log"></div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,15 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="support/frame-ancestors-test.sub.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<script>
|
||||
test = async_test("A 'frame-ancestors' CSP directive with a value 'none' should block rendering in nested frames.");
|
||||
|
||||
testNestedIFrame("'none'", CROSS_ORIGIN, CROSS_ORIGIN, EXPECT_BLOCK);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,15 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="support/frame-ancestors-test.sub.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<script>
|
||||
test = async_test("A 'frame-ancestors' CSP directive with a value 'same' should block render in same-origin nested frames.");
|
||||
|
||||
testNestedIFrame("'self'", CROSS_ORIGIN, CROSS_ORIGIN, EXPECT_BLOCK);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,15 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="support/frame-ancestors-test.sub.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<script>
|
||||
test = async_test("A 'frame-ancestors' CSP directive with a value '*' should render in nested frames.");
|
||||
|
||||
testNestedIFrame("*", CROSS_ORIGIN, CROSS_ORIGIN, EXPECT_LOAD);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,15 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="support/frame-ancestors-test.sub.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<script>
|
||||
test = async_test("A 'frame-ancestors' CSP directive with a URL value should block or allow rendering in nested frames as appropriate.");
|
||||
|
||||
testNestedIFrame(SAMEORIGIN_ORIGIN + " " + CROSSORIGIN_ORIGIN, CROSS_ORIGIN, CROSS_ORIGIN, EXPECT_LOAD);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,15 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="support/frame-ancestors-test.sub.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<script>
|
||||
test = async_test("A 'frame-ancestors' CSP directive with a URL value should block or allow rendering in nested frames as appropriate.");
|
||||
|
||||
testNestedIFrame(CROSSORIGIN_ORIGIN, CROSS_ORIGIN, CROSS_ORIGIN, EXPECT_BLOCK);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,16 @@
|
|||
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="support/frame-ancestors-test.sub.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<script>
|
||||
test = async_test("A 'frame-ancestors' CSP directive with a value 'none' should block rendering in nested frames.");
|
||||
|
||||
testNestedIFrame("'none'", SAME_ORIGIN, CROSS_ORIGIN, EXPECT_BLOCK);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,15 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="support/frame-ancestors-test.sub.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<script>
|
||||
test = async_test("A 'frame-ancestors' CSP directive with a value 'same' should block render in same-origin nested frames.");
|
||||
|
||||
testNestedIFrame("'self'", SAME_ORIGIN, CROSS_ORIGIN, EXPECT_BLOCK);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,16 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="support/frame-ancestors-test.sub.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<script>
|
||||
test = async_test("A 'frame-ancestors' CSP directive with a value '*' should render in nested frames.");
|
||||
|
||||
// Note that we can't distinguish blocked URLs from allowed cross-origin URLs due to the same-origin policy. This test passes if no console message declares that the frame was blocked.
|
||||
testNestedIFrame("*", SAME_ORIGIN, CROSS_ORIGIN, EXPECT_BLOCK);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,16 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="support/frame-ancestors-test.sub.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<script>
|
||||
test = async_test("A 'frame-ancestors' CSP directive with a URL value should block or allow rendering in nested frames as appropriate.");
|
||||
|
||||
// Note that we can't distinguish blocked URLs from allowed cross-origin URLs due to the same-origin policy. This test passes if no console message declares that the frame was blocked.
|
||||
testNestedIFrame(SAMEORIGIN_ORIGIN + " " + CROSSORIGIN_ORIGIN, SAME_ORIGIN, CROSS_ORIGIN, EXPECT_BLOCK);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,15 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="support/frame-ancestors-test.sub.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<script>
|
||||
test = async_test("A 'frame-ancestors' CSP directive with a URL value should block or allow rendering in nested frames as appropriate.");
|
||||
|
||||
testNestedIFrame(CROSSORIGIN_ORIGIN, SAME_ORIGIN, CROSS_ORIGIN, EXPECT_BLOCK);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,16 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="support/frame-ancestors-test.sub.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<script>
|
||||
test = async_test("A 'frame-ancestors' CSP directive with a URL value should compare against each frame's origin rather than URL, " +
|
||||
"so a nested frame with a sandboxed parent frame should be blocked due to the parent having a unique origin.");
|
||||
|
||||
testNestedSandboxedIFrame(SAMEORIGIN_ORIGIN + " " + CROSSORIGIN_ORIGIN, CROSS_ORIGIN, CROSS_ORIGIN, EXPECT_BLOCK);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,15 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="support/frame-ancestors-test.sub.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<script>
|
||||
test = async_test("A 'frame-ancestors' CSP directive with a value 'none' should block rendering in nested frames.");
|
||||
|
||||
testNestedIFrame("'none'", CROSS_ORIGIN, SAME_ORIGIN, EXPECT_BLOCK);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,15 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="support/frame-ancestors-test.sub.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<script>
|
||||
test = async_test("A 'frame-ancestors' CSP directive with a value 'same' should block render in same-origin nested frames.");
|
||||
|
||||
testNestedIFrame("'self'", CROSS_ORIGIN, SAME_ORIGIN, EXPECT_BLOCK);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,15 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="support/frame-ancestors-test.sub.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<script>
|
||||
test = async_test("A 'frame-ancestors' CSP directive with a value '*' should render in nested frames.");
|
||||
|
||||
testNestedIFrame("*", CROSS_ORIGIN, SAME_ORIGIN, EXPECT_LOAD);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,15 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="support/frame-ancestors-test.sub.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<script>
|
||||
test = async_test("A 'frame-ancestors' CSP directive with a URL value should block or allow rendering in nested frames as appropriate.");
|
||||
|
||||
testNestedIFrame(SAMEORIGIN_ORIGIN + " " + CROSSORIGIN_ORIGIN, CROSS_ORIGIN, SAME_ORIGIN, EXPECT_LOAD);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,15 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="support/frame-ancestors-test.sub.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<script>
|
||||
test = async_test("A 'frame-ancestors' CSP directive with a URL value should block or allow rendering in nested frames as appropriate.");
|
||||
|
||||
testNestedIFrame(SAMEORIGIN_ORIGIN, CROSS_ORIGIN, SAME_ORIGIN, EXPECT_BLOCK);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,15 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="support/frame-ancestors-test.sub.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<script>
|
||||
test = async_test("A 'frame-ancestors' CSP directive with a value 'none' should block rendering in nested frames.");
|
||||
|
||||
testNestedIFrame("'none'", SAME_ORIGIN, SAME_ORIGIN, EXPECT_BLOCK);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,15 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="support/frame-ancestors-test.sub.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<script>
|
||||
test = async_test("A 'frame-ancestors' CSP directive with a value 'same' should block render in same-origin nested frames.");
|
||||
|
||||
testNestedIFrame("'self'", SAME_ORIGIN, SAME_ORIGIN, EXPECT_LOAD);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,15 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="support/frame-ancestors-test.sub.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<script>
|
||||
test = async_test("A 'frame-ancestors' CSP directive with a value '*' should render in nested frames.");
|
||||
|
||||
testNestedIFrame("*", SAME_ORIGIN, SAME_ORIGIN, EXPECT_LOAD);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,15 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="support/frame-ancestors-test.sub.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<script>
|
||||
test = async_test("A 'frame-ancestors' CSP directive with a URL value should block or allow rendering in nested frames as appropriate.");
|
||||
|
||||
testNestedIFrame(SAMEORIGIN_ORIGIN, SAME_ORIGIN, SAME_ORIGIN, EXPECT_LOAD);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,15 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="support/frame-ancestors-test.sub.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<script>
|
||||
test = async_test("A 'frame-ancestors' CSP directive with a URL value should block or allow rendering in nested frames as appropriate.");
|
||||
|
||||
testNestedIFrame(CROSSORIGIN_ORIGIN, SAME_ORIGIN, SAME_ORIGIN, EXPECT_BLOCK);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,16 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="support/frame-ancestors-test.sub.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<script>
|
||||
test = async_test("A 'frame-ancestors' CSP directive with a value 'none' should block rendering.");
|
||||
|
||||
sameOriginFrameShouldBeBlocked("'none'");
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<script>
|
||||
async_test(function (t) {
|
||||
var i = document.createElement('iframe');
|
||||
i.src = "support/frame-ancestors-and-x-frame-options.sub.html?policy='self'&xfo=DENY";
|
||||
i.onload = t.step_func_done(function () {
|
||||
assert_equals(i.contentDocument.origin, document.origin, "The same-origin page loaded.");
|
||||
});
|
||||
document.body.appendChild(i);
|
||||
}, "A 'frame-ancestors' CSP directive overrides an 'x-frame-options' header which would block the page.");
|
||||
|
||||
async_test(function (t) {
|
||||
var i = document.createElement('iframe');
|
||||
i.src = "support/frame-ancestors-and-x-frame-options.sub.html?policy=other-origin.com&xfo=SAMEORIGIN";
|
||||
i.onload = t.step_func_done(function () {
|
||||
assert_throws(
|
||||
"SecurityError",
|
||||
function () { i.contentDocument.origin },
|
||||
"The same-origin page was blocked and sandboxed.");
|
||||
});
|
||||
document.body.appendChild(i);
|
||||
}, "A 'frame-ancestors' CSP directive overrides an 'x-frame-options' header which would allow the page.");
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,16 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="support/frame-ancestors-test.sub.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<script>
|
||||
test = async_test("A 'frame-ancestors' CSP directive with a value 'self' should allow rendering.");
|
||||
|
||||
sameOriginFrameShouldBeAllowed("'self'");
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="support/frame-ancestors-test.sub.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<script>
|
||||
test = async_test("A 'frame-ancestors' CSP directive with a value 'self' should block rendering.");
|
||||
|
||||
crossOriginFrameShouldBeBlocked("'self'");
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,16 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="support/frame-ancestors-test.sub.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<script>
|
||||
test = async_test("A 'frame-ancestors' CSP directive with '*' should allow rendering.");
|
||||
|
||||
// Note that we can't distinguish blocked URLs from allowed cross-origin URLs due to the same-origin policy. This test passes if no console message declares that the frame was blocked.
|
||||
crossOriginFrameShouldBeBlocked("*");
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,15 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="support/frame-ancestors-test.sub.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<script>
|
||||
test = async_test("A 'frame-ancestors' CSP directive with '*' should allow rendering.");
|
||||
|
||||
sameOriginFrameShouldBeAllowed("*");
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,15 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="support/frame-ancestors-test.sub.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<script>
|
||||
test = async_test("A 'frame-ancestors' CSP directive with a URL matching this origin should allow rendering.");
|
||||
|
||||
sameOriginFrameShouldBeAllowed('{{location[scheme]}}://{{location[host]}}');
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,15 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="support/frame-ancestors-test.sub.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<script>
|
||||
test = async_test("A 'frame-ancestors' CSP directive with a URL which doesn't match this origin should be blocked.");
|
||||
|
||||
crossOriginFrameShouldBeBlocked("http://example.com/");
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -1,21 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<body>
|
||||
<p>Reporting Frame...</p>
|
||||
<script>
|
||||
function onMessage(event) {
|
||||
var p = document.createElement(p);
|
||||
p.textContent = event.data;
|
||||
document.body.appendChild(p);
|
||||
window.parent.postMessage(event.data, "*");
|
||||
}
|
||||
|
||||
window.addEventListener(
|
||||
"message",
|
||||
onMessage,
|
||||
false
|
||||
);
|
||||
</script>
|
||||
<iframe src='{{GET[subframe]}}' name="deepframe"></iframe>
|
||||
</body>
|
||||
</html>
|
|
@ -1,5 +0,0 @@
|
|||
Expires: Mon, 26 Jul 1997 05:00:00 GMT
|
||||
Cache-Control: no-store, no-cache, must-revalidate
|
||||
Cache-Control: post-check=0, pre-check=0, false
|
||||
Pragma: no-cache
|
||||
Content-Security-Policy: frame-ancestors 'self'
|
|
@ -1,20 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<body>
|
||||
<p>Reporting Frame...</p>
|
||||
<script>
|
||||
function onMessage(event) {
|
||||
var p = document.createElement(p);
|
||||
p.textContent = event.data;
|
||||
document.body.appendChild(p);
|
||||
window.parent.postMessage(event.data, "*");
|
||||
}
|
||||
window.addEventListener(
|
||||
"message",
|
||||
onMessage,
|
||||
false
|
||||
);
|
||||
</script>
|
||||
<iframe src='{{GET[subframe]}}' name="deepframe"></iframe>
|
||||
</body>
|
||||
</html>
|
|
@ -1,5 +0,0 @@
|
|||
Expires: Mon, 26 Jul 1997 05:00:00 GMT
|
||||
Cache-Control: no-store, no-cache, must-revalidate
|
||||
Cache-Control: post-check=0, pre-check=0, false
|
||||
Pragma: no-cache
|
||||
Content-Security-Policy: frame-ancestors *
|
|
@ -1,41 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>multiple-frames-self-allowed</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="../support/logTest.sub.js?logs=[]"></script>
|
||||
<script src='../support/alertAssert.sub.js?alerts=["hello frame1","hello frame2"]'></script>
|
||||
<!-- enforcing policy:
|
||||
connect-src 'self' 'none'; script-src 'self' 'unsafe-inline'; frame-src 'self';
|
||||
-->
|
||||
<script>
|
||||
var startTestCtr = 0;
|
||||
function onMessage(event) {
|
||||
if(event.data == "start test") {
|
||||
startTestCtr++;
|
||||
if(startTestCtr == 2) {
|
||||
startTest();
|
||||
}
|
||||
} else {
|
||||
alert_assert(event.data);
|
||||
}
|
||||
}
|
||||
|
||||
window.addEventListener(
|
||||
"message",
|
||||
onMessage,
|
||||
false);
|
||||
|
||||
function startTest() {
|
||||
window.frames['frame1'].postMessage("hello frame1", "*");
|
||||
window.frames['frame2'].postMessage("hello frame2", "*");
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<iframe src='http://{{host}}:{{ports[http][0]}}/content-security-policy/frame-ancestors/reporting-frame-allows-self.html' name="frame1"></iframe>
|
||||
<iframe src='http://{{host}}:{{ports[http][0]}}/content-security-policy/frame-ancestors/reporting-frame-allows-none-meta.html' name="frame2"></iframe>
|
||||
<div id="log"></div>
|
||||
</body>
|
||||
</html>
|
|
@ -1,37 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>multiple-frames-self-allowed</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="../support/logTest.sub.js?logs=[]"></script>
|
||||
<script src='../support/alertAssert.sub.js?alerts=["hello frame2"]'></script>
|
||||
<!-- enforcing policy:
|
||||
connect-src 'self' 'none'; script-src 'self' 'unsafe-inline'; frame-src 'self';
|
||||
-->
|
||||
<script>
|
||||
function onMessage(event) {
|
||||
if(event.data == "start test") {
|
||||
startTest();
|
||||
} else {
|
||||
alert_assert(event.data);
|
||||
}
|
||||
}
|
||||
|
||||
window.addEventListener(
|
||||
"message",
|
||||
onMessage,
|
||||
false);
|
||||
|
||||
function startTest() {
|
||||
window.frames['frame1'].postMessage("hello frame1", "*");
|
||||
window.frames['frame2'].postMessage("hello frame2", "*");
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<iframe src='http://{{host}}:{{ports[http][0]}}/content-security-policy/frame-ancestors/reporting-frame-allows-none.html' name="frame1"></iframe>
|
||||
<iframe src='http://{{host}}:{{ports[http][0]}}/content-security-policy/frame-ancestors/reporting-frame-allows-self.html' name="frame2"></iframe>
|
||||
<div id="log"></div>
|
||||
</body>
|
||||
</html>
|
|
@ -1,39 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>multiple-frames-self-allowed</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="../support/logTest.sub.js?logs=[]"></script>
|
||||
<script src='../support/alertAssert.sub.js?alerts=["hello frame1","hello frame2"]'></script>
|
||||
<!-- enforcing policy:
|
||||
connect-src 'self' 'none'; script-src 'self' 'unsafe-inline'; frame-src 'self';
|
||||
-->
|
||||
<script>
|
||||
var startTestCtr = 0;
|
||||
function onMessage(event) {
|
||||
if(event.data == "start test") {
|
||||
startTestCtr++;
|
||||
if(startTestCtr == 2) {
|
||||
startTest();
|
||||
}
|
||||
} else {
|
||||
alert_assert(event.data);
|
||||
}
|
||||
}
|
||||
window.addEventListener(
|
||||
"message",
|
||||
onMessage,
|
||||
false);
|
||||
function startTest() {
|
||||
window.frames['frame1'].postMessage("hello frame1", "*");
|
||||
window.frames['frame2'].postMessage("hello frame2", "*");
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<iframe src='http://{{host}}:{{ports[http][0]}}/content-security-policy/frame-ancestors/reporting-frame-allows-self.html' name="frame1"></iframe>
|
||||
<iframe src='http://{{host}}:{{ports[http][0]}}/content-security-policy/frame-ancestors/reporting-frame-allows-self.html' name="frame2"></iframe>
|
||||
<div id="log"></div>
|
||||
</body>
|
||||
</html>
|
|
@ -1,33 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>single-frame-self-allowed</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="../support/logTest.sub.js?logs=[]"></script>
|
||||
<script src='../support/alertAssert.sub.js?alerts=["hello deep frame"]'></script>
|
||||
<!-- enforcing policy:
|
||||
connect-src 'self' 'none'; script-src 'self' 'unsafe-inline'; frame-src 'self';
|
||||
-->
|
||||
<script>
|
||||
function onMessage(event) {
|
||||
if(event.data == "start test") {
|
||||
startTest();
|
||||
} else {
|
||||
alert_assert(event.data);
|
||||
}
|
||||
}
|
||||
window.addEventListener(
|
||||
"message",
|
||||
onMessage,
|
||||
false);
|
||||
function startTest() {
|
||||
window.frames['frame1'].frames['deepframe'].postMessage("hello deep frame", "*");
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<iframe src='http://{{host}}:{{ports[http][0]}}/content-security-policy/frame-ancestors/intermediate-reporting-frame-allows-self.sub.html?subframe=http://{{host}}:{{ports[http][0]}}/content-security-policy/frame-ancestors/reporting-frame-allows-self.html' name="frame1"></iframe>
|
||||
<div id="log"></div>
|
||||
</body>
|
||||
</html>
|
|
@ -1,35 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>single-frame-self-allowed</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="../support/logTest.sub.js?logs=[]"></script>
|
||||
<script src='../support/alertAssert.sub.js?alerts=["PASS"]'></script>
|
||||
<!-- enforcing policy:
|
||||
connect-src 'self' 'none'; script-src 'self' 'unsafe-inline'; frame-src 'self';
|
||||
-->
|
||||
<script>
|
||||
function onMessage(event) {
|
||||
if(event.data == "start test") {
|
||||
startTest();
|
||||
} else {
|
||||
alert_assert(event.data);
|
||||
}
|
||||
}
|
||||
window.addEventListener(
|
||||
"message",
|
||||
onMessage,
|
||||
false);
|
||||
function startTest() {
|
||||
window.frames['frame1'].frames['deepframe'].postMessage("hello deep frame", "*");
|
||||
}
|
||||
function done() { alert_assert("PASS"); }
|
||||
setTimeout(done(), 1);
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<iframe src='http://www1.{{host}}:{{ports[http][0]}}/content-security-policy/frame-ancestors/intermediate-reporting-frame-allows-star.sub.html?subframe=http://{{host}}:{{ports[http][0]}}/content-security-policy/frame-ancestors/reporting-frame-allows-self.html' name="frame1"></iframe>
|
||||
<div id="log"></div>
|
||||
</body>
|
||||
</html>
|
|
@ -1,37 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>single-frame-self-allowed</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="../support/logTest.sub.js?logs=[]"></script>
|
||||
<script src='../support/alertAssert.sub.js?alerts=["PASS"]'></script>
|
||||
<!-- enforcing policy:
|
||||
connect-src 'self' 'none'; script-src 'self' 'unsafe-inline'; frame-src 'self';
|
||||
-->
|
||||
<script>
|
||||
function onMessage(event) {
|
||||
if(event.data == "start test") {
|
||||
startTest();
|
||||
} else {
|
||||
alert_assert(event.data);
|
||||
}
|
||||
}
|
||||
|
||||
window.addEventListener(
|
||||
"message",
|
||||
onMessage,
|
||||
false);
|
||||
|
||||
function startTest() {
|
||||
window.frames['frame1'].frames['deepframe'].postMessage("hello deep frame", "*");
|
||||
}
|
||||
function done() { alert_assert("PASS"); }
|
||||
setTimeout(done(), 1);
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<iframe src='http://{{host}}:{{ports[http][0]}}/content-security-policy/frame-ancestors/intermediate-reporting-frame-allows-self.sub.html?subframe=http://www1.{{host}}:{{ports[http][0]}}/content-security-policy/frame-ancestors/reporting-frame-allows-self.html' name="frame1"></iframe>
|
||||
<div id="log"></div>
|
||||
</body>
|
||||
</html>
|
|
@ -1,23 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Security-Policy" content="frame-ancestors 'none'">
|
||||
</head>
|
||||
<body>
|
||||
<p>Reporting Frame...</p>
|
||||
<script>
|
||||
function onMessage(event) {
|
||||
var p = document.createElement(p);
|
||||
p.textContent = event.data;
|
||||
document.body.appendChild(p);
|
||||
window.parent.postMessage(event.data, "*");
|
||||
}
|
||||
window.addEventListener(
|
||||
"message",
|
||||
onMessage,
|
||||
false
|
||||
);
|
||||
window.parent.postMessage("start test", "*");
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -1,22 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<body>
|
||||
<p>Reporting Frame...</p>
|
||||
<script>
|
||||
function onMessage(event) {
|
||||
var p = document.createElement(p);
|
||||
p.textContent = event.data;
|
||||
document.body.appendChild(p);
|
||||
window.parent.postMessage(event.data, "*");
|
||||
}
|
||||
|
||||
window.addEventListener(
|
||||
"message",
|
||||
onMessage,
|
||||
false
|
||||
);
|
||||
|
||||
window.parent.postMessage("start test", "*");
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -1,5 +0,0 @@
|
|||
Expires: Mon, 26 Jul 1997 05:00:00 GMT
|
||||
Cache-Control: no-store, no-cache, must-revalidate
|
||||
Cache-Control: post-check=0, pre-check=0, false
|
||||
Pragma: no-cache
|
||||
Content-Security-Policy: frame-ancestors 'none'
|
|
@ -1,22 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<body>
|
||||
<p>Reporting Frame...</p>
|
||||
<script>
|
||||
function onMessage(event) {
|
||||
var p = document.createElement(p);
|
||||
p.textContent = event.data;
|
||||
document.body.appendChild(p);
|
||||
window.parent.postMessage(event.data, "*");
|
||||
}
|
||||
|
||||
window.addEventListener(
|
||||
"message",
|
||||
onMessage,
|
||||
false
|
||||
);
|
||||
|
||||
window.parent.postMessage("start test", "*");
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -1,5 +0,0 @@
|
|||
Expires: Mon, 26 Jul 1997 05:00:00 GMT
|
||||
Cache-Control: no-store, no-cache, must-revalidate
|
||||
Cache-Control: post-check=0, pre-check=0, false
|
||||
Pragma: no-cache
|
||||
Content-Security-Policy: frame-ancestors 'self'
|
|
@ -1,35 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>single-frame-self-allowed</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="../support/logTest.sub.js?logs=[]"></script>
|
||||
<script src='../support/alertAssert.sub.js?alerts=["hello frame1"]'></script>
|
||||
<!-- enforcing policy:
|
||||
connect-src 'self' 'none'; script-src 'self' 'unsafe-inline'; frame-src 'self';
|
||||
-->
|
||||
<script>
|
||||
function onMessage(event) {
|
||||
if(event.data == "start test") {
|
||||
startTest();
|
||||
} else {
|
||||
alert_assert(event.data);
|
||||
}
|
||||
}
|
||||
|
||||
window.addEventListener(
|
||||
"message",
|
||||
onMessage,
|
||||
false);
|
||||
|
||||
function startTest() {
|
||||
window.frames['frame1'].postMessage("hello frame1", "*");
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<iframe src='http://{{host}}:{{ports[http][0]}}/content-security-policy/frame-ancestors/reporting-frame-allows-self.html' name="frame1"></iframe>
|
||||
<div id="log"></div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,9 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<body>
|
||||
<p>This is an IFrame sending a Content Security Policy header containing "frame-ancestors {{GET[policy]}}" and "X-Frame-Options: {{GET[xfo]}}".</p>
|
||||
<script>
|
||||
// This is an IFrame sending a Content Security Policy header containing "frame-ancestors {{GET[policy]}}" and "X-Frame-Options: {{GET[xfo]}}".
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,3 @@
|
|||
Content-Type: text/html; charset=UTF-8
|
||||
Content-Security-Policy: frame-ancestors {{GET[policy]}}
|
||||
X-Frame-Options: {{GET[xfo]}}
|
|
@ -0,0 +1,134 @@
|
|||
var SAME_ORIGIN = true;
|
||||
var CROSS_ORIGIN = false;
|
||||
|
||||
var EXPECT_BLOCK = true;
|
||||
var EXPECT_LOAD = false;
|
||||
|
||||
var SAMEORIGIN_ORIGIN = "{{location[scheme]}}://{{location[host]}}";
|
||||
var CROSSORIGIN_ORIGIN = "http://{{domains[www1]}}:{{ports[http][1]}}";
|
||||
|
||||
var test;
|
||||
|
||||
function endTest(failed, message) {
|
||||
if (typeof test === 'undefined') return;
|
||||
|
||||
if (failed) {
|
||||
test.step(function() {
|
||||
assert_unreached(message);
|
||||
test.done();
|
||||
});
|
||||
}
|
||||
else test.done({message: message});
|
||||
}
|
||||
|
||||
window.addEventListener("message", function (e) {
|
||||
if (window.parent != window)
|
||||
window.parent.postMessage(e.data, "*");
|
||||
else
|
||||
if (e.data.type === 'test_result')
|
||||
endTest(e.data.failed, "Inner IFrame msg: " + e.data.msg);
|
||||
});
|
||||
|
||||
function injectNestedIframe(policy, parent, child, expectation, isSandboxed) {
|
||||
var iframe = document.createElement("iframe");
|
||||
|
||||
var url = "/content-security-policy/frame-ancestors/support/frame-in-frame.sub.html"
|
||||
+ "?policy=" + policy
|
||||
+ "&parent=" + parent
|
||||
+ "&child=" + child
|
||||
+ "&expectation=" + expectation;
|
||||
url = (parent == "same" ? SAMEORIGIN_ORIGIN : CROSSORIGIN_ORIGIN) + url;
|
||||
|
||||
iframe.src = url;
|
||||
|
||||
if (isSandboxed)
|
||||
iframe.sandbox = 'allow-scripts';
|
||||
|
||||
document.body.appendChild(iframe);
|
||||
}
|
||||
|
||||
function injectIFrame(policy, sameOrigin, expectBlock) {
|
||||
var iframe = document.createElement("iframe");
|
||||
iframe.addEventListener("load", iframeLoaded(expectBlock));
|
||||
iframe.addEventListener("error", iframeLoaded(expectBlock));
|
||||
|
||||
var url = "/content-security-policy/frame-ancestors/support/frame-ancestors.sub.html?policy=" + policy;
|
||||
if (sameOrigin)
|
||||
url = SAMEORIGIN_ORIGIN + url;
|
||||
else
|
||||
url = CROSSORIGIN_ORIGIN + url;
|
||||
|
||||
iframe.src = url;
|
||||
document.body.appendChild(iframe);
|
||||
}
|
||||
|
||||
function iframeLoaded(expectBlock) {
|
||||
return function(ev) {
|
||||
var failed = true;
|
||||
var message = "";
|
||||
try {
|
||||
if (expectBlock) {
|
||||
message = "The IFrame should have been blocked (or cross-origin). It wasn't.";
|
||||
failed = true;
|
||||
} else {
|
||||
message = "The IFrame should not have been blocked. It wasn't.";
|
||||
failed = false;
|
||||
}
|
||||
} catch (ex) {
|
||||
if (expectBlock) {
|
||||
message = "The IFrame should have been blocked (or cross-origin). It was.";
|
||||
failed = false;
|
||||
} else {
|
||||
message = "The IFrame should not have been blocked. It was.";
|
||||
failed = true;
|
||||
}
|
||||
}
|
||||
if (window.parent != window)
|
||||
window.parent.postMessage({type: 'test_result', failed: failed, message: message}, '*');
|
||||
else
|
||||
endTest(failed, message);
|
||||
};
|
||||
}
|
||||
|
||||
function originFrameShouldBe(child, expectation, policy) {
|
||||
if (child == "cross" && expectation == "blocked") crossOriginFrameShouldBeBlocked(policy);
|
||||
if (child == "same" && expectation == "blocked") sameOriginFrameShouldBeBlocked(policy);
|
||||
if (child == "cross" && expectation == "allowed") crossOriginFrameShouldBeAllowed(policy);
|
||||
if (child == "same" && expectation == "allowed") sameOriginFrameShouldBeAllowed(policy);
|
||||
}
|
||||
|
||||
function crossOriginFrameShouldBeBlocked(policy) {
|
||||
window.onload = function () {
|
||||
injectIFrame(policy, CROSS_ORIGIN, EXPECT_BLOCK);
|
||||
};
|
||||
}
|
||||
|
||||
function crossOriginFrameShouldBeAllowed(policy) {
|
||||
window.onload = function () {
|
||||
injectIFrame(policy, CROSS_ORIGIN, EXPECT_LOAD);
|
||||
};
|
||||
}
|
||||
|
||||
function sameOriginFrameShouldBeBlocked(policy) {
|
||||
window.onload = function () {
|
||||
injectIFrame(policy, SAME_ORIGIN, EXPECT_BLOCK);
|
||||
};
|
||||
}
|
||||
|
||||
function sameOriginFrameShouldBeAllowed(policy) {
|
||||
window.onload = function () {
|
||||
injectIFrame(policy, SAME_ORIGIN, EXPECT_LOAD);
|
||||
};
|
||||
}
|
||||
|
||||
function testNestedIFrame(policy, parent, child, expectation) {
|
||||
window.onload = function () {
|
||||
injectNestedIframe(policy, parent == SAME_ORIGIN ? "same" : "cross", child == SAME_ORIGIN ? "same" : "cross", expectation == EXPECT_LOAD ? "allowed" : "blocked", false /* isSandboxed */);
|
||||
};
|
||||
}
|
||||
|
||||
function testNestedSandboxedIFrame(policy, parent, child, expectation) {
|
||||
window.onload = function () {
|
||||
injectNestedIframe(policy, parent == SAME_ORIGIN ? "same" : "cross", child == SAME_ORIGIN ? "same" : "cross", expectation == EXPECT_LOAD ? "allowed" : "blocked", true /* isSandboxed */);
|
||||
};
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<body>
|
||||
<p>This is an IFrame sending a Content Security Policy header containing "frame-ancestors {{GET[policy]}}".</p>
|
||||
<script>
|
||||
// This is an IFrame sending a Content Security Policy header containing "frame-ancestors {{GET[policy]}}"
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,2 @@
|
|||
Content-Type: text/html; charset=UTF-8
|
||||
Content-Security-Policy: frame-ancestors {{GET[policy]}}
|
|
@ -0,0 +1,12 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<body>
|
||||
<script src='/resources/testharness.js'></script>
|
||||
<script src='/resources/testharnessreport.js'></script>
|
||||
<script src='/content-security-policy/frame-ancestors/support/frame-ancestors-test.sub.js'></script>
|
||||
<script>
|
||||
test = async_test("Testing a {{GET[child]}}-origin child with a policy of {{GET[policy]}} nested in a {{GET[parent]}}-origin parent");
|
||||
originFrameShouldBe("{{GET[child]}}", "{{GET[expectation]}}", "{{GET[policy]]}}");
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1 @@
|
|||
Content-Type: text/html; charset=UTF-8
|
Loading…
Add table
Add a link
Reference in a new issue