blob: 893a6398239c17da5565983f86a9a0a5e7baf3e8 [file] [log] [blame]
<html>
<head><title>Click nocontent link</title>
<script>
function simulateClick(target) {
var evt = document.createEvent("MouseEvents");
evt.initMouseEvent("click", true, true, window,
0, 0, 0, 0, 0, false, false,
false, false, 0, null);
return target.dispatchEvent(evt);
}
function clickNoContentTargetedLink() {
return simulateClick(document.getElementById("nocontent_targeted_link"));
}
function clickNoContentScriptedTargetedLink() {
return simulateClick(document.getElementById(
"nocontent_scripted_targeted_link"));
}
function getNewWindowReference() {
// Grab a reference to the existing foo window, but don't otherwise access
// it in any way.
var w = window.open("", "foo");
// w is intentionally unused after this point to avoid triggering a call to
// DidAccessInitialDocument().
// Modify the title to give the test a notification to listen for. Use a
// timeout so that any DidAccessInitialDocument() notification arrives
// first. Note that this intentionally uses |window| instead of |w| to avoid
// test boilerplate from triggering calls to DidAccessInitialDocument().
setTimeout(function() { window.document.title = "Modified Title"; });
}
function modifyNewWindow() {
// Grab a reference to the existing foo window and modify its content.
var w = window.open("", "foo");
w.document.body.innerHTML += "Modified";
// Modify the title to give the test a notification to listen for. Use a
// timeout so that any DidAccessInitialDocument() notification arrives
// first. Note that this intentionally uses |window| instead of |w| to avoid
// test boilerplate from triggering calls to DidAccessInitialDocument().
setTimeout(function() { window.document.title = "Modified Title"; });
}
function modifyNewWindowWithDocumentOpen() {
// Grab a reference to the existing foo window and modify its content.
var w = window.open("", "foo");
w.document.open();
w.document.write("Modified");
w.document.close();
// Modify the title to give the test a notification to listen for. Use a
// timeout so that any DidAccessInitialDocument() notification arrives
// first. Note that this intentionally uses |window| instead of |w| to avoid
// test boilerplate from triggering calls to DidAccessInitialDocument().
setTimeout(function() { window.document.title = "Modified Title"; });
}
</script>
</head>
<a href="/nocontent" id="nocontent_targeted_link" target="foo">
/nocontent target=foo</a><br>
<button onclick="modifyNewWindow()">Modify New Window</button><br>
<a href="/nocontent" id="nocontent_scripted_targeted_link" target="foo"
onclick="modifyNewWindow()">
/nocontent scripted target=foo</a><br>
</html>