fix(kill-switch): handle non-semver extension versions well

This change makes the extension convert non-semver versions to semver
versions so the kill switch logic can correctly compare the extension
version with the affected versions range set in kill switches.

It does so by only allowing version numbers to have 3 parts, and
stripping further sub-versioning. In the canary version, version numbers
consist of 4 parts (the latest version number followed by a dot and the
number of commits made since that release). Thus, this fixes an issue in
the kill switch logic for the canary channel.

Fixed: twpowertools:189
Change-Id: Iee62f75c38e73b39786a0fc05de6e827edd4c8a2
diff --git a/src/common/extUtils.js b/src/common/extUtils.js
index 39cf196..591d810 100644
--- a/src/common/extUtils.js
+++ b/src/common/extUtils.js
@@ -14,6 +14,13 @@
   return manifest?.version;
 }
 
+// Returns a semver-compatible extension version
+export function getSemVerExtVersion() {
+  const version = getExtVersion();
+  if (!(typeof version === 'string')) return null;
+  return version.match(/^[^.]*(?:\.[^.]*){0,2}/)?.[0] ?? null;
+}
+
 // Get a URL to a document which is part of the extension documentation (using
 // |ref| as the Git ref).
 export function getDocURLWithRef(doc, ref) {