destroy guest webcontents before embedder

This commit is contained in:
deepak1556 2017-03-19 01:10:30 +05:30
parent 16f9754445
commit 72adbf7a2f
3 changed files with 12 additions and 9 deletions

View file

@ -411,14 +411,18 @@ WebContents::~WebContents() {
if (type_ == WEB_VIEW)
guest_delegate_->Destroy();
// The WebContentsDestroyed will not be called automatically because we
// unsubscribe from webContents before destroying it. So we have to manually
// call it here to make sure "destroyed" event is emitted.
RenderViewDeleted(web_contents()->GetRenderViewHost());
WebContentsDestroyed();
DestroyWebContents();
}
}
void WebContents::DestroyWebContents() {
// This event is only for internal use, which is emitted when WebContents is
// being destroyed.
Emit("will-destroy");
CommonWebContentsDelegate::DestroyWebContents();
}
bool WebContents::DidAddMessageToConsole(content::WebContents* source,
int32_t level,
const base::string16& message,
@ -919,10 +923,6 @@ bool WebContents::OnMessageReceived(const IPC::Message& message) {
// be destroyed on close, and WebContentsDestroyed would be called for it, so
// we need to make sure the api::WebContents is also deleted.
void WebContents::WebContentsDestroyed() {
// This event is only for internal use, which is emitted when WebContents is
// being destroyed.
Emit("will-destroy");
// Cleanup relationships with other parts.
RemoveFromWeakMap();

View file

@ -76,6 +76,9 @@ class WebContents : public mate::TrackableObject<WebContents>,
static void BuildPrototype(v8::Isolate* isolate,
v8::Local<v8::FunctionTemplate> prototype);
// Notifies to destroy any guest web contents before destroying self.
void DestroyWebContents();
int64_t GetID() const;
int GetProcessID() const;
Type GetType() const;

2
vendor/brightray vendored

@ -1 +1 @@
Subproject commit d0144ba2c9024d65cdf260abf5c03c742afff3fd
Subproject commit 53aa2cfc8a40627d62bf5be757ff9dea444f80bd