For modern bundles, treat Chromium and "Headless Chrome" the same as Chrome.

Best I can tell, the major version portion of Chromium versions has always
tracked all the way through to Chrome Canary, Dev and Stable releases.
Since we observe the major version of Chrome in terms of identifying it as a
"modern browser", it seems to make sense to treat "Headless Chrome" and
Chromium in the same regard.

Interestingly, when the same Chrome as we all use on our machines is run
with the `--headless` flag, it switches its `navigator.userAgent` to
`HeadlessChrome/`, rather than `Chrome/`.

This was initially problematic since the `useragent` npm we use for parsing
user agents didn't understand this designation, however, with the update of
`webapp`'s `useragent` npm in 058351b7, `headlesschrome` will now have its
version available from `WebAppInternals.identifyBrowser`, so we can
accurately identify it and serve it the modern bundle.
This commit is contained in:
Jesse Rosenberger
2018-11-14 11:35:25 +02:00
committed by Ben Newman
parent 5e98790291
commit 128c9311ea

View File

@@ -1,15 +1,24 @@
const minimumVersions = Object.create(null);
const hasOwn = Object.prototype.hasOwnProperty;
// By default, any minimum versions specified for chrome should apply to
// chromeMobile too, per https://github.com/meteor/meteor/pull/9793,
// though it should also be possible to specify minimum versions
// specifically for chromeMobile. This map defines that aliasing behavior
// in a generic way that could work for other browsers as well.
// This map defines aliasing behavior in a generic way which still permits
// minimum versions to be specified for a specific browser family.
const browserAliases = {
chrome: [
// chromeMobile*, per https://github.com/meteor/meteor/pull/9793,
"chromeMobile",
"chromeMobileIOS",
// The major version number of Chromium and Headless Chrome track with the
// releases of Chrome Dev, Canary and Stable, so we should be okay to
// alias them to Chrome in a generic sense.
// https://www.chromium.org/developers/version-numbers
//
// Chromium is particularly important to list here since, unlike macOS
// builds, Linux builds list Chromium in the userAgent along with Chrome:
// e.g. Chromium/70.0.3538.77 Chrome/70.0.3538.77
"chromium",
"headlesschrome",
],
// If a call to setMinimumBrowserVersions specifies Edge 12 as a minimum