-
Notifications
You must be signed in to change notification settings - Fork 15k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix:
BroadcastChannel
initialization location (#37444)
* fix: `BroadcastChannel` initialization location * fix: BroadcastChannel initialization location * chore: update patches --------- Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com> Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com> * Update .patches chore: fixup .patches file that trop botched * chore: update patches --------- Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com> Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com> Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org> Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
- Loading branch information
1 parent
269e7ba
commit 443699a
Showing
2 changed files
with
45 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
patches/node/lib_fix_broadcastchannel_initialization_location.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 | ||
From: Shelley Vohr <shelley.vohr@gmail.com> | ||
Date: Mon, 27 Feb 2023 12:56:15 +0100 | ||
Subject: lib: fix BroadcastChannel initialization location | ||
|
||
Refs https://github.com/nodejs/node/pull/40532. | ||
|
||
Fixes a bug in the above, wherein BroadcastChannel should have been | ||
initialized in bootstrap/browser instead of bootstrap/node. That | ||
inadvertently made it such that there was incorrect handling of the | ||
DOM vs Node.js implementations of BroadcastChannel. | ||
|
||
This will be upstreamed. | ||
|
||
diff --git a/lib/internal/bootstrap/browser.js b/lib/internal/bootstrap/browser.js | ||
index d0c01ca2a512be549b0fea8a829c05eabbec799a..210a1bb7e929021725b04786bc11d9b3ce09ad04 100644 | ||
--- a/lib/internal/bootstrap/browser.js | ||
+++ b/lib/internal/bootstrap/browser.js | ||
@@ -12,6 +12,10 @@ const { | ||
} = require('internal/util'); | ||
const config = internalBinding('config'); | ||
|
||
+// Non-standard extensions: | ||
+const { BroadcastChannel } = require('internal/worker/io'); | ||
+exposeInterface(globalThis, 'BroadcastChannel', BroadcastChannel); | ||
+ | ||
// https://console.spec.whatwg.org/#console-namespace | ||
exposeNamespace(globalThis, 'console', | ||
createGlobalConsole()); | ||
diff --git a/lib/internal/bootstrap/node.js b/lib/internal/bootstrap/node.js | ||
index 83ac636db19a66f43fc7d3c1fc1e8290eeadd334..cb5072df3c23b499292887c56501820aee5cbd0e 100644 | ||
--- a/lib/internal/bootstrap/node.js | ||
+++ b/lib/internal/bootstrap/node.js | ||
@@ -248,10 +248,6 @@ const { | ||
queueMicrotask | ||
} = require('internal/process/task_queues'); | ||
|
||
-// Non-standard extensions: | ||
-const { BroadcastChannel } = require('internal/worker/io'); | ||
-exposeInterface(globalThis, 'BroadcastChannel', BroadcastChannel); | ||
- | ||
defineOperation(globalThis, 'queueMicrotask', queueMicrotask); | ||
|
||
const timers = require('timers'); |