blob: 63985e74ed0099f340c7c0e3692cc024c14f0012 [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<title>Same-origin different-ports test</title>
</head>
<body>
<iframe src="http://127.0.0.1:8080/security/resources/agent-equality-report-to-parent.html">
</iframe>
<script>
// This file should be loaded as an iframe hosted on 127.0.0.1:8000.
// This test creates the following frame tree:
//
// A: 127.0.0.1:8000 (this file)
// |
// +-- B: 127.0.0.1:8080
//
// This page posts a message to the parent window, containing two strings
// which correspond to the agent IDs of A and B, respectively.
//
// Success condition: A's agent is the same as B's.
function onMessage(evt) {
let agentIdB = evt.data;
let message = [
'same-origin different-ports test',
internals.getAgentId(window),
agentIdB
];
window.parent.postMessage(message, '*');
}
window.addEventListener('message', onMessage, {'once': true});
</script>
</body>
</html>