fix: re-entrancy issues in webContents.loadURL()
(#48044)
This commit is contained in:
parent
9a788ad231
commit
f4e6a361de
3 changed files with 53 additions and 2 deletions
|
@ -2001,16 +2001,21 @@ SkRegion* WebContents::draggable_region() {
|
|||
|
||||
void WebContents::DidStartNavigation(
|
||||
content::NavigationHandle* navigation_handle) {
|
||||
base::AutoReset<bool> resetter(&is_safe_to_delete_, false);
|
||||
EmitNavigationEvent("did-start-navigation", navigation_handle);
|
||||
}
|
||||
|
||||
void WebContents::DidRedirectNavigation(
|
||||
content::NavigationHandle* navigation_handle) {
|
||||
base::AutoReset<bool> resetter(&is_safe_to_delete_, false);
|
||||
EmitNavigationEvent("did-redirect-navigation", navigation_handle);
|
||||
}
|
||||
|
||||
void WebContents::ReadyToCommitNavigation(
|
||||
content::NavigationHandle* navigation_handle) {
|
||||
base::AutoReset<bool> resetter(&is_safe_to_delete_, false);
|
||||
EmitNavigationEvent("-ready-to-commit-navigation", navigation_handle);
|
||||
|
||||
// Don't focus content in an inactive window.
|
||||
if (!owner_window())
|
||||
return;
|
||||
|
@ -2353,7 +2358,7 @@ void WebContents::LoadURL(const GURL& url,
|
|||
// http://crbug.com/347742.
|
||||
auto& ctrl_impl = static_cast<content::NavigationControllerImpl&>(
|
||||
web_contents()->GetController());
|
||||
if (ctrl_impl.in_navigate_to_pending_entry()) {
|
||||
if (!is_safe_to_delete_ || ctrl_impl.in_navigate_to_pending_entry()) {
|
||||
Emit("did-fail-load", static_cast<int>(net::ERR_FAILED),
|
||||
net::ErrorToShortString(net::ERR_FAILED), url.possibly_invalid_spec(),
|
||||
true);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue