Skip to content
This repository has been archived by the owner on Nov 29, 2018. It is now read-only.

type command fails with security error in Firefox 8 for file inputs #2826

Closed
lukeis opened this issue Mar 3, 2016 · 42 comments
Closed

type command fails with security error in Firefox 8 for file inputs #2826

lukeis opened this issue Mar 3, 2016 · 42 comments

Comments

@lukeis
Copy link
Member

lukeis commented Mar 3, 2016

Originally reported on Google Code with ID 2826


What steps will reproduce the problem?
Running this test in windows Vista with Firefox 8.0
It uses a publicly available page to make it easy to replicate the issue
<tr>
    <td>open</td>
    <td>http://www.htmlcodetutorial.com/forms/_INPUT_TYPE_FILE.html</td>
    <td></td>
</tr>
<tr>
    <td>type</td>
    <td>name=upfile</td>
    <td>C:\Users\n.delargy\Desktop\M86_1_SV12.jpg</td>
</tr>

What is the expected output? What do you see instead?
I'd expect this to fill the file input
instead if produces the following exception

[error] Unexpected Exception: code -> 1000, INDEX_SIZE_ERR -> 1, DOMSTRING_SIZE_ERR
-> 2, HIERARCHY_REQUEST_ERR -> 3, WRONG_DOCUMENT_ERR -> 4, INVALID_CHARACTER_ERR ->
5, NO_DATA_ALLOWED_ERR -> 6, NO_MODIFICATION_ALLOWED_ERR -> 7, NOT_FOUND_ERR -> 8,
NOT_SUPPORTED_ERR -> 9, INUSE_ATTRIBUTE_ERR -> 10, INVALID_STATE_ERR -> 11, SYNTAX_ERR
-> 12, INVALID_MODIFICATION_ERR -> 13, NAMESPACE_ERR -> 14, INVALID_ACCESS_ERR -> 15,
VALIDATION_ERR -> 16, TYPE_MISMATCH_ERR -> 17, DATA_CLONE_ERR -> 25, message -> Security
error, result -> 2152924136, name -> NS_ERROR_DOM_SECURITY_ERR, filename -> chrome://selenium-ide/content/selenium-core/scripts/atoms.js,
lineNumber -> 8866, columnNumber -> 0, location -> JS frame :: chrome://selenium-ide/content/selenium-core/scripts/atoms.js
:: <TOP_LEVEL> :: line 8866, inner -> null, data -> null

Selenium version: 1.3.0
OS: Windows
Browser: Firefox
Brower version: 8.0


Reported by n.delargy@ctidigital.com on 2011-11-11 15:27:51

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

Affects Selenium IDE

Reported by n.delargy@ctidigital.com on 2011-11-11 15:30:06

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

Reported by barancev on 2011-11-14 07:26:51

  • Labels added: Component-Core, Browser-Firefox

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

I'm seeing the same behavior in Selenium RC when using the *chrome mode for Firefox
8.  I'm getting the following error:

ERROR: Command execution failure. Please search the user group at
https://groups.google.com/forum/#!forum/selenium-users for error
details from the log window. The error message is: Security error

Reported by mike.selenium on 2011-11-14 21:29:34

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

In atoms.js, changing a.value = d to XPCNativeWrapper(a).value = d under core.events.replaceText
seems to fix this issue for Selenium IDE. Not sure if this is the ideal fix or if it
breaks other stuff.

Reported by youngrobby@live.com on 2011-11-15 14:04:44

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

This change resolved the issue for me in Selenium RC as well, and my other Type() commands
still worked correctly.

Reported by mike.selenium on 2011-11-15 17:31:06

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

Issue 2849 has been merged into this issue.

Reported by barancev on 2011-11-16 05:10:15

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

Have also run into this problem.

How do you edit the atoms.js file if you're running Selenium RC? Can do it with Selenium
IDE, but having troubles finding it with Selenium RC.

Reported by antonios.sarhanis@cxense.com on 2011-11-30 00:31:04

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

Found the atoms.js file.

More info here:

http://groups.google.com/group/selenium-users/browse_thread/thread/f09fbab515806073

Reported by antonios.sarhanis@cxense.com on 2011-11-30 06:28:26

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

I've also run into this problem. I'm using Firefox 8 and Selenium IDE 1.4.1. Any idea
if this could be fixed to the next version of Selenium IDE, or do we just need to "hack"
the atoms.js....

Reported by jesse.j.julkunen on 2011-12-01 05:58:44

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

I've applied the hack and all my tests are still working.  I suppose it'll be fixed
soon, seems to be affecting a lot of people.

Reported by n.delargy@ctidigital.com on 2011-12-01 10:21:46

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

I have also applied this hack. Hoping for the official fix.

Reported by me@tian.im on 2011-12-01 22:59:27

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

I am having the same issue; how do i update atoms.js to make my test run?? I am using
selenium-rc

here is the selenium group url where i asked the same question.
http://groups.google.com/group/selenium-users/browse_thread/thread/a25cc0fe1afd00e5/db75c60c10b4d894?hl=en#db75c60c10b4d894

Reported by qatseay on 2011-12-02 18:18:22

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

I'm tired of seeing this question, so here's my step-by-step guide:

1. Get the latest version of 7-zip on Windows.
2. Open the jar file with 7-zip.
3. Delete the LICENSE file.  I'm sure this isn't exactly kosher, but case-insensitive
Windows confuses the LICENSE file with the license directory.
4. Go to the core\scripts path within the jar file.
5. Edit the atoms.js file.  (Right-click and Edit, or click and F4.)
6. Find the line with "a.value = d" and change it to "XPCNativeWrapper(a).value = d;"
7. Save the changes.  You're done!

* Step 6 is from http://stackoverflow.com/questions/8149403/selenium-ide-1-4-1-throwing-security-error-when-uploading-a-local-file/8248691#8248691

Reported by kbrazier on 2011-12-02 18:38:11

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

Issue 2994 has been merged into this issue.

Reported by barancev on 2011-12-06 20:39:17

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

Issue 2906 has been merged into this issue.

Reported by barancev on 2011-12-07 06:20:21

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

The correct method to use when uploading files is the "attachFile" method, not "type".
We can attempt to make it work in chrome mode for firefox.

Reported by simon.m.stewart on 2011-12-07 12:02:09

  • Status changed: WontFix

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

Could the attachFile method also be added to Selenium IDE?

Reported by jesse.j.julkunen on 2011-12-07 12:06:52

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

Reported by simon.m.stewart on 2011-12-07 12:53:34

  • Labels added: Component-IDE
  • Labels removed: Component-Core

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

Reported by barancev on 2011-12-07 18:59:13

  • Status changed: New

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

Re: Comments 18-20, is there another ticket to watch for the RC / core functionality
- comments 3, 14 etc?

Thank you.

Reported by fiztlen on 2011-12-08 17:07:24

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

It appears that the attachFile command in Selenium RC is also failing with a security
error. On inspection, the attachFile command appears to download a remote file before
calling the type command to place the absolute path to the file into the file input
field. In this case, I don't see an immediate need to add attachFile to Selenium IDE.

I have created a patch that fixes the type security error, and have successfully tested
this with various Firefox versions. Unfortunately I have not been able to run the selenium-atoms
tests in other browsers, so I do not have complete confidence to check this in. If
someone could do this, or assist me it would be much appreciated. I'm keen to get this
fix in time for Selenium IDE 1.5.0.

Reported by dave.hunt on 2011-12-09 00:32:31

  • Status changed: Started
  • Labels added: Component-Core, Browser-Atoms

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

Patch mentioned in previous comment.

Reported by dave.hunt on 2011-12-09 00:33:17


- _Attachment: [2826.patch](https://storage.googleapis.com/google-code-attachments/selenium/issue-2826/comment-23/2826.patch)_

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

Does this patch also fix it in the non-ide parts? (core and rc)

Reported by lkwg82 on 2011-12-09 10:53:34

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

@lkwg82 yes, the fix is in the core code.

Reported by dave.hunt on 2011-12-09 11:13:01

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

Fixed in r15134

Reported by dave.hunt on 2011-12-09 17:50:58

  • Status changed: Fixed

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

Hi

I have selenium IDE on my machine plugin installed, I want to update atoms.js file
for 
changing a.value = d to XPCNativeWrapper(a).value = d under core.events.replaceText.
Inorder to do this do i need to install selenium server ?

Please let me know how can i update the atoms.js where can i find that?

Thanks
raj

Reported by Rajsrqa on 2011-12-09 20:19:58

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

@Rajsrqa this issue has been fixed, and a snapshot build of Selenium IDE is available
here: http://xserve.openqa.org:8085/browse/IDE-EDITOR-210/artifact/MULTI/Selenium-IDE/selenium-ide.xpi

Reported by dave.hunt on 2011-12-09 21:32:44

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

Hi Dave

Is this fix available in the latest download for selenium IDE 1.0.4 ? If not when can
we see that.


Reported by Rajsrqa on 2011-12-12 15:11:22

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

@Rajsrqa version 1.0.4 is almost two years old, and I'd be surprised if this even works
with Firefox 8. Please see my last comment with a link to a candidate build for 1.5.0,
which will hopefully be released later this week.

Reported by dave.hunt on 2011-12-12 15:37:10

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

Issue 3094 has been merged into this issue.

Reported by barancev on 2011-12-26 06:43:11

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

is this issue ficed in selenium 2.15?

Reported by sanam.chugh@qualitiasoft.com on 2011-12-28 05:02:47

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

No, 2.15 does not include this fix, it'll go in 2.16

Reported by barancev on 2011-12-28 06:56:35

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

@Sanam, you should be able to work out how the patch in comment 23 applies to the built
version of the Javascript as with comment 14.

That worked perfectly for me.

Reported by meh@corefiling.co.uk on 2011-12-28 10:22:27

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

When is the release date of 2.16? 

Reported by lazze.ostergaard on 2012-01-03 13:44:26

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

i have the same Problem using 2.18 and Firefox9 

i tried to change  
goog.userAgent.GECKO && bot.userAgent.isEngineVersion(8) ? XPCNativeWrapper(a).value
= d : a.value = d

into 

goog.userAgent.GECKO && (bot.userAgent.isEngineVersion(8) || bot.userAgent.isEngineVersion(9))
? XPCNativeWrapper(a).value = d : a.value = d

hoping this will fix it for Firefox 9 too but still i get an security error trying
to upload a file.

--> same for type() and attachFile()
--> same with *firefox and *chrome mode

is there any solution for this Problem with Firefox 9??

Reported by matthias.pomm@affinitas.de on 2012-02-01 13:31:37

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

If this works for you in Firefox 8 then could you raise the failure in Firefox 9 as
a new issue? I suspect if this has regressed then the cause/fix may be different. The
isEngineVersion returns true if the version is at least equal to the argument.

Reported by dave.hunt on 2012-02-01 14:10:15

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

Hmm, ok it looks like i had a test error yesterday. By retesting it the fileupload is
working in Firefox 8 and 9 with version 2.18 without any errors. 

Dont know why this was not working yesterday.

Sorry for bothering you.

Reported by matthias.pomm@affinitas.de on 2012-02-02 09:54:18

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

This issue has been reproduced again in 1.7.1 + FF 11, but can be fixed by changing
a.value = d to XPCNativeWrapper(a).value = d.

Reported by yaKuramori on 2012-03-15 17:32:34

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

I'm aware of this regression will update once I know the reasons for this change. Hopefully
we can get this resolved soon.

Reported by dave.hunt on 2012-03-15 17:35:41

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

any news? is there a fix for selenium IDE?

Reported by gabriella.loconte@pleiade.it on 2012-03-20 17:14:55

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

This is being tracked on issue 3549

Reported by dave.hunt on 2012-03-20 20:52:15

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

Reported by luke.semerau on 2015-09-17 18:14:09

  • Labels added: Restrict-AddIssueComment-Commit

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant