Firefox raises SecurityError and points to JQuery

Firefox raises SecurityError and points to JQuery

Hi Guys!

Test environment: Firefox 16.02 MacOS 10.7.4 / JQuery 1.7.2 


In our application we have a custom implementation of a file uploader UI (to make it CSS-friendly). 

We are using hidden <input type="file"> elements (we hide them via .hide() function). 

Clicking a normal <button> triggers a click event on the hidden file input too and the file selector screen shows up.


Sof far so good. But as soon as we select a file, Firefox raises an exception:


SecurityError: The operation is insecure (code: 18).


This error is generated only once for each file input, so subsequent tries result in normal operation. However, the first click always raises this error.


Due to the error, our change event listener (attached to the same file inputs) doesn't get executed.

We tried to track this down and the error appears to be coming from line 2425 of JQuery package:


  1. if ( !hooks || !("set" in hooks) || hooks.set( this, val, "value" ) === undefined ) {
  2.      this.value = val;
  3. }


Under certain conditions, JQuery seems to be trying to set the value of the <input type=file> and that makes FF complain. And we don't call .val() on file inputs!


What could be causing this? Under which conditions JQuery is trying to set the value of a file input? We do not set it explicitly anywhere. 


Any help would be appreciated!

Thanks!