From ea800be6cdc58af3b34d6b98f4a26ed35bedb671 Mon Sep 17 00:00:00 2001 From: dtapuska Date: Tue, 6 Jan 2015 07:34:01 -0800 Subject: Mojo HTML viewer crash Check that we have a valid navigator_host_ object before we call methods on it BUG=443193 Review URL: https://codereview.chromium.org/790793007 Cr-Commit-Position: refs/heads/master@{#310090} --- mojo/services/html_viewer/html_document.cc | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'mojo') diff --git a/mojo/services/html_viewer/html_document.cc b/mojo/services/html_viewer/html_document.cc index 1892ce85..7688442 100644 --- a/mojo/services/html_viewer/html_document.cc +++ b/mojo/services/html_viewer/html_document.cc @@ -243,9 +243,11 @@ blink::WebNavigationPolicy HTMLDocument::decidePolicyForNavigation( if (CanNavigateLocally(frame, request)) return default_policy; - navigator_host_->RequestNavigate( - WebNavigationPolicyToNavigationTarget(default_policy), - mojo::URLRequest::From(request).Pass()); + if (navigator_host_.get()) { + navigator_host_->RequestNavigate( + WebNavigationPolicyToNavigationTarget(default_policy), + mojo::URLRequest::From(request).Pass()); + } return blink::WebNavigationPolicyIgnore; } @@ -261,7 +263,8 @@ void HTMLDocument::didNavigateWithinPage( blink::WebLocalFrame* frame, const blink::WebHistoryItem& history_item, blink::WebHistoryCommitType commit_type) { - navigator_host_->DidNavigateLocally(history_item.urlString().utf8()); + if (navigator_host_.get()) + navigator_host_->DidNavigateLocally(history_item.urlString().utf8()); } blink::WebEncryptedMediaClient* HTMLDocument::encryptedMediaClient() { -- cgit v1.1