Chromium Code Reviews| Index: content/browser/frame_host/navigation_handle_impl.cc |
| diff --git a/content/browser/frame_host/navigation_handle_impl.cc b/content/browser/frame_host/navigation_handle_impl.cc |
| index a31508c18e0e1ec27973f27cbb510d2398d4090a..a445944a51e56aa77f306880b380d44e221b24e0 100644 |
| --- a/content/browser/frame_host/navigation_handle_impl.cc |
| +++ b/content/browser/frame_host/navigation_handle_impl.cc |
| @@ -244,6 +244,14 @@ void NavigationHandleImpl::CancelDeferredNavigation( |
| RunCompleteCallback(result); |
| } |
| +void NavigationHandleImpl::QueueConsoleMessage(ConsoleMessageLevel level, |
| + const std::string& message) { |
| + console_queue_.emplace(level, message); |
| + |
| + if (state_ >= WILL_PROCESS_RESPONSE) |
| + DumpMessagesToConsole(); |
| +} |
| + |
| void NavigationHandleImpl::RegisterThrottleForTesting( |
| std::unique_ptr<NavigationThrottle> navigation_throttle) { |
| throttles_.push_back(std::move(navigation_throttle)); |
| @@ -390,6 +398,13 @@ void NavigationHandleImpl::WillProcessResponse( |
| state_ = WILL_PROCESS_RESPONSE; |
| complete_callback_ = callback; |
| + // Clear out the pending console message queue now that we have a |
| + // render_frame_host. |
| + // |
| + // TODO(mkwst): Move this to 'ReadyToCommitNavigation' as part of the work |
| + // in https://crbug.com/621856. |
| + DumpMessagesToConsole(); |
|
clamy
2016/06/28 11:30:38
This is problematic right now for transfer navigat
Mike West
2016/06/28 12:22:33
It's no more problematic than getting the RenderFr
|
| + |
| // Notify each throttle of the response. |
| NavigationThrottle::ThrottleCheckResult result = CheckWillProcessResponse(); |
| @@ -541,4 +556,15 @@ void NavigationHandleImpl::RunCompleteCallback( |
| // destruction. |
| } |
| +void NavigationHandleImpl::DumpMessagesToConsole() { |
| + DCHECK_GE(state_, WILL_PROCESS_RESPONSE); |
| + DCHECK(GetRenderFrameHost()); |
| + |
| + while (!console_queue_.empty()) { |
| + GetRenderFrameHost()->AddMessageToConsole(console_queue_.front().first, |
| + console_queue_.front().second); |
| + console_queue_.pop(); |
| + } |
| +} |
| + |
| } // namespace content |