Commit 90afaa85 authored by Yutaka Hirano's avatar Yutaka Hirano Committed by Commit Bot

[Beacon API] Port beacon-cross-origin.https.html to wpt

Despite its name, the test checks the mixed content check for sendBeacon.
This CL moves it to wpt/mixed-content.

Bug: 821294
Change-Id: Ifd264dae0fec5c4d821d61d37d61f4ebbc763516
Reviewed-on: https://chromium-review.googlesource.com/959982Reviewed-by: default avatarMike West <mkwst@chromium.org>
Commit-Queue: Yutaka Hirano <yhirano@chromium.org>
Cr-Commit-Position: refs/heads/master@{#543105}
parent 73616f4e
<!DOCTYPE html>
<!-- DO NOT EDIT! Generated by mixed-content/generic/tools/generate.py using mixed-content/generic/template/test.release.html.template. -->
<html>
<head>
<title>Mixed-Content: Blockable content</title>
<meta charset='utf-8'>
<meta name="description" content="Test behavior of blockable content.">
<link rel="author" title="Kristijan Burnik" href="burnik@chromium.org">
<link rel="help" href="http://www.w3.org/TR/mixed-content/#category-blockable">
<meta name="assert" content="opt_in_method: http-csp
origin: cross-origin-http
source_scheme: https
context_nesting: top-level
redirection: keep-scheme-redirect
subresource: beacon-request
expectation: blocked">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/mixed-content/generic/common.js"></script>
<script src="/mixed-content/generic/mixed-content-test-case.js?pipe=sub"></script>
</head>
<body>
<script>
MixedContentTestCase(
{
"opt_in_method": "http-csp",
"origin": "cross-origin-http",
"source_scheme": "https",
"context_nesting": "top-level",
"redirection": "keep-scheme-redirect",
"subresource": "beacon-request",
"expectation": "blocked"
},
document.querySelector("meta[name=assert]").content,
new SanityChecker()
).start();
</script>
<div id="log"></div>
</body>
</html>
<!DOCTYPE html>
<!-- DO NOT EDIT! Generated by mixed-content/generic/tools/generate.py using mixed-content/generic/template/test.release.html.template. -->
<html>
<head>
<title>Mixed-Content: Blockable content</title>
<meta charset='utf-8'>
<meta name="description" content="Test behavior of blockable content.">
<link rel="author" title="Kristijan Burnik" href="burnik@chromium.org">
<link rel="help" href="http://www.w3.org/TR/mixed-content/#category-blockable">
<meta name="assert" content="opt_in_method: http-csp
origin: cross-origin-http
source_scheme: https
context_nesting: top-level
redirection: no-redirect
subresource: beacon-request
expectation: blocked">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/mixed-content/generic/common.js"></script>
<script src="/mixed-content/generic/mixed-content-test-case.js?pipe=sub"></script>
</head>
<body>
<script>
MixedContentTestCase(
{
"opt_in_method": "http-csp",
"origin": "cross-origin-http",
"source_scheme": "https",
"context_nesting": "top-level",
"redirection": "no-redirect",
"subresource": "beacon-request",
"expectation": "blocked"
},
document.querySelector("meta[name=assert]").content,
new SanityChecker()
).start();
</script>
<div id="log"></div>
</body>
</html>
<!DOCTYPE html>
<!-- DO NOT EDIT! Generated by mixed-content/generic/tools/generate.py using mixed-content/generic/template/test.release.html.template. -->
<html>
<head>
<title>Mixed-Content: Blockable content</title>
<meta charset='utf-8'>
<meta name="description" content="Test behavior of blockable content.">
<link rel="author" title="Kristijan Burnik" href="burnik@chromium.org">
<link rel="help" href="http://www.w3.org/TR/mixed-content/#category-blockable">
<meta name="assert" content="opt_in_method: http-csp
origin: cross-origin-http
source_scheme: https
context_nesting: top-level
redirection: swap-scheme-redirect
subresource: beacon-request
expectation: blocked">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/mixed-content/generic/common.js"></script>
<script src="/mixed-content/generic/mixed-content-test-case.js?pipe=sub"></script>
</head>
<body>
<script>
MixedContentTestCase(
{
"opt_in_method": "http-csp",
"origin": "cross-origin-http",
"source_scheme": "https",
"context_nesting": "top-level",
"redirection": "swap-scheme-redirect",
"subresource": "beacon-request",
"expectation": "blocked"
},
document.querySelector("meta[name=assert]").content,
new SanityChecker()
).start();
</script>
<div id="log"></div>
</body>
</html>
<!DOCTYPE html>
<!-- DO NOT EDIT! Generated by mixed-content/generic/tools/generate.py using mixed-content/generic/template/test.release.html.template. -->
<html>
<head>
<title>Mixed-Content: Blockable content</title>
<meta charset='utf-8'>
<meta name="description" content="Test behavior of blockable content.">
<link rel="author" title="Kristijan Burnik" href="burnik@chromium.org">
<link rel="help" href="http://www.w3.org/TR/mixed-content/#category-blockable">
<meta name="assert" content="opt_in_method: http-csp
origin: same-host-http
source_scheme: https
context_nesting: top-level
redirection: keep-scheme-redirect
subresource: beacon-request
expectation: blocked">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/mixed-content/generic/common.js"></script>
<script src="/mixed-content/generic/mixed-content-test-case.js?pipe=sub"></script>
</head>
<body>
<script>
MixedContentTestCase(
{
"opt_in_method": "http-csp",
"origin": "same-host-http",
"source_scheme": "https",
"context_nesting": "top-level",
"redirection": "keep-scheme-redirect",
"subresource": "beacon-request",
"expectation": "blocked"
},
document.querySelector("meta[name=assert]").content,
new SanityChecker()
).start();
</script>
<div id="log"></div>
</body>
</html>
<!DOCTYPE html>
<!-- DO NOT EDIT! Generated by mixed-content/generic/tools/generate.py using mixed-content/generic/template/test.release.html.template. -->
<html>
<head>
<title>Mixed-Content: Blockable content</title>
<meta charset='utf-8'>
<meta name="description" content="Test behavior of blockable content.">
<link rel="author" title="Kristijan Burnik" href="burnik@chromium.org">
<link rel="help" href="http://www.w3.org/TR/mixed-content/#category-blockable">
<meta name="assert" content="opt_in_method: http-csp
origin: same-host-http
source_scheme: https
context_nesting: top-level
redirection: no-redirect
subresource: beacon-request
expectation: blocked">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/mixed-content/generic/common.js"></script>
<script src="/mixed-content/generic/mixed-content-test-case.js?pipe=sub"></script>
</head>
<body>
<script>
MixedContentTestCase(
{
"opt_in_method": "http-csp",
"origin": "same-host-http",
"source_scheme": "https",
"context_nesting": "top-level",
"redirection": "no-redirect",
"subresource": "beacon-request",
"expectation": "blocked"
},
document.querySelector("meta[name=assert]").content,
new SanityChecker()
).start();
</script>
<div id="log"></div>
</body>
</html>
<!DOCTYPE html>
<!-- DO NOT EDIT! Generated by mixed-content/generic/tools/generate.py using mixed-content/generic/template/test.release.html.template. -->
<html>
<head>
<title>Mixed-Content: Blockable content</title>
<meta charset='utf-8'>
<meta name="description" content="Test behavior of blockable content.">
<link rel="author" title="Kristijan Burnik" href="burnik@chromium.org">
<link rel="help" href="http://www.w3.org/TR/mixed-content/#category-blockable">
<meta name="assert" content="opt_in_method: http-csp
origin: same-host-http
source_scheme: https
context_nesting: top-level
redirection: swap-scheme-redirect
subresource: beacon-request
expectation: blocked">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/mixed-content/generic/common.js"></script>
<script src="/mixed-content/generic/mixed-content-test-case.js?pipe=sub"></script>
</head>
<body>
<script>
MixedContentTestCase(
{
"opt_in_method": "http-csp",
"origin": "same-host-http",
"source_scheme": "https",
"context_nesting": "top-level",
"redirection": "swap-scheme-redirect",
"subresource": "beacon-request",
"expectation": "blocked"
},
document.querySelector("meta[name=assert]").content,
new SanityChecker()
).start();
</script>
<div id="log"></div>
</body>
</html>
<!DOCTYPE html>
<!-- DO NOT EDIT! Generated by mixed-content/generic/tools/generate.py using mixed-content/generic/template/test.release.html.template. -->
<html>
<head>
<title>Mixed-Content: Allowed content</title>
<meta charset='utf-8'>
<meta name="description" content="Test behavior of allowed content.">
<link rel="author" title="Kristijan Burnik" href="burnik@chromium.org">
<link rel="help" href="http://www.w3.org/TR/mixed-content/">
<meta name="assert" content="opt_in_method: http-csp
origin: same-host-https
source_scheme: https
context_nesting: top-level
redirection: keep-scheme-redirect
subresource: beacon-request
expectation: allowed">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/mixed-content/generic/common.js"></script>
<script src="/mixed-content/generic/mixed-content-test-case.js?pipe=sub"></script>
</head>
<body>
<script>
MixedContentTestCase(
{
"opt_in_method": "http-csp",
"origin": "same-host-https",
"source_scheme": "https",
"context_nesting": "top-level",
"redirection": "keep-scheme-redirect",
"subresource": "beacon-request",
"expectation": "allowed"
},
document.querySelector("meta[name=assert]").content,
new SanityChecker()
).start();
</script>
<div id="log"></div>
</body>
</html>
<!DOCTYPE html>
<!-- DO NOT EDIT! Generated by mixed-content/generic/tools/generate.py using mixed-content/generic/template/test.release.html.template. -->
<html>
<head>
<title>Mixed-Content: Allowed content</title>
<meta charset='utf-8'>
<meta name="description" content="Test behavior of allowed content.">
<link rel="author" title="Kristijan Burnik" href="burnik@chromium.org">
<link rel="help" href="http://www.w3.org/TR/mixed-content/">
<meta name="assert" content="opt_in_method: http-csp
origin: same-host-https
source_scheme: https
context_nesting: top-level
redirection: no-redirect
subresource: beacon-request
expectation: allowed">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/mixed-content/generic/common.js"></script>
<script src="/mixed-content/generic/mixed-content-test-case.js?pipe=sub"></script>
</head>
<body>
<script>
MixedContentTestCase(
{
"opt_in_method": "http-csp",
"origin": "same-host-https",
"source_scheme": "https",
"context_nesting": "top-level",
"redirection": "no-redirect",
"subresource": "beacon-request",
"expectation": "allowed"
},
document.querySelector("meta[name=assert]").content,
new SanityChecker()
).start();
</script>
<div id="log"></div>
</body>
</html>
<!DOCTYPE html>
<!-- DO NOT EDIT! Generated by mixed-content/generic/tools/generate.py using mixed-content/generic/template/test.release.html.template. -->
<html>
<head>
<title>Mixed-Content: Blockable content</title>
<meta charset='utf-8'>
<meta name="description" content="Test behavior of blockable content.">
<link rel="author" title="Kristijan Burnik" href="burnik@chromium.org">
<link rel="help" href="http://www.w3.org/TR/mixed-content/#category-blockable">
<meta name="assert" content="opt_in_method: meta-csp
origin: cross-origin-http
source_scheme: https
context_nesting: top-level
redirection: no-redirect
subresource: beacon-request
expectation: blocked">
<meta http-equiv="Content-Security-Policy" content="block-all-mixed-content">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/mixed-content/generic/common.js"></script>
<script src="/mixed-content/generic/mixed-content-test-case.js?pipe=sub"></script>
</head>
<body>
<script>
MixedContentTestCase(
{
"opt_in_method": "meta-csp",
"origin": "cross-origin-http",
"source_scheme": "https",
"context_nesting": "top-level",
"redirection": "no-redirect",
"subresource": "beacon-request",
"expectation": "blocked"
},
document.querySelector("meta[name=assert]").content,
new SanityChecker()
).start();
</script>
<div id="log"></div>
</body>
</html>
<!DOCTYPE html>
<!-- DO NOT EDIT! Generated by mixed-content/generic/tools/generate.py using mixed-content/generic/template/test.release.html.template. -->
<html>
<head>
<title>Mixed-Content: Blockable content</title>
<meta charset='utf-8'>
<meta name="description" content="Test behavior of blockable content.">
<link rel="author" title="Kristijan Burnik" href="burnik@chromium.org">
<link rel="help" href="http://www.w3.org/TR/mixed-content/#category-blockable">
<meta name="assert" content="opt_in_method: meta-csp
origin: same-host-http
source_scheme: https
context_nesting: top-level
redirection: no-redirect
subresource: beacon-request
expectation: blocked">
<meta http-equiv="Content-Security-Policy" content="block-all-mixed-content">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/mixed-content/generic/common.js"></script>
<script src="/mixed-content/generic/mixed-content-test-case.js?pipe=sub"></script>
</head>
<body>
<script>
MixedContentTestCase(
{
"opt_in_method": "meta-csp",
"origin": "same-host-http",
"source_scheme": "https",
"context_nesting": "top-level",
"redirection": "no-redirect",
"subresource": "beacon-request",
"expectation": "blocked"
},
document.querySelector("meta[name=assert]").content,
new SanityChecker()
).start();
</script>
<div id="log"></div>
</body>
</html>
<!DOCTYPE html>
<!-- DO NOT EDIT! Generated by mixed-content/generic/tools/generate.py using mixed-content/generic/template/test.release.html.template. -->
<html>
<head>
<title>Mixed-Content: Allowed content</title>
<meta charset='utf-8'>
<meta name="description" content="Test behavior of allowed content.">
<link rel="author" title="Kristijan Burnik" href="burnik@chromium.org">
<link rel="help" href="http://www.w3.org/TR/mixed-content/">
<meta name="assert" content="opt_in_method: meta-csp
origin: same-host-https
source_scheme: https
context_nesting: top-level
redirection: no-redirect
subresource: beacon-request
expectation: allowed">
<meta http-equiv="Content-Security-Policy" content="block-all-mixed-content">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/mixed-content/generic/common.js"></script>
<script src="/mixed-content/generic/mixed-content-test-case.js?pipe=sub"></script>
</head>
<body>
<script>
MixedContentTestCase(
{
"opt_in_method": "meta-csp",
"origin": "same-host-https",
"source_scheme": "https",
"context_nesting": "top-level",
"redirection": "no-redirect",
"subresource": "beacon-request",
"expectation": "allowed"
},
document.querySelector("meta[name=assert]").content,
new SanityChecker()
).start();
</script>
<div id="log"></div>
</body>
</html>
<!DOCTYPE html>
<!-- DO NOT EDIT! Generated by mixed-content/generic/tools/generate.py using mixed-content/generic/template/test.release.html.template. -->
<html>
<head>
<title>Mixed-Content: Blockable content</title>
<meta charset='utf-8'>
<meta name="description" content="Test behavior of blockable content.">
<link rel="author" title="Kristijan Burnik" href="burnik@chromium.org">
<link rel="help" href="http://www.w3.org/TR/mixed-content/#category-blockable">
<meta name="assert" content="opt_in_method: no-opt-in
origin: cross-origin-http
source_scheme: https
context_nesting: top-level
redirection: keep-scheme-redirect
subresource: beacon-request
expectation: blocked">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/mixed-content/generic/common.js"></script>
<script src="/mixed-content/generic/mixed-content-test-case.js?pipe=sub"></script>
</head>
<body>
<script>
MixedContentTestCase(
{
"opt_in_method": "no-opt-in",
"origin": "cross-origin-http",
"source_scheme": "https",
"context_nesting": "top-level",
"redirection": "keep-scheme-redirect",
"subresource": "beacon-request",
"expectation": "blocked"
},
document.querySelector("meta[name=assert]").content,
new SanityChecker()
).start();
</script>
<div id="log"></div>
</body>
</html>
<!DOCTYPE html>
<!-- DO NOT EDIT! Generated by mixed-content/generic/tools/generate.py using mixed-content/generic/template/test.release.html.template. -->
<html>
<head>
<title>Mixed-Content: Blockable content</title>
<meta charset='utf-8'>
<meta name="description" content="Test behavior of blockable content.">
<link rel="author" title="Kristijan Burnik" href="burnik@chromium.org">
<link rel="help" href="http://www.w3.org/TR/mixed-content/#category-blockable">
<meta name="assert" content="opt_in_method: no-opt-in
origin: cross-origin-http
source_scheme: https
context_nesting: top-level
redirection: no-redirect
subresource: beacon-request
expectation: blocked">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/mixed-content/generic/common.js"></script>
<script src="/mixed-content/generic/mixed-content-test-case.js?pipe=sub"></script>
</head>
<body>
<script>
MixedContentTestCase(
{
"opt_in_method": "no-opt-in",
"origin": "cross-origin-http",
"source_scheme": "https",
"context_nesting": "top-level",
"redirection": "no-redirect",
"subresource": "beacon-request",
"expectation": "blocked"
},
document.querySelector("meta[name=assert]").content,
new SanityChecker()
).start();
</script>
<div id="log"></div>
</body>
</html>
<!DOCTYPE html>
<!-- DO NOT EDIT! Generated by mixed-content/generic/tools/generate.py using mixed-content/generic/template/test.release.html.template. -->
<html>
<head>
<title>Mixed-Content: Blockable content</title>
<meta charset='utf-8'>
<meta name="description" content="Test behavior of blockable content.">
<link rel="author" title="Kristijan Burnik" href="burnik@chromium.org">
<link rel="help" href="http://www.w3.org/TR/mixed-content/#category-blockable">
<meta name="assert" content="opt_in_method: no-opt-in
origin: cross-origin-http
source_scheme: https
context_nesting: top-level
redirection: swap-scheme-redirect
subresource: beacon-request
expectation: blocked">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/mixed-content/generic/common.js"></script>
<script src="/mixed-content/generic/mixed-content-test-case.js?pipe=sub"></script>
</head>
<body>
<script>
MixedContentTestCase(
{
"opt_in_method": "no-opt-in",
"origin": "cross-origin-http",
"source_scheme": "https",
"context_nesting": "top-level",
"redirection": "swap-scheme-redirect",
"subresource": "beacon-request",
"expectation": "blocked"
},
document.querySelector("meta[name=assert]").content,
new SanityChecker()
).start();
</script>
<div id="log"></div>
</body>
</html>
<!DOCTYPE html>
<!-- DO NOT EDIT! Generated by mixed-content/generic/tools/generate.py using mixed-content/generic/template/test.release.html.template. -->
<html>
<head>
<title>Mixed-Content: Blockable content</title>
<meta charset='utf-8'>
<meta name="description" content="Test behavior of blockable content.">
<link rel="author" title="Kristijan Burnik" href="burnik@chromium.org">
<link rel="help" href="http://www.w3.org/TR/mixed-content/#category-blockable">
<meta name="assert" content="opt_in_method: no-opt-in
origin: same-host-http
source_scheme: https
context_nesting: top-level
redirection: keep-scheme-redirect
subresource: beacon-request
expectation: blocked">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/mixed-content/generic/common.js"></script>
<script src="/mixed-content/generic/mixed-content-test-case.js?pipe=sub"></script>
</head>
<body>
<script>
MixedContentTestCase(
{
"opt_in_method": "no-opt-in",
"origin": "same-host-http",
"source_scheme": "https",
"context_nesting": "top-level",
"redirection": "keep-scheme-redirect",
"subresource": "beacon-request",
"expectation": "blocked"
},
document.querySelector("meta[name=assert]").content,
new SanityChecker()
).start();
</script>
<div id="log"></div>
</body>
</html>
<!DOCTYPE html>
<!-- DO NOT EDIT! Generated by mixed-content/generic/tools/generate.py using mixed-content/generic/template/test.release.html.template. -->
<html>
<head>
<title>Mixed-Content: Blockable content</title>
<meta charset='utf-8'>
<meta name="description" content="Test behavior of blockable content.">
<link rel="author" title="Kristijan Burnik" href="burnik@chromium.org">
<link rel="help" href="http://www.w3.org/TR/mixed-content/#category-blockable">
<meta name="assert" content="opt_in_method: no-opt-in
origin: same-host-http
source_scheme: https
context_nesting: top-level
redirection: no-redirect
subresource: beacon-request
expectation: blocked">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/mixed-content/generic/common.js"></script>
<script src="/mixed-content/generic/mixed-content-test-case.js?pipe=sub"></script>
</head>
<body>
<script>
MixedContentTestCase(
{
"opt_in_method": "no-opt-in",
"origin": "same-host-http",
"source_scheme": "https",
"context_nesting": "top-level",
"redirection": "no-redirect",
"subresource": "beacon-request",
"expectation": "blocked"
},
document.querySelector("meta[name=assert]").content,
new SanityChecker()
).start();
</script>
<div id="log"></div>
</body>
</html>
<!DOCTYPE html>
<!-- DO NOT EDIT! Generated by mixed-content/generic/tools/generate.py using mixed-content/generic/template/test.release.html.template. -->
<html>
<head>
<title>Mixed-Content: Blockable content</title>
<meta charset='utf-8'>
<meta name="description" content="Test behavior of blockable content.">
<link rel="author" title="Kristijan Burnik" href="burnik@chromium.org">
<link rel="help" href="http://www.w3.org/TR/mixed-content/#category-blockable">
<meta name="assert" content="opt_in_method: no-opt-in
origin: same-host-http
source_scheme: https
context_nesting: top-level
redirection: swap-scheme-redirect
subresource: beacon-request
expectation: blocked">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/mixed-content/generic/common.js"></script>
<script src="/mixed-content/generic/mixed-content-test-case.js?pipe=sub"></script>
</head>
<body>
<script>
MixedContentTestCase(
{
"opt_in_method": "no-opt-in",
"origin": "same-host-http",
"source_scheme": "https",
"context_nesting": "top-level",
"redirection": "swap-scheme-redirect",
"subresource": "beacon-request",
"expectation": "blocked"
},
document.querySelector("meta[name=assert]").content,
new SanityChecker()
).start();
</script>
<div id="log"></div>
</body>
</html>
<!DOCTYPE html>
<!-- DO NOT EDIT! Generated by mixed-content/generic/tools/generate.py using mixed-content/generic/template/test.release.html.template. -->
<html>
<head>
<title>Mixed-Content: Allowed content</title>
<meta charset='utf-8'>
<meta name="description" content="Test behavior of allowed content.">
<link rel="author" title="Kristijan Burnik" href="burnik@chromium.org">
<link rel="help" href="http://www.w3.org/TR/mixed-content/">
<meta name="assert" content="opt_in_method: no-opt-in
origin: same-host-https
source_scheme: https
context_nesting: top-level
redirection: keep-scheme-redirect
subresource: beacon-request
expectation: allowed">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/mixed-content/generic/common.js"></script>
<script src="/mixed-content/generic/mixed-content-test-case.js?pipe=sub"></script>
</head>
<body>
<script>
MixedContentTestCase(
{
"opt_in_method": "no-opt-in",
"origin": "same-host-https",
"source_scheme": "https",
"context_nesting": "top-level",
"redirection": "keep-scheme-redirect",
"subresource": "beacon-request",
"expectation": "allowed"
},
document.querySelector("meta[name=assert]").content,
new SanityChecker()
).start();
</script>
<div id="log"></div>
</body>
</html>
<!DOCTYPE html>
<!-- DO NOT EDIT! Generated by mixed-content/generic/tools/generate.py using mixed-content/generic/template/test.release.html.template. -->
<html>
<head>
<title>Mixed-Content: Allowed content</title>
<meta charset='utf-8'>
<meta name="description" content="Test behavior of allowed content.">
<link rel="author" title="Kristijan Burnik" href="burnik@chromium.org">
<link rel="help" href="http://www.w3.org/TR/mixed-content/">
<meta name="assert" content="opt_in_method: no-opt-in
origin: same-host-https
source_scheme: https
context_nesting: top-level
redirection: no-redirect
subresource: beacon-request
expectation: allowed">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/mixed-content/generic/common.js"></script>
<script src="/mixed-content/generic/mixed-content-test-case.js?pipe=sub"></script>
</head>
<body>
<script>
MixedContentTestCase(
{
"opt_in_method": "no-opt-in",
"origin": "same-host-https",
"source_scheme": "https",
"context_nesting": "top-level",
"redirection": "no-redirect",
"subresource": "beacon-request",
"expectation": "allowed"
},
document.querySelector("meta[name=assert]").content,
new SanityChecker()
).start();
</script>
<div id="log"></div>
</body>
</html>
...@@ -304,6 +304,26 @@ function requestViaLinkPrefetch(url) { ...@@ -304,6 +304,26 @@ function requestViaLinkPrefetch(url) {
} }
} }
/**
* Initiates a new beacon request.
* @param {string} url The URL of a resource to prefetch.
* @return {Promise} The promise for success/error events.
*/
async function requestViaSendBeacon(url) {
function wait(ms) {
return new Promise(resolve => step_timeout(resolve, ms));
}
if (!navigator.sendBeacon(url)) {
// If mixed-content check fails, it should return false.
throw new Error('sendBeacon() fails.');
}
// We don't have a means to see the result of sendBeacon() request
// for sure. Let's wait for a while and let the generic test function
// ask the server for the result.
await wait(500);
return 'allowed';
}
/** /**
* Creates a new media element with a child source element, binds loadeddata and * Creates a new media element with a child source element, binds loadeddata and
* error events, sets attributes and appends to document.body. * error events, sets attributes and appends to document.body.
......
...@@ -59,6 +59,7 @@ function MixedContentTestCase(scenario, description, sanityChecker) { ...@@ -59,6 +59,7 @@ function MixedContentTestCase(scenario, description, sanityChecker) {
var resourceMap = { var resourceMap = {
"a-tag": requestViaAnchor, "a-tag": requestViaAnchor,
"area-tag": requestViaArea, "area-tag": requestViaArea,
"beacon-request": requestViaSendBeacon,
"fetch-request": requestViaFetch, "fetch-request": requestViaFetch,
"form-tag": requestViaForm, "form-tag": requestViaForm,
"iframe-tag": requestViaIframe, "iframe-tag": requestViaIframe,
...@@ -81,6 +82,7 @@ function MixedContentTestCase(scenario, description, sanityChecker) { ...@@ -81,6 +82,7 @@ function MixedContentTestCase(scenario, description, sanityChecker) {
var contentType = { var contentType = {
"a-tag": "text/html", "a-tag": "text/html",
"area-tag": "text/html", "area-tag": "text/html",
"beacon-request": "text/plain",
"fetch-request": "application/json", "fetch-request": "application/json",
"form-tag": "text/html", "form-tag": "text/html",
"iframe-tag": "text/html", "iframe-tag": "text/html",
......
...@@ -240,7 +240,8 @@ ...@@ -240,7 +240,8 @@
"object-tag", "object-tag",
"picture-tag", "picture-tag",
"websocket-request", "websocket-request",
"link-prefetch-tag" "link-prefetch-tag",
"beacon-request"
], ],
"optionally-blockable": [ "optionally-blockable": [
"img-tag", "img-tag",
......
var SPEC_JSON = {"test_expansion_schema": {"origin": ["same-host-https", "same-host-http", "cross-origin-https", "cross-origin-http", "same-host-wss", "same-host-ws", "cross-origin-wss", "cross-origin-ws"], "subresource": {"blockable": ["script-tag", "link-css-tag", "xhr-request", "worker-request", "fetch-request", "a-tag", "object-tag", "picture-tag", "websocket-request", "link-prefetch-tag"], "optionally-blockable": ["img-tag", "audio-tag", "video-tag"]}, "context_nesting": ["top-level", "sub-level"], "expectation": ["allowed", "blocked"], "expansion": ["default", "override"], "redirection": ["no-redirect", "keep-scheme-redirect", "swap-scheme-redirect"], "opt_in_method": ["no-opt-in", "http-csp", "meta-csp", "img-crossorigin"], "source_scheme": ["http", "https"]}, "specification": [{"test_expansion": [{"origin": ["cross-origin-http", "same-host-http"], "name": "opt-in-blocks", "redirection": "*", "expectation": "blocked", "expansion": "default", "context_nesting": "top-level", "opt_in_method": ["http-csp", "meta-csp"], "source_scheme": "https", "subresource": {"blockable": [], "optionally-blockable": "*"}}, {"origin": ["cross-origin-http", "same-host-http"], "name": "no-opt-in-allows", "redirection": "*", "expectation": "allowed", "expansion": "default", "context_nesting": "top-level", "opt_in_method": "no-opt-in", "source_scheme": "https", "subresource": {"blockable": [], "optionally-blockable": "*"}}], "description": "Test behavior of optionally-blockable content", "specification_url": "http://www.w3.org/TR/mixed-content/#category-optionally-blockable", "name": "optionally-blockable", "title": "Optionally-blockable content"}, {"test_expansion": [{"origin": ["cross-origin-http", "same-host-http"], "name": "opt-in-blocks", "redirection": "*", "expectation": "blocked", "expansion": "default", "context_nesting": "top-level", "opt_in_method": ["http-csp", "meta-csp"], "source_scheme": "https", "subresource": {"blockable": "*", "optionally-blockable": []}}, {"origin": ["cross-origin-http", "same-host-http"], "name": "no-opt-in-blocks", "redirection": "*", "expectation": "blocked", "expansion": "default", "context_nesting": "top-level", "opt_in_method": "no-opt-in", "source_scheme": "https", "subresource": {"blockable": "*", "optionally-blockable": []}}, {"origin": ["cross-origin-ws", "same-host-ws"], "name": "ws-downgrade-blocks", "redirection": "*", "expectation": "blocked", "expansion": "default", "context_nesting": "top-level", "opt_in_method": ["no-opt-in", "http-csp", "meta-csp"], "source_scheme": "https", "subresource": {"blockable": "websocket-request", "optionally-blockable": []}}], "description": "Test behavior of blockable content.", "specification_url": "http://www.w3.org/TR/mixed-content/#category-blockable", "name": "blockable", "title": "Blockable content"}, {"test_expansion": [{"origin": ["same-host-https"], "name": "allowed", "redirection": ["no-redirect", "keep-scheme-redirect"], "expectation": "allowed", "expansion": "default", "context_nesting": "top-level", "opt_in_method": "*", "source_scheme": "https", "subresource": {"blockable": "*", "optionally-blockable": "*"}}, {"origin": ["same-host-wss"], "name": "websocket-allowed", "redirection": ["no-redirect", "keep-scheme-redirect"], "expectation": "allowed", "expansion": "default", "context_nesting": "top-level", "opt_in_method": "*", "source_scheme": "https", "subresource": {"blockable": "websocket-request", "optionally-blockable": []}}], "description": "Test behavior of allowed content.", "specification_url": "http://www.w3.org/TR/mixed-content/", "name": "allowed", "title": "Allowed content"}], "excluded_tests": [{"origin": "*", "name": "Redundant-subresources", "redirection": "*", "expectation": "*", "expansion": "*", "context_nesting": "*", "opt_in_method": "*", "source_scheme": "*", "subresource": {"blockable": ["a-tag"], "optionally-blockable": []}}, {"origin": ["same-host-https", "same-host-http", "cross-origin-https", "cross-origin-http"], "name": "Skip-origins-not-applicable-to-websockets", "redirection": "*", "expectation": "*", "expansion": "*", "context_nesting": "*", "opt_in_method": "*", "source_scheme": "*", "subresource": {"blockable": ["websocket-request"], "optionally-blockable": []}}, {"origin": "*", "name": "TODO-opt-in-method-img-cross-origin", "redirection": "*", "expectation": "*", "expansion": "*", "context_nesting": "*", "opt_in_method": "img-crossorigin", "source_scheme": "*", "subresource": {"blockable": "*", "optionally-blockable": "*"}}, {"origin": "*", "name": "Skip-redundant-for-opt-in-method", "redirection": ["keep-scheme-redirect", "swap-scheme-redirect"], "expectation": "*", "expansion": "*", "context_nesting": "*", "opt_in_method": ["meta-csp", "img-crossorigin"], "source_scheme": "*", "subresource": {"blockable": "*", "optionally-blockable": "*"}}]}; var SPEC_JSON = {"test_expansion_schema": {"origin": ["same-host-https", "same-host-http", "cross-origin-https", "cross-origin-http", "same-host-wss", "same-host-ws", "cross-origin-wss", "cross-origin-ws"], "subresource": {"blockable": ["script-tag", "link-css-tag", "xhr-request", "worker-request", "fetch-request", "a-tag", "object-tag", "picture-tag", "websocket-request", "link-prefetch-tag", "beacon-request"], "optionally-blockable": ["img-tag", "audio-tag", "video-tag"]}, "context_nesting": ["top-level", "sub-level"], "expectation": ["allowed", "blocked"], "expansion": ["default", "override"], "redirection": ["no-redirect", "keep-scheme-redirect", "swap-scheme-redirect"], "opt_in_method": ["no-opt-in", "http-csp", "meta-csp", "img-crossorigin"], "source_scheme": ["http", "https"]}, "specification": [{"test_expansion": [{"origin": ["cross-origin-http", "same-host-http"], "name": "opt-in-blocks", "redirection": "*", "expectation": "blocked", "expansion": "default", "context_nesting": "top-level", "opt_in_method": ["http-csp", "meta-csp"], "source_scheme": "https", "subresource": {"blockable": [], "optionally-blockable": "*"}}, {"origin": ["cross-origin-http", "same-host-http"], "name": "no-opt-in-allows", "redirection": "*", "expectation": "allowed", "expansion": "default", "context_nesting": "top-level", "opt_in_method": "no-opt-in", "source_scheme": "https", "subresource": {"blockable": [], "optionally-blockable": "*"}}], "description": "Test behavior of optionally-blockable content", "specification_url": "http://www.w3.org/TR/mixed-content/#category-optionally-blockable", "name": "optionally-blockable", "title": "Optionally-blockable content"}, {"test_expansion": [{"origin": ["cross-origin-http", "same-host-http"], "name": "opt-in-blocks", "redirection": "*", "expectation": "blocked", "expansion": "default", "context_nesting": "top-level", "opt_in_method": ["http-csp", "meta-csp"], "source_scheme": "https", "subresource": {"blockable": "*", "optionally-blockable": []}}, {"origin": ["cross-origin-http", "same-host-http"], "name": "no-opt-in-blocks", "redirection": "*", "expectation": "blocked", "expansion": "default", "context_nesting": "top-level", "opt_in_method": "no-opt-in", "source_scheme": "https", "subresource": {"blockable": "*", "optionally-blockable": []}}, {"origin": ["cross-origin-ws", "same-host-ws"], "name": "ws-downgrade-blocks", "redirection": "*", "expectation": "blocked", "expansion": "default", "context_nesting": "top-level", "opt_in_method": ["no-opt-in", "http-csp", "meta-csp"], "source_scheme": "https", "subresource": {"blockable": "websocket-request", "optionally-blockable": []}}], "description": "Test behavior of blockable content.", "specification_url": "http://www.w3.org/TR/mixed-content/#category-blockable", "name": "blockable", "title": "Blockable content"}, {"test_expansion": [{"origin": ["same-host-https"], "name": "allowed", "redirection": ["no-redirect", "keep-scheme-redirect"], "expectation": "allowed", "expansion": "default", "context_nesting": "top-level", "opt_in_method": "*", "source_scheme": "https", "subresource": {"blockable": "*", "optionally-blockable": "*"}}, {"origin": ["same-host-wss"], "name": "websocket-allowed", "redirection": ["no-redirect", "keep-scheme-redirect"], "expectation": "allowed", "expansion": "default", "context_nesting": "top-level", "opt_in_method": "*", "source_scheme": "https", "subresource": {"blockable": "websocket-request", "optionally-blockable": []}}], "description": "Test behavior of allowed content.", "specification_url": "http://www.w3.org/TR/mixed-content/", "name": "allowed", "title": "Allowed content"}], "excluded_tests": [{"origin": "*", "name": "Redundant-subresources", "redirection": "*", "expectation": "*", "expansion": "*", "context_nesting": "*", "opt_in_method": "*", "source_scheme": "*", "subresource": {"blockable": ["a-tag"], "optionally-blockable": []}}, {"origin": ["same-host-https", "same-host-http", "cross-origin-https", "cross-origin-http"], "name": "Skip-origins-not-applicable-to-websockets", "redirection": "*", "expectation": "*", "expansion": "*", "context_nesting": "*", "opt_in_method": "*", "source_scheme": "*", "subresource": {"blockable": ["websocket-request"], "optionally-blockable": []}}, {"origin": "*", "name": "TODO-opt-in-method-img-cross-origin", "redirection": "*", "expectation": "*", "expansion": "*", "context_nesting": "*", "opt_in_method": "img-crossorigin", "source_scheme": "*", "subresource": {"blockable": "*", "optionally-blockable": "*"}}, {"origin": "*", "name": "Skip-redundant-for-opt-in-method", "redirection": ["keep-scheme-redirect", "swap-scheme-redirect"], "expectation": "*", "expansion": "*", "context_nesting": "*", "opt_in_method": ["meta-csp", "img-crossorigin"], "source_scheme": "*", "subresource": {"blockable": "*", "optionally-blockable": "*"}}]};
CONSOLE ERROR: line 1: Mixed Content: The page at 'https://127.0.0.1:8443/sendbeacon/beacon-cross-origin.https.html' was loaded over HTTPS, but requested an insecure Beacon endpoint 'http://example.test:8000/sendbeacon/resources/save-beacon.php?name=cross-origin'. This request has been blocked; the content must be served over HTTPS.
Verify navigator.sendBeacon() mixed content checking.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS navigator.sendBeacon("http://example.test:8000/sendbeacon/resources/save-beacon.php?name=cross-origin", "CrossOrigin"); is false
PASS successfullyParsed is true
TEST COMPLETE
<!DOCTYPE HTML>
<html>
<head>
<script src="/js-test-resources/js-test.js"></script>
<script>
description("Verify navigator.sendBeacon() mixed content checking.");
window.jsTestIsAsync = true;
function test() {
if (window.testRunner) {
testRunner.dumpAsText();
testRunner.waitUntilDone();
}
shouldBeFalse('navigator.sendBeacon("http://example.test:8000/sendbeacon/resources/save-beacon.php?name=cross-origin", "CrossOrigin");');
finishJSTest();
}
</script>
</head>
<body onload="test();">
</body>
</html>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment