gecko/content/html/document/test/bug196523-subframe.html
2008-08-29 20:36:46 -04:00

38 lines
1022 B
HTML

<!DOCTYPE html>
<script>
function checkDomain(str, msg) {
window.parent.postMessage((str == document.domain) + ";" +msg,
"http://localhost:8888/");
}
function reportException(msg) {
window.parent.postMessage(false + ";" + msg, "http://localhost:8888/");
}
var win1;
try {
win1 = window.open("", "", "width=100,height=100");
var otherDomain1 = win1.document.domain;
win1.close();
checkDomain(otherDomain1, "Opened document should have our domain");
} catch(e) {
reportException("Exception getting document.domain: " + e);
} finally {
win1.close();
}
document.domain = "example.org";
var win2;
try {
win2 = window.open("", "", "width=100,height=100");
var otherDomain2 = win2.document.domain;
checkDomain(otherDomain2, "Opened document should have our domain");
win2.close();
} catch(e) {
reportException("Exception getting document.domain after domain set: " + e);
} finally {
win2.close();
}
</script>