-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
42f23f0
commit 10990f5
Showing
6 changed files
with
33 additions
and
1 deletion.
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
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
Binary file not shown.
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,14 @@ | ||
import { test, expect, describe } from "bun:test"; | ||
import { JSDOM } from "jsdom"; | ||
|
||
describe("jsdom", () => { | ||
for (const runScripts of ["dangerously", "outside-only", undefined]) { | ||
test(`runScripts: ${runScripts}`, () => { | ||
const dom = new JSDOM(`<!DOCTYPE html><html><body><h1>Hello World!</h1></body></html>`, { | ||
url: "https://example.com", | ||
runScripts, | ||
}); | ||
expect(dom.window.document.querySelector("h1").textContent).toBe("Hello World!"); | ||
}); | ||
} | ||
}); |
13 changes: 13 additions & 0 deletions
13
test/js/node/test/parallel/test-vm-set-proto-null-on-globalthis.js
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,13 @@ | ||
'use strict'; | ||
require('../common'); | ||
|
||
// Setting __proto__ on vm context's globalThis should not cause a crash | ||
// Regression test for https://github.com/nodejs/node/issues/47798 | ||
|
||
const vm = require('vm'); | ||
const context = vm.createContext(); | ||
|
||
const contextGlobalThis = vm.runInContext('this', context); | ||
|
||
// Should not crash. | ||
contextGlobalThis.__proto__ = null; // eslint-disable-line no-proto |
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