From 53d3853de01835a1ba98a31da44c90805d26fd5b Mon Sep 17 00:00:00 2001 From: Stephen McGruer Date: Thu, 4 Mar 2021 08:31:37 -0500 Subject: [PATCH] [WIP] Remove Edge from the default browser set --- webapp/components/product-info.js | 22 +++++++++++++++++++++- webapp/components/wpt-flags.js | 6 ++++++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/webapp/components/product-info.js b/webapp/components/product-info.js index fc62922fb1f..42f12ca9199 100644 --- a/webapp/components/product-info.js +++ b/webapp/components/product-info.js @@ -3,6 +3,7 @@ * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ + const DisplayNames = (() => { let m = new Map(); ['chrome', 'chrome-experimental'].forEach(n => m.set(n, 'Chrome')); @@ -42,7 +43,15 @@ const AllBrowserNames = Object.freeze(['chrome', 'edge', 'firefox', 'safari', 's // The list of default browsers used in cases where the user has not otherwise // chosen a set of browsers (e.g. which browsers to show runs for). Stored as // an ordered list so that the first entry can be used as a consistent default. -const DefaultBrowserNames = Object.freeze(['chrome', 'edge', 'firefox', 'safari']); +// +// Historically Edge was included in the default browsers, but it was removed +// to show only one browser per engine +// (https://github.com/web-platform-tests/wpt.fyi/issues/1519). For user +// convenience, there is a flag to include it in the default set again. +const DefaultBrowserNames = edgeIsDefaultProduct() + ? Object.freeze(['chrome', 'edge', 'firefox', 'safari']) + : Object.freeze(['chrome', 'firefox', 'safari']); +console.log(DefaultBrowserNames); const DefaultProductSpecs = DefaultBrowserNames; // The above sets, encoded as product objects. This avoids repeatedly calling @@ -59,6 +68,17 @@ const SemanticLabels = [ { property: '_source', values: Sources }, ]; +function edgeIsDefaultProduct() { + // Preferably we would use the WPTFlags class here, but it expects to be a + // super-class wrapping a Polymer element to work. Instead we use our + // knowledge of its internal implementation to go straight to local storage. + const value = localStorage.getItem('features.edgeIsDefaultProduct'); + console.log(value); + console.log(value !== null); + console.log(JSON.parse(value)); + return value !== null && JSON.parse(value); +} + function parseProductSpec(spec) { // @sha (optional) let revision = ''; diff --git a/webapp/components/wpt-flags.js b/webapp/components/wpt-flags.js index bf211ef6989..940b8c8eec5 100644 --- a/webapp/components/wpt-flags.js +++ b/webapp/components/wpt-flags.js @@ -21,6 +21,7 @@ Object.defineProperty(wpt, 'ClientSideFeatures', { 'colorHomepage', 'diffFromAPI', 'displayMetadata', + 'edgeIsDefaultProduct', 'experimentalByDefault', 'experimentalAligned', 'experimentalAlignedExceptEdge', @@ -183,6 +184,11 @@ class WPTFlagsEditor extends FlagsEditorClass(/*environmentFlags*/ false) { Use pass-rate colors on the homepage + + + Include Edge as part of the default product set. + + Interpret query strings as structured queries over test names and test