diff options
Diffstat (limited to 'content/browser/android')
-rw-r--r-- | content/browser/android/content_view_core_impl.cc | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/content/browser/android/content_view_core_impl.cc b/content/browser/android/content_view_core_impl.cc index ccdc2e0..81347ee 100644 --- a/content/browser/android/content_view_core_impl.cc +++ b/content/browser/android/content_view_core_impl.cc @@ -778,7 +778,12 @@ void ContentViewCoreImpl::SetAllUserAgentOverridesInHistory( ScopedJavaLocalRef<jstring> ContentViewCoreImpl::GetURL( JNIEnv* env, jobject) const { - return ConvertUTF8ToJavaString(env, GetWebContents()->GetURL().spec()); + // The current users of the Java API expect to use the active entry + // rather than the visible entry, which is exposed by WebContents::GetURL. + content::NavigationEntry* entry = + web_contents_->GetController().GetActiveEntry(); + GURL url = entry ? entry->GetVirtualURL() : GURL::EmptyGURL(); + return ConvertUTF8ToJavaString(env, url.spec()); } ScopedJavaLocalRef<jstring> ContentViewCoreImpl::GetTitle( |