Default hasUserGesture to false when null
This commit is contained in:
parent
6fcb784f6e
commit
6240e30be1
1 changed files with 8 additions and 1 deletions
|
@ -115,8 +115,8 @@ const asyncWebFrameMethods = function (requestId, method, callback, ...args) {
|
||||||
this.send('ELECTRON_INTERNAL_RENDERER_ASYNC_WEB_FRAME_METHOD', requestId, method, args)
|
this.send('ELECTRON_INTERNAL_RENDERER_ASYNC_WEB_FRAME_METHOD', requestId, method, args)
|
||||||
ipcMain.once(`ELECTRON_INTERNAL_BROWSER_ASYNC_WEB_FRAME_RESPONSE_${requestId}`, function (event, error, result) {
|
ipcMain.once(`ELECTRON_INTERNAL_BROWSER_ASYNC_WEB_FRAME_RESPONSE_${requestId}`, function (event, error, result) {
|
||||||
if (error == null) {
|
if (error == null) {
|
||||||
resolve(result)
|
|
||||||
if (typeof callback === 'function') callback(result)
|
if (typeof callback === 'function') callback(result)
|
||||||
|
resolve(result)
|
||||||
} else {
|
} else {
|
||||||
reject(error)
|
reject(error)
|
||||||
}
|
}
|
||||||
|
@ -149,10 +149,17 @@ for (const method of webFrameMethodsWithResult) {
|
||||||
// WebContents has been loaded.
|
// WebContents has been loaded.
|
||||||
WebContents.prototype.executeJavaScript = function (code, hasUserGesture, callback) {
|
WebContents.prototype.executeJavaScript = function (code, hasUserGesture, callback) {
|
||||||
const requestId = getNextId()
|
const requestId = getNextId()
|
||||||
|
|
||||||
if (typeof hasUserGesture === 'function') {
|
if (typeof hasUserGesture === 'function') {
|
||||||
|
// Shift.
|
||||||
callback = hasUserGesture
|
callback = hasUserGesture
|
||||||
|
hasUserGesture = null
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hasUserGesture == null) {
|
||||||
hasUserGesture = false
|
hasUserGesture = false
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.getURL() && !this.isLoadingMainFrame()) {
|
if (this.getURL() && !this.isLoadingMainFrame()) {
|
||||||
return asyncWebFrameMethods.call(this, requestId, 'executeJavaScript', callback, code, hasUserGesture)
|
return asyncWebFrameMethods.call(this, requestId, 'executeJavaScript', callback, code, hasUserGesture)
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue