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 — worker: add Symbol.toStringTag to BroadcastChannel · nodejs/node@818c49c

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • lib/internal/worker
    • io.js
  • test/parallel
    • test-messaging-string-tag.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎lib/internal/worker/io.js‎

Copy file name to clipboardExpand all lines: lib/internal/worker/io.js
+11Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,12 +211,16 @@ ObjectDefineProperty(MessagePort.prototype, inspect.custom, {
211211

212212
ObjectDefineProperty(MessagePort.prototype, SymbolToStringTag, {
213213
__proto__: null,
214+
writable: false,
215+
enumerable: false,
214216
configurable: true,
215217
value: 'MessagePort',
216218
});
217219

218220
ObjectDefineProperty(MessageChannel.prototype, SymbolToStringTag, {
219221
__proto__: null,
222+
writable: false,
223+
enumerable: false,
220224
configurable: true,
221225
value: 'MessageChannel',
222226
});
@@ -474,6 +478,13 @@ class BroadcastChannel extends EventTarget {
474478
}
475479

476480
ObjectDefineProperties(BroadcastChannel.prototype, {
481+
[SymbolToStringTag]: {
482+
__proto__: null,
483+
writable: false,
484+
enumerable: false,
485+
configurable: true,
486+
value: 'BroadcastChannel',
487+
},
477488
name: kEnumerableProperty,
478489
close: kEnumerableProperty,
479490
postMessage: kEnumerableProperty,
Collapse file

‎…rallel/test-messagechannel-string-tag.js‎ ‎…st/parallel/test-messaging-string-tag.js‎test/parallel/test-messagechannel-string-tag.js renamed to test/parallel/test-messaging-string-tag.js test/parallel/test-messagechannel-string-tag.js renamed to test/parallel/test-messaging-string-tag.js

Copy file name to clipboardExpand all lines: test/parallel/test-messaging-string-tag.js
+5-1Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ require('../common');
44

55
const assert = require('assert');
66

7-
const classesToBeTested = [ MessageChannel, MessagePort ];
7+
const classesToBeTested = [ MessageChannel, MessagePort, BroadcastChannel ];
88

99
classesToBeTested.forEach((cls) => {
1010
assert.strictEqual(cls.prototype[Symbol.toStringTag], cls.name);
@@ -15,3 +15,7 @@ classesToBeTested.forEach((cls) => {
1515
const channel = new MessageChannel();
1616
assert.strictEqual(Object.prototype.toString.call(channel), '[object MessageChannel]');
1717
assert.strictEqual(Object.prototype.toString.call(channel.port1), '[object MessagePort]');
18+
19+
const broadcastChannel = new BroadcastChannel('string-tag');
20+
assert.strictEqual(Object.prototype.toString.call(broadcastChannel), '[object BroadcastChannel]');
21+
broadcastChannel.close();

0 commit comments

Comments
0 (0)
You are visitor 01402792 — 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.