| 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..74b3559bd73818e55b1f9b46a266433d7fb22573 100644
|
| --- a/content/browser/frame_host/navigation_handle_impl.cc
|
| +++ b/content/browser/frame_host/navigation_handle_impl.cc
|
| @@ -390,6 +390,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();
|
| +
|
| // Notify each throttle of the response.
|
| NavigationThrottle::ThrottleCheckResult result = CheckWillProcessResponse();
|
|
|
| @@ -431,6 +438,14 @@ void NavigationHandleImpl::DidCommitNavigation(
|
| state_ = net_error_code_ == net::OK ? DID_COMMIT : DID_COMMIT_ERROR_PAGE;
|
| }
|
|
|
| +void NavigationHandleImpl::QueueConsoleMessage(ConsoleMessageLevel level,
|
| + const std::string& message) {
|
| + console_queue_.emplace(level, message);
|
| +
|
| + if (state_ >= WILL_PROCESS_RESPONSE)
|
| + DumpMessagesToConsole();
|
| +}
|
| +
|
| NavigationThrottle::ThrottleCheckResult
|
| NavigationHandleImpl::CheckWillStartRequest() {
|
| DCHECK(state_ == WILL_SEND_REQUEST || state_ == DEFERRING_START);
|
| @@ -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
|
|
|