Do not use did-finish-load to detect whether WebContents is ready
The WebContents JS object can be created way later after the C++ object gets created.
This commit is contained in:
parent
e656d8428c
commit
8a8b11cf10
1 changed files with 1 additions and 3 deletions
|
@ -44,10 +44,8 @@ wrapWebContents = (webContents) ->
|
|||
|
||||
# Make sure webContents.executeJavaScript would run the code only when the
|
||||
# web contents has been loaded.
|
||||
webContents.loaded = false
|
||||
webContents.once 'did-finish-load', -> @loaded = true
|
||||
webContents.executeJavaScript = (code, hasUserGesture=false) ->
|
||||
if @loaded
|
||||
if @getUrl() and not @isLoading()
|
||||
@_executeJavaScript code, hasUserGesture
|
||||
else
|
||||
webContents.once 'did-finish-load', @_executeJavaScript.bind(this, code, hasUserGesture)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue