[Needlesearch] editor error
Rodrigo Araujo
rmaraujo at dcc.online.pt
Fri Jul 22 03:38:51 EDT 2005
I found the cause for the editor error in FC distributions and Firefox.
FC shipped versions of Firefox have their vendor string set as "Fedora"
and NeedleSearch expects it to be "Firefox" to tell it from Mozilla
(different DTD locations apply for each browser so NeedleSearch uses
editor.xul for FF and editor_moz.xul for Mozilla).
Mozilla versions shipped with FC also have navigator.vendor set as
"Fedora" so checking it does not seem to be a suitable method for
telling one browser from the other. You can check that string by typing
"javascript:alert(navigator.vendor);" without quotes in the address bar
of your browser.
In FC 4 Firefoxes the only string I found to contain "Firefox" is
navigator.userAgent. Since that seems to be common to all versions of
Firefox (I compared with Windows XP version of FF at least), I suggest
the function isFirefox() in file content/needlesearch/jslib/nsSniffer.js
becomes something like this:
isFirefox : function () {
if ( navigator.userAgent != null ) {
if (navigator.userAgent.toLowerCase().indexOf("firefox")
!= -1) {
return true;
}
}
if ( navigator.vendor != null ) {
if (navigator.vendor.toLowerCase() == "firefox") {
return true;
}
}
return false;
},
This way it seems safe to me. It does the same checks for undefined
strings as before and keeps the old detection method just in case
although it seems to be redundant, but one never knows about other
"costumized" versions of the browser. You decide if you want to keep the
navigator.vendor checks or not ;)
Please check with other platform versions of Firefox to confirm this by
typing "javascript:alert(navigator.userAgent);" (without quotes) in the
address bar and seeing if it contains "Firefox" at some point. If every
version does, then it should be safe just to check navigator.userAgent.
I'm also attaching a patch against the CVS version of NeedleSearch to
introduce this. With this change NeedleSearch works correctly with FC 4
Firefox 1.0.6, FC 3 Firefox 1.0.4, Windows XP Firefox 1.0.4 and FC 4
Mozilla 1.7.8.
If you find this patch useful, please commit it to the official branch
so the issue is gone in the next release of NeedleSearch :)
Best regards,
Rodrigo Araujo
-------------- next part --------------
A non-text attachment was scrubbed...
Name: needlesearch-firefox-detection-bug.patch
Type: text/x-patch
Size: 861 bytes
Desc: not available
Url : http://mozdev.org/pipermail/needlesearch/attachments/20050722/a9aaf013/needlesearch-firefox-detection-bug.bin
More information about the Needlesearch
mailing list