Last modified: 2011-03-06 14:34:40 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 T29652, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 27652 - [jQuery.client] versionBase is wrong for versions higher with two or more digits
[jQuery.client] versionBase is wrong for versions higher with two or more digits
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
JavaScript (Other open bugs)
1.18.x
All All
: Normal normal (vote)
: ---
Assigned To: Krinkle
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-02-23 08:10 UTC by Krinkle
Modified: 2011-03-06 14:34 UTC (History)
3 users (show)

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


Attachments

Description Krinkle 2011-02-23 08:10:02 UTC
> navigator.userAgent
< "Opera/9.80 (Macintosh; Intel Mac OS X; U; en) Presto/2.6.30 Version/10.62"

> $.client.profile()
< Object /\ {
  layout: "presto"
  layoutVersion: "unknown"
  name: "opera"
  platform: "mac"
  version: "10.62"
  versionBase: "1"
  versionNumber: 10.62
  __proto__: Object \/
}
Comment 1 Krinkle 2011-02-27 20:26:18 UTC
The problem is on line 129

http://svn.wikimedia.org/viewvc/mediawiki/trunk/phase3/resources/jquery/jquery.client.js?view=markup&pathrev=81276#l129
> 				'versionBase': ( version !== x ? new String( version ).substr( 0, 1 ) : x ),

Instead of rounding downwards without digets, it's slicing the first number.
Comment 2 Krinkle 2011-03-02 09:51:42 UTC
Untested, will test/commit when I get home:



>			var version = ...;
> +			var versionNumber = parseFloat( version, 10 ) || 0.0;
>
>			/* Caching */
>
>			profile = {
>				'name': name,
>				'layout': layout,
>				'layoutVersion': layoutversion,
>				'platform': platform,
>				'version': version,
> -				'versionBase': ( version !== x ? new String( version ).substr( 0, 1 ) : x ),
> -				'versionNumber': ( parseFloat( version, 10 ) || 0.0 )
> +				'versionBase': ( version !== x ? Math.floor( versionNumber ).toString() : x ),
> +				'versionNumber': versionNumber
>			};
>		}
Comment 3 Krinkle 2011-03-06 14:34:35 UTC
Fixed in r83383.

 A userAgent like the following:
> "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_8; nl-nl) AppleWebKit/533.19.4 (KHTML, like Gecko) Version/5.0.3 Safari/533.19.4"
Will now have a versionBase of "10" instead of "1".

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


Navigation
Links