1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-25 15:29:32 -05:00

fix(repl): prevent panic when deleting globalThis.closed property (#24014)

This commit is contained in:
safaa-mojahed 2024-06-18 04:34:25 +03:00 committed by Bartek Iwańczuk
parent a8c7aec937
commit 290cfb8189
No known key found for this signature in database
GPG key ID: 0C6BCDDC3B3AD750

View file

@ -99,6 +99,9 @@ Object.defineProperty(globalThis, "{0}", {{
lastThrownError: undefined, lastThrownError: undefined,
inspectArgs: Deno[Deno.internal].inspectArgs, inspectArgs: Deno[Deno.internal].inspectArgs,
noColor: Deno.noColor, noColor: Deno.noColor,
get closed() {{
return typeof globalThis.closed === 'undefined' ? false : globalThis.closed;
}}
}}, }},
}}); }});
Object.defineProperty(globalThis, "_", {{ Object.defineProperty(globalThis, "_", {{
@ -299,8 +302,9 @@ impl ReplSession {
} }
pub async fn closing(&mut self) -> Result<bool, AnyError> { pub async fn closing(&mut self) -> Result<bool, AnyError> {
let expression = format!(r#"{}.closed"#, *REPL_INTERNALS_NAME);
let closed = self let closed = self
.evaluate_expression("(this.closed)") .evaluate_expression(&expression)
.await? .await?
.result .result
.value .value