Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(616)

Side by Side Diff: content/browser/frame_host/navigation_entry_impl.cc

Issue 1189413005: Fix race when reloading original URL (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixing include Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/browser/frame_host/navigation_entry_impl.h" 5 #include "content/browser/frame_host/navigation_entry_impl.h"
6 6
7 #include <queue> 7 #include <queue>
8 8
9 #include "base/metrics/histogram.h" 9 #include "base/metrics/histogram.h"
10 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
(...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after
439 FrameMsg_Navigate_Type::Value navigation_type) const { 439 FrameMsg_Navigate_Type::Value navigation_type) const {
440 FrameMsg_UILoadMetricsReportType::Value report_type = 440 FrameMsg_UILoadMetricsReportType::Value report_type =
441 FrameMsg_UILoadMetricsReportType::NO_REPORT; 441 FrameMsg_UILoadMetricsReportType::NO_REPORT;
442 base::TimeTicks ui_timestamp = base::TimeTicks(); 442 base::TimeTicks ui_timestamp = base::TimeTicks();
443 #if defined(OS_ANDROID) 443 #if defined(OS_ANDROID)
444 if (!intent_received_timestamp().is_null()) 444 if (!intent_received_timestamp().is_null())
445 report_type = FrameMsg_UILoadMetricsReportType::REPORT_INTENT; 445 report_type = FrameMsg_UILoadMetricsReportType::REPORT_INTENT;
446 ui_timestamp = intent_received_timestamp(); 446 ui_timestamp = intent_received_timestamp();
447 #endif 447 #endif
448 448
449 GURL url = frame_entry.url();
450 Referrer referrer = frame_entry.referrer();
451 if (navigation_type == FrameMsg_Navigate_Type::RELOAD_ORIGINAL_REQUEST_URL &&
452 GetOriginalRequestURL().is_valid() && !GetHasPostData()) {
453 // We may have been redirected when navigating to the current URL.
454 // Use the URL the user originally intended to visit, if it's valid and if a
455 // POST wasn't involved; the latter case avoids issues with sending data to
456 // the wrong page.
457 url = GetOriginalRequestURL();
458 referrer = Referrer();
459 }
460
449 return CommonNavigationParams( 461 return CommonNavigationParams(
450 frame_entry.url(), frame_entry.referrer(), GetTransitionType(), 462 url, referrer, GetTransitionType(), navigation_type, !IsViewSourceMode(),
451 navigation_type, !IsViewSourceMode(), ui_timestamp, report_type, 463 ui_timestamp, report_type, GetBaseURLForDataURL(),
452 GetBaseURLForDataURL(), GetHistoryURLForDataURL()); 464 GetHistoryURLForDataURL());
453 } 465 }
454 466
455 StartNavigationParams NavigationEntryImpl::ConstructStartNavigationParams() 467 StartNavigationParams NavigationEntryImpl::ConstructStartNavigationParams()
456 const { 468 const {
457 std::vector<unsigned char> browser_initiated_post_data; 469 std::vector<unsigned char> browser_initiated_post_data;
458 if (GetBrowserInitiatedPostData()) { 470 if (GetBrowserInitiatedPostData()) {
459 browser_initiated_post_data.assign( 471 browser_initiated_post_data.assign(
460 GetBrowserInitiatedPostData()->front(), 472 GetBrowserInitiatedPostData()->front(),
461 GetBrowserInitiatedPostData()->front() + 473 GetBrowserInitiatedPostData()->front() +
462 GetBrowserInitiatedPostData()->size()); 474 GetBrowserInitiatedPostData()->size());
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
604 return node; 616 return node;
605 } 617 }
606 // Enqueue any children and keep looking. 618 // Enqueue any children and keep looking.
607 for (auto& child : node->children) 619 for (auto& child : node->children)
608 work_queue.push(child); 620 work_queue.push(child);
609 } 621 }
610 return nullptr; 622 return nullptr;
611 } 623 }
612 624
613 } // namespace content 625 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698