Merge pull request #5199 from Mr0grog/5183-disambiguate-loading-from-main-frame-loading

Add `isLoadingMainFrame()` to WebContents
This commit is contained in:
Cheng Zhao 2016-04-20 20:49:56 +09:00
commit aa29dc0c8a
6 changed files with 88 additions and 1 deletions

View file

@ -116,7 +116,7 @@ let wrapWebContents = function (webContents) {
callback = hasUserGesture
hasUserGesture = false
}
if (this.getURL() && !this.isLoading()) {
if (this.getURL() && !this.isLoadingMainFrame()) {
return asyncWebFrameMethods.call(this, requestId, 'executeJavaScript', callback, code, hasUserGesture)
} else {
return this.once('did-finish-load', asyncWebFrameMethods.bind(this, requestId, 'executeJavaScript', callback, code, hasUserGesture))