Fix possible null WebContents access in ExternalProtocolDialog.
The dialog may outlive the WebContents, but ExternalProtocolDialogDelegate::DoAccept() is missing a check on the result of tab_util::GetWebContentsByID() before dereferencing the WebContents. Add a check and a regression test. In order to achieve coverage of the crashing lines, update the test harness and the static method involved to use a ExternalProtocolHandler::Delegate. This interface already exists and is used for testing, but wasn't in the codepaths invoked from the crashing code in ExternalProtocolDialogDelegate::DoAccept(). Bug: 835216 Change-Id: If7d4593090a1db9a96bc829d1e1c253860d0cf20 Reviewed-on: https://chromium-review.googlesource.com/1049774Reviewed-by:Ben Wells <benwells@chromium.org> Commit-Queue: Trent Apted <tapted@chromium.org> Cr-Commit-Position: refs/heads/master@{#557478}
Showing
Please register or sign in to comment