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 — diagnostics_channel: validate before channel activation · nodejs/node@755c2cf

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • lib
    • diagnostics_channel.js
  • test/parallel
    • test-diagnostics-channel-object-channel-pub-sub.js
    • test-diagnostics-channel-pub-sub.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎lib/diagnostics_channel.js‎

Copy file name to clipboardExpand all lines: lib/diagnostics_channel.js
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,7 @@ class Channel {
205205
}
206206

207207
subscribe(subscription) {
208+
validateFunction(subscription, 'subscription');
208209
markActive(this);
209210
this.subscribe(subscription);
210211
}
Collapse file

‎test/parallel/test-diagnostics-channel-object-channel-pub-sub.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-diagnostics-channel-object-channel-pub-sub.js
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,5 @@ assert.ok(!channel.unsubscribe(subscriber));
4444
assert.throws(() => {
4545
channel.subscribe(null);
4646
}, { code: 'ERR_INVALID_ARG_TYPE' });
47+
assert.ok(!channel.hasSubscribers);
48+
assert.ok(!dc.hasSubscribers('test'));
Collapse file

‎test/parallel/test-diagnostics-channel-pub-sub.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-diagnostics-channel-pub-sub.js
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ assert.ok(!dc.unsubscribe(name, subscriber));
4242
assert.throws(() => {
4343
dc.subscribe(name, null);
4444
}, { code: 'ERR_INVALID_ARG_TYPE' });
45+
assert.ok(!channel.hasSubscribers);
46+
assert.ok(!dc.hasSubscribers(name));
4547

4648
// Reaching zero subscribers should not delete from the channels map as there
4749
// will be no more weakref to incRef if another subscribe happens while the

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.