Skip to content

Commit

Permalink
fix: check for validity of guest webcontents (#21035)
Browse files Browse the repository at this point in the history
  • Loading branch information
trop[bot] authored and John Kleinschmidt committed Nov 7, 2019
1 parent bcabc25 commit dc97938
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions shell/browser/web_view_manager.cc
Expand Up @@ -62,10 +62,14 @@ content::WebContents* WebViewManager::GetGuestByInstanceID(

bool WebViewManager::ForEachGuest(content::WebContents* embedder_web_contents,
const GuestCallback& callback) {
for (auto& item : web_contents_embedder_map_)
if (item.second.embedder == embedder_web_contents &&
callback.Run(item.second.web_contents))
for (auto& item : web_contents_embedder_map_) {
if (item.second.embedder != embedder_web_contents)
continue;

auto* guest_web_contents = item.second.web_contents;
if (guest_web_contents && callback.Run(guest_web_contents))
return true;
}
return false;
}

Expand Down

0 comments on commit dc97938

Please sign in to comment.