[iOS] Crash long pressing on <input type=file>
[WebKit-https.git] / ManualTests / ios / long-press-input-type-file-crash.html
1 <!DOCTYPE html>
2 <html>
3     <body onload="test()">
4         <p>
5             This test checks that a long press gesture on an file input button does not crash on iOS.
6             Press and hold on the file input button below until you see the word "PASS".
7         </p>
8         <p id="result">Test not running</p>
9         <p>
10             <input type="file" id="filecontrol">
11         </p>
12         <script>
13             var timer;
14             var pass;
15             function setText(s)
16             {
17                 document.getElementById("result").innerHTML = s;
18             }
19
20             function test() {
21                 var input = document.getElementById("filecontrol");
22                 input.onclick = function(e) { e.preventDefault(); }
23                 input.ontouchstart = function() {
24                     setText("Wait...");
25                     passed = false;
26                     timer = window.setTimeout(function() { setText("PASS"); passed = true; }, 1000);
27                 }
28                 input.ontouchend = input.ontouchmove = function() {
29                     if (passed)
30                         return;
31                     setText("Try again");
32                     window.clearTimeout(timer);
33                 }
34             }
35         </script>
36     </body>
37 </html>