Ticket #148 (new defect)

Opened 3 months ago

Firefox 3 breaks greasemonkey and doesn't let you change file input fields

Reported by: fcri..@gmail.com Assigned to:
Priority: major Milestone:
Version: Keywords:
Cc:

Description

1. set signed.applets.codebase_principal_support to true in about:config

2. make an .html file with the following contents

<html><body>
<form id='testform' method='POST'>
<input name='userfile' type='file' onchange='alert("changed")' />
</form>
</html></body>

3. install a greasemonkey script like this:

var start_script = function()
{
        unsafeWindow.set_file = function()
        {
       
                try
                {
                        ret = unsafeWindow.netscape.security.PrivilegeManager.enablePrivilege("UniversalFileRead");
                }
                catch (e)
                {
                        alert('exception getting privileges: ' + e);
                }
 
                try
                {
                        unsafeWindow.document.getElementsByName('userfile')[0].value
                                = 'c:\\' + new Date().getTime() + '.txt';
                }
                catch (e)
                {
                        alert('exception changing value: ' + e);
                }
        }
 
        unsafeWindow.set_file();
}

window.setTimeout(start_script, 1000)

In Firefox 2, this script will work (once you approve the security upgrade in a popup). It changes the file input field and all is well. In Firefox 3, changing the value of the input field throws an exception. Everything seems to work fine if you're not using greasemonkey - like putting the script right into the page.

Attachments


Add/Change #148 (Firefox 3 breaks greasemonkey and doesn't let you change file input fields)