From: Timo Tijhof Date: Thu, 6 Feb 2014 00:45:07 +0000 (-0800) Subject: jquery.client: Include platform in the profile cache key X-Git-Tag: 1.31.0-rc.0~16999 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/exercices/journal.php?a=commitdiff_plain;h=83fc47889fd3ca1f77eea6aa560c6848ee717b20;p=lhc%2Fweb%2Fwiklou.git jquery.client: Include platform in the profile cache key When different tests run a similar userAgent string but with a different platform, it returns an inappropiate cache object e.g. userAgent: Firefox platform: Linux x86_64 -> { platform: 'linux' } userAgent: Firefox platform: MacIntel -> { platform: 'linux' } (instead of platform: 'mac' ) Change-Id: Iaf2a5711ace82cbd2b68486e9680c7a6bcb7f9da --- diff --git a/resources/jquery/jquery.client.js b/resources/jquery/jquery.client.js index f35782be1c..98ed46d226 100644 --- a/resources/jquery/jquery.client.js +++ b/resources/jquery/jquery.client.js @@ -37,8 +37,9 @@ if ( nav === undefined ) { nav = window.navigator; } + // Use the cached version if possible - if ( profileCache[nav.userAgent] === undefined ) { + if ( profileCache[ nav.userAgent + '|' + nav.platform ] === undefined ) { var versionNumber, @@ -174,7 +175,7 @@ /* Caching */ - profileCache[nav.userAgent] = { + profileCache[ nav.userAgent + '|' + nav.platform ] = { name: name, layout: layout, layoutVersion: layoutversion, @@ -184,7 +185,7 @@ versionNumber: versionNumber }; } - return profileCache[nav.userAgent]; + return profileCache[ nav.userAgent + '|' + nav.platform ]; }, /**