gecko/dom/tests/mochitest/general/test_browserFrame7.html

49 lines
1.4 KiB
HTML

<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=725796
-->
<head>
<title>Test for Bug 725796</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="browserFrameHelpers.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=725796">Mozilla Bug 725796</a>
<!--
Test that an <iframe mozbrowser> is a window.{top,parent,frameElement} barrier.
If <iframe mozbrowser> is changed to run in a separate process, this test
will not work.
-->
<script type="application/javascript;version=1.7">
"use strict";
browserFrameHelpers.setEnabledPref(true);
browserFrameHelpers.addToWhitelist();
var iframe = document.createElement('iframe');
iframe.mozbrowser = true;
document.body.appendChild(iframe);
var innerIframe = document.createElement('iframe');
iframe.contentDocument.body.appendChild(innerIframe);
var iframeCw = iframe.contentWindow;
var innerCw = innerIframe.contentWindow;
is(iframeCw.top, iframeCw, 'iframe top');
is(iframeCw.parent, iframeCw, 'iframe parent');
is(iframeCw.frameElement, null, 'iframe frameElement');
is(innerCw.top, iframeCw, 'inner iframe top');
is(innerCw.parent, iframeCw, 'inner iframe parent');
is(innerCw.frameElement, innerIframe, 'inner iframe frameElement');
</script>
</body>
</html>