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)
|
||||
ipcMain.once(`ELECTRON_INTERNAL_BROWSER_ASYNC_WEB_FRAME_RESPONSE_${requestId}`, function (event, error, result) {
|
||||
if (error == null) {
|
||||
resolve(result)
|
||||
if (typeof callback === 'function') callback(result)
|
||||
resolve(result)
|
||||
} else {
|
||||
reject(error)
|
||||
}
|
||||
|
@ -149,10 +149,17 @@ for (const method of webFrameMethodsWithResult) {
|
|||
// WebContents has been loaded.
|
||||
WebContents.prototype.executeJavaScript = function (code, hasUserGesture, callback) {
|
||||
const requestId = getNextId()
|
||||
|
||||
if (typeof hasUserGesture === 'function') {
|
||||
// Shift.
|
||||
callback = hasUserGesture
|
||||
hasUserGesture = null
|
||||
}
|
||||
|
||||
if (hasUserGesture == null) {
|
||||
hasUserGesture = false
|
||||
}
|
||||
|
||||
if (this.getURL() && !this.isLoadingMainFrame()) {
|
||||
return asyncWebFrameMethods.call(this, requestId, 'executeJavaScript', callback, code, hasUserGesture)
|
||||
} else {
|
||||
|
|
Loading…
Reference in a new issue