Change isReleaseVersion to isProdVersion
The experiments button in the options page was only shown on released
builds, and the link to the feature doc included a tag with the version
installed also on released builds. However, this doesn't work well in
Canary builds, since they should be treated like the unreleased
versions.
This CL fixes this by changing the function name to isProdVersion and
making the Canary builds behave like unreleased builds.
Change-Id: Ied55cf92b2317602adbe3c8dfc7f815b4c88fa19
diff --git a/src/common/extUtils.js b/src/common/extUtils.js
index e47a74c..cabf8cb 100644
--- a/src/common/extUtils.js
+++ b/src/common/extUtils.js
@@ -1,7 +1,11 @@
-// Returns whether the extension is a release version.
-export function isReleaseVersion() {
- var manifest = chrome.runtime.getManifest();
- return ('version' in manifest) && manifest.version != '0';
+// Returns whether the extension is a production version (released stable or
+// beta version).
+export function isProdVersion() {
+ // #!if production && !canary
+ return true;
+ // #!else
+ return false;
+ // #!endif
}
// Returns the extension version
diff --git a/src/options/optionsCommon.js b/src/options/optionsCommon.js
index 863232d..b442fad 100644
--- a/src/options/optionsCommon.js
+++ b/src/options/optionsCommon.js
@@ -1,4 +1,4 @@
-import {getExtVersion, isReleaseVersion} from '../common/extUtils.js';
+import {getExtVersion, isProdVersion} from '../common/extUtils.js';
import {ensureOptPermissions, grantedOptPermissions, missingPermissions} from '../common/optionsPermissions.js';
import {cleanUpOptions, optionsPrototype, specialOptions} from '../common/optionsUtils.js';
@@ -19,7 +19,7 @@
// Get a URL to a document which is part of the extension documentation
// (autodetect the appropriate Git ref)
function getDocURL(doc) {
- if (!isReleaseVersion()) return getDocURLWithRef(doc, 'HEAD');
+ if (!isProdVersion()) return getDocURLWithRef(doc, 'HEAD');
var version = getExtVersion();
return getDocURLWithRef(doc, 'refs/tags/v' + version);
@@ -96,7 +96,7 @@
window.addEventListener('load', function() {
if (window.CONTEXT == 'options') {
- if (!isReleaseVersion()) {
+ if (!isProdVersion()) {
var experimentsLink = document.querySelector('.experiments-link');
experimentsLink.removeAttribute('hidden');
experimentsLink.addEventListener('click', _ => chrome.tabs.create({
diff --git a/webpack.config.js b/webpack.config.js
index 90f67b6..486a408 100644
--- a/webpack.config.js
+++ b/webpack.config.js
@@ -65,6 +65,7 @@
params: {
browser_target: env.browser_target,
production: args.mode == 'production',
+ canary: !!env.canary
},
},
};