blob: d1eec31b52955b0850c67b2f26fe036fd1388db3 [file] [log] [blame]
<!DOCTYPE html>
<meta charset="utf-8"/>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/websockets/cookies/support/websocket-cookies-helper.sub.js"></script>
<iframe id="iframe" src=""></iframe>
<script>
if (window.testRunner) {
// Block third-party cookies.
testRunner.setBlockThirdPartyCookies(true);
}
async_test(t => {
window.addEventListener(
'message',
t.step_func_done(event => {
assert_equals(event.data, 'DONE: (none)');
}),
false);
// The iframe is same-origin as the websocket and cross-origin from the main frame.
// The main frame is cross-origin from the websocket.
var url = document.location.href.replace(HTTPS_ORIGIN, HTTPS_CROSS_SITE_ORIGIN)
.replace('third-party-cookie-blocked-on-same-origin-websocket.https.html', '') +
'resources/set-cookie.https.html?remote';
document.getElementById('iframe').setAttribute('src', url);
}, 'Test that third-party cookies are blocked for WebSockets even when the ' +
'WebSocket\'s URL\'s domain is an exact match for the domain of its ' +
'initiator.');
</script>