fix: check for validity of guest webcontents (#21019)
This commit is contained in:
parent
7625202891
commit
c716ecb916
1 changed files with 7 additions and 3 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue