Skip to content

Commit e0efe7e

Browse files
[js] Remove Firefox Extension code handling
1 parent d1e3a2c commit e0efe7e

2 files changed

Lines changed: 4 additions & 73 deletions

File tree

javascript/atoms/device.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -512,9 +512,7 @@ bot.Device.prototype.focusOnElement = function () {
512512
* @private {boolean}
513513
* @const
514514
*/
515-
bot.Device.ALWAYS_FOLLOWS_LINKS_ON_CLICK_ =
516-
goog.userAgent.WEBKIT ||
517-
(bot.userAgent.FIREFOX_EXTENSION && bot.userAgent.isProductVersion(3.6));
515+
bot.Device.ALWAYS_FOLLOWS_LINKS_ON_CLICK_ = goog.userAgent.WEBKIT;
518516

519517

520518
/**
@@ -558,7 +556,7 @@ bot.Device.shouldFollowHref_ = function (element) {
558556
return false;
559557
}
560558

561-
if (!(bot.userAgent.FIREFOX_EXTENSION || bot.userAgent.WEBEXTENSION)) {
559+
if (!(bot.userAgent.WEBEXTENSION)) {
562560
return true;
563561
}
564562

javascript/atoms/userAgent.js

Lines changed: 2 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,7 @@ goog.require('goog.userAgent.product.isVersion');
4242
* than the given version.
4343
*/
4444
bot.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
*/
7068
bot.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

Comments
 (0)