JinPhil / js-test-driver

Automatically exported from code.google.com/p/js-test-driver
0 stars 0 forks source link

UserAgentParser defaults to invalid unique identifier #194

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Run 'java -jar JsTestDriver-1.2.2.jar --config jsTestDriver.conf --port 9876'
2. Register browser Iceweasel
3. Run 'java -jar JsTestDriver-1.2.2.jar --config jsTestDriver.conf 
--testOutput results --tests all'

What is the expected output? What do you see instead?
I expect XML files to be created in the 'results' folder. Instead there are no 
errors but no XML files are created either

What version of the product are you using? On what operating system?
debian 3

Please provide any additional information below.
When using --runnerMode DEBUG the following output is generated:

SEVERE: Could not create file: 
/home/ivo/results/TEST-Mozilla/50_(X11;_U;_Linux_x86_64;_en-US;_rv:19019)_Gecko/
2010120923_Iceweasel/306_(Debian-306-3)__Linux.JSON DecodeDefault.xml

Because of the '/' character from the User-agent string JsTestDriver attempts 
to generate subfolders.

Looking into the code, the problem seems to be in the file 
UserAgentParser.java. In there are some checks if the browser is either Chrome, 
IE, Safari, Firefox, Opera or Konqueror. Altough Iceweasel is a Firefox branch, 
it does not indicate that in the user-agent string: 
Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.0.19) Gecko/2010120923 
Iceweasel/3.0.6 (Debian-3.0.6-3)

This results that the entire userAgent string is set as the userAgentName 
without any parsing of the special characters inside the userAgent string.

I think it would be save to add 'Iceweasel' to the BROWSER_NAME_AND_VERSION 
Pattern in UserAgentParser.java

But I also think that some sane conversion for the UserAgent to UserAgentName 
should be applied as default case when BROWSER_NAME_AND_VERSION could not be 
applied.

Original issue reported on code.google.com by IvDo...@gmail.com on 3 Feb 2011 at 10:41

GoogleCodeExporter commented 8 years ago
The latest version (1.3.1) seems to have solved the issue for me.

Original comment by IvDo...@gmail.com on 24 Feb 2011 at 2:11

GoogleCodeExporter commented 8 years ago
Mostly by accident. There is special care being taken to ensure that the 
generated file names are valid.

Still need to clean up the user agent parser.

Original comment by corbinrs...@gmail.com on 24 Feb 2011 at 4:29