s/global/session

This commit is contained in:
Samuel Attard 2017-09-17 01:08:44 +10:00 committed by Cheng Zhao
parent 3b80ee0655
commit d2707315e6

View file

@ -67,7 +67,7 @@ electron.ipcRenderer.on('ELECTRON_INTERNAL_RENDERER_ASYNC_WEB_FRAME_METHOD', (ev
let nodeIntegration = 'false' let nodeIntegration = 'false'
let webviewTag = 'false' let webviewTag = 'false'
let preloadScript = null let preloadScript = null
const globalPreloadScripts = [] const sessionPreloadScripts = []
let isBackgroundPage = false let isBackgroundPage = false
let appPath = null let appPath = null
for (let arg of process.argv) { for (let arg of process.argv) {
@ -88,7 +88,7 @@ for (let arg of process.argv) {
} else if (arg.indexOf('--webview-tag=') === 0) { } else if (arg.indexOf('--webview-tag=') === 0) {
webviewTag = arg.substr(arg.indexOf('=') + 1) webviewTag = arg.substr(arg.indexOf('=') + 1)
} else if (arg.indexOf('--global-preload') === 0) { } else if (arg.indexOf('--global-preload') === 0) {
globalPreloadScripts.push(arg.substr(arg.indexOf('=') + 1)) sessionPreloadScripts.push(arg.substr(arg.indexOf('=') + 1))
} }
} }
@ -174,11 +174,11 @@ if (nodeIntegration === 'true') {
}) })
} }
for (const globalPreloadScript of globalPreloadScripts) { for (const sessionPreloadScript of sessionPreloadScripts) {
try { try {
require(globalPreloadScript) require(sessionPreloadScript)
} catch (error) { } catch (error) {
console.error('Unable to load global preload script: ' + globalPreloadScript) console.error('Unable to load session preload script: ' + sessionPreloadScript)
console.error(error.stack || error.message) console.error(error.stack || error.message)
} }
} }