NavigationHandle does not report view-source component of URL |
||
Issue descriptionI stumbled on an interesting discrepancy in NavigationHandle::GetURL versus WebContents::GetLastCommittedURL. The SavePageBrowserTest.SaveViewSourceHTMLOnly browser test navigates to a view source URL - "view-source:http://mock.http/save_page/a.htm". In WebContentsObserver::DidFinishNavigation, after checking that the navigation was committed and in the main frame and without error, navigation_handle->GetURL() returned "http://mock.http/save_page/a.htm", without the view-source: prefix. However, calling web_contents()->GetLastCommittedURL() returned the link with the correct view-source prefix. Is there a reason why the navigation handle doesn't have the view-source component in the URL? Is it to do with how view source is implemented? As an aside, this inconsistency tripped an ASAN bot into exposing a memory leak in HostContentSettingsMap, so it was helpful in a way! :)
,
Jun 9 2016
Thanks for the context. An update to the comment in web_contents.h SGTM just to clarify what's going on. :)
,
Jun 21 2016
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/319d693f722a8bc60ca52b6735b8efae7875d5d0 commit 319d693f722a8bc60ca52b6735b8efae7875d5d0 Author: dominickn <dominickn@chromium.org> Date: Tue Jun 21 00:59:26 2016 Clarify that WebContents::GetLastCommittedURL returns the virtual URL. NavigationHandle::GetURL is not necessarily consistent with WebContents::GetLastCommittedURL, as the URL being navigated to may be changed for display in the URL bar. For example, when viewing the page source, NavigationHandle::GetURL returns the page's URL, but WebContents::GetLastCommittedURL returns the URL prefixed with "view-source:". This CL notes the difference in the header comments for both methods. BUG= 618553 Review-Url: https://codereview.chromium.org/2076063002 Cr-Commit-Position: refs/heads/master@{#400857} [modify] https://crrev.com/319d693f722a8bc60ca52b6735b8efae7875d5d0/content/public/browser/navigation_handle.h [modify] https://crrev.com/319d693f722a8bc60ca52b6735b8efae7875d5d0/content/public/browser/web_contents.h
,
Jun 21 2016
|
||
►
Sign in to add a comment |
||
Comment 1 by creis@chromium.org
, Jun 9 2016