From 58a9ac7a9f534ef3cda229da75cff9e6f6487a24 Mon Sep 17 00:00:00 2001 From: qinmin Date: Wed, 26 Apr 2017 11:45:03 -0700 Subject: [PATCH] fix a layout test crash due to no browser window The test opens a link to a pdf, which results in a download and closing the tab immediately. As a result, the crash could triggered by potential race between shut down the content shell and opening the download. BUG=707599 Review-Url: https://codereview.chromium.org/2842023003 Cr-Commit-Position: refs/heads/master@{#467392} --- .../layout_test/layout_test_download_manager_delegate.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/content/shell/browser/layout_test/layout_test_download_manager_delegate.cc b/content/shell/browser/layout_test/layout_test_download_manager_delegate.cc index 9f7b098b622bfa..9516f096dce376 100644 --- a/content/shell/browser/layout_test/layout_test_download_manager_delegate.cc +++ b/content/shell/browser/layout_test/layout_test_download_manager_delegate.cc @@ -35,7 +35,8 @@ LayoutTestDownloadManagerDelegate::~LayoutTestDownloadManagerDelegate(){ bool LayoutTestDownloadManagerDelegate::ShouldOpenDownload( DownloadItem* item, const DownloadOpenDelayedCallback& callback) { - if (BlinkTestController::Get()->IsMainWindow(item->GetWebContents()) && + if (BlinkTestController::Get() && + BlinkTestController::Get()->IsMainWindow(item->GetWebContents()) && item->GetMimeType() == "text/html") { BlinkTestController::Get()->OpenURL( net::FilePathToFileURL(item->GetFullPath()));