diff --git a/CHANGELOG.md b/CHANGELOG.md index 6d493f729647..076dae3e49c3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ - Fixed some validation cases in `Object.setPrototypeOf`, [#1329](https://github.com/zloirock/core-js/issues/1329), thanks [**@minseok-choe**](https://github.com/minseok-choe) - Fixed the order of validations in `Array.from`, [#1331](https://github.com/zloirock/core-js/pull/1331), thanks [**@minseok-choe**](https://github.com/minseok-choe) - Added a fix of [Bun `queueMicrotask` arity](https://github.com/oven-sh/bun/issues/9249) +- Added a fix of [Bun `URL.canParse` arity](https://github.com/oven-sh/bun/issues/9250) - Compat data improvements: - Added React Native 0.74 Hermes compat data, `Array.prototype.{ toSpliced, toReversed, with }` and `atob` marked as supported - Added Deno 1.41.3 compat data mapping diff --git a/packages/core-js-compat/src/data.mjs b/packages/core-js-compat/src/data.mjs index ef22e19f72fe..bb215ac61099 100644 --- a/packages/core-js-compat/src/data.mjs +++ b/packages/core-js-compat/src/data.mjs @@ -2635,7 +2635,9 @@ export const data = { safari: '14.0', }, 'web.url.can-parse': { - bun: '1.0.2', + // Bun ~ 1.0.30 bug + // https://github.com/oven-sh/bun/issues/9250 + // bun: '1.0.2', chrome: '120', deno: '1.33.2', firefox: '115', diff --git a/packages/core-js/modules/web.url.can-parse.js b/packages/core-js/modules/web.url.can-parse.js index 874d88022054..4333553291b9 100644 --- a/packages/core-js/modules/web.url.can-parse.js +++ b/packages/core-js/modules/web.url.can-parse.js @@ -14,9 +14,15 @@ var THROWS_WITHOUT_ARGUMENTS = USE_NATIVE_URL && fails(function () { URL.canParse(); }); +// Bun ~ 1.0.30 bug +// https://github.com/oven-sh/bun/issues/9250 +var WRONG_ARITY = fails(function () { + return URL.canParse !== 1; +}); + // `URL.canParse` method // https://url.spec.whatwg.org/#dom-url-canparse -$({ target: 'URL', stat: true, forced: !THROWS_WITHOUT_ARGUMENTS }, { +$({ target: 'URL', stat: true, forced: !THROWS_WITHOUT_ARGUMENTS || WRONG_ARITY }, { canParse: function canParse(url) { var length = validateArgumentsLength(arguments.length, 1); var urlString = toString(url); diff --git a/tests/compat/tests.js b/tests/compat/tests.js index 0ae9d27fecd1..7f06686d6f22 100644 --- a/tests/compat/tests.js +++ b/tests/compat/tests.js @@ -1992,7 +1992,7 @@ GLOBAL.tests = { try { URL.canParse(); } catch (error) { - return URL.canParse; + return URL.canParse.length === 1; } }], 'web.url.to-json': [URL_AND_URL_SEARCH_PARAMS_SUPPORT, function () {