diff options
author | Yoshiya Hinosawa <stibium121@gmail.com> | 2024-08-17 11:16:43 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-08-17 11:16:43 +0900 |
commit | b6cdb31c0591ffd4dd9fee7a44554f5d915ba58e (patch) | |
tree | b815eb1d3c847b1a57b04631c6e6dc246baaffaa /tests/registry | |
parent | 2eeea0a1d2011567d3a41065d66802097366dc8c (diff) |
fix(ext/node): fix prismjs compatibiliy in Web Worker (#25062)
PrismJS uses `WorkerGlobalScope` and `self` for detecting browser's Web
Worker context:
https://github.com/PrismJS/prism/blob/59e5a3471377057de1f401ba38337aca27b80e03/prism.js#L11
Now the detection logic above is broken when it's imported from Deno's
Web Worker context because we only hide `self` (Prism assumes when
`WorkerGlobalScope` is available, `self` is also available).
This change fixes the above by also hiding `WorkerGlobalScope` global in
Node compat mode.
closes #25008
Diffstat (limited to 'tests/registry')
-rw-r--r-- | tests/registry/npm/@denotest/check-worker-globals/1.0.0/index.js | 7 | ||||
-rw-r--r-- | tests/registry/npm/@denotest/check-worker-globals/1.0.0/package.json | 5 |
2 files changed, 12 insertions, 0 deletions
diff --git a/tests/registry/npm/@denotest/check-worker-globals/1.0.0/index.js b/tests/registry/npm/@denotest/check-worker-globals/1.0.0/index.js new file mode 100644 index 000000000..8da68f791 --- /dev/null +++ b/tests/registry/npm/@denotest/check-worker-globals/1.0.0/index.js @@ -0,0 +1,7 @@ +if (typeof self !== "undefined") { + throw new Error("self is defined"); +} + +if (typeof WorkerGlobalScope !== "undefined") { + throw new Error("WorkerGlobalScope is defined"); +} diff --git a/tests/registry/npm/@denotest/check-worker-globals/1.0.0/package.json b/tests/registry/npm/@denotest/check-worker-globals/1.0.0/package.json new file mode 100644 index 000000000..b78fa210a --- /dev/null +++ b/tests/registry/npm/@denotest/check-worker-globals/1.0.0/package.json @@ -0,0 +1,5 @@ +{ + "name": "@denotest/check-worker-globals", + "version": "1.0.0", + "main": "index.js" +} |