Skip to content

Commit

Permalink
fix ArrayBuffer.length in V8 ~ Chrome 27-
Browse files Browse the repository at this point in the history
  • Loading branch information
zloirock committed Aug 19, 2022
1 parent c9aff1b commit 95fc85d
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
- Avoid unnecessary promise creation and do not validate result in `%WrapForValid(Async)IteratorPrototype%.return`, [proposal-iterator-helpers/215](https://github.com/tc39/proposal-iterator-helpers/pull/215)
- Fixed the order creation of properties of iteration result object of some iterators (`value` should be created before `done`)
- Fixed some cases of Safari < 13 bug - silent on non-writable array `.length` setting
- Fixed `ArrayBuffer.length` in V8 ~ Chrome 27-
- Relaxed condition of re-usage native `WeakMap` for internal states with multiple `core-js` copies
- Availability cloning of `FileList` in the `structuredClone` polyfill extended to some more old engines versions
- Some stylistic changes
Expand Down
2 changes: 1 addition & 1 deletion packages/core-js-compat/src/data.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ export const data = {
},
'es.array-buffer.constructor': {
bun: '0.1.1',
chrome: '26',
chrome: '28',
edge: '14',
firefox: '44',
hermes: '0.1',
Expand Down
4 changes: 2 additions & 2 deletions packages/core-js/internals/array-buffer.js
Original file line number Diff line number Diff line change
Expand Up @@ -197,9 +197,9 @@ if (!NATIVE_ARRAY_BUFFER) {
new NativeArrayBuffer();
new NativeArrayBuffer(1.5);
new NativeArrayBuffer(NaN);
return INCORRECT_ARRAY_BUFFER_NAME && !CONFIGURABLE_FUNCTION_NAME;
return NativeArrayBuffer.length != 1 || INCORRECT_ARRAY_BUFFER_NAME && !CONFIGURABLE_FUNCTION_NAME;
})) {
/* eslint-enable no-new -- required for testing */
/* eslint-enable no-new -- required for testing */
$ArrayBuffer = function ArrayBuffer(length) {
anInstance(this, ArrayBufferPrototype);
return new NativeArrayBuffer(toIndex(length));
Expand Down
2 changes: 1 addition & 1 deletion tests/compat/tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,7 @@ GLOBAL.tests = {
new ArrayBuffer();
new ArrayBuffer(1.5);
new ArrayBuffer(NaN);
return ArrayBuffer.name == 'ArrayBuffer';
return ArrayBuffer.length == 1 && ArrayBuffer.name == 'ArrayBuffer';
}],
'es.array-buffer.is-view': [ARRAY_BUFFER_VIEWS_SUPPORT, function () {
return ArrayBuffer.isView;
Expand Down

0 comments on commit 95fc85d

Please sign in to comment.