fix: potential crash in chrome.tabs.update()
(#45276)
fix: potential crash in chrome.tabs.update()
This commit is contained in:
parent
5e05dff949
commit
5aabb6bec5
1 changed files with 10 additions and 1 deletions
|
@ -651,7 +651,16 @@ bool TabsUpdateFunction::UpdateURL(const std::string& url_string,
|
||||||
// will stay in the omnibox - see https://crbug.com/1085779.
|
// will stay in the omnibox - see https://crbug.com/1085779.
|
||||||
load_params.transition_type = ui::PAGE_TRANSITION_FROM_API;
|
load_params.transition_type = ui::PAGE_TRANSITION_FROM_API;
|
||||||
|
|
||||||
|
base::WeakPtr<content::NavigationHandle> navigation_handle =
|
||||||
web_contents_->GetController().LoadURLWithParams(load_params);
|
web_contents_->GetController().LoadURLWithParams(load_params);
|
||||||
|
// Navigation can fail for any number of reasons at the content layer.
|
||||||
|
// Unfortunately, we can't provide a detailed error message here, because
|
||||||
|
// there are too many possible triggers. At least notify the extension that
|
||||||
|
// the update failed.
|
||||||
|
if (!navigation_handle) {
|
||||||
|
*error = "Navigation rejected.";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
DCHECK_EQ(url,
|
DCHECK_EQ(url,
|
||||||
web_contents_->GetController().GetPendingEntry()->GetVirtualURL());
|
web_contents_->GetController().GetPendingEntry()->GetVirtualURL());
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue