refactor: take advantage of structured clone algorithm in the remote module (#20427)

This commit is contained in:
Milan Burda 2019-10-10 15:59:08 +02:00 committed by John Kleinschmidt
parent c2e77e4429
commit b92163d226
13 changed files with 87 additions and 210 deletions

View file

@ -140,8 +140,6 @@ if (process.isMainFrame) {
webViewInit(contextIsolation, isWebViewTagEnabled, guestInstanceId)
}
const errorUtils = require('@electron/internal/common/error-utils')
// Wrap the script into a function executed in global scope. It won't have
// access to the current scope, so we'll expose a few objects as arguments:
//
@ -166,13 +164,13 @@ for (const { preloadPath, preloadSrc, preloadError } of preloadScripts) {
if (preloadSrc) {
runPreloadScript(preloadSrc)
} else if (preloadError) {
throw errorUtils.deserialize(preloadError)
throw preloadError
}
} catch (error) {
console.error(`Unable to load preload script: ${preloadPath}`)
console.error(error)
ipcRendererInternal.send('ELECTRON_BROWSER_PRELOAD_ERROR', preloadPath, errorUtils.serialize(error))
ipcRendererInternal.send('ELECTRON_BROWSER_PRELOAD_ERROR', preloadPath, error)
}
}