Index: third_party/google_input_tools/third_party/closure_library/closure/goog/labs/useragent/engine.js |
diff --git a/third_party/google_input_tools/third_party/closure_library/closure/goog/labs/useragent/engine.js b/third_party/google_input_tools/third_party/closure_library/closure/goog/labs/useragent/engine.js |
index ab8346c653c0d90056064c79064046cbf95102e0..63025e730ff8b4bebb8b2e5b8c684f94c3551383 100644 |
--- a/third_party/google_input_tools/third_party/closure_library/closure/goog/labs/useragent/engine.js |
+++ b/third_party/google_input_tools/third_party/closure_library/closure/goog/labs/useragent/engine.js |
@@ -46,10 +46,19 @@ goog.labs.userAgent.engine.isTrident = function() { |
/** |
+ * @return {boolean} Whether the rendering engine is Edge. |
+ */ |
+goog.labs.userAgent.engine.isEdge = function() { |
+ return goog.labs.userAgent.util.matchUserAgent('Edge'); |
+}; |
+ |
+ |
+/** |
* @return {boolean} Whether the rendering engine is WebKit. |
*/ |
goog.labs.userAgent.engine.isWebKit = function() { |
- return goog.labs.userAgent.util.matchUserAgentIgnoreCase('WebKit'); |
+ return goog.labs.userAgent.util.matchUserAgentIgnoreCase('WebKit') && |
+ !goog.labs.userAgent.engine.isEdge(); |
}; |
@@ -59,7 +68,8 @@ goog.labs.userAgent.engine.isWebKit = function() { |
goog.labs.userAgent.engine.isGecko = function() { |
return goog.labs.userAgent.util.matchUserAgent('Gecko') && |
!goog.labs.userAgent.engine.isWebKit() && |
- !goog.labs.userAgent.engine.isTrident(); |
+ !goog.labs.userAgent.engine.isTrident() && |
+ !goog.labs.userAgent.engine.isEdge(); |
}; |
@@ -73,7 +83,7 @@ goog.labs.userAgent.engine.getVersion = function() { |
var tuples = goog.labs.userAgent.util.extractVersionTuples( |
userAgentString); |
- var engineTuple = tuples[1]; |
+ var engineTuple = goog.labs.userAgent.engine.getEngineTuple_(tuples); |
if (engineTuple) { |
// In Gecko, the version string is either in the browser info or the |
// Firefox version. See Gecko user agent string reference: |
@@ -86,8 +96,9 @@ goog.labs.userAgent.engine.getVersion = function() { |
return engineTuple[1]; |
} |
- // IE has only one version identifier, and the Trident version is |
- // specified in the parenthetical. |
+ // MSIE has only one version identifier, and the Trident version is |
+ // specified in the parenthetical. IE Edge is covered in the engine tuple |
+ // detection. |
var browserTuple = tuples[0]; |
var info; |
if (browserTuple && (info = browserTuple[2])) { |
@@ -102,6 +113,25 @@ goog.labs.userAgent.engine.getVersion = function() { |
/** |
+ * @param {!Array<!Array<string>>} tuples Extracted version tuples. |
+ * @return {!Array<string>|undefined} The engine tuple or undefined if not |
+ * found. |
+ * @private |
+ */ |
+goog.labs.userAgent.engine.getEngineTuple_ = function(tuples) { |
+ if (!goog.labs.userAgent.engine.isEdge()) { |
+ return tuples[1]; |
+ } |
+ for (var i = 0; i < tuples.length; i++) { |
+ var tuple = tuples[i]; |
+ if (tuple[0] == 'Edge') { |
+ return tuple; |
+ } |
+ } |
+}; |
+ |
+ |
+/** |
* @param {string|number} version The version to check. |
* @return {boolean} Whether the rendering engine version is higher or the same |
* as the given version. |
@@ -113,7 +143,7 @@ goog.labs.userAgent.engine.isVersionOrHigher = function(version) { |
/** |
- * @param {!Array.<!Array.<string>>} tuples Version tuples. |
+ * @param {!Array<!Array<string>>} tuples Version tuples. |
* @param {string} key The key to look for. |
* @return {string} The version string of the given key, if present. |
* Otherwise, the empty string. |