Skip to content
This repository has been archived by the owner on Jan 4, 2019. It is now read-only.

Commit

Permalink
don’t send messages to webcontents when they are detached
Browse files Browse the repository at this point in the history
auditors @bbondy @darkdh
  • Loading branch information
bridiver committed Apr 12, 2017
1 parent 9f78288 commit 3ce8375
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions brave/browser/guest_view/tab_view/tab_view_guest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
#include "content/public/browser/render_view_host.h"
#include "content/public/browser/render_widget_host.h"
#include "content/public/browser/render_widget_host_view.h"
#include "content/public/browser/resource_dispatcher_host.h"
#include "content/public/browser/site_instance.h"
#include "extensions/browser/guest_view/web_view/web_view_constants.h"
#include "native_mate/dictionary.h"
Expand Down Expand Up @@ -312,6 +313,9 @@ void TabViewGuest::ApplyAttributes(const base::DictionaryValue& params) {
void TabViewGuest::DidAttachToEmbedder() {
DCHECK(api_web_contents_);

content::ResourceDispatcherHost::ResumeBlockedRequestsForFrameFromUI(
web_contents()->GetMainFrame());

auto tab_helper = extensions::TabHelper::FromWebContents(web_contents());

if (!tab_helper->IsDiscarded()) {
Expand All @@ -334,6 +338,9 @@ void TabViewGuest::DidAttachToEmbedder() {
}

void TabViewGuest::DidDetachFromEmbedder() {
content::ResourceDispatcherHost::BlockRequestsForFrameFromUI(
web_contents()->GetMainFrame());

if (api_web_contents_) {
api_web_contents_->Emit("did-detach",
extensions::TabHelper::IdForTab(web_contents()));
Expand Down

1 comment on commit 3ce8375

@darkdh
Copy link
Member

@darkdh darkdh commented on 3ce8375 Apr 13, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

++

Please sign in to comment.