Skip to content

Commit d76041c

Browse files
committed
update lists of [Serializable] and [Transferable] objects in the structuredClone polyfill
1 parent fd7812a commit d76041c

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
## Changelog
22
##### Unreleased
33
- Added a workaround of a Nashorn bug with `Function.prototype.{ call, apply, bind }` on string methods, [#1128](https://github.com/zloirock/core-js/issues/1128)
4+
- Updated lists of `[Serializable]` and `[Transferable]` objects in the `structuredClone` polyfill. Mainly, for better error messages if polyfilling of cloning such types is impossible
45
- `Array.prototype.{ group, groupToMap }` marked as [supported from V8 ~ Chromium 108](https://chromestatus.com/feature/5714791975878656)
56
- Added Electron 22 compat data mapping
67

packages/core-js/modules/web.structured-clone.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -371,9 +371,13 @@ var structuredCloneInternal = function (value, map) {
371371
} catch (error) {
372372
throwUnpolyfillable(type);
373373
} break;
374+
case 'CropTarget':
374375
case 'CryptoKey':
375-
case 'GPUCompilationMessage':
376+
case 'FileSystemDirectoryHandle':
377+
case 'FileSystemFileHandle':
378+
case 'FileSystemHandle':
376379
case 'GPUCompilationInfo':
380+
case 'GPUCompilationMessage':
377381
case 'ImageBitmap':
378382
case 'RTCCertificate':
379383
case 'WebAssembly.Module':
@@ -472,6 +476,7 @@ var tryToTransfer = function (rawTransfer, map) {
472476
} catch (error) { /* empty */ }
473477
break;
474478
case 'ArrayBuffer':
479+
case 'MediaSourceHandle':
475480
case 'MessagePort':
476481
case 'OffscreenCanvas':
477482
case 'ReadableStream':
@@ -485,6 +490,8 @@ var tryToTransfer = function (rawTransfer, map) {
485490
}
486491
};
487492

493+
// `structuredClone` method
494+
// https://html.spec.whatwg.org/multipage/structured-data.html#dom-structuredclone
488495
$({ global: true, enumerable: true, sham: !PROPER_TRANSFER, forced: FORCED_REPLACEMENT }, {
489496
structuredClone: function structuredClone(value /* , { transfer } */) {
490497
var options = validateArgumentsLength(arguments.length, 1) > 1 && !isNullOrUndefined(arguments[1]) ? anObject(arguments[1]) : undefined;

0 commit comments

Comments
 (0)