mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
74 lines
2.4 KiB
HTML
74 lines
2.4 KiB
HTML
<!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>
|
|
<body>
|
|
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=36619">Mozilla Bug 36619</a>
|
|
<p id="display"></p>
|
|
<div id="content" style="display:none;">
|
|
<input id='a' type='file'>
|
|
</div>
|
|
<button id='b' onclick="document.getElementById('a').click();">Show Filepicker</button>
|
|
<button id='c' onmousedown="document.getElementById('a').click();">Show Filepicker</button>
|
|
<button id='d' onmouseup="document.getElementById('a').click();">Show Filepicker</button>
|
|
<pre id="test">
|
|
<script type="application/javascript">
|
|
|
|
/** Test for Bug 36619 **/
|
|
|
|
SimpleTest.waitForExplicitFinish();
|
|
|
|
var MockFilePicker = SpecialPowers.MockFilePicker;
|
|
MockFilePicker.init();
|
|
|
|
// enable popups the first time
|
|
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.
|
|
synthesizeMouseAtCenter(b, {});
|
|
SimpleTest.executeSoon(function() {
|
|
ok(MockFilePicker.shown, "File picker show method should have been called");
|
|
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() {
|
|
ok(!MockFilePicker.shown, "File picker show method should not have been called");
|
|
MockFilePicker.reset();
|
|
|
|
synthesizeMouseAtCenter(document.getElementById('c'), {});
|
|
SimpleTest.executeSoon(function() {
|
|
ok(!MockFilePicker.shown, "File picker show method should have been called");
|
|
MockFilePicker.reset();
|
|
|
|
synthesizeMouseAtCenter(document.getElementById('d'), {});
|
|
SimpleTest.executeSoon(function() {
|
|
ok(MockFilePicker.shown, "File picker show method should have been called");
|
|
|
|
MockFilePicker.cleanup();
|
|
SimpleTest.finish();
|
|
});
|
|
});
|
|
});
|
|
});
|
|
});
|
|
});
|
|
|
|
</script>
|
|
</pre>
|
|
</body>
|
|
</html>
|