2007-07-12 16:06:05 +04:00
|
|
|
<!DOCTYPE HTML>
|
|
|
|
<html>
|
|
|
|
<!--
|
|
|
|
https://bugzilla.mozilla.org/show_bug.cgi?id=386496
|
|
|
|
-->
|
|
|
|
<head>
|
|
|
|
<title>Test for Bug 386496</title>
|
2019-04-16 06:53:28 +03:00
|
|
|
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
2011-04-29 16:23:23 +04:00
|
|
|
<SCRIPT Type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
|
2007-07-12 16:06:05 +04:00
|
|
|
<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=386496">Mozilla Bug 386496</a>
|
|
|
|
<p id="display"></p>
|
|
|
|
<div id="content">
|
2011-04-29 16:23:23 +04:00
|
|
|
<iframe style='display: block;' id="testIframe"
|
2017-05-04 07:10:12 +03:00
|
|
|
srcdoc="<div><a id='a' href='http://a.invalid/'>Link</a></div>">
|
2011-04-29 16:23:23 +04:00
|
|
|
</iframe>
|
2007-07-12 16:06:05 +04:00
|
|
|
</div>
|
|
|
|
<pre id="test">
|
|
|
|
<script class="testbody" type="text/javascript">
|
|
|
|
|
|
|
|
/** Test for Bug 386496 **/
|
|
|
|
|
|
|
|
var frame = document.getElementById("testIframe");
|
|
|
|
|
|
|
|
function testDesignMode() {
|
2011-04-29 16:23:23 +04:00
|
|
|
var unloadRequested = false;
|
2007-07-12 16:06:05 +04:00
|
|
|
|
|
|
|
frame.contentDocument.designMode = "on";
|
|
|
|
|
2011-04-29 16:23:23 +04:00
|
|
|
frame.contentWindow.addEventListener("beforeunload", function() {
|
|
|
|
unloadRequested = true;
|
2017-01-17 13:50:25 +03:00
|
|
|
});
|
2011-04-29 16:23:23 +04:00
|
|
|
|
|
|
|
synthesizeMouseAtCenter(frame.contentDocument.getElementById("a"), {},
|
|
|
|
frame.contentWindow);
|
2007-07-12 16:06:05 +04:00
|
|
|
|
2011-04-29 16:23:23 +04:00
|
|
|
// The click has been sent. If 'beforeunload' event has been caught when we go
|
|
|
|
// back from the event loop that means the link has been activated.
|
|
|
|
setTimeout(function() {
|
|
|
|
ok(!unloadRequested, "The link should not be activated in designMode");
|
|
|
|
SimpleTest.finish();
|
|
|
|
}, 0);
|
2007-07-12 16:06:05 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
SimpleTest.waitForExplicitFinish();
|
2011-04-29 16:23:23 +04:00
|
|
|
SimpleTest.waitForFocus(testDesignMode);
|
2007-07-12 16:06:05 +04:00
|
|
|
|
|
|
|
</script>
|
|
|
|
</pre>
|
|
|
|
</body>
|
|
|
|
</html>
|