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

Unified Diff: third_party/WebKit/Source/web/LocalFrameClientImpl.cpp

Issue 2901223003: PlzNavigate: Fix wrong SourceLocation. (Closed)
Patch Set: Rebase + Fix conflicts. Created 3 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/web/LocalFrameClientImpl.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/web/LocalFrameClientImpl.cpp
diff --git a/third_party/WebKit/Source/web/LocalFrameClientImpl.cpp b/third_party/WebKit/Source/web/LocalFrameClientImpl.cpp
index 78a1ecfc0652e6a746f14446f3b8200c04c3c046..7c07259cc70cb6df1c450ff2ffd8995ab05ba326 100644
--- a/third_party/WebKit/Source/web/LocalFrameClientImpl.cpp
+++ b/third_party/WebKit/Source/web/LocalFrameClientImpl.cpp
@@ -494,6 +494,7 @@ static bool AllowCreatingBackgroundTabs() {
NavigationPolicy LocalFrameClientImpl::DecidePolicyForNavigation(
const ResourceRequest& request,
+ Document* origin_document,
DocumentLoader* loader,
NavigationType type,
NavigationPolicy policy,
@@ -555,8 +556,14 @@ NavigationPolicy LocalFrameClientImpl::DecidePolicyForNavigation(
if (form)
navigation_info.form = WebFormElement(form);
+ // The frame has navigated either by itself or by the action of the
+ // |origin_document| when it is defined. |source_location| represents the
+ // line of code that has initiated the navigation. It is used to let web
+ // developpers locate the root cause of blocked navigations.
std::unique_ptr<SourceLocation> source_location =
- SourceLocation::Capture(web_frame_->GetFrame()->GetDocument());
+ origin_document
+ ? SourceLocation::Capture(origin_document)
+ : SourceLocation::Capture(web_frame_->GetFrame()->GetDocument());
if (source_location && !source_location->IsUnknown()) {
navigation_info.source_location.url = source_location->Url();
navigation_info.source_location.line_number = source_location->LineNumber();
« no previous file with comments | « third_party/WebKit/Source/web/LocalFrameClientImpl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698