blob: 11e1a7d40a87aaf172823deaaa2c6d7ad39ff8f1 [file] [log] [blame]
(async function(testRunner) {
const {page, session, dp} = await testRunner.startBlank(
`Verifies that making cross origin requests which set SameSite=Lax cookies send us Network.ResponseReceivedExtraInfo events with corresponding blocked set-cookies.\n`);
await dp.Network.enable();
const thirdPartyUrl = 'https://thirdparty.test:8443/inspector-protocol/network/resources/hello-world.html';
const setCookieUrl = 'https://cookie.test:8443/inspector-protocol/network/resources/set-cookie.php?cookie='
+ encodeURIComponent('name=value; SameSite=Lax');
const helper = (await testRunner.loadScript('resources/extra-info-helper.js'))(dp, session);
// make a cross origin request to set the cookie, see that it gets blocked
await helper.navigateWithExtraInfo(thirdPartyUrl);
var {responseExtraInfo} = await helper.fetchWithExtraInfo(setCookieUrl);
testRunner.log(responseExtraInfo.params.blockedCookies, 'Javascript initiated subresource blocked set-cookies:');
// make a cross origin navigation via javascript to set the cookie, see that it is not blocked
await helper.navigateWithExtraInfo(thirdPartyUrl);
var {responseExtraInfo} = await helper.jsNavigateWithExtraInfo(setCookieUrl);
testRunner.log(responseExtraInfo.params.blockedCookies, 'Javascript initiated navigation blocked set-cookies:');
// make a cross origin navigation via browser to set the cookie, see that it is not blocked
await helper.navigateWithExtraInfo(thirdPartyUrl);
var {responseExtraInfo} = await helper.navigateWithExtraInfo(setCookieUrl);
testRunner.log(responseExtraInfo.params.blockedCookies, 'Browser initiated navigation blocked set-cookies');
testRunner.completeTest();
})