fix toJSON calls from value explorer

This commit is contained in:
Dmitry Vasilev
2023-06-10 23:44:43 +03:00
parent 05a43b617f
commit 624759e7a1
2 changed files with 37 additions and 24 deletions

View File

@@ -5,6 +5,7 @@
// content
import {el, stringify, scrollIntoViewIfNeeded} from './domutils.js'
import {with_code_execution} from '../index.js'
// We test both for Object and globalThis.run_window.Object because objects may
@@ -31,7 +32,9 @@ const isDate = object =>
const toJSON_safe = object => {
try {
return object.toJSON()
return with_code_execution(() => {
return object.toJSON()
})
} catch(e) {
return object
}