fix a bug where firefox detection breaks with obfuscation of the js_osdetect code
git-svn-id: file:///home/svn/framework3/trunk@5632 4d416f70-5f16-0410-b530-b9f4589650daunstable
parent
e203311af7
commit
1e3d89b467
|
@ -29,8 +29,8 @@ function getVersion(){
|
||||||
var browser_version;
|
var browser_version;
|
||||||
var useragent = navigator.userAgent;
|
var useragent = navigator.userAgent;
|
||||||
|
|
||||||
var ver = "";
|
var version = "";
|
||||||
ver = useragent;
|
version = useragent;
|
||||||
|
|
||||||
document.write("navigator.userAgent = '"+navigator.userAgent+"'<br>");
|
document.write("navigator.userAgent = '"+navigator.userAgent+"'<br>");
|
||||||
document.write("navigator.appVersion = '"+navigator.appVersion+"'<br>");
|
document.write("navigator.appVersion = '"+navigator.appVersion+"'<br>");
|
||||||
|
@ -39,17 +39,17 @@ function getVersion(){
|
||||||
// userAgent all the time. If userAgent is spoofed, appVersion will lie
|
// userAgent all the time. If userAgent is spoofed, appVersion will lie
|
||||||
// also, so we don't lose anything by doing it this way.
|
// also, so we don't lose anything by doing it this way.
|
||||||
|
|
||||||
if (ver.indexOf("Windows 95") != -1) { os_name = "#{oses::WINDOWS}"; os_flavor = "95"; }
|
if (version.indexOf("Windows 95") != -1) { os_name = "#{oses::WINDOWS}"; os_flavor = "95"; }
|
||||||
else if (ver.indexOf("Windows NT 4") != -1) { os_name = "#{oses::WINDOWS}"; os_flavor = "NT"; }
|
else if (version.indexOf("Windows NT 4") != -1) { os_name = "#{oses::WINDOWS}"; os_flavor = "NT"; }
|
||||||
else if (ver.indexOf("Win 9x 4.9") != -1) { os_name = "#{oses::WINDOWS}"; os_flavor = "ME"; }
|
else if (version.indexOf("Win 9x 4.9") != -1) { os_name = "#{oses::WINDOWS}"; os_flavor = "ME"; }
|
||||||
else if (ver.indexOf("Windows 98") != -1) { os_name = "#{oses::WINDOWS}"; os_flavor = "98"; }
|
else if (version.indexOf("Windows 98") != -1) { os_name = "#{oses::WINDOWS}"; os_flavor = "98"; }
|
||||||
else if (ver.indexOf("Windows NT 5.0") != -1) { os_name = "#{oses::WINDOWS}"; os_flavor = "2000"; }
|
else if (version.indexOf("Windows NT 5.0") != -1) { os_name = "#{oses::WINDOWS}"; os_flavor = "2000"; }
|
||||||
else if (ver.indexOf("Windows NT 5.1") != -1) { os_name = "#{oses::WINDOWS}"; os_flavor = "XP"; }
|
else if (version.indexOf("Windows NT 5.1") != -1) { os_name = "#{oses::WINDOWS}"; os_flavor = "XP"; }
|
||||||
else if (ver.indexOf("Windows NT 5.2") != -1) { os_name = "#{oses::WINDOWS}"; os_flavor = "2003"; }
|
else if (version.indexOf("Windows NT 5.2") != -1) { os_name = "#{oses::WINDOWS}"; os_flavor = "2003"; }
|
||||||
else if (ver.indexOf("Windows NT 6.0") != -1) { os_name = "#{oses::WINDOWS}"; os_flavor = "Vista"; }
|
else if (version.indexOf("Windows NT 6.0") != -1) { os_name = "#{oses::WINDOWS}"; os_flavor = "Vista"; }
|
||||||
else if (ver.indexOf("Windows") != -1) { os_name = "#{oses::WINDOWS}"; }
|
else if (version.indexOf("Windows") != -1) { os_name = "#{oses::WINDOWS}"; }
|
||||||
else if (ver.indexOf("Mac") != -1) { os_name = "#{oses::MAC_OSX}"; }
|
else if (version.indexOf("Mac") != -1) { os_name = "#{oses::MAC_OSX}"; }
|
||||||
else if (ver.indexOf("Linux") != -1) { os_name = "#{oses::LINUX}"; }
|
else if (version.indexOf("Linux") != -1) { os_name = "#{oses::LINUX}"; }
|
||||||
|
|
||||||
if (os_name == "#{oses::LINUX}") {
|
if (os_name == "#{oses::LINUX}") {
|
||||||
if (useragent.indexOf("Gentoo") != -1) { os_flavor = "Gentoo"; }
|
if (useragent.indexOf("Gentoo") != -1) { os_flavor = "Gentoo"; }
|
||||||
|
@ -81,11 +81,11 @@ function getVersion(){
|
||||||
// any sploits for it yet and it's a very low market share
|
// any sploits for it yet and it's a very low market share
|
||||||
os_name = "#{oses::WINDOWS}";
|
os_name = "#{oses::WINDOWS}";
|
||||||
browser_name = "#{clients::IE}";
|
browser_name = "#{clients::IE}";
|
||||||
ver = ScriptEngineMajorVersion().toString();
|
version = ScriptEngineMajorVersion().toString();
|
||||||
ver += ScriptEngineMinorVersion().toString();
|
version += ScriptEngineMinorVersion().toString();
|
||||||
ver += ScriptEngineBuildVersion().toString();
|
version += ScriptEngineBuildVersion().toString();
|
||||||
document.write("ScriptEngine: "+ver+"<br />");
|
document.write("ScriptEngine: "+version+"<br />");
|
||||||
switch (ver){
|
switch (version){
|
||||||
case "514615":
|
case "514615":
|
||||||
os_flavor = "2000";
|
os_flavor = "2000";
|
||||||
os_sp = "SP0";
|
os_sp = "SP0";
|
||||||
|
@ -155,19 +155,19 @@ function getVersion(){
|
||||||
|
|
||||||
if (navigator.systemLanguage) {
|
if (navigator.systemLanguage) {
|
||||||
// ie
|
// ie
|
||||||
ver = navigator.systemLanguage;
|
version = navigator.systemLanguage;
|
||||||
} else if (navigator.language) {
|
} else if (navigator.language) {
|
||||||
// gecko derivatives
|
// gecko derivatives
|
||||||
ver = navigator.language;
|
version = navigator.language;
|
||||||
} else {
|
} else {
|
||||||
// some other browser and we don't know how to get the language, so
|
// some other browser and we don't know how to get the language, so
|
||||||
// just guess english
|
// just guess english
|
||||||
ver = "en";
|
version = "en";
|
||||||
}
|
}
|
||||||
|
|
||||||
document.write("language = '"+ver+"'<br>");
|
document.write("language = '"+version+"'<br>");
|
||||||
os_lang = ver;
|
os_lang = version;
|
||||||
//switch (ver){
|
//switch (version){
|
||||||
// case "fr": os_lang = "French"; break;
|
// case "fr": os_lang = "French"; break;
|
||||||
// case "zh": os_lang = "Chinese"; break;
|
// case "zh": os_lang = "Chinese"; break;
|
||||||
// case "nl": os_lang = "Dutch"; break;
|
// case "nl": os_lang = "Dutch"; break;
|
||||||
|
@ -187,10 +187,10 @@ function getVersion(){
|
||||||
// os_lang = "English"; break;
|
// os_lang = "English"; break;
|
||||||
//} // switch navigator.systemLanguage
|
//} // switch navigator.systemLanguage
|
||||||
|
|
||||||
ver = navigator.platform;
|
version = navigator.platform;
|
||||||
if ( ("Win32" == ver) || (ver.match(/i.86/)) ) {
|
if ( ("Win32" == version) || (version.match(/i.86/)) ) {
|
||||||
arch = "#{ARCH_X86}";
|
arch = "#{ARCH_X86}";
|
||||||
} else if (-1 != ver.indexOf('PPC')) {
|
} else if (-1 != version.indexOf('PPC')) {
|
||||||
arch = "#{ARCH_PPC}";
|
arch = "#{ARCH_PPC}";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -208,7 +208,7 @@ ENDJS
|
||||||
'arch',
|
'arch',
|
||||||
'browser_name',
|
'browser_name',
|
||||||
'browser_version',
|
'browser_version',
|
||||||
'useragent', 'ver'
|
'useragent', 'version'
|
||||||
],
|
],
|
||||||
'Methods' => [ 'getVersion' ]
|
'Methods' => [ 'getVersion' ]
|
||||||
}
|
}
|
||||||
|
|
|
@ -100,7 +100,7 @@ class ObfuscateJS
|
||||||
elsif opts['Symbols']
|
elsif opts['Symbols']
|
||||||
@opts['Symbols'] = opts['Symbols']
|
@opts['Symbols'] = opts['Symbols']
|
||||||
end
|
end
|
||||||
@opts['Strings'] = opts['Strings'] || false
|
@opts['Strings'] ||= opts['Strings']
|
||||||
end
|
end
|
||||||
|
|
||||||
#
|
#
|
||||||
|
|
Loading…
Reference in New Issue