Skip to content

Commit

Permalink
consider ArrayBuffer and DataView as existent in `web.structured-…
Browse files Browse the repository at this point in the history
…clone`
  • Loading branch information
zloirock committed Dec 9, 2023
1 parent 712bead commit 548da11
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions packages/core-js/modules/web.structured-clone.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ var Array = global.Array;
var Date = global.Date;
var Error = global.Error;
var TypeError = global.TypeError;
var ArrayBuffer = global.ArrayBuffer;
var DataView = global.DataView;
var getUint8 = uncurryThis(DataView.prototype.getUint8);
var setUint8 = uncurryThis(DataView.prototype.setUint8);
var PerformanceMark = global.PerformanceMark;
// dependency: web.dom-exception.constructor
var DOMException = getBuiltIn('DOMException');
Expand Down Expand Up @@ -150,11 +154,6 @@ var cloneBuffer = function (value, map, $type) {
// SharedArrayBuffer should use shared memory, we can't polyfill it, so return the original
else clone = value;
} else {
var DataView = global.DataView;

// `ArrayBuffer#slice` is not available in IE10
// `ArrayBuffer#slice` and `DataView` are not available in old FF
if (!DataView && !isCallable(value.slice)) throwUnpolyfillable('ArrayBuffer');
// detached buffers throws in `DataView` and `.slice`
try {
if (isCallable(value.slice) && !value.resizable) {
Expand All @@ -167,7 +166,7 @@ var cloneBuffer = function (value, map, $type) {
source = new DataView(value);
target = new DataView(clone);
for (i = 0; i < length; i++) {
target.setUint8(i, source.getUint8(i));
setUint8(target, i, getUint8(source, i));
}
}
} catch (error) {
Expand Down

0 comments on commit 548da11

Please sign in to comment.