Seamonkey and Browser Check Bug

General feedback

Moderators: ScalixSupport, admin

Rhiandur

Seamonkey and Browser Check Bug

Postby Rhiandur » Wed Jul 25, 2007 7:19 am

Hi,

I am another user of SeaMonkey since the old Mozilla Project found its end and wondered why my browser got rejected in Webmail and SAC.

So i searched thru the javascript code and noticed Seamonkey would get accepted like Mozilla did when its Version would be 1.7+, now that seems easy because Seamonkey is Version 1.8+

But SCALIX has a problem identifying browsers minor version when patch numbers are included. Mine identifies "1.8.1.2pre". SCALIX takes "1" as major and "8.1.2pre" minor but does a numeric compare on minor that must fail due to dots and letters. Therefore I modified the JS to take only the first minor without patch:

Code: Select all

// Return browser's (actual) minor version or -1 if bad version entered
function getMinorVersion(v) {
    return getMajorVersion ( (!isEmpty(v) ? (!hasDot(v) ? v.match(/\.(\d*([-\.]\d*)*)/)[1] : 0) : -1) );
}


This change applies to the files

Code: Select all

/var/opt/scalix/st/tomcat/webapps/sac/js/brwsniff.js
/var/opt/scalix/st/tomcat/webapps/webmail/js/2675359740.js


Since this patch SeaMonkey works for me perfectly.

florian
Scalix
Scalix
Posts: 3852
Joined: Fri Dec 24, 2004 8:16 am
Location: Frankfurt, Germany
Contact:

Postby florian » Thu Jul 26, 2007 12:04 pm

Well... I wouldn't necessarily call this a bug; while we have tested SWA on Firefox and Mozilla, we have done *no* testing whatsoever on Seamonkey. As SWA interacts with the browser in complex - and sometimes surprising - ways, we'd not want to call something supported unless we have done proper testing, hence the browser check.

Having said that, if you really want to go ahead and try, I assume tweaking the UserAgent string the browser sends is the (unsupported!) way to go.....

-- Florian.
Florian von Kurnatowski, Die Harder!

Rhiandur

Postby Rhiandur » Thu Jul 26, 2007 3:01 pm

Let me reply that with original Scalix 11 code, having a view on the SAC scripts.

This part in the brwsniff.js handles the values for Seamonkey ..

Code: Select all

...
    // Mozilla Seamonkey
        b[0]="mozsea";
        b[1]=brs.match(/rv\x3a(\d+(\.?\d)*)/)[1];
        b[2]="gecko";
        b[3]=getGeckoVersion();
        return b;
...

... it handels it correct with a gecko engine and return all important values.

Now lets have a look at the next step of compatibility check, located in Utilities.js...

Code: Select all

...
    } else if ( browserID == "mozsea" ) {
      if ( browserMajorVersion > 1 ||
           ( browserMajorVersion == 1 &&
             browserMinorVersion >= 7 ) ) {
        gUnsupportedBrowser = false;
      }
...


This code handels the Seamonkey browsers identifed as above, and the if-command says, when Major >1 and Minor >=7 (aka v1.7+) the browser is supported. Seamonkey is the continued work of Mozilla Suite that ended with 1.7.6. Seamonkey suite is currently at 1.1.3, but internal its a 1.8.1+ Mozilla Suite.

Now code is "meant" to accept seamonkey but we know it gets rejected. The bug is located in the numeric compare "browserMinorVersion >= 7". For my browser this compare resolves as "8.1.2pre">=7. Javascript tries to convert the left string to number, but fails due to dots and chars, nulling it. JS finally compares 0>=7 and of course returns false. So where do these versions come from? Lets look back at brwsniff.js

Code: Select all

// Return browser's (actual) major version or -1 if bad version entered
function getMajorVersion(v) {
    return (isEmpty(v) ? -1 : (hasDot(v) ? v : v.match(/(\d*)(\.\d*)*/)[1]));
}

// Return browser's (actual) minor version or -1 if bad version entered
function getMinorVersion(v) {
    return (!isEmpty(v) ? (!hasDot(v) ? v.match(/\.(\d*([-\.]\d*)*)/)[1] : 0) : -1);
}


These functions extract major/minor from b[1] value of first code part. It cuts it by the dots and thats fine but the minor regexp is too greedy and returns everything past the first dot. That works unless a brower (not just SM) gets a patch version containing letters and more dots. The only thing my patch does is taking only the "major" part of the "minor" version to allow following numeric compares to success.

~~~

I assume, Seamonkey was intend to be supported in development when its version was just "1.8". I understand you guys did NO TESTING, when Scalix rejected this Browser as unsupported in later days.

So better fix the bug (not just for seamoney, others may get miss-rejected too) and do some testing to avoid new bugs. Otherwise present me an official 1.8.1 Mozilla Suite ;)


Return to “Feedback”



Who is online

Users browsing this forum: No registered users and 1 guest