Source code
Revision control
Copy as Markdown
Other Tools
<!DOCTYPE html>
<title>child frame with delayed onload event</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="utils.js"></script>
<body>
</body>
<script>
(function () {
const [element_type, toplevel_loaded_key, result_key] = parseKeylist();
// Delays the onload event of the iframe for 2 sec.
if (element_type == "iframe") {
const img = document.createElement("img");
img.src = "/common/square.png?pipe=trickle(d2)";
document.body.appendChild(img);
return;
}
const iframe = document.createElement('iframe');
iframe.src = generateURL("ignore-child-fenced-frame-onload-event-inner." +
"html", ["iframe"]);
document.body.append(iframe);
let iframe_loaded = false;
let result = "passed";
window.onload = async function () {
const toplevel_loaded = await readValueFromServer(toplevel_loaded_key);
if (!toplevel_loaded.status || !iframe_loaded)
result = "failed";
writeValueToServer(result_key, result);
}
iframe.onload = function () {
iframe_loaded = true;
}
})();
</script>
</html>