Last modified: 2012-04-12 13:54:48 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T34147, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 32147 - is_ff2 in wikibits.js will break on Firefox 10 and later
is_ff2 in wikibits.js will break on Firefox 10 and later
Status: RESOLVED WONTFIX
Product: MediaWiki
Classification: Unclassified
JavaScript (Other open bugs)
1.16.x
All All
: Normal normal (vote)
: 1.19.0 release
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-11-02 18:08 UTC by Brion Vibber
Modified: 2012-04-12 13:54 UTC (History)
4 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Brion Vibber 2011-11-02 18:08:20 UTC
Firefox version numbers are going up waaaaay faster since the new release schedule this year; 10 will be coming up in a few months.

This code ain't gonna cut it:

  // For accesskeys; note that FF3+ is included here!
  window.is_ff2 = /firefox\/[2-9]|minefield\/3/.test( clientPC );

It's also pretty generally wrong and should probably not be being used by anything. :P
Comment 1 Daniel Friesen 2011-11-03 01:22:35 UTC
(In reply to comment #0)
> Firefox version numbers are going up waaaaay faster since the new release
> schedule this year; 10 will be coming up in a few months.
> 
> This code ain't gonna cut it:
> 
>   // For accesskeys; note that FF3+ is included here!
>   window.is_ff2 = /firefox\/[2-9]|minefield\/3/.test( clientPC );
> 
> It's also pretty generally wrong and should probably not be being used by
> anything. :P

;) On the plus side, once Firefox hits version 20 that code will start working again.

It's a shame browsers don't expose their accesskey prefixes in some api.
Comment 2 Roan Kattouw 2011-11-03 10:08:20 UTC
(In reply to comment #0)
> It's also pretty generally wrong and should probably not be being used by
> anything. :P
+1. However, we should also check that jquery.client.js (which is the recommended way of doing browser version detection now) can handle FF versions >=10.
Comment 3 Brion Vibber 2011-11-03 16:48:26 UTC
What the heck...

if ( val === false ) {
	return false;
} else if ( typeof val == 'string' ) {
	if ( !( eval( 'profile.version' + op + '"' + val + '"' ) ) ) {
		return false;
	}
} else if ( typeof val == 'number' ) {
	if ( !( eval( 'profile.versionNumber' + op + val ) ) ) {
		return false;
	}
}

in jquery.client's test() method, which is used to test the found data against whitelist/blacklist maps.


This just looks ALL KINDS of wrong.

First, eval() -- always bad.

Second, if doing greater-than/less-than comparisons with strings -- as with the '7.0.1' or '10.0.0' that you might get from Firefox -- that's gonna fail utterly.

Of course browser version sniffing is almost ALWAYS the wrong thing to do, so nothing *should* be doing these sorts of comparisons anyway...
Comment 4 Daniel Friesen 2011-11-03 17:02:08 UTC
Where'd you get that code?

Since just about the only valid browser testing there is, is the accesskey stuff I'm starting to think we should ditch the whole is_* stuff and $.browser and the accesskey stuff should test for known user agents itself.

That said, we still don't know what Firefox is going to do. This kind of crap code has been around for awhile. It's possible Firefox might try to hack it's way around it. Dare I say, Firefox could suddenly jump from 9.*.* to version 20.*.*, or maybe they'll pull an Opera with something like `Firefox/9.8.0 Version/10.0.0`.
Comment 5 Brion Vibber 2011-11-03 17:48:38 UTC
Where'd I get it? jquery.client.js's test() method, like I said...
Comment 6 Brion Vibber 2011-11-03 17:52:14 UTC
And btw you can download Firefox 10 nightlies *right now* from http://nightly.mozilla.org/

User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0a1) Gecko/20111103 Firefox/10.0a1
Comment 7 Brion Vibber 2011-11-03 18:35:32 UTC
I added some more qunit tests for jquery.client in r101845, as well as sample UA entries & profiles for IE 10 and Firefox 10 (using the documented & confirmed-on-developer-preview IE 10 user-agent and an actual user-agent from a Firefox 10 nightly build).

The sample compatibility map from WikiEditor that the tests use works on FF 10 and IE 10, but only because it's comparing numbers against the extracted major version number.
Comment 8 Mark A. Hershberger 2011-11-09 14:21:24 UTC
*sigh* like Bug #32047, I'm afraid this will end up in us patching jquery.  Reported upstream: https://forum.jquery.com/topic/version-sniffing-is-wrong-and-will-break
Comment 9 Brion Vibber 2011-11-09 14:57:15 UTC
isn't that one of our modules that we wrote for MediaWiki and not from upstream anywhere ?
Comment 10 Roan Kattouw 2011-11-09 17:40:54 UTC
(In reply to comment #9)
> isn't that one of our modules that we wrote for MediaWiki and not from upstream
> anywhere ?
I think it came from *somewhere*. Trevor would know. test() is our code but I don't think profile() is originally ours.
Comment 11 Krinkle 2012-01-03 22:01:50 UTC
- removing upstream as this is our own wikibits
- marking WONTFIX as all of wikibits is deprecated and jquery.client.profile() doesn't have this bug

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links