feat: promisify executeJavaScript (#17312)
This commit is contained in:
parent
878538f2e8
commit
2e89348541
14 changed files with 164 additions and 100 deletions
|
@ -64,16 +64,14 @@ const getIsRemoteProtocol = function () {
|
|||
* @returns {boolean} Is a CSP with `unsafe-eval` set?
|
||||
*/
|
||||
const isUnsafeEvalEnabled = function () {
|
||||
return new Promise((resolve) => {
|
||||
webFrame.executeJavaScript(`(${(() => {
|
||||
try {
|
||||
new Function('') // eslint-disable-line no-new,no-new-func
|
||||
} catch {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}).toString()})()`, false, resolve)
|
||||
})
|
||||
return webFrame.executeJavaScript(`(${(() => {
|
||||
try {
|
||||
new Function('') // eslint-disable-line no-new,no-new-func
|
||||
} catch {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}).toString()})()`, false)
|
||||
}
|
||||
|
||||
const moreInformation = `\nFor more information and help, consult
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue