1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-28 16:20:57 -05:00

fix(repl): avoid panic when assigned to globalThis (#12273)

This commit is contained in:
Yoshiya Hinosawa 2021-10-01 00:25:58 +09:00 committed by Ryan Dahl
parent dbf2f5ff10
commit df94139aa8
2 changed files with 12 additions and 1 deletions

View file

@ -134,6 +134,17 @@ fn pty_ignore_symbols() {
});
}
#[test]
fn pty_assign_global_this() {
util::with_pty(&["repl"], |mut console| {
console.write_line("globalThis = 42;");
console.write_line("close();");
let output = console.read_all_output();
assert!(!output.contains("panicked"));
});
}
#[test]
fn console_log() {
let (out, err) = util::run_and_collect_output(

View file

@ -485,7 +485,7 @@ impl ReplSession {
pub async fn is_closing(&mut self) -> Result<bool, AnyError> {
let closed = self
.evaluate_expression("(globalThis.closed)")
.evaluate_expression("(this.closed)")
.await?
.get("result")
.unwrap()