Skip to content

Commit

Permalink
update lists of [Serializable] and [Transferable] objects in the …
Browse files Browse the repository at this point in the history
…`structuredClone` polyfill
  • Loading branch information
zloirock committed Oct 2, 2022
1 parent fd7812a commit d76041c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
@@ -1,6 +1,7 @@
## Changelog
##### Unreleased
- 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)
- Updated lists of `[Serializable]` and `[Transferable]` objects in the `structuredClone` polyfill. Mainly, for better error messages if polyfilling of cloning such types is impossible
- `Array.prototype.{ group, groupToMap }` marked as [supported from V8 ~ Chromium 108](https://chromestatus.com/feature/5714791975878656)
- Added Electron 22 compat data mapping

Expand Down
9 changes: 8 additions & 1 deletion packages/core-js/modules/web.structured-clone.js
Expand Up @@ -371,9 +371,13 @@ var structuredCloneInternal = function (value, map) {
} catch (error) {
throwUnpolyfillable(type);
} break;
case 'CropTarget':
case 'CryptoKey':
case 'GPUCompilationMessage':
case 'FileSystemDirectoryHandle':
case 'FileSystemFileHandle':
case 'FileSystemHandle':
case 'GPUCompilationInfo':
case 'GPUCompilationMessage':
case 'ImageBitmap':
case 'RTCCertificate':
case 'WebAssembly.Module':
Expand Down Expand Up @@ -472,6 +476,7 @@ var tryToTransfer = function (rawTransfer, map) {
} catch (error) { /* empty */ }
break;
case 'ArrayBuffer':
case 'MediaSourceHandle':
case 'MessagePort':
case 'OffscreenCanvas':
case 'ReadableStream':
Expand All @@ -485,6 +490,8 @@ var tryToTransfer = function (rawTransfer, map) {
}
};

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

0 comments on commit d76041c

Please sign in to comment.