Source code

Revision control

Copy as Markdown

Other Tools

<?xml version="1.0"?>
<!-- Any copyright is dedicated to the Public Domain.
<window title="Test mozFrameType attribute"
onload="runTests();">
<html:iframe id="normalFrame"/>
<html:iframe id="typeContentFrame" mozframetype="content"/>
<script type="application/javascript"><![CDATA[
function runTests() {
let opener = window.arguments[0];
let SimpleTest = opener.SimpleTest;
function getDocShellType(frame) {
return frame.contentWindow.docShell.itemType;
}
var normalFrame = document.getElementById("normalFrame");
var typeContentFrame = document.getElementById("typeContentFrame");
SimpleTest.is(getDocShellType(normalFrame), Ci.nsIDocShellTreeItem.typeChrome,
"normal iframe in chrome document is typeChrome");
SimpleTest.is(getDocShellType(typeContentFrame), Ci.nsIDocShellTreeItem.typeContent,
"iframe with mozFrameType='content' in chrome document is typeContent");
SimpleTest.executeSoon(function () {
// First focus the parent window and then close this one.
SimpleTest.waitForFocus(function() {
let ww = SpecialPowers.Services.ww;
ww.registerNotification(function windowObs(subject, topic) {
if (topic == "domwindowclosed") {
ww.unregisterNotification(windowObs);
// Don't start the next test synchronously!
SimpleTest.executeSoon(function() {
SimpleTest.finish();
});
}
});
window.close();
}, opener);
});
}
]]></script>
</window>