only do the UA string search in firefox if we don't have a perfect match on buildId

git-svn-id: file:///home/svn/framework3/trunk@9129 4d416f70-5f16-0410-b530-b9f4589650da
unstable
James Lee 2010-04-24 21:31:12 +00:00
parent 13171ad1c6
commit 01f9c0b616
1 changed files with 18 additions and 19 deletions

View File

@ -401,21 +401,14 @@ function getVersion(){
case "20100324182054": ua_version = "3.6.2"; os_name = "#{oses::FREEBSD}"; os_flavor = "PC-BSD"; arch = "#{ARCH_X86}"; break;
case "20100401080539": ua_version = "3.6.3"; os_name = "#{oses::WINDOWS}"; break;
case "20100402010516": ua_version = "3.5.9"; os_name = "#{oses::LINUX}"; os_flavor = "Ubuntu"; break;
}
// end navigator.buildID checks
// Verify whether the ua string is lying by checking if it contains
// what we detected using known objects above as a substring. If it
// appears to be truthful, then use its more precise version number.
//
// XXX: This should probably check only the first 2 sections of the
// version number so that things like "3.5.0" don't cause false
// positives.
default:
version = searchVersion("Firefox", navigator.userAgent);
if (version && version.substr(0,ua_version.length) == ua_version) {
// The version number will end with a space or end of line, so strip
// off anything after a space if one exists
// Verify whether the ua string is lying by checking if it contains
// the major version we detected using known objects above. If it
// appears to be truthful, then use its more precise version number.
if (version && version.split(".")[0] == ua_version.split(".")[0]) {
// The version number will sometimes end with a space or end of
// line, so strip off anything after a space if one exists
if (-1 != version.indexOf(" ")) {
version = version.substr(0,version.indexOf(" "));
}
@ -423,6 +416,12 @@ function getVersion(){
} else {
ua_is_lying = true;
}
break;
}
if (ua_is_lying) { alert("UA is lying"); }
alert(ua_version + " vs " + navigator.userAgent);
// end navigator.buildID checks
} else if (typeof ScriptEngineMajorVersion == "function") {
// Then this is IE and we can very reliably detect the OS.