scripting: prevent crash (built-in client only) when using the variable navigator
This commit is contained in:
parent
6813be50fb
commit
f3acec538f
3 changed files with 8 additions and 1 deletions
|
|
@ -90,6 +90,11 @@ class Vm {
|
|||
contextKeys = ['__VARS'],
|
||||
contextValues = [{}]
|
||||
|
||||
// detached context + reading global navigator == crash electron
|
||||
if (code.indexOf('navigator') !== -1) {
|
||||
contextInit += 'var navigator;'
|
||||
}
|
||||
|
||||
if (defaultContext) {
|
||||
for (var k in defaultContext) {
|
||||
contextInit += `var ${k} = ${k} === undefined ? ${JSON.stringify(defaultContext[k])} : ${k};`
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue