Commit 5fe10abf authored by Jialiu Lin's avatar Jialiu Lin Committed by Commit Bot

Check web_contents before getting navigation ID

When password protection verdict comes back from Safe Browsing backend,
it is possible that the web_contents has already gone. Therefore, we
need to check if web_contents is still valid before getting navigation
ID from it.

Bug: 885359
Change-Id: I3c80a8f2a3158ad3c459317e4d4954aa60f6d1f9
Reviewed-on: https://chromium-review.googlesource.com/1236816Reviewed-by: default avatarDaniel Rubery <drubery@chromium.org>
Commit-Queue: Jialiu Lin <jialiul@chromium.org>
Cr-Commit-Position: refs/heads/master@{#592992}
parent 15df5b95
......@@ -115,6 +115,8 @@ PasswordReuseLookup::ReputationVerdict GetVerdictToLogFromResponse(
// Given a |web_contents|, returns the navigation id of its last committed
// navigation.
int64_t GetLastCommittedNavigationID(const content::WebContents* web_contents) {
if (!web_contents)
return 0;
content::NavigationEntry* navigation =
web_contents->GetController().GetLastCommittedEntry();
return navigation
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment