jquery.client: Include platform in the profile cache key
authorTimo Tijhof <krinklemail@gmail.com>
Thu, 6 Feb 2014 00:45:07 +0000 (16:45 -0800)
committerTimo Tijhof <krinklemail@gmail.com>
Thu, 6 Feb 2014 00:50:16 +0000 (16:50 -0800)
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

resources/jquery/jquery.client.js

index f35782b..98ed46d 100644 (file)
@@ -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,
 
                                /* Caching */
 
-                               profileCache[nav.userAgent] = {
+                               profileCache[ nav.userAgent + '|' + nav.platform  ] = {
                                        name: name,
                                        layout: layout,
                                        layoutVersion: layoutversion,
                                        versionNumber: versionNumber
                                };
                        }
-                       return profileCache[nav.userAgent];
+                       return profileCache[ nav.userAgent + '|' + nav.platform  ];
                },
 
                /**