diff --git a/lib/browser/api/web-contents.js b/lib/browser/api/web-contents.js index f5f53f44a312..4b3e777b4dcb 100644 --- a/lib/browser/api/web-contents.js +++ b/lib/browser/api/web-contents.js @@ -184,7 +184,7 @@ WebContents.prototype.executeJavaScript = function (code, hasUserGesture, callba return asyncWebFrameMethods.call(this, requestId, 'executeJavaScript', callback, code, hasUserGesture) } else { return new Promise((resolve, reject) => { - this.once('did-finish-load', () => { + this.once('did-stop-loading', () => { asyncWebFrameMethods.call(this, requestId, 'executeJavaScript', callback, code, hasUserGesture).then(resolve).catch(reject) }) })