diff options
author | Steve Block <steveblock@google.com> | 2011-08-31 06:23:18 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2011-08-31 06:23:18 -0700 |
commit | 24a08199b7204cfa19c1f61d93ea8df86d3bb99f (patch) | |
tree | b82ee6f27a90c756aded85f735bdac71e580787a /Source/WebKit/android/WebCoreSupport/FrameLoaderClientAndroid.cpp | |
parent | 12b77e280bad970089c6ef32e247a39a13e36057 (diff) | |
parent | 5498351dca14a6380ef3174a0afa0bb950b92d68 (diff) | |
download | external_webkit-24a08199b7204cfa19c1f61d93ea8df86d3bb99f.zip external_webkit-24a08199b7204cfa19c1f61d93ea8df86d3bb99f.tar.gz external_webkit-24a08199b7204cfa19c1f61d93ea8df86d3bb99f.tar.bz2 |
Merge "Make sure WebViewClient.onPageStarted() doesn't preceed WebViewClient.shouldOverrideUrlLoading()"
Diffstat (limited to 'Source/WebKit/android/WebCoreSupport/FrameLoaderClientAndroid.cpp')
-rw-r--r-- | Source/WebKit/android/WebCoreSupport/FrameLoaderClientAndroid.cpp | 37 |
1 files changed, 22 insertions, 15 deletions
diff --git a/Source/WebKit/android/WebCoreSupport/FrameLoaderClientAndroid.cpp b/Source/WebKit/android/WebCoreSupport/FrameLoaderClientAndroid.cpp index b79b550..9de6c09 100644 --- a/Source/WebKit/android/WebCoreSupport/FrameLoaderClientAndroid.cpp +++ b/Source/WebKit/android/WebCoreSupport/FrameLoaderClientAndroid.cpp @@ -95,7 +95,8 @@ FrameLoaderClientAndroid::FrameLoaderClientAndroid(WebFrame* webframe) , m_webFrame(webframe) , m_manualLoader(NULL) , m_hasSentResponseToPlugin(false) - , m_onDemandPluginsEnabled(false) { + , m_onDemandPluginsEnabled(false) + , m_didReceiveServerRedirect(false) { Retain(m_webFrame); } @@ -210,9 +211,8 @@ void FrameLoaderClientAndroid::dispatchDidHandleOnloadEvents() { } void FrameLoaderClientAndroid::dispatchDidReceiveServerRedirectForProvisionalLoad() { - ASSERT(m_frame); - // Tell the load it was a redirect. - m_webFrame->loadStarted(m_frame); + ASSERT(!m_didReceiveServerRedirect); + m_didReceiveServerRedirect = true; } void FrameLoaderClientAndroid::dispatchDidCancelClientRedirect() { @@ -768,17 +768,24 @@ bool FrameLoaderClientAndroid::shouldFallBack(const ResourceError&) { } bool FrameLoaderClientAndroid::canHandleRequest(const ResourceRequest& request) const { - ASSERT(m_frame); - // Don't allow hijacking of intrapage navigation - if (WebCore::equalIgnoringFragmentIdentifier(request.url(), m_frame->document()->url())) - return true; - - // Don't allow hijacking of iframe urls that are http or https - if (request.url().protocol().startsWith("http", false) && - m_frame->tree() && m_frame->tree()->parent()) - return true; - - return m_webFrame->canHandleRequest(request); + // This is called by WebCore to determine if this load can be handled by the + // WebView. In general, we delegate to the WebFrame, which may ask the + // embedding application whether it wishes to hijack the load. However, we + // don't allow this if the load is ... + // - An intrapage navigation + // - An iframe with a HTTP or HTTPS scheme URL + bool canHandle = WebCore::equalIgnoringFragmentIdentifier(request.url(), m_frame->document()->url()) || + (request.url().protocol().startsWith("http", false) && m_frame->tree() && m_frame->tree()->parent()) || + m_webFrame->canHandleRequest(request); + + // If this is a server-side redirect and the WebView will handle loading it, + // notify the WebFrame, which may notify the embedding application that + // we're loading a new URL. + if (m_didReceiveServerRedirect && canHandle) + m_webFrame->loadStarted(m_frame); + m_didReceiveServerRedirect = false; + + return canHandle; } bool FrameLoaderClientAndroid::canShowMIMEType(const String& mimeType) const { |