Don't leak listeners in embedder when guest is destroyed
This commit is contained in:
parent
a26091e485
commit
da54ac5f55
3 changed files with 5 additions and 3 deletions
|
@ -274,6 +274,9 @@ void WebContents::Destroy() {
|
|||
if (!destruction_callback_.is_null())
|
||||
destruction_callback_.Run();
|
||||
|
||||
// When force destroying the "destroyed" event is not emitted.
|
||||
WebContentsDestroyed();
|
||||
|
||||
Observe(nullptr);
|
||||
storage_.reset();
|
||||
}
|
||||
|
|
|
@ -40,9 +40,9 @@ createGuest = (embedder, params) ->
|
|||
destroyEvents = ['destroyed', 'crashed', 'did-navigate-to-different-page']
|
||||
destroy = ->
|
||||
destroyGuest id if guestInstances[id]?
|
||||
embedder.removeListener event, destroy for event in destroyEvents
|
||||
embedder.setMaxListeners 100 # we can have lots of <webview> in one page.
|
||||
embedder.once event, destroy for event in destroyEvents
|
||||
guest.once 'destroyed', ->
|
||||
embedder.removeListener event, destroy for event in destroyEvents
|
||||
|
||||
# Init guest web view after attached.
|
||||
guest.once 'did-attach', ->
|
||||
|
|
|
@ -50,7 +50,6 @@ class WebViewImpl
|
|||
# heard back from createGuest yet. We will not reset the flag in this case so
|
||||
# that we don't end up allocating a second guest.
|
||||
if @guestInstanceId
|
||||
# FIXME
|
||||
guestViewInternal.destroyGuest @guestInstanceId
|
||||
@guestInstanceId = undefined
|
||||
@beforeFirstNavigation = true
|
||||
|
|
Loading…
Reference in a new issue