gecko/browser/base/content/test/test_bug787619.html

47 lines
1.5 KiB
HTML
Raw Normal View History

<html>
<head>
<title>Test for Bug 787619</title>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
<script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
<script type="application/javascript;version=1.7" src="head.js"></script>
<script>
SpecialPowers.setBoolPref('plugins.click_to_play', true);
</script>
</head>
<body>
<a id="wrapper">
<embed id="plugin" style="width: 200px; height: 200px" type="application/x-test">
</a>
<script class="testbody" type="application/javascript;version=1.7">
SimpleTest.waitForExplicitFinish();
const Ci = Components.interfaces;
let wrapperClickCount = 0;
function test1() {
let plugin = document.getElementById('plugin');
ok(plugin, 'got plugin element');
let objLC = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
ok(!objLC.activated, 'plugin should not be activated');
synthesizeMouseAtCenter(plugin, {});
waitForCondition(function() objLC.activated, test2,
'waited too long for plugin to activate');
}
function test2() {
is(wrapperClickCount, 0, 'wrapper should not have received any clicks');
SpecialPowers.clearUserPref('plugins.click_to_play');
SimpleTest.finish();
}
let wrapper = document.getElementById('wrapper');
wrapper.addEventListener('click', function() ++wrapperClickCount, false);
SimpleTest.waitForFocus(test1);
</script>
</body>
</html>