Replace browser conditions by preprocessed conditions
The extension used to rely on the isFirefox method to check whether the
browser is Firefox or Chromium-based. This CL removes this function and
replaces the conditions based in this function by conditions which are
pre-processed at compile time.
Change-Id: Id7280e6c8fb3dfd3fabbc05339ef3791822aa6ac
diff --git a/src/killSwitch/index.js b/src/killSwitch/index.js
index 1456a51..f0b1294 100644
--- a/src/killSwitch/index.js
+++ b/src/killSwitch/index.js
@@ -1,6 +1,6 @@
import {compareLoose} from 'semver';
-import {getExtVersion, isFirefox} from '../common/extUtils.js';
+import {getExtVersion} from '../common/extUtils.js';
import * as commonPb from './api_proto/common_pb.js';
import {KillSwitchServicePromiseClient} from './api_proto/kill_switch_grpc_web_pb.js';
@@ -16,8 +16,11 @@
}
getCurrentBrowser() {
- if (isFirefox()) return commonPb.Environment.Browser.BROWSER_GECKO;
+ // #!if browser_target == 'gecko'
+ return commonPb.Environment.Browser.BROWSER_GECKO;
+ // #!else
return commonPb.Environment.Browser.BROWSER_CHROMIUM;
+ // #!endif
}
updateKillSwitchStatus() {