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

Unified Diff: android_webview/browser/renderer_host/aw_resource_dispatcher_host_delegate.cc

Issue 11417061: [android_webview] Enable navigation interception for iframes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: make findbugs happy? Created 8 years, 1 month 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 | « no previous file | android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientShouldIgnoreNavigationTest.java » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: android_webview/browser/renderer_host/aw_resource_dispatcher_host_delegate.cc
diff --git a/android_webview/browser/renderer_host/aw_resource_dispatcher_host_delegate.cc b/android_webview/browser/renderer_host/aw_resource_dispatcher_host_delegate.cc
index b24eb2b56eac50e61bccdadb308a07a74515d6c0..328cecf30f5e2d69e86b84336118844603d64e20 100644
--- a/android_webview/browser/renderer_host/aw_resource_dispatcher_host_delegate.cc
+++ b/android_webview/browser/renderer_host/aw_resource_dispatcher_host_delegate.cc
@@ -130,7 +130,22 @@ void AwResourceDispatcherHostDelegate::RequestBeginning(
throttles->push_back(new MaybeCancelResourceThrottle(
child_id, route_id, request));
- if (resource_type == ResourceType::MAIN_FRAME) {
+ bool allow_intercepting =
+ // We ignore POST requests because of BUG=155250.
+ request->method() != "POST" &&
+ // We allow intercepting navigations within subframes, but only if the
+ // scheme other than http or https. This is because the embedder
+ // can't distinguish main frame and subframe callbacks (which could lead
+ // to broken content if the embedder decides to not ignore the main frame
+ // navigation, but ignores the subframe navigation).
+ // The reason this is supported at all is that certain JavaScript-based
+ // frameworks use iframe navigation as a form of communication with the
+ // embedder.
+ (resource_type == ResourceType::MAIN_FRAME ||
+ (resource_type == ResourceType::SUB_FRAME &&
+ !request->url().SchemeIs(chrome::kHttpScheme) &&
+ !request->url().SchemeIs(chrome::kHttpsScheme)));
+ if (allow_intercepting) {
throttles->push_back(InterceptNavigationDelegate::CreateThrottleFor(
request));
}
« no previous file with comments | « no previous file | android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientShouldIgnoreNavigationTest.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698