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