fix: check for validity of guest webcontents (#21019)

This commit is contained in:
Robo 2019-11-07 07:39:48 -08:00 committed by GitHub
parent 7625202891
commit c716ecb916
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -62,10 +62,14 @@ content::WebContents* WebViewManager::GetGuestByInstanceID(
bool WebViewManager::ForEachGuest(content::WebContents* embedder_web_contents, bool WebViewManager::ForEachGuest(content::WebContents* embedder_web_contents,
const GuestCallback& callback) { const GuestCallback& callback) {
for (auto& item : web_contents_embedder_map_) for (auto& item : web_contents_embedder_map_) {
if (item.second.embedder == embedder_web_contents && if (item.second.embedder != embedder_web_contents)
callback.Run(item.second.web_contents)) continue;
auto* guest_web_contents = item.second.web_contents;
if (guest_web_contents && callback.Run(guest_web_contents))
return true; return true;
}
return false; return false;
} }