Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(schemas/browsers)!: merge accepts_{flags,webextension} fields into accepts array #25825

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions browsers/chrome.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@
"type": "desktop",
"preview_name": "Canary",
"pref_url": "chrome://flags",
"accepts_flags": true,
"accepts_webextensions": true,
"accepts": {
"flags": true,
"webextensions": true
},
"releases": {
"1": {
"release_date": "2008-12-11",
Expand Down
5 changes: 3 additions & 2 deletions browsers/chrome_android.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@
"type": "mobile",
"upstream": "chrome",
"pref_url": "chrome://flags",
"accepts_flags": true,
"accepts_webextensions": false,
"accepts": {
"flags": true
},
"releases": {
"18": {
"release_date": "2012-06-27",
Expand Down
5 changes: 3 additions & 2 deletions browsers/deno.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
"deno": {
"name": "Deno",
"type": "server",
"accepts_flags": true,
"accepts_webextensions": false,
"accepts": {
"flags": true
},
"releases": {
"1.0": {
"release_date": "2020-05-13",
Expand Down
6 changes: 4 additions & 2 deletions browsers/edge.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@
"type": "desktop",
"upstream": "chrome",
"pref_url": "about:flags",
"accepts_flags": true,
"accepts_webextensions": true,
"accepts": {
"flags": true,
"webextensions": true
},
"releases": {
"12": {
"release_date": "2015-07-29",
Expand Down
6 changes: 4 additions & 2 deletions browsers/firefox.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@
"type": "desktop",
"preview_name": "Nightly",
"pref_url": "about:config",
"accepts_flags": true,
"accepts_webextensions": true,
"accepts": {
"flags": true,
"webextensions": true
},
"releases": {
"1": {
"release_date": "2004-11-09",
Expand Down
5 changes: 3 additions & 2 deletions browsers/firefox_android.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@
"type": "mobile",
"upstream": "firefox",
"pref_url": "about:config",
"accepts_flags": false,
"accepts_webextensions": true,
"accepts": {
"webextensions": true
},
"releases": {
"4": {
"release_date": "2011-03-29",
Expand Down
3 changes: 1 addition & 2 deletions browsers/ie.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
"ie": {
"name": "Internet Explorer",
"type": "desktop",
"accepts_flags": false,
"accepts_webextensions": false,
"accepts": {},
"releases": {
"1": {
"release_date": "1995-08-16",
Expand Down
5 changes: 3 additions & 2 deletions browsers/nodejs.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
"nodejs": {
"name": "Node.js",
"type": "server",
"accepts_flags": true,
"accepts_webextensions": false,
"accepts": {
"flags": true
},
"releases": {
"0.10.0": {
"release_date": "2013-03-11",
Expand Down
5 changes: 3 additions & 2 deletions browsers/oculus.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@
"type": "xr",
"upstream": "chrome_android",
"pref_url": "chrome://flags",
"accepts_flags": true,
"accepts_webextensions": false,
"accepts": {
"flags": true
},
"releases": {
"5.0": {
"release_notes": "https://developer.oculus.com/documentation/web/browser-release-notes/#oculus-browser-50",
Expand Down
6 changes: 4 additions & 2 deletions browsers/opera.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@
"type": "desktop",
"upstream": "chrome",
"pref_url": "opera://flags",
"accepts_flags": true,
"accepts_webextensions": true,
"accepts": {
"flags": true,
"webextensions": true
},
"releases": {
"2": {
"release_date": "1996-07-14",
Expand Down
3 changes: 1 addition & 2 deletions browsers/opera_android.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
"name": "Opera Android",
"type": "mobile",
"upstream": "chrome_android",
"accepts_flags": false,
"accepts_webextensions": false,
"accepts": {},
"releases": {
"10.1": {
"release_date": "2010-11-09",
Expand Down
6 changes: 4 additions & 2 deletions browsers/safari.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@
"name": "Safari",
"type": "desktop",
"preview_name": "TP",
"accepts_flags": true,
"accepts_webextensions": true,
"accepts": {
"flags": true,
"webextensions": true
},
"releases": {
"1": {
"release_date": "2003-06-23",
Expand Down
6 changes: 4 additions & 2 deletions browsers/safari_ios.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@
"name": "Safari on iOS",
"type": "mobile",
"upstream": "safari",
"accepts_flags": true,
"accepts_webextensions": true,
"accepts": {
"flags": true,
"webextensions": true
},
"releases": {
"1": {
"release_date": "2007-06-29",
Expand Down
3 changes: 1 addition & 2 deletions browsers/samsunginternet_android.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
"name": "Samsung Internet",
"type": "mobile",
"upstream": "chrome_android",
"accepts_flags": false,
"accepts_webextensions": false,
"accepts": {},
"releases": {
"1.0": {
"release_date": "2013-04-27",
Expand Down
3 changes: 1 addition & 2 deletions browsers/webview_android.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
"name": "WebView Android",
"type": "mobile",
"upstream": "chrome_android",
"accepts_flags": false,
"accepts_webextensions": false,
"accepts": {},
"releases": {
"1": {
"release_date": "2008-09-23",
Expand Down
3 changes: 1 addition & 2 deletions browsers/webview_ios.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
"name": "WebView on iOS",
"type": "mobile",
"upstream": "safari_ios",
"accepts_flags": false,
"accepts_webextensions": false,
"accepts": {},
"releases": {
"1": {
"release_date": "2007-06-29",
Expand Down
28 changes: 16 additions & 12 deletions lint/linter/test-browsers-data.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ describe('test-browsers-data', () => {
const data: BrowserStatement = {
name: 'Node.js',
type: 'server',
accepts_flags: true,
accepts_webextensions: false,
accepts: {
flags: true,
},
releases: {
'20.6.0': {
release_date: '2023-09-04',
Expand All @@ -43,8 +44,10 @@ describe('test-browsers-data', () => {
const data: BrowserStatement = {
name: 'Firefox',
type: 'desktop',
accepts_flags: true,
accepts_webextensions: true,
accepts: {
flags: true,
webextensions: true,
},
releases: {
'1': { status: 'nightly' },
'2': { status: 'nightly' },
Expand All @@ -59,8 +62,9 @@ describe('test-browsers-data', () => {
const data: BrowserStatement = {
name: 'Node.js',
type: 'server',
accepts_flags: true,
accepts_webextensions: false,
accepts: {
flags: true,
},
releases: {
'1': { status: 'nightly' },
'2': { status: 'nightly' },
Expand All @@ -76,8 +80,7 @@ describe('test-browsers-data', () => {
name: 'Safari iOS',
type: 'mobile',
upstream: browser,
accepts_flags: false,
accepts_webextensions: false,
accepts: {},
releases: {},
};

Expand All @@ -91,8 +94,7 @@ describe('test-browsers-data', () => {
name: 'Safari iOS',
type: 'mobile',
upstream: 'unknown' as any,
accepts_flags: false,
accepts_webextensions: false,
accepts: {},
releases: {},
};

Expand All @@ -107,8 +109,10 @@ describe('test-browsers-data', () => {
type: 'desktop',
upstream: 'chrome',
pref_url: 'opera://flags',
accepts_flags: true,
accepts_webextensions: true,
accepts: {
flags: true,
webextensions: true,
},
releases: {
'97': {
status: 'retired',
Expand Down
4 changes: 2 additions & 2 deletions lint/linter/test-browsers-presence.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,14 @@ const processData = (
? ['server']
: []),
].includes(browsers[b].type) &&
(category !== 'webextensions' || browsers[b].accepts_webextensions),
(category !== 'webextensions' || browsers[b].accepts.webextensions),
);
const requiredBrowsers = (
Object.keys(browsers) as (keyof typeof browsers)[]
).filter(
(b) =>
browsers[b].type == 'desktop' &&
(category !== 'webextensions' || browsers[b].accepts_webextensions),
(category !== 'webextensions' || browsers[b].accepts.webextensions),
);

const undefEntries = definedBrowsers.filter(
Expand Down
2 changes: 1 addition & 1 deletion lint/linter/test-mirror.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const checkMirroring = (
): void => {
const browsersToCheck = Object.keys(browsers)
.filter((b) =>
category === 'webextensions' ? browsers[b].accepts_webextensions : !!b,
category === 'webextensions' ? browsers[b].accepts.webextensions : !!b,
)
.filter((b) => browsers[b].upstream) as BrowserName[];

Expand Down
4 changes: 2 additions & 2 deletions lint/linter/test-versions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ const checkVersions = (
logger: Logger,
): void => {
const browsersToCheck = Object.keys(browsers).filter((b) =>
category === 'webextensions' ? browsers[b].accepts_webextensions : !!b,
category === 'webextensions' ? browsers[b].accepts.webextensions : !!b,
) as BrowserName[];

for (const browser of browsersToCheck) {
Expand Down Expand Up @@ -211,7 +211,7 @@ const checkVersions = (
}
}

if ('flags' in statement && !browsers[browser].accepts_flags) {
if ('flags' in statement && !browsers[browser].accepts.flags) {
logger.error(
chalk`This browser ({bold ${browser}}) does not support flags, so support cannot be behind a flag for this feature.`,
);
Expand Down
12 changes: 6 additions & 6 deletions schemas/browsers-schema.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ Below is an example of the browser data:
"type": "desktop",
"preview_name": "Nightly",
"pref_url": "about:config",
"accepts_flags": true,
"accepts_webextensions": true,
"accepts" ["flags", "webextensions"],
"releases": {
"1.5": {
"release_date": "2005-11-29",
Expand Down Expand Up @@ -46,13 +45,14 @@ The `type` string is a required property which indicates the platform category t

The `upstream` string is an optional property which indicates the upstream browser updates are derived from. For example, Firefox Android's upstream browser is Firefox (desktop), and Edge's upstream browser is Chrome. This is used for mirroring data between browsers. Valid options are any browser defined in the data.

### `accepts_flags`
### `accepts`

An optional boolean indicating whether the browser supports flags. If it is set to `false`, flag data will not be allowed for that browser.
An optional object indicating which additional features the browser supports. Possible properties are:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
An optional object indicating which additional features the browser supports. Possible properties are:
An object indicating which additional features the browser supports. Possible properties are:


### `accepts_webextensions`
- `flags` - if the browser supports flags.
- `webextensions` - if the browser supports web extensions.

An optional boolean indicating whether the browser supports web extensions. A `true` value will allow this browser to be defined in web extensions support.
The value is used to determine if support data for this feature can be added for the browser.

### `pref_url`

Expand Down
34 changes: 20 additions & 14 deletions schemas/browsers.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,10 @@
"type": "string",
"description": "URL of the page where feature flags can be changed (e.g. 'about:config' for Firefox or 'chrome://flags' for Chrome)."
},
"accepts_flags": {
"type": "boolean",
"description": "Whether the browser supports user-toggleable flags that enable or disable features."
},
"accepts_webextensions": {
"type": "boolean",
"description": "Whether the browser supports extensions."
"accepts": {
"$ref": "#/definitions/accepts_statement",
"description": "The additional features the browser supports.",
"tsType": "AcceptsStatement"
},
"releases": {
"type": "object",
Expand All @@ -87,13 +84,22 @@
"tsType": "{ [version: string]: ReleaseStatement };"
}
},
"required": [
"name",
"type",
"releases",
"accepts_flags",
"accepts_webextensions"
],
"required": ["name", "type", "releases", "accepts"],
"additionalProperties": false
},

"accepts_statement": {
"type": "object",
"properties": {
"flags": {
"type": "boolean",
"description": "Whether the browser supports user-toggleable flags that enable or disable features."
},
"webextensions": {
"type": "boolean",
"description": "Whether the browser supports extensions."
}
},
"additionalProperties": false
},

Expand Down
2 changes: 1 addition & 1 deletion scripts/build/mirror.ts
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ export const bumpSupport = (

const newData: SimpleSupportStatement = copyStatement(sourceData);

if (!browsers[destination].accepts_flags && newData.flags) {
if (!browsers[destination].accepts.flags && newData.flags) {
// Remove flag data if the target browser doesn't accept flags
return { version_added: false };
}
Expand Down
3 changes: 1 addition & 2 deletions scripts/lib/stringify-and-order-properties.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ const propOrder = {
'upstream',
'preview_name',
'pref_url',
'accepts_flags',
'accepts_webextensions',
'accepts',
'releases',
],
release: [
Expand Down
Loading