@@ -42,9 +42,7 @@ goog.require('goog.userAgent.product.isVersion');
4242 * than the given version.
4343 */
4444bot . userAgent . isEngineVersion = function ( version ) {
45- if ( bot . userAgent . FIREFOX_EXTENSION ) {
46- return bot . userAgent . FIREFOX_EXTENSION_IS_ENGINE_VERSION_ ( version ) ;
47- } else if ( goog . userAgent . IE ) {
45+ if ( goog . userAgent . IE ) {
4846 return goog . string . compareVersions (
4947 /** @type {number } */ ( goog . userAgent . DOCUMENT_MODE ) , version ) >= 0 ;
5048 } else {
@@ -68,9 +66,7 @@ bot.userAgent.isEngineVersion = function (version) {
6866 * than the given version.
6967 */
7068bot . userAgent . isProductVersion = function ( version ) {
71- if ( bot . userAgent . FIREFOX_EXTENSION ) {
72- return bot . userAgent . FIREFOX_EXTENSION_IS_PRODUCT_VERSION_ ( version ) ;
73- } else if ( goog . userAgent . product . ANDROID ) {
69+ if ( goog . userAgent . product . ANDROID ) {
7470 return goog . string . compareVersions (
7571 bot . userAgent . ANDROID_VERSION_ , version ) >= 0 ;
7672 } else {
@@ -79,69 +75,6 @@ bot.userAgent.isProductVersion = function (version) {
7975} ;
8076
8177
82- /**
83- * When we are in a Firefox extension, this is a function that accepts a version
84- * and returns whether the version of Gecko we are on is the same or higher
85- * than the given version. When we are not in a Firefox extension, this is null.
86- * @private {(undefined|function((string|number)): boolean)}
87- */
88- bot . userAgent . FIREFOX_EXTENSION_IS_ENGINE_VERSION_ ;
89-
90-
91- /**
92- * When we are in a Firefox extension, this is a function that accepts a version
93- * and returns whether the version of Firefox we are on is the same or higher
94- * than the given version. When we are not in a Firefox extension, this is null.
95- * @private {(undefined|function((string|number)): boolean)}
96- */
97- bot . userAgent . FIREFOX_EXTENSION_IS_PRODUCT_VERSION_ ;
98-
99-
100- /**
101- * Whether we are in a Firefox extension.
102- *
103- * @const
104- * @type {boolean }
105- */
106- bot . userAgent . FIREFOX_EXTENSION = ( function ( ) {
107- // False if this browser is not a Gecko browser.
108- if ( ! goog . userAgent . GECKO ) {
109- return false ;
110- }
111-
112- // False if this code isn't running in an extension.
113- var Components = goog . global . Components ;
114- if ( ! Components ) {
115- return false ;
116- }
117- try {
118- if ( ! Components [ 'classes' ] ) {
119- return false ;
120- }
121- } catch ( e ) {
122- return false ;
123- }
124-
125- // Populate the version checker functions.
126- var cc = Components [ 'classes' ] ;
127- var ci = Components [ 'interfaces' ] ;
128- var versionComparator = cc [ '@mozilla.org/xpcom/version-comparator;1' ] [
129- 'getService' ] ( ci [ 'nsIVersionComparator' ] ) ;
130- var appInfo = cc [ '@mozilla.org/xre/app-info;1' ] [ 'getService' ] (
131- ci [ 'nsIXULAppInfo' ] ) ;
132- var geckoVersion = appInfo [ 'platformVersion' ] ;
133- var firefoxVersion = appInfo [ 'version' ] ;
134-
135- bot . userAgent . FIREFOX_EXTENSION_IS_ENGINE_VERSION_ = function ( version ) {
136- return versionComparator . compare ( geckoVersion , '' + version ) >= 0 ;
137- } ;
138- bot . userAgent . FIREFOX_EXTENSION_IS_PRODUCT_VERSION_ = function ( version ) {
139- return versionComparator . compare ( firefoxVersion , '' + version ) >= 0 ;
140- } ;
141-
142- return true ;
143- } ) ( ) ;
144-
14578/**
14679 * Whether we are a WebExtension.
14780 *
0 commit comments