summaryrefslogtreecommitdiff
path: root/runtime/js/98_global_scope.js
diff options
context:
space:
mode:
authorJulien Cayzac <jcayzac@users.noreply.github.com>2023-12-08 22:24:49 +0900
committerGitHub <noreply@github.com>2023-12-08 14:24:49 +0100
commitca64771257d23ceee97e882965269702c359f6aa (patch)
tree7b348cdba31e60f7988c032672530a21fdeb2a56 /runtime/js/98_global_scope.js
parente15c735edee6a6faf17f618b245908f635a3d9a7 (diff)
fix(unstable): Honor granular unstable flags in js runtime (#21466)
This fixes #21434 for `BroadcastChannel` and `WebSocketStream`. `--unstable` still enable both, but granular unstable flags now also work: * `--unstable-net` now enables `WebSocketStream`. * `--unstable-broadcast-channel` now enables `BroadcastChannel`. * Additionally, there are now tests for all granular unstable flags. Since `unsafe-proto` already had tests, so I didn't add any for this one. It also introduces a map to keep track of granular unstable ids without having to sync multiple places.
Diffstat (limited to 'runtime/js/98_global_scope.js')
-rw-r--r--runtime/js/98_global_scope.js8
1 files changed, 6 insertions, 2 deletions
diff --git a/runtime/js/98_global_scope.js b/runtime/js/98_global_scope.js
index 56354948e..65a9c6933 100644
--- a/runtime/js/98_global_scope.js
+++ b/runtime/js/98_global_scope.js
@@ -42,6 +42,7 @@ import * as globalInterfaces from "ext:deno_web/04_global_interfaces.js";
import * as webStorage from "ext:deno_webstorage/01_webstorage.js";
import * as prompt from "ext:runtime/41_prompt.js";
import * as imageData from "ext:deno_web/16_image_data.js";
+import { unstableIds } from "ext:runtime/90_deno_ns.js";
// https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope
const windowOrWorkerGlobalScope = {
@@ -143,8 +144,11 @@ const windowOrWorkerGlobalScope = {
[webidl.brand]: util.nonEnumerable(webidl.brand),
};
-const unstableWindowOrWorkerGlobalScope = {
+const unstableForWindowOrWorkerGlobalScope = {};
+unstableForWindowOrWorkerGlobalScope[unstableIds.broadcastChannel] = {
BroadcastChannel: util.nonEnumerable(broadcastChannel.BroadcastChannel),
+};
+unstableForWindowOrWorkerGlobalScope[unstableIds.net] = {
WebSocketStream: util.nonEnumerable(webSocketStream.WebSocketStream),
};
@@ -312,7 +316,7 @@ const workerRuntimeGlobalProperties = {
export {
mainRuntimeGlobalProperties,
memoizeLazy,
- unstableWindowOrWorkerGlobalScope,
+ unstableForWindowOrWorkerGlobalScope,
windowOrWorkerGlobalScope,
workerRuntimeGlobalProperties,
};