GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — stream: reject duplicate nested transferables · nodejs/node@cfb1fa9

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • src
    • node_messaging.cc
  • test
    • parallel
      • test-whatwg-webstreams-transform-stream-members.js
    • wpt/status
      • streams.json
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎src/node_messaging.cc‎

Copy file name to clipboardExpand all lines: src/node_messaging.cc
+7-2Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -415,10 +415,15 @@ class SerializerDelegate : public ValueSerializer::Delegate {
415415
if (!host_objects_[i]->NestedTransferables().To(&nested_transferables))
416416
return Nothing<bool>();
417417
for (auto& nested_transferable : nested_transferables) {
418-
if (std::ranges::find(host_objects_, nested_transferable) ==
418+
if (std::ranges::find(host_objects_, nested_transferable) !=
419419
host_objects_.end()) {
420-
AddHostObject(nested_transferable);
420+
ThrowDataCloneException(
421+
context_,
422+
FIXED_ONE_BYTE_STRING(env_->isolate(),
423+
"The transfer list is invalid."));
424+
return Nothing<bool>();
421425
}
426+
AddHostObject(nested_transferable);
422427
}
423428
}
424429
return Just(true);
Collapse file

‎test/parallel/test-whatwg-webstreams-transform-stream-members.js‎

Copy file name to clipboard
+19Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
'use strict';
2+
3+
require('../common');
4+
const assert = require('node:assert');
5+
6+
const combinations = [
7+
((t) => [t, t.readable])(new TransformStream()),
8+
((t) => [t.readable, t])(new TransformStream()),
9+
((t) => [t, t.writable])(new TransformStream()),
10+
((t) => [t.writable, t])(new TransformStream()),
11+
];
12+
13+
for (const combination of combinations) {
14+
assert.throws(() => structuredClone(combination, { transfer: combination }), {
15+
constructor: DOMException,
16+
name: 'DataCloneError',
17+
code: 25,
18+
});
19+
}
Collapse file

‎test/wpt/status/streams.json‎

Copy file name to clipboardExpand all lines: test/wpt/status/streams.json
-8Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,6 @@
4141
"transferable/transfer-with-messageport.window.js": {
4242
"skip": "Browser-specific test"
4343
},
44-
"transferable/transform-stream-members.any.js": {
45-
"fail": {
46-
"expected": [
47-
"Transferring [object TransformStream],[object ReadableStream] should fail",
48-
"Transferring [object TransformStream],[object WritableStream] should fail"
49-
]
50-
}
51-
},
5244
"transform-streams/invalid-realm.tentative.window.js": {
5345
"skip": "Browser-specific test"
5446
}

0 commit comments

Comments
0 (0)
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.