Source code
Revision control
Copy as Markdown
Other Tools
Test Info: Warnings
- This test has a WPT meta file that expects 4 subtest issues.
- This WPT test may be referenced by the following Test IDs:
- /content-security-policy/embedded-enforcement/subsumption_algorithm-host_sources-ports.html - WPT Dashboard Interop Dashboard
<!DOCTYPE html>
<html>
<head>
<title>Embedded Enforcement: Subsumption Algorithm - Port parts in host source expressions.</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="support/testharness-helper.sub.js"></script>
</head>
<body>
<script>
var tests = [
{ "name": "Specified ports must match.",
"expected": IframeLoad.EXPECT_BLOCK },
{ "name": "Returned CSP should be subsumed even if the port is not specified but is a default port for a scheme.",
"expected": IframeLoad.EXPECT_LOAD },
{ "name": "Returned CSP should be subsumed even if the port is not specified but is a default port for a more secure scheme.",
"expected": IframeLoad.EXPECT_LOAD },
{ "name": "The same should hold for `ws` case.",
"expected": IframeLoad.EXPECT_LOAD },
{ "name": "Unspecified ports must match if schemes match.",
"expected": IframeLoad.EXPECT_LOAD },
{ "name": "Returned CSP should be subsumed if the port is specified.",
"expected": IframeLoad.EXPECT_LOAD },
{ "name": "Returned CSP should be subsumed if the port is specified but the scheme is more secure.",
"expected": IframeLoad.EXPECT_LOAD },
{ "name": "Returned CSP should be subsumed if the port is specified but is not default for a more secure scheme.",
"expected": IframeLoad.EXPECT_BLOCK },
{ "name": "Returned CSP should be subsumed if the ports match but schemes are not identical.",
"expected": IframeLoad.EXPECT_LOAD },
{ "name": "Returned CSP should be subsumed if the ports match but schemes are not identical for `ws`.",
"expected": IframeLoad.EXPECT_LOAD },
{ "name": "Wildcard port should match unspecified port.",
"expected": IframeLoad.EXPECT_LOAD },
{ "name": "Wildcard port should match any specific port.",
"expected": IframeLoad.EXPECT_LOAD },
{ "name": "Wildcard port should match a wildcard.",
"expected": IframeLoad.EXPECT_LOAD },
{ "name": "Wildcard port should not be subsumed by a default port.",
"expected": IframeLoad.EXPECT_BLOCK },
{ "name": "Wildcard port should not be subsumed by a spcified port.",
"expected": IframeLoad.EXPECT_BLOCK },
];
tests.forEach(test => {
async_test(t => {
var url = generateUrlWithPolicies(Host.CROSS_ORIGIN, test.returned_csp);
assert_iframe_with_csp(t, url, test.required_csp, test.expected, test.name, null);
}, test.name);
});
</script>
</body>
</html>