From b1c4e07f746af4644df22bd15ff021db67af5516 Mon Sep 17 00:00:00 2001 From: John Lenz Date: Fri, 27 Oct 2023 12:21:08 -0700 Subject: [PATCH] Remove references to X11 from closure userAgent RELNOTES[INC]: Remove X11 references from goog.userAgent PiperOrigin-RevId: 577272544 Change-Id: Ie721bc14089ebdf7040b44301d671406cd0099f6 --- closure/goog/positioning/positioning_test.js | 8 ++--- closure/goog/ui/popup_test.js | 9 ++---- closure/goog/useragent/useragent.js | 33 ++------------------ closure/goog/useragent/useragenttestutil.js | 1 - 4 files changed, 6 insertions(+), 45 deletions(-) diff --git a/closure/goog/positioning/positioning_test.js b/closure/goog/positioning/positioning_test.js index cb8b35aafc..e80268fc2f 100644 --- a/closure/goog/positioning/positioning_test.js +++ b/closure/goog/positioning/positioning_test.js @@ -45,14 +45,10 @@ let testArea; /** This is used to round pixel values on FF3 Mac. */ function assertRoundedEquals(a, b, c) { - function round(x) { - return userAgent.GECKO && (userAgent.MAC || userAgent.X11) ? Math.round(x) : - x; - } if (arguments.length == 3) { - assertRoughlyEquals(a, round(b), round(c), ALLOWED_OFFSET); + assertRoughlyEquals(a, b, c, ALLOWED_OFFSET); } else { - assertRoughlyEquals(round(a), round(b), ALLOWED_OFFSET); + assertRoughlyEquals(a, b, ALLOWED_OFFSET); } } diff --git a/closure/goog/ui/popup_test.js b/closure/goog/ui/popup_test.js index c415c1ffd4..1e615ae617 100644 --- a/closure/goog/ui/popup_test.js +++ b/closure/goog/ui/popup_test.js @@ -12,18 +12,13 @@ const Corner = goog.require('goog.positioning.Corner'); const Popup = goog.require('goog.ui.Popup'); const style = goog.require('goog.style'); const testSuite = goog.require('goog.testing.testSuite'); -const userAgent = goog.require('goog.userAgent'); /** This is used to round pixel values on FF3 Mac. */ function assertRoundedEquals(a, b, c) { - function round(x) { - return userAgent.GECKO && (userAgent.MAC || userAgent.X11) ? Math.round(x) : - x; - } if (arguments.length == 3) { - assertEquals(a, round(b), round(c)); + assertEquals(a, b, c); } else { - assertEquals(round(a), round(b)); + assertEquals(a, b); } } diff --git a/closure/goog/useragent/useragent.js b/closure/goog/useragent/useragent.js index 8070a98780..5859e50151 100644 --- a/closure/goog/useragent/useragent.js +++ b/closure/goog/useragent/useragent.js @@ -252,13 +252,6 @@ goog.userAgent.ASSUME_WINDOWS = goog.userAgent.ASSUME_LINUX = goog.define('goog.userAgent.ASSUME_LINUX', false); -/** - * @define {boolean} Whether the user agent is running on a X11 windowing - * system. - */ -goog.userAgent.ASSUME_X11 = goog.define('goog.userAgent.ASSUME_X11', false); - - /** * @define {boolean} Whether the user agent is running on Android. */ @@ -297,9 +290,8 @@ goog.userAgent.ASSUME_KAIOS = goog.define('goog.userAgent.ASSUME_KAIOS', false); */ goog.userAgent.PLATFORM_KNOWN_ = goog.userAgent.ASSUME_MAC || goog.userAgent.ASSUME_WINDOWS || goog.userAgent.ASSUME_LINUX || - goog.userAgent.ASSUME_X11 || goog.userAgent.ASSUME_ANDROID || - goog.userAgent.ASSUME_IPHONE || goog.userAgent.ASSUME_IPAD || - goog.userAgent.ASSUME_IPOD; + goog.userAgent.ASSUME_ANDROID || goog.userAgent.ASSUME_IPHONE || + goog.userAgent.ASSUME_IPAD || goog.userAgent.ASSUME_IPOD; /** @@ -348,27 +340,6 @@ goog.userAgent.LINUX = goog.userAgent.PLATFORM_KNOWN_ ? goog.userAgent.isLegacyLinux_(); -/** - * @return {boolean} Whether the user agent is an X11 windowing system. - * @private - */ -goog.userAgent.isX11_ = function() { - 'use strict'; - var navigator = goog.userAgent.getNavigatorTyped(); - return !!navigator && - goog.string.internal.contains(navigator['appVersion'] || '', 'X11'); -}; - - -/** - * Whether the user agent is running on a X11 windowing system. - * @type {boolean} - */ -goog.userAgent.X11 = goog.userAgent.PLATFORM_KNOWN_ ? - goog.userAgent.ASSUME_X11 : - goog.userAgent.isX11_(); - - /** * Whether the user agent is running on Android. * @type {boolean} diff --git a/closure/goog/useragent/useragenttestutil.js b/closure/goog/useragent/useragenttestutil.js index f9fd8c0ada..bcf2da0dd9 100644 --- a/closure/goog/useragent/useragenttestutil.js +++ b/closure/goog/useragent/useragenttestutil.js @@ -51,7 +51,6 @@ goog.userAgentTestUtil.reinitializeUserAgent = function() { goog.userAgent.MAC = goog.labs.userAgent.platform.isMacintosh(); goog.userAgent.WINDOWS = goog.labs.userAgent.platform.isWindows(); goog.userAgent.LINUX = goog.userAgent.isLegacyLinux_(); - goog.userAgent.X11 = goog.userAgent.isX11_(); goog.userAgent.ANDROID = goog.labs.userAgent.platform.isAndroid(); goog.userAgent.IPAD = goog.labs.userAgent.platform.isIpad(); goog.userAgent.IPHONE = goog.labs.userAgent.platform.isIphone();