Matmarex has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/72469


Change subject: jquery.client: Detect Internet Explorer 11
......................................................................

jquery.client: Detect Internet Explorer 11

It only admits it's using Trident, the browser name is not in the UA.

Side-effect: detects Trident's version for IE10 as well.

Bug: 50873
Change-Id: I79d65548e90d2c98c4e1d3253ac432801f48b4ba
---
M resources/jquery/jquery.client.js
M tests/qunit/suites/resources/jquery/jquery.client.test.js
2 files changed, 28 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/69/72469/1

diff --git a/resources/jquery/jquery.client.js 
b/resources/jquery/jquery.client.js
index 6941ec4..b58a32a 100644
--- a/resources/jquery/jquery.client.js
+++ b/resources/jquery/jquery.client.js
@@ -82,11 +82,11 @@
                                        // Tanslations for conforming browser 
names
                                        nameTranslations = [],
                                        // Names of known layout engines
-                                       layouts = ['gecko', 'konqueror', 
'msie', 'opera', 'webkit'],
+                                       layouts = ['gecko', 'konqueror', 
'msie', 'trident', 'opera', 'webkit'],
                                        // Translations for conforming layout 
names
                                        layoutTranslations = [ ['konqueror', 
'khtml'], ['msie', 'trident'], ['opera', 'presto'] ],
                                        // Names of supported layout engines 
for version number
-                                       layoutVersions = ['applewebkit', 
'gecko'],
+                                       layoutVersions = ['applewebkit', 
'gecko', 'trident'],
                                        // Names of known operating systems
                                        platforms = ['win', 'mac', 'linux', 
'sunos', 'solaris', 'iphone'],
                                        // Translations for conforming 
operating system names
@@ -162,6 +162,13 @@
                                                version = match[1];
                                        }
                                }
+                               // And IE 11's lies about being not being IE
+                               if ( layout === 'trident' && layoutversion >= 7 
&& ( match = ua.match( /rv ([0-9\.]*)/ ) ) ) {
+                                       if ( match[1] ) {
+                                               name = 'msie';
+                                               version = match[1];
+                                       }
+                               }
 
                                versionNumber = parseFloat( version, 10 ) || 
0.0;
 
diff --git a/tests/qunit/suites/resources/jquery/jquery.client.test.js 
b/tests/qunit/suites/resources/jquery/jquery.client.test.js
index 4163e9e..b007ea8 100644
--- a/tests/qunit/suites/resources/jquery/jquery.client.test.js
+++ b/tests/qunit/suites/resources/jquery/jquery.client.test.js
@@ -34,7 +34,7 @@
                                profile: {
                                        name: 'msie',
                                        layout: 'trident',
-                                       layoutVersion: 'unknown', // should be 
able to report 6?
+                                       layoutVersion: 6,
                                        platform: 'win',
                                        version: '10.0',
                                        versionBase: '10',
@@ -45,6 +45,24 @@
                                        rtl: true
                                }
                        },
+                       // Internet Explorer 11
+                       'Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv 11.0) 
like Gecko': {
+                               title: 'Internet Explorer 11',
+                               platform: 'Win32',
+                               profile: {
+                                       name: 'msie',
+                                       layout: 'trident',
+                                       layoutVersion: 7,
+                                       platform: 'win',
+                                       version: '11.0',
+                                       versionBase: '11',
+                                       versionNumber: 11
+                               },
+                               wikiEditor: {
+                                       ltr: true,
+                                       rtl: true
+                               }
+                       },
                        // Firefox 2
                        // Firefox 3.5
                        'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; 
rv:1.9.1.19) Gecko/20110420 Firefox/3.5.19': {

-- 
To view, visit https://gerrit.wikimedia.org/r/72469
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I79d65548e90d2c98c4e1d3253ac432801f48b4ba
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Matmarex <matma....@gmail.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to