Browse Source

fix: suppress worldSafe warning emitted from security checks (#25828)

Co-authored-by: Jeremy Rose <[email protected]>
trop[bot] 4 years ago
parent
commit
1eea063c3a
1 changed files with 3 additions and 2 deletions
  1. 3 2
      lib/renderer/security-warnings.ts

+ 3 - 2
lib/renderer/security-warnings.ts

@@ -76,8 +76,9 @@ const isLocalhost = function () {
  *
  * @returns {boolean} Is a CSP with `unsafe-eval` set?
  */
-const isUnsafeEvalEnabled = function () {
-  return webFrame.executeJavaScript(`(${(() => {
+const isUnsafeEvalEnabled: () => Promise<boolean> = function () {
+  // Call _executeJavaScript to bypass the world-safe deprecation warning
+  return (webFrame as any)._executeJavaScript(`(${(() => {
     try {
       new Function(''); // eslint-disable-line no-new,no-new-func
     } catch {