blob: dc3f54db48b919040cf2f994d1b150c890a75178 [file] [log] [blame]
<head>
<script>
if (window.testRunner && window.internals) {
testRunner.dumpAsText();
testRunner.dumpChildFramesAsText();
internals.settings.setHyperlinkAuditingEnabled(true);
testRunner.waitUntilDone();
}
function loadLinkWithPing() {
var iframe = document.getElementById("link_frame");
var iframeDoc = iframe.contentDocument || iframe.contentWindow.document;
iframeDoc.write('' +
'<img src="resources/delete-ping.php?test=contentextensions-block-ping" ' +
'onerror="parent.clickOnLinkWithPing();">' +
'<a id="a" ' +
'href="resources/check-ping.html" ' + // check-ping.html calls showPingResult()
'ping="resources/save-ping.php?test=contentextensions-block-ping"> ' +
'Link with ping' +
'</a>'
);
}
function clickOnLinkWithPing() {
var iframe = document.getElementById("link_frame");
var iframeDoc = iframe.contentDocument;
if (window.eventSender) {
var a = iframeDoc.getElementById("a");
var x = iframe.offsetLeft + a.offsetLeft + 2;
var y = iframe.offsetTop + a.offsetTop + 2;
eventSender.mouseMoveTo(x, y);
eventSender.mouseDown();
eventSender.mouseUp();
}
}
function showPingResult() {
var iframe = document.getElementById("result_frame");
iframe.onload = function() {
if (window.testRunner) { testRunner.notifyDone(); }
}
iframe.src = "resources/get-ping-data.php?test=contentextensions-block-ping&timeout_ms=1000";
// Why timeout_ms=1000:
// To pass the test, the ping shouldn't arrive, so we need to
// timeout at some point. We don't have to wait too long because
// the console message can tell us whether the ping was blocked.
}
</script>
</head>
<body onload="loadLinkWithPing();">
This test follows a link with a ping attribute where the ping URL matches a 'block' rule.
<iframe id="link_frame" name="link_frame"><!-- Will contain link with ping --></iframe>
<iframe id="result_frame" name="result_frame"><!-- Will contain ping data received by server --></iframe>
</body>