diff --git a/unittest/unit/bcd.test.js b/unittest/unit/bcd.test.js index d5909318b..6dc1ace2d 100644 --- a/unittest/unit/bcd.test.js +++ b/unittest/unit/bcd.test.js @@ -79,6 +79,32 @@ export default { } } }, + UnflaggedInterface: { + __compat: { + support: { + chrome: [ + { + version_added: '83', + flags: {}, + notes: 'Not supported on Windows XP.' + } + ] + } + } + }, + UnprefixedInterface: { + __compat: { + support: { + chrome: [ + { + version_added: '83', + prefix: 'webkit', + notes: 'Not supported on Windows XP.' + } + ] + } + } + }, NullAPI: { __compat: {support: {chrome: {version_added: '80'}}} }, diff --git a/unittest/unit/update-bcd.ts b/unittest/unit/update-bcd.ts index 7c987fa1c..4c9c7a0c2 100644 --- a/unittest/unit/update-bcd.ts +++ b/unittest/unit/update-bcd.ts @@ -67,6 +67,16 @@ const reports: Report[] = [ exposure: 'Window', result: true }, + { + name: 'api.UnflaggedInterface', + exposure: 'Window', + result: null + }, + { + name: 'api.UnprefixedInterface', + exposure: 'Window', + result: null + }, { name: 'api.NullAPI', exposure: 'Window', @@ -147,6 +157,16 @@ const reports: Report[] = [ exposure: 'Window', result: true }, + { + name: 'api.UnflaggedInterface', + exposure: 'Window', + result: true + }, + { + name: 'api.UnprefixedInterface', + exposure: 'Window', + result: true + }, { name: 'api.NewInterfaceNotInBCD', exposure: 'Window', @@ -226,6 +246,16 @@ const reports: Report[] = [ exposure: 'Window', result: true }, + { + name: 'api.UnflaggedInterface', + exposure: 'Window', + result: true + }, + { + name: 'api.UnprefixedInterface', + exposure: 'Window', + result: true + }, { name: 'api.NewInterfaceNotInBCD', exposure: 'Window', @@ -353,6 +383,8 @@ describe('BCD updater', () => { ['api.AudioContext.close', false], ['api.DeprecatedInterface', true], ['api.ExperimentalInterface', true], + ['api.UnflaggedInterface', null], + ['api.UnprefixedInterface', null], ['api.NullAPI', null], ['api.RemovedInterface', true], ['api.SuperNewInterface', false], @@ -374,6 +406,8 @@ describe('BCD updater', () => { ['api.AudioContext.close', false], ['api.DeprecatedInterface', true], ['api.ExperimentalInterface', true], + ['api.UnflaggedInterface', true], + ['api.UnprefixedInterface', true], ['api.NewInterfaceNotInBCD', false], ['api.NullAPI', null], ['api.RemovedInterface', false], @@ -511,6 +545,34 @@ describe('BCD updater', () => { ] ]) ], + [ + 'api.UnflaggedInterface', + new Map([ + [ + 'chrome', + new Map([ + ['82', null], + ['83', null], + ['84', true], + ['85', true] + ]) + ] + ]) + ], + [ + 'api.UnprefixedInterface', + new Map([ + [ + 'chrome', + new Map([ + ['82', null], + ['83', null], + ['84', true], + ['85', true] + ]) + ] + ]) + ], [ 'api.NewInterfaceNotInBCD', new Map([ @@ -648,6 +710,8 @@ describe('BCD updater', () => { chrome: [{version_added: '0> ≤83', version_removed: '85'}] }, 'api.ExperimentalInterface': {chrome: [{version_added: '0> ≤83'}]}, + 'api.UnflaggedInterface': {chrome: [{version_added: '0> ≤84'}]}, + 'api.UnprefixedInterface': {chrome: [{version_added: '0> ≤84'}]}, 'api.NewInterfaceNotInBCD': {chrome: [{version_added: '85'}]}, 'api.NullAPI': {chrome: []}, 'api.RemovedInterface': { @@ -793,6 +857,31 @@ describe('BCD updater', () => { } } }, + UnflaggedInterface: { + __compat: { + support: { + chrome: { + version_added: '≤84' + } + } + } + }, + UnprefixedInterface: { + __compat: { + support: { + chrome: [ + { + version_added: '≤84' + }, + { + version_added: '83', + prefix: 'webkit', + notes: 'Not supported on Windows XP.' + } + ] + } + } + }, NullAPI: { __compat: {support: {chrome: {version_added: '80'}}} }, diff --git a/update-bcd.ts b/update-bcd.ts index 9094f41e7..e4d2749d8 100644 --- a/update-bcd.ts +++ b/update-bcd.ts @@ -363,10 +363,18 @@ export const update = ( inferredStatement.version_added = inferredStatement.version_added.replace('0> ', ''); } - allStatements.unshift(inferredStatement); + // Remove flag data for features which are enabled by default. + // + // See https://github.com/mdn/browser-compat-data/pull/16637 + const nonFlagStatements = allStatements.filter( + (statement) => !('flags' in statement) + ); entry.__compat.support[browser] = - allStatements.length === 1 ? allStatements[0] : allStatements; + nonFlagStatements.length === 0 + ? inferredStatement + : [inferredStatement].concat(nonFlagStatements); modified = true; + continue; }