Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/renderer/render_frame_impl.h" | 5 #include "content/renderer/render_frame_impl.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| 11 #include "base/debug/alias.h" | 11 #include "base/debug/alias.h" |
| 12 #include "base/debug/dump_without_crashing.h" | 12 #include "base/debug/dump_without_crashing.h" |
| 13 #include "base/i18n/char_iterator.h" | 13 #include "base/i18n/char_iterator.h" |
| 14 #include "base/metrics/histogram.h" | 14 #include "base/metrics/histogram.h" |
| 15 #include "base/process/kill.h" | |
| 16 #include "base/process/process.h" | |
| 15 #include "base/strings/utf_string_conversions.h" | 17 #include "base/strings/utf_string_conversions.h" |
| 16 #include "base/time/time.h" | 18 #include "base/time/time.h" |
| 17 #include "content/child/appcache/appcache_dispatcher.h" | 19 #include "content/child/appcache/appcache_dispatcher.h" |
| 18 #include "content/child/plugin_messages.h" | 20 #include "content/child/plugin_messages.h" |
| 19 #include "content/child/quota_dispatcher.h" | 21 #include "content/child/quota_dispatcher.h" |
| 20 #include "content/child/request_extra_data.h" | 22 #include "content/child/request_extra_data.h" |
| 21 #include "content/child/service_worker/web_service_worker_provider_impl.h" | 23 #include "content/child/service_worker/web_service_worker_provider_impl.h" |
| 22 #include "content/common/frame_messages.h" | 24 #include "content/common/frame_messages.h" |
| 23 #include "content/common/socket_stream_handle_data.h" | 25 #include "content/common/socket_stream_handle_data.h" |
| 24 #include "content/common/swapped_out_messages.h" | 26 #include "content/common/swapped_out_messages.h" |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 40 #include "content/renderer/child_frame_compositing_helper.h" | 42 #include "content/renderer/child_frame_compositing_helper.h" |
| 41 #include "content/renderer/context_menu_params_builder.h" | 43 #include "content/renderer/context_menu_params_builder.h" |
| 42 #include "content/renderer/internal_document_state_data.h" | 44 #include "content/renderer/internal_document_state_data.h" |
| 43 #include "content/renderer/npapi/plugin_channel_host.h" | 45 #include "content/renderer/npapi/plugin_channel_host.h" |
| 44 #include "content/renderer/render_thread_impl.h" | 46 #include "content/renderer/render_thread_impl.h" |
| 45 #include "content/renderer/render_view_impl.h" | 47 #include "content/renderer/render_view_impl.h" |
| 46 #include "content/renderer/render_widget_fullscreen_pepper.h" | 48 #include "content/renderer/render_widget_fullscreen_pepper.h" |
| 47 #include "content/renderer/renderer_webapplicationcachehost_impl.h" | 49 #include "content/renderer/renderer_webapplicationcachehost_impl.h" |
| 48 #include "content/renderer/shared_worker_repository.h" | 50 #include "content/renderer/shared_worker_repository.h" |
| 49 #include "content/renderer/websharedworker_proxy.h" | 51 #include "content/renderer/websharedworker_proxy.h" |
| 52 #include "net/base/data_url.h" | |
| 50 #include "net/base/net_errors.h" | 53 #include "net/base/net_errors.h" |
| 51 #include "net/http/http_util.h" | 54 #include "net/http/http_util.h" |
| 52 #include "third_party/WebKit/public/platform/WebStorageQuotaCallbacks.h" | 55 #include "third_party/WebKit/public/platform/WebStorageQuotaCallbacks.h" |
| 53 #include "third_party/WebKit/public/platform/WebString.h" | 56 #include "third_party/WebKit/public/platform/WebString.h" |
| 54 #include "third_party/WebKit/public/platform/WebURL.h" | 57 #include "third_party/WebKit/public/platform/WebURL.h" |
| 55 #include "third_party/WebKit/public/platform/WebURLError.h" | 58 #include "third_party/WebKit/public/platform/WebURLError.h" |
| 56 #include "third_party/WebKit/public/platform/WebURLResponse.h" | 59 #include "third_party/WebKit/public/platform/WebURLResponse.h" |
| 57 #include "third_party/WebKit/public/platform/WebVector.h" | 60 #include "third_party/WebKit/public/platform/WebVector.h" |
| 58 #include "third_party/WebKit/public/web/WebDocument.h" | 61 #include "third_party/WebKit/public/web/WebDocument.h" |
| 59 #include "third_party/WebKit/public/web/WebFrame.h" | 62 #include "third_party/WebKit/public/web/WebFrame.h" |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 74 #include "content/renderer/pepper/pepper_plugin_instance_impl.h" | 77 #include "content/renderer/pepper/pepper_plugin_instance_impl.h" |
| 75 #include "content/renderer/pepper/pepper_webplugin_impl.h" | 78 #include "content/renderer/pepper/pepper_webplugin_impl.h" |
| 76 #include "content/renderer/pepper/plugin_module.h" | 79 #include "content/renderer/pepper/plugin_module.h" |
| 77 #endif | 80 #endif |
| 78 | 81 |
| 79 #if defined(ENABLE_WEBRTC) | 82 #if defined(ENABLE_WEBRTC) |
| 80 #include "content/renderer/media/rtc_peer_connection_handler.h" | 83 #include "content/renderer/media/rtc_peer_connection_handler.h" |
| 81 #endif | 84 #endif |
| 82 | 85 |
| 83 using blink::WebContextMenuData; | 86 using blink::WebContextMenuData; |
| 87 using blink::WebData; | |
| 84 using blink::WebDataSource; | 88 using blink::WebDataSource; |
| 85 using blink::WebDocument; | 89 using blink::WebDocument; |
| 86 using blink::WebFrame; | 90 using blink::WebFrame; |
| 87 using blink::WebHistoryItem; | 91 using blink::WebHistoryItem; |
| 92 using blink::WebHTTPBody; | |
| 88 using blink::WebNavigationPolicy; | 93 using blink::WebNavigationPolicy; |
| 89 using blink::WebPluginParams; | 94 using blink::WebPluginParams; |
| 90 using blink::WebReferrerPolicy; | 95 using blink::WebReferrerPolicy; |
| 91 using blink::WebSearchableFormData; | 96 using blink::WebSearchableFormData; |
| 92 using blink::WebSecurityOrigin; | 97 using blink::WebSecurityOrigin; |
| 93 using blink::WebSecurityPolicy; | 98 using blink::WebSecurityPolicy; |
| 94 using blink::WebServiceWorkerProvider; | 99 using blink::WebServiceWorkerProvider; |
| 95 using blink::WebStorageQuotaCallbacks; | 100 using blink::WebStorageQuotaCallbacks; |
| 96 using blink::WebString; | 101 using blink::WebString; |
| 97 using blink::WebURL; | 102 using blink::WebURL; |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 135 ds->redirectChain(urls); | 140 ds->redirectChain(urls); |
| 136 result->reserve(urls.size()); | 141 result->reserve(urls.size()); |
| 137 for (size_t i = 0; i < urls.size(); ++i) { | 142 for (size_t i = 0; i < urls.size(); ++i) { |
| 138 if (urls[i] != GURL(kSwappedOutURL)) | 143 if (urls[i] != GURL(kSwappedOutURL)) |
| 139 result->push_back(urls[i]); | 144 result->push_back(urls[i]); |
| 140 else | 145 else |
| 141 result->push_back(blank_url); | 146 result->push_back(blank_url); |
| 142 } | 147 } |
| 143 } | 148 } |
| 144 | 149 |
| 150 NOINLINE static void CrashIntentionally() { | |
| 151 // NOTE(shess): Crash directly rather than using NOTREACHED() so | |
| 152 // that the signature is easier to triage in crash reports. | |
| 153 volatile int* zero = NULL; | |
| 154 *zero = 0; | |
| 155 } | |
| 156 | |
| 157 #if defined(ADDRESS_SANITIZER) | |
| 158 NOINLINE static void MaybeTriggerAsanError(const GURL& url) { | |
| 159 // NOTE(rogerm): We intentionally perform an invalid heap access here in | |
| 160 // order to trigger an Address Sanitizer (ASAN) error report. | |
| 161 static const char kCrashDomain[] = "crash"; | |
| 162 static const char kHeapOverflow[] = "/heap-overflow"; | |
| 163 static const char kHeapUnderflow[] = "/heap-underflow"; | |
| 164 static const char kUseAfterFree[] = "/use-after-free"; | |
| 165 static const int kArraySize = 5; | |
| 166 | |
| 167 if (!url.DomainIs(kCrashDomain, sizeof(kCrashDomain) - 1)) | |
| 168 return; | |
| 169 | |
| 170 if (!url.has_path()) | |
| 171 return; | |
| 172 | |
| 173 scoped_ptr<int[]> array(new int[kArraySize]); | |
| 174 std::string crash_type(url.path()); | |
| 175 int dummy = 0; | |
| 176 if (crash_type == kHeapOverflow) { | |
| 177 dummy = array[kArraySize]; | |
| 178 } else if (crash_type == kHeapUnderflow ) { | |
| 179 dummy = array[-1]; | |
| 180 } else if (crash_type == kUseAfterFree) { | |
| 181 int* dangling = array.get(); | |
| 182 array.reset(); | |
| 183 dummy = dangling[kArraySize / 2]; | |
| 184 } | |
| 185 | |
| 186 // Make sure the assignments to the dummy value aren't optimized away. | |
| 187 base::debug::Alias(&dummy); | |
| 188 } | |
| 189 #endif // ADDRESS_SANITIZER | |
| 190 | |
| 191 static void MaybeHandleDebugURL(const GURL& url) { | |
| 192 if (!url.SchemeIs(kChromeUIScheme)) | |
| 193 return; | |
| 194 if (url == GURL(kChromeUICrashURL)) { | |
| 195 CrashIntentionally(); | |
| 196 } else if (url == GURL(kChromeUIKillURL)) { | |
| 197 base::KillProcess(base::GetCurrentProcessHandle(), 1, false); | |
| 198 } else if (url == GURL(kChromeUIHangURL)) { | |
| 199 for (;;) { | |
| 200 base::PlatformThread::Sleep(base::TimeDelta::FromSeconds(1)); | |
| 201 } | |
| 202 } else if (url == GURL(kChromeUIShorthangURL)) { | |
| 203 base::PlatformThread::Sleep(base::TimeDelta::FromSeconds(20)); | |
| 204 } | |
| 205 | |
| 206 #if defined(ADDRESS_SANITIZER) | |
| 207 MaybeTriggerAsanError(url); | |
| 208 #endif // ADDRESS_SANITIZER | |
| 209 } | |
| 210 | |
| 211 static void NotifyTimezoneChange(blink::WebFrame* frame) { | |
|
Charlie Reis
2014/02/13 19:27:21
Don't forget to remove this copy.
nasko
2014/02/13 19:37:25
Doh! Done.
| |
| 212 v8::HandleScope handle_scope(v8::Isolate::GetCurrent()); | |
| 213 v8::Context::Scope context_scope(frame->mainWorldScriptContext()); | |
| 214 v8::Date::DateTimeConfigurationChangeNotification(v8::Isolate::GetCurrent()); | |
| 215 blink::WebFrame* child = frame->firstChild(); | |
| 216 for (; child; child = child->nextSibling()) | |
| 217 NotifyTimezoneChange(child); | |
| 218 } | |
| 219 | |
| 145 } // namespace | 220 } // namespace |
| 146 | 221 |
| 147 static RenderFrameImpl* (*g_create_render_frame_impl)(RenderViewImpl*, int32) = | 222 static RenderFrameImpl* (*g_create_render_frame_impl)(RenderViewImpl*, int32) = |
| 148 NULL; | 223 NULL; |
| 149 | 224 |
| 150 // static | 225 // static |
| 151 RenderFrameImpl* RenderFrameImpl::Create(RenderViewImpl* render_view, | 226 RenderFrameImpl* RenderFrameImpl::Create(RenderViewImpl* render_view, |
| 152 int32 routing_id) { | 227 int32 routing_id) { |
| 153 DCHECK(routing_id != MSG_ROUTING_NONE); | 228 DCHECK(routing_id != MSG_ROUTING_NONE); |
| 154 | 229 |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 414 ObserverListBase<RenderFrameObserver>::Iterator it(observers_); | 489 ObserverListBase<RenderFrameObserver>::Iterator it(observers_); |
| 415 RenderFrameObserver* observer; | 490 RenderFrameObserver* observer; |
| 416 while ((observer = it.GetNext()) != NULL) { | 491 while ((observer = it.GetNext()) != NULL) { |
| 417 if (observer->OnMessageReceived(msg)) | 492 if (observer->OnMessageReceived(msg)) |
| 418 return true; | 493 return true; |
| 419 } | 494 } |
| 420 | 495 |
| 421 bool handled = true; | 496 bool handled = true; |
| 422 bool msg_is_ok = true; | 497 bool msg_is_ok = true; |
| 423 IPC_BEGIN_MESSAGE_MAP_EX(RenderFrameImpl, msg, msg_is_ok) | 498 IPC_BEGIN_MESSAGE_MAP_EX(RenderFrameImpl, msg, msg_is_ok) |
| 499 IPC_MESSAGE_HANDLER(FrameMsg_Navigate, OnNavigate) | |
| 424 IPC_MESSAGE_HANDLER(FrameMsg_SwapOut, OnSwapOut) | 500 IPC_MESSAGE_HANDLER(FrameMsg_SwapOut, OnSwapOut) |
| 425 IPC_MESSAGE_HANDLER(FrameMsg_BuffersSwapped, OnBuffersSwapped) | 501 IPC_MESSAGE_HANDLER(FrameMsg_BuffersSwapped, OnBuffersSwapped) |
| 426 IPC_MESSAGE_HANDLER_GENERIC(FrameMsg_CompositorFrameSwapped, | 502 IPC_MESSAGE_HANDLER_GENERIC(FrameMsg_CompositorFrameSwapped, |
| 427 OnCompositorFrameSwapped(msg)) | 503 OnCompositorFrameSwapped(msg)) |
| 428 IPC_MESSAGE_HANDLER(FrameMsg_ChildFrameProcessGone, OnChildFrameProcessGone) | 504 IPC_MESSAGE_HANDLER(FrameMsg_ChildFrameProcessGone, OnChildFrameProcessGone) |
| 429 IPC_MESSAGE_HANDLER(FrameMsg_ContextMenuClosed, OnContextMenuClosed) | 505 IPC_MESSAGE_HANDLER(FrameMsg_ContextMenuClosed, OnContextMenuClosed) |
| 430 IPC_MESSAGE_HANDLER(FrameMsg_CustomContextMenuAction, | 506 IPC_MESSAGE_HANDLER(FrameMsg_CustomContextMenuAction, |
| 431 OnCustomContextMenuAction) | 507 OnCustomContextMenuAction) |
| 432 IPC_END_MESSAGE_MAP_EX() | 508 IPC_END_MESSAGE_MAP_EX() |
| 433 | 509 |
| 434 if (!msg_is_ok) { | 510 if (!msg_is_ok) { |
| 435 // The message had a handler, but its deserialization failed. | 511 // The message had a handler, but its deserialization failed. |
| 436 // Kill the renderer to avoid potential spoofing attacks. | 512 // Kill the renderer to avoid potential spoofing attacks. |
| 437 CHECK(false) << "Unable to deserialize message in RenderFrameImpl."; | 513 CHECK(false) << "Unable to deserialize message in RenderFrameImpl."; |
| 438 } | 514 } |
| 439 | 515 |
| 440 return handled; | 516 return handled; |
| 441 } | 517 } |
| 518 | |
| 519 void RenderFrameImpl::OnNavigate(const FrameMsg_Navigate_Params& params) { | |
| 520 MaybeHandleDebugURL(params.url); | |
| 521 if (!render_view_->webview()) | |
| 522 return; | |
| 523 | |
| 524 render_view_->OnNavigate(params); | |
| 525 | |
| 526 bool is_reload = RenderViewImpl::IsReload(params); | |
| 527 WebURLRequest::CachePolicy cache_policy = | |
| 528 WebURLRequest::UseProtocolCachePolicy; | |
| 529 | |
| 530 // If this is a stale back/forward (due to a recent navigation the browser | |
| 531 // didn't know about), ignore it. | |
| 532 if (render_view_->IsBackForwardToStaleEntry(params, is_reload)) | |
| 533 return; | |
| 534 | |
| 535 // Swap this renderer back in if necessary. | |
| 536 if (render_view_->is_swapped_out_) { | |
| 537 // We marked the view as hidden when swapping the view out, so be sure to | |
| 538 // reset the visibility state before navigating to the new URL. | |
| 539 render_view_->webview()->setVisibilityState( | |
| 540 render_view_->visibilityState(), false); | |
| 541 | |
| 542 // If this is an attempt to reload while we are swapped out, we should not | |
| 543 // reload swappedout://, but the previous page, which is stored in | |
| 544 // params.state. Setting is_reload to false will treat this like a back | |
| 545 // navigation to accomplish that. | |
| 546 is_reload = false; | |
| 547 cache_policy = WebURLRequest::ReloadIgnoringCacheData; | |
| 548 | |
| 549 // We refresh timezone when a view is swapped in since timezone | |
| 550 // can get out of sync when the system timezone is updated while | |
| 551 // the view is swapped out. | |
| 552 RenderViewImpl::NotifyTimezoneChange(render_view_->webview()->mainFrame()); | |
| 553 | |
| 554 render_view_->SetSwappedOut(false); | |
| 555 is_swapped_out_ = false; | |
| 556 } | |
| 557 | |
| 558 if (params.should_clear_history_list) { | |
| 559 CHECK_EQ(params.pending_history_list_offset, -1); | |
| 560 CHECK_EQ(params.current_history_list_offset, -1); | |
| 561 CHECK_EQ(params.current_history_list_length, 0); | |
| 562 } | |
| 563 render_view_->history_list_offset_ = params.current_history_list_offset; | |
| 564 render_view_->history_list_length_ = params.current_history_list_length; | |
| 565 if (render_view_->history_list_length_ >= 0) { | |
| 566 render_view_->history_page_ids_.resize( | |
| 567 render_view_->history_list_length_, -1); | |
| 568 } | |
| 569 if (params.pending_history_list_offset >= 0 && | |
| 570 params.pending_history_list_offset < render_view_->history_list_length_) { | |
| 571 render_view_->history_page_ids_[params.pending_history_list_offset] = | |
| 572 params.page_id; | |
| 573 } | |
| 574 | |
| 575 GetContentClient()->SetActiveURL(params.url); | |
| 576 | |
| 577 WebFrame* frame = frame_; | |
| 578 if (!params.frame_to_navigate.empty()) { | |
| 579 // TODO(nasko): Move this lookup to the browser process. | |
| 580 frame = render_view_->webview()->findFrameByName( | |
| 581 WebString::fromUTF8(params.frame_to_navigate)); | |
| 582 CHECK(frame) << "Invalid frame name passed: " << params.frame_to_navigate; | |
| 583 } | |
| 584 | |
| 585 if (is_reload && frame->currentHistoryItem().isNull()) { | |
| 586 // We cannot reload if we do not have any history state. This happens, for | |
| 587 // example, when recovering from a crash. | |
| 588 is_reload = false; | |
| 589 cache_policy = WebURLRequest::ReloadIgnoringCacheData; | |
| 590 } | |
| 591 | |
| 592 render_view_->pending_navigation_params_.reset( | |
| 593 new FrameMsg_Navigate_Params(params)); | |
| 594 | |
| 595 // If we are reloading, then WebKit will use the history state of the current | |
| 596 // page, so we should just ignore any given history state. Otherwise, if we | |
| 597 // have history state, then we need to navigate to it, which corresponds to a | |
| 598 // back/forward navigation event. | |
| 599 if (is_reload) { | |
| 600 bool reload_original_url = | |
| 601 (params.navigation_type == | |
| 602 FrameMsg_Navigate_Type::RELOAD_ORIGINAL_REQUEST_URL); | |
| 603 bool ignore_cache = (params.navigation_type == | |
| 604 FrameMsg_Navigate_Type::RELOAD_IGNORING_CACHE); | |
| 605 | |
| 606 if (reload_original_url) | |
| 607 frame->reloadWithOverrideURL(params.url, true); | |
| 608 else | |
| 609 frame->reload(ignore_cache); | |
| 610 } else if (params.page_state.IsValid()) { | |
| 611 // We must know the page ID of the page we are navigating back to. | |
| 612 DCHECK_NE(params.page_id, -1); | |
| 613 WebHistoryItem item = PageStateToHistoryItem(params.page_state); | |
| 614 if (!item.isNull()) { | |
| 615 // Ensure we didn't save the swapped out URL in UpdateState, since the | |
| 616 // browser should never be telling us to navigate to swappedout://. | |
| 617 CHECK(item.urlString() != WebString::fromUTF8(kSwappedOutURL)); | |
| 618 frame->loadHistoryItem(item, cache_policy); | |
| 619 } | |
| 620 } else if (!params.base_url_for_data_url.is_empty()) { | |
| 621 // A loadData request with a specified base URL. | |
| 622 std::string mime_type, charset, data; | |
| 623 if (net::DataURL::Parse(params.url, &mime_type, &charset, &data)) { | |
| 624 frame->loadData( | |
| 625 WebData(data.c_str(), data.length()), | |
| 626 WebString::fromUTF8(mime_type), | |
| 627 WebString::fromUTF8(charset), | |
| 628 params.base_url_for_data_url, | |
| 629 params.history_url_for_data_url, | |
| 630 false); | |
| 631 } else { | |
| 632 CHECK(false) << | |
| 633 "Invalid URL passed: " << params.url.possibly_invalid_spec(); | |
| 634 } | |
| 635 } else { | |
| 636 // Navigate to the given URL. | |
| 637 WebURLRequest request(params.url); | |
| 638 | |
| 639 // A session history navigation should have been accompanied by state. | |
| 640 CHECK_EQ(params.page_id, -1); | |
| 641 | |
| 642 if (frame->isViewSourceModeEnabled()) | |
| 643 request.setCachePolicy(WebURLRequest::ReturnCacheDataElseLoad); | |
| 644 | |
| 645 if (params.referrer.url.is_valid()) { | |
| 646 WebString referrer = WebSecurityPolicy::generateReferrerHeader( | |
| 647 params.referrer.policy, | |
| 648 params.url, | |
| 649 WebString::fromUTF8(params.referrer.url.spec())); | |
| 650 if (!referrer.isEmpty()) | |
| 651 request.setHTTPReferrer(referrer, params.referrer.policy); | |
| 652 } | |
| 653 | |
| 654 if (!params.extra_headers.empty()) { | |
| 655 for (net::HttpUtil::HeadersIterator i(params.extra_headers.begin(), | |
| 656 params.extra_headers.end(), "\n"); | |
| 657 i.GetNext(); ) { | |
| 658 request.addHTTPHeaderField(WebString::fromUTF8(i.name()), | |
| 659 WebString::fromUTF8(i.values())); | |
| 660 } | |
| 661 } | |
| 662 | |
| 663 if (params.is_post) { | |
| 664 request.setHTTPMethod(WebString::fromUTF8("POST")); | |
| 665 | |
| 666 // Set post data. | |
| 667 WebHTTPBody http_body; | |
| 668 http_body.initialize(); | |
| 669 const char* data = NULL; | |
| 670 if (params.browser_initiated_post_data.size()) { | |
| 671 data = reinterpret_cast<const char*>( | |
| 672 ¶ms.browser_initiated_post_data.front()); | |
| 673 } | |
| 674 http_body.appendData( | |
| 675 WebData(data, params.browser_initiated_post_data.size())); | |
| 676 request.setHTTPBody(http_body); | |
| 677 } | |
| 678 | |
| 679 frame->loadRequest(request); | |
| 680 | |
| 681 // If this is a cross-process navigation, the browser process will send | |
| 682 // along the proper navigation start value. | |
| 683 if (!params.browser_navigation_start.is_null() && | |
| 684 frame->provisionalDataSource()) { | |
| 685 // browser_navigation_start is likely before this process existed, so we | |
| 686 // can't use InterProcessTimeTicksConverter. Instead, the best we can do | |
| 687 // is just ensure we don't report a bogus value in the future. | |
| 688 base::TimeTicks navigation_start = std::min( | |
| 689 base::TimeTicks::Now(), params.browser_navigation_start); | |
| 690 double navigation_start_seconds = | |
| 691 (navigation_start - base::TimeTicks()).InSecondsF(); | |
| 692 frame->provisionalDataSource()->setNavigationStartTime( | |
| 693 navigation_start_seconds); | |
| 694 } | |
| 695 } | |
| 696 | |
| 697 // In case LoadRequest failed before DidCreateDataSource was called. | |
| 698 render_view_->pending_navigation_params_.reset(); | |
| 699 } | |
| 442 | 700 |
| 443 void RenderFrameImpl::OnSwapOut() { | 701 void RenderFrameImpl::OnSwapOut() { |
| 444 // Only run unload if we're not swapped out yet, but send the ack either way. | 702 // Only run unload if we're not swapped out yet, but send the ack either way. |
| 445 if (!is_swapped_out_) { | 703 if (!is_swapped_out_) { |
| 446 // Swap this RenderView out so the tab can navigate to a page rendered by a | 704 // Swap this RenderView out so the tab can navigate to a page rendered by a |
| 447 // different process. This involves running the unload handler and clearing | 705 // different process. This involves running the unload handler and clearing |
| 448 // the page. Once WasSwappedOut is called, we also allow this process to | 706 // the page. Once WasSwappedOut is called, we also allow this process to |
| 449 // exit if there are no other active RenderViews in it. | 707 // exit if there are no other active RenderViews in it. |
| 450 | 708 |
| 451 // Send an UpdateState message before we get swapped out. | 709 // Send an UpdateState message before we get swapped out. |
| (...skipping 610 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1062 // TODO(davidben): This should also take the failed navigation's replacement | 1320 // TODO(davidben): This should also take the failed navigation's replacement |
| 1063 // state into account, if a location.replace() failed. | 1321 // state into account, if a location.replace() failed. |
| 1064 bool replace = | 1322 bool replace = |
| 1065 navigation_state->pending_page_id() != -1 || | 1323 navigation_state->pending_page_id() != -1 || |
| 1066 PageTransitionCoreTypeIs(navigation_state->transition_type(), | 1324 PageTransitionCoreTypeIs(navigation_state->transition_type(), |
| 1067 PAGE_TRANSITION_AUTO_SUBFRAME); | 1325 PAGE_TRANSITION_AUTO_SUBFRAME); |
| 1068 | 1326 |
| 1069 // If we failed on a browser initiated request, then make sure that our error | 1327 // If we failed on a browser initiated request, then make sure that our error |
| 1070 // page load is regarded as the same browser initiated request. | 1328 // page load is regarded as the same browser initiated request. |
| 1071 if (!navigation_state->is_content_initiated()) { | 1329 if (!navigation_state->is_content_initiated()) { |
| 1072 render_view_->pending_navigation_params_.reset(new ViewMsg_Navigate_Params); | 1330 render_view_->pending_navigation_params_.reset( |
| 1331 new FrameMsg_Navigate_Params); | |
| 1073 render_view_->pending_navigation_params_->page_id = | 1332 render_view_->pending_navigation_params_->page_id = |
| 1074 navigation_state->pending_page_id(); | 1333 navigation_state->pending_page_id(); |
| 1075 render_view_->pending_navigation_params_->pending_history_list_offset = | 1334 render_view_->pending_navigation_params_->pending_history_list_offset = |
| 1076 navigation_state->pending_history_list_offset(); | 1335 navigation_state->pending_history_list_offset(); |
| 1077 render_view_->pending_navigation_params_->should_clear_history_list = | 1336 render_view_->pending_navigation_params_->should_clear_history_list = |
| 1078 navigation_state->history_list_was_cleared(); | 1337 navigation_state->history_list_was_cleared(); |
| 1079 render_view_->pending_navigation_params_->transition = | 1338 render_view_->pending_navigation_params_->transition = |
| 1080 navigation_state->transition_type(); | 1339 navigation_state->transition_type(); |
| 1081 render_view_->pending_navigation_params_->request_time = | 1340 render_view_->pending_navigation_params_->request_time = |
| 1082 document_state->request_time(); | 1341 document_state->request_time(); |
| (...skipping 871 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1954 | 2213 |
| 1955 void RenderFrameImpl::didStartLoading() { | 2214 void RenderFrameImpl::didStartLoading() { |
| 1956 Send(new FrameHostMsg_DidStartLoading(routing_id_)); | 2215 Send(new FrameHostMsg_DidStartLoading(routing_id_)); |
| 1957 } | 2216 } |
| 1958 | 2217 |
| 1959 void RenderFrameImpl::didStopLoading() { | 2218 void RenderFrameImpl::didStopLoading() { |
| 1960 Send(new FrameHostMsg_DidStopLoading(routing_id_)); | 2219 Send(new FrameHostMsg_DidStopLoading(routing_id_)); |
| 1961 } | 2220 } |
| 1962 | 2221 |
| 1963 } // namespace content | 2222 } // namespace content |
| OLD | NEW |