Bug 136448

Summary: onchange Event For File Input Slow / Fails To Respond
Product: WebKit Reporter: Kevin Gale <keving>
Component: UI EventsAssignee: Nobody <webkit-unassigned>
Status: NEW ---    
Severity: Major CC: ap, joepeck
Priority: P2 Keywords: InRadar
Version: 528+ (Nightly build)   
Hardware: iPhone / iPad   
OS: iOS 6.1   

Description Kevin Gale 2014-09-02 02:38:53 PDT
Our HTML5 application allows users to choose multiple pictures from their library.

We have found that when the selection is performed on an iPhone or iPad the onchange event takes a very long time to trigger. This is slow for a small number of selected pictures but gets much worse when a larger number of pictures are selected (I think it actually fails when selecting a large number of pictures).

Steps to Reproduce:
1. Open the following URL in Safari on an iPhone or iPad
http://jsfiddle.net/chu_man_fu/87Z49/1/

2. Select multiple pictures (minimum 10 - 20 or a large number such as 100).

The onchange event will eventually write a message to the page but this takes a long time and is dictated by the number of pictures chosen.

Expected Results:
onchange to respond quickly.

Actual Results:
onchange responds very slowly and can make our application look like it has crashed.


Note. I have also reported this in the Apple Bug Reporter - case 17917988.
Comment 1 Kevin Gale 2014-10-03 04:47:33 PDT
I have investigated this some more and the performance issue appears to be with the file selection process rather than the onchange event. I have stripped my example down to the HTML below and have discovered the following:
1. Choosing 3 videos with the durations 0:32, 0:39, 0:02 was fastest.
2. Choosing 3 screen shots was slower.
3. Choosing 3 pictures taken with a camera (iPhone 5 / iOS7) was slowest.

To me, this looks like the problem is related to either the size of the file or the content of the file.

Our app is a HTML5 based photo app which allows users to select lots of pictures. Unfortunately, due to this performance issue our users are complaining that it is unusable once they choose a few pictures as nothing happens for quite some time. We think iOS 8.0.2 might be faster than iOS7 but it is difficult to confirm this. However, even with iOS 8.0.2 the performance is still unusably slow.

<html>
<head>
</head>
<body>
<form>
  <input id="uploads" name='uploads[]' type="file" multiple>
</form>
</body>
</html>
Comment 2 Alexey Proskuryakov 2014-10-03 09:42:54 PDT
<rdar://problem/17917988>