(closedPort, potentiallyOpenPort)
| 14 | port2.onmessage = common.mustNotCall(); |
| 15 | |
| 16 | function testSingle(closedPort, potentiallyOpenPort) { |
| 17 | assert.throws(common.mustCall(() => { |
| 18 | potentiallyOpenPort.postMessage(null, [arrayBuf, closedPort]); |
| 19 | }), common.mustCall((err) => { |
| 20 | assert.strictEqual(err.name, 'DataCloneError'); |
| 21 | assert.strictEqual(err.message, |
| 22 | 'MessagePort in transfer list is already detached'); |
| 23 | assert.strictEqual(err.code, 25); |
| 24 | assert.ok(err instanceof Error); |
| 25 | |
| 26 | const DOMException = err.constructor; |
| 27 | assert.ok(err instanceof DOMException); |
| 28 | assert.strictEqual(DOMException.name, 'DOMException'); |
| 29 | |
| 30 | return true; |
| 31 | })); |
| 32 | |
| 33 | // arrayBuf must not be transferred, even though it is present earlier in the |
| 34 | // transfer list than the closedPort. |
| 35 | assert.strictEqual(arrayBuf.byteLength, 10); |
| 36 | } |
| 37 | |
| 38 | function testBothClosed() { |
| 39 | testSingle(port1, port2); |
no test coverage detected
searching dependent graphs…