summaryrefslogtreecommitdiffstats
path: root/webkit
diff options
context:
space:
mode:
authortkent@chromium.org <tkent@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-19 02:23:34 +0000
committertkent@chromium.org <tkent@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-19 02:23:34 +0000
commit7b7a7dc7f3cd95ea98b990250540e91b6d6c2b85 (patch)
tree11ffe0c0a370a0690c3865a0e5756c46817f2426 /webkit
parentfa902b7c687b26a82f61b3a408c2ed6c4f7a3020 (diff)
downloadchromium_src-7b7a7dc7f3cd95ea98b990250540e91b6d6c2b85.zip
chromium_src-7b7a7dc7f3cd95ea98b990250540e91b6d6c2b85.tar.gz
chromium_src-7b7a7dc7f3cd95ea98b990250540e91b6d6c2b85.tar.bz2
Make LayoutTests/http/tests/misc/redirect-to-external-url.html PASS.
* Implement WebFrameLoaderClient::dispatchUnableToImplementPolicy() * Implement WebFrameLoaderClient::canHandleRequest() so that an unkown scheme makes ResourceError. - Introduce WebFrameClient::canHandleRequest() to avoid chrome:: dependency from webkit/glue. - Introduce WebFrameClient::cannotShowURLError() to keep transparency of WebURLError. * Introduce WebFrameClient::unableToImplementPolicyWithError() An implmentation in test_shell prints the message same as WebKit. BUG=24074 TEST=This change enables 1 test. Review URL: http://codereview.chromium.org/271087 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@29386 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r--webkit/api/public/WebFrameClient.h10
-rw-r--r--webkit/glue/empty_webframeclient.h6
-rw-r--r--webkit/glue/webframeloaderclient_impl.cc23
-rw-r--r--webkit/tools/layout_tests/test_expectations.txt4
-rw-r--r--webkit/tools/test_shell/test_webview_delegate.cc26
-rw-r--r--webkit/tools/test_shell/test_webview_delegate.h5
6 files changed, 61 insertions, 13 deletions
diff --git a/webkit/api/public/WebFrameClient.h b/webkit/api/public/WebFrameClient.h
index 82f9eed..f0fd8b3 100644
--- a/webkit/api/public/WebFrameClient.h
+++ b/webkit/api/public/WebFrameClient.h
@@ -91,6 +91,16 @@ namespace WebKit {
const WebNode& originatingNode,
WebNavigationPolicy defaultPolicy, bool isRedirect) = 0;
+ // Query if the specified request can be handled.
+ virtual bool canHandleRequest(const WebURLRequest& request) = 0;
+
+ // Called if canHandledRequest() returns false.
+ virtual WebURLError cannotShowURLError(
+ const WebURLRequest& request) = 0;
+
+ // Notify that a URL cannot be handled.
+ virtual void unableToImplementPolicyWithError(
+ WebFrame*, const WebURLError&) = 0;
// Navigational notifications ------------------------------------------
diff --git a/webkit/glue/empty_webframeclient.h b/webkit/glue/empty_webframeclient.h
index 62a52c0..6b1af5e 100644
--- a/webkit/glue/empty_webframeclient.h
+++ b/webkit/glue/empty_webframeclient.h
@@ -6,6 +6,7 @@
#define WEBKIT_GLUE_EMPTY_WEBFRAMECLIENT_H_
#include "webkit/api/public/WebFrameClient.h"
+#include "webkit/api/public/WebURLError.h"
namespace webkit_glue {
@@ -30,6 +31,11 @@ class EmptyWebFrameClient : public WebKit::WebFrameClient {
WebKit::WebNavigationType type, const WebKit::WebNode& originating_node,
WebKit::WebNavigationPolicy default_policy, bool is_redirect) {
return default_policy; }
+ virtual bool canHandleRequest(const WebKit::WebURLRequest&) { return true; }
+ virtual WebKit::WebURLError cannotShowURLError(
+ const WebKit::WebURLRequest& request) { return WebKit::WebURLError(); }
+ virtual void unableToImplementPolicyWithError(
+ WebKit::WebFrame*, const WebKit::WebURLError&) {}
virtual void willSubmitForm(WebKit::WebFrame* frame,
const WebKit::WebForm& form) {}
virtual void willPerformClientRedirect(
diff --git a/webkit/glue/webframeloaderclient_impl.cc b/webkit/glue/webframeloaderclient_impl.cc
index 826625dd..3fe52c62 100644
--- a/webkit/glue/webframeloaderclient_impl.cc
+++ b/webkit/glue/webframeloaderclient_impl.cc
@@ -849,8 +849,11 @@ void WebFrameLoaderClient::cancelPolicyCheck() {
// FIXME
}
-void WebFrameLoaderClient::dispatchUnableToImplementPolicy(const ResourceError&) {
- // FIXME
+void WebFrameLoaderClient::dispatchUnableToImplementPolicy(
+ const ResourceError& error) {
+ WebKit::WebURLError url_error =
+ webkit_glue::ResourceErrorToWebURLError(error);
+ webframe_->client()->unableToImplementPolicyWithError(webframe_, url_error);
}
void WebFrameLoaderClient::dispatchWillSubmitForm(FramePolicyFunction function,
@@ -999,10 +1002,13 @@ ResourceError WebFrameLoaderClient::cancelledError(
return ResourceError(net::kErrorDomain, net::ERR_ABORTED,
request.url().string(), String());
}
-ResourceError WebFrameLoaderClient::cannotShowURLError(const ResourceRequest&) {
- // FIXME
- return ResourceError();
+
+ResourceError WebFrameLoaderClient::cannotShowURLError(
+ const ResourceRequest& request) {
+ return webkit_glue::WebURLErrorToResourceError(
+ webframe_->client()->cannotShowURLError(WrappedResourceRequest(request)));
}
+
ResourceError WebFrameLoaderClient::interruptForPolicyChangeError(
const ResourceRequest& request) {
return ResourceError(kInternalErrorDomain, ERR_POLICY_CHANGE,
@@ -1034,10 +1040,9 @@ bool WebFrameLoaderClient::shouldFallBack(const ResourceError& error) {
return error.errorCode() != net::ERR_ABORTED;
}
-bool WebFrameLoaderClient::canHandleRequest(const ResourceRequest&) const {
- // FIXME: this appears to be used only by the context menu code to determine
- // if "open" should be displayed in the menu when clicking on a link.
- return true;
+bool WebFrameLoaderClient::canHandleRequest(
+ const ResourceRequest& request) const {
+ return webframe_->client()->canHandleRequest(WrappedResourceRequest(request));
}
bool WebFrameLoaderClient::canShowMIMEType(const String& mime_type) const {
diff --git a/webkit/tools/layout_tests/test_expectations.txt b/webkit/tools/layout_tests/test_expectations.txt
index 29efeec..8c3a91d 100644
--- a/webkit/tools/layout_tests/test_expectations.txt
+++ b/webkit/tools/layout_tests/test_expectations.txt
@@ -2643,10 +2643,6 @@ BUG10861 WIN : LayoutTests/http/tests/plugins/post-url-file.html = PASS
BUG10861 MAC : LayoutTests/http/tests/plugins/post-url-file.html = TIMEOUT
// New failures from WebKit merge 42725:42805
-// Need to implement WebFrameLoaderClient::dispatchUnableToImplmentPolicy().
-BUG24074 : LayoutTests/http/tests/misc/redirect-to-external-url.html = FAIL
-
-// New failures from WebKit merge 42725:42805
// WebKit change http://trac.webkit.org/changeset/42785
// added a test which submits a form and then uses history.back()
// to go back. in test_shell history.back() does not go back,
diff --git a/webkit/tools/test_shell/test_webview_delegate.cc b/webkit/tools/test_shell/test_webview_delegate.cc
index 69d1224..0ed4780 100644
--- a/webkit/tools/test_shell/test_webview_delegate.cc
+++ b/webkit/tools/test_shell/test_webview_delegate.cc
@@ -657,6 +657,32 @@ WebNavigationPolicy TestWebViewDelegate::decidePolicyForNavigation(
return result;
}
+bool TestWebViewDelegate::canHandleRequest(const WebURLRequest& request) {
+ GURL url = request.url();
+ // Just reject the scheme used in
+ // LayoutTests/http/tests/misc/redirect-to-external-url.html
+ return !url.SchemeIs("spaceballs");
+}
+
+WebURLError TestWebViewDelegate::cannotShowURLError(
+ const WebURLRequest& request) {
+ WebURLError error;
+ // A WebKit layout test expects the following values.
+ // unableToImplementPolicyWithError() below prints them.
+ error.domain = WebString::fromUTF8("WebKitErrorDomain");
+ error.reason = 101;
+ error.unreachableURL = request.url();
+ return error;
+}
+
+void TestWebViewDelegate::unableToImplementPolicyWithError(
+ WebFrame* frame, const WebURLError& error) {
+ std::string domain = error.domain.utf8();
+ printf("Policy delegate: unable to implement policy with error domain '%s', "
+ "error code %d, in frame '%s'\n",
+ domain.data(), error.reason, frame->name().utf8().data());
+}
+
void TestWebViewDelegate::willPerformClientRedirect(
WebFrame* frame, const WebURL& from, const WebURL& to,
double interval, double fire_time) {
diff --git a/webkit/tools/test_shell/test_webview_delegate.h b/webkit/tools/test_shell/test_webview_delegate.h
index ad82a4a..155bb64 100644
--- a/webkit/tools/test_shell/test_webview_delegate.h
+++ b/webkit/tools/test_shell/test_webview_delegate.h
@@ -182,6 +182,11 @@ class TestWebViewDelegate : public WebViewDelegate,
WebKit::WebFrame*, const WebKit::WebURLRequest&,
WebKit::WebNavigationType, const WebKit::WebNode&,
WebKit::WebNavigationPolicy default_policy, bool isRedirect);
+ virtual bool canHandleRequest(const WebKit::WebURLRequest&);
+ virtual WebKit::WebURLError cannotShowURLError(
+ const WebKit::WebURLRequest& request);
+ virtual void unableToImplementPolicyWithError(
+ WebKit::WebFrame*, const WebKit::WebURLError&);
virtual void willSubmitForm(WebKit::WebFrame*, const WebKit::WebForm&) {}
virtual void willPerformClientRedirect(
WebKit::WebFrame*, const WebKit::WebURL& from, const WebKit::WebURL& to,