Skip to content

Commit

Permalink
fix subclassing of wrapped ArrayBuffer
Browse files Browse the repository at this point in the history
  • Loading branch information
zloirock committed Dec 26, 2023
1 parent df48f21 commit 87540ce
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
## Changelog
##### Unreleased
- Fixed handling some cases of non-enumerable symbol keys from `Symbol` polyfill
- Unneeded NodeJS domains-related logic removed from `queueMicrotask`
- Removed unneeded NodeJS domains-related logic from `queueMicrotask` polyfill
- Fixed subclassing of wrapped `ArrayBuffer`
- Refactoring, some optimizations
- Compat data improvements:
- [`Array.fromAsync`](https://github.com/tc39/proposal-array-from-async) marked as [supported from V8 ~ Chrome 121](https://bugs.chromium.org/p/v8/issues/detail?id=13321#c13)
Expand Down
3 changes: 2 additions & 1 deletion packages/core-js/internals/array-buffer.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ var getPrototypeOf = require('../internals/object-get-prototype-of');
var setPrototypeOf = require('../internals/object-set-prototype-of');
var arrayFill = require('../internals/array-fill');
var arraySlice = require('../internals/array-slice');
var inheritIfRequired = require('../internals/inherit-if-required');
var copyConstructorProperties = require('../internals/copy-constructor-properties');
var setToStringTag = require('../internals/set-to-string-tag');
var InternalStateModule = require('../internals/internal-state');
Expand Down Expand Up @@ -218,7 +219,7 @@ if (!NATIVE_ARRAY_BUFFER) {
/* eslint-enable no-new -- required for testing */
$ArrayBuffer = function ArrayBuffer(length) {
anInstance(this, ArrayBufferPrototype);
return new NativeArrayBuffer(toIndex(length));
return inheritIfRequired(new NativeArrayBuffer(toIndex(length)), this, $ArrayBuffer);
};

$ArrayBuffer[PROTOTYPE] = ArrayBufferPrototype;
Expand Down

0 comments on commit 87540ce

Please sign in to comment.