2010-08-27 08:49:10 -07:00
|
|
|
<!DOCTYPE HTML>
|
|
|
|
<html>
|
|
|
|
<!--
|
|
|
|
https://bugzilla.mozilla.org/show_bug.cgi?id=36619
|
|
|
|
-->
|
|
|
|
<head>
|
|
|
|
<title>Test for Bug 36619</title>
|
|
|
|
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
|
|
|
<script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
|
|
|
|
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
|
|
|
</head>
|
2010-08-31 23:09:28 -07:00
|
|
|
<body>
|
2010-08-27 08:49:10 -07:00
|
|
|
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=36619">Mozilla Bug 36619</a>
|
|
|
|
<p id="display"></p>
|
2010-08-31 23:09:28 -07:00
|
|
|
<div id="content" style="display:none;">
|
2010-08-27 08:49:10 -07:00
|
|
|
<input id='a' type='file'>
|
|
|
|
</div>
|
2010-08-31 23:09:28 -07:00
|
|
|
<button id='b' onclick="document.getElementById('a').click();">Show Filepicker</button>
|
2011-12-21 09:03:52 -08:00
|
|
|
<button id='c' onmousedown="document.getElementById('a').click();">Show Filepicker</button>
|
|
|
|
<button id='d' onmouseup="document.getElementById('a').click();">Show Filepicker</button>
|
2010-08-27 08:49:10 -07:00
|
|
|
<pre id="test">
|
|
|
|
<script type="application/javascript">
|
|
|
|
|
|
|
|
/** Test for Bug 36619 **/
|
|
|
|
|
|
|
|
SimpleTest.waitForExplicitFinish();
|
|
|
|
|
2011-10-21 16:39:30 -07:00
|
|
|
var MockFilePicker = SpecialPowers.MockFilePicker;
|
2011-12-22 14:10:52 -08:00
|
|
|
MockFilePicker.init();
|
2010-08-27 08:49:10 -07:00
|
|
|
|
|
|
|
// enable popups the first time
|
2011-10-21 16:39:30 -07:00
|
|
|
SpecialPowers.pushPrefEnv({'set': [
|
|
|
|
["dom.disable_open_during_load", true],
|
|
|
|
["privacy.popups.showBrowserMessage", false]
|
|
|
|
]}, function() {
|
|
|
|
SimpleTest.waitForFocus(function() {
|
|
|
|
|
|
|
|
// Tests that a click on 'b' calls the show method.
|
|
|
|
var b = document.getElementById('b');
|
|
|
|
b.focus(); // Be sure the element is visible.
|
2011-12-21 09:03:52 -08:00
|
|
|
synthesizeMouseAtCenter(b, {});
|
2011-10-21 16:39:30 -07:00
|
|
|
SimpleTest.executeSoon(function() {
|
2012-08-17 08:35:01 -07:00
|
|
|
ok(MockFilePicker.showing,
|
|
|
|
"File picker showAsync method should have been called");
|
2011-10-21 16:39:30 -07:00
|
|
|
MockFilePicker.reset();
|
|
|
|
|
|
|
|
// Tests that a click on 'a' doesn't call the show method, because it is hidden.
|
|
|
|
document.getElementById("a").click();
|
|
|
|
SimpleTest.executeSoon(function() {
|
2012-08-17 08:35:01 -07:00
|
|
|
ok(!MockFilePicker.showing,
|
|
|
|
"File picker showAsync method should not have been called");
|
2011-12-21 09:03:52 -08:00
|
|
|
MockFilePicker.reset();
|
2011-10-21 16:39:30 -07:00
|
|
|
|
2011-12-21 09:03:52 -08:00
|
|
|
synthesizeMouseAtCenter(document.getElementById('c'), {});
|
|
|
|
SimpleTest.executeSoon(function() {
|
2012-08-17 08:35:01 -07:00
|
|
|
ok(!MockFilePicker.showing,
|
|
|
|
"File picker showAsync method should have been called");
|
2011-12-21 09:03:52 -08:00
|
|
|
MockFilePicker.reset();
|
|
|
|
|
|
|
|
synthesizeMouseAtCenter(document.getElementById('d'), {});
|
|
|
|
SimpleTest.executeSoon(function() {
|
2012-08-17 08:35:01 -07:00
|
|
|
ok(MockFilePicker.showing,
|
|
|
|
"File picker showAsync method should have been called");
|
2011-12-21 09:03:52 -08:00
|
|
|
|
|
|
|
MockFilePicker.cleanup();
|
|
|
|
SimpleTest.finish();
|
|
|
|
});
|
|
|
|
});
|
2011-10-21 16:39:30 -07:00
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
2010-08-31 23:09:28 -07:00
|
|
|
});
|
2010-08-27 08:49:10 -07:00
|
|
|
|
|
|
|
</script>
|
|
|
|
</pre>
|
|
|
|
</body>
|
|
|
|
</html>
|