Title: [167611] trunk/Source/WebKit2
- Revision
- 167611
- Author
- [email protected]
- Date
- 2014-04-21 12:51:01 -0700 (Mon, 21 Apr 2014)
Log Message
Need default WKNavigationDelegate behavior
https://bugs.webkit.org/show_bug.cgi?id=131944
<rdar://problem/15949822>
Reviewed by Dan Bernstein.
Port the WebKit1 default delegate behavior over.
* UIProcess/Cocoa/NavigationState.mm:
(WebKit::NavigationState::PolicyClient::decidePolicyForNavigationAction):
(WebKit::NavigationState::PolicyClient::decidePolicyForResponse):
Modified Paths
Diff
Modified: trunk/Source/WebKit2/ChangeLog (167610 => 167611)
--- trunk/Source/WebKit2/ChangeLog 2014-04-21 19:49:00 UTC (rev 167610)
+++ trunk/Source/WebKit2/ChangeLog 2014-04-21 19:51:01 UTC (rev 167611)
@@ -1,3 +1,17 @@
+2014-04-21 Anders Carlsson <[email protected]>
+
+ Need default WKNavigationDelegate behavior
+ https://bugs.webkit.org/show_bug.cgi?id=131944
+ <rdar://problem/15949822>
+
+ Reviewed by Dan Bernstein.
+
+ Port the WebKit1 default delegate behavior over.
+
+ * UIProcess/Cocoa/NavigationState.mm:
+ (WebKit::NavigationState::PolicyClient::decidePolicyForNavigationAction):
+ (WebKit::NavigationState::PolicyClient::decidePolicyForResponse):
+
2014-04-21 Dan Bernstein <[email protected]>
[Cocoa] Expose WebPage::setDefersLoading
Modified: trunk/Source/WebKit2/UIProcess/Cocoa/NavigationState.mm (167610 => 167611)
--- trunk/Source/WebKit2/UIProcess/Cocoa/NavigationState.mm 2014-04-21 19:49:00 UTC (rev 167610)
+++ trunk/Source/WebKit2/UIProcess/Cocoa/NavigationState.mm 2014-04-21 19:51:01 UTC (rev 167611)
@@ -210,8 +210,24 @@
void NavigationState::PolicyClient::decidePolicyForNavigationAction(WebPageProxy*, WebFrameProxy* destinationFrame, const NavigationActionData& navigationActionData, WebFrameProxy* sourceFrame, const WebCore::ResourceRequest& originalRequest, const WebCore::ResourceRequest& request, RefPtr<WebFramePolicyListenerProxy> listener, API::Object* userData)
{
if (!m_navigationState.m_navigationDelegateMethods.webViewDecidePolicyForNavigationActionDecisionHandler) {
- // FIXME: <rdar://problem/15949822> Figure out what the "default delegate behavior" should be here.
- listener->use();
+ if (!destinationFrame) {
+ listener->use();
+ return;
+ }
+
+ NSURLRequest *nsURLRequest = request.nsURLRequest(WebCore::DoNotUpdateHTTPBody);
+ if ([NSURLConnection canHandleRequest:nsURLRequest]) {
+ listener->use();
+ return;
+ }
+
+#if PLATFORM(MAC)
+ // A file URL shouldn't fall through to here, but if it did,
+ // it would be a security risk to open it.
+ if (![nsURLRequest.URL isFileURL])
+ [[NSWorkspace sharedWorkspace] openURL:nsURLRequest.URL];
+#endif
+ listener->ignore();
return;
}
@@ -266,8 +282,22 @@
void NavigationState::PolicyClient::decidePolicyForResponse(WebPageProxy*, WebFrameProxy* frame, const WebCore::ResourceResponse& resourceResponse, const WebCore::ResourceRequest& resourceRequest, bool canShowMIMEType, RefPtr<WebFramePolicyListenerProxy> listener, API::Object* userData)
{
if (!m_navigationState.m_navigationDelegateMethods.webViewDecidePolicyForNavigationResponseDecisionHandler) {
- // FIXME: <rdar://problem/15949822> Figure out what the "default delegate behavior" should be here.
- listener->use();
+ NSURL *url = ""
+ if ([url isFileURL]) {
+ BOOL isDirectory = NO;
+ BOOL exists = [[NSFileManager defaultManager] fileExistsAtPath:url.path isDirectory:&isDirectory];
+
+ if (exists && !isDirectory && canShowMIMEType)
+ listener->use();
+ else
+ listener->ignore();
+ return;
+ }
+
+ if (canShowMIMEType)
+ listener->use();
+ else
+ listener->ignore();
return;
}
@@ -275,7 +305,6 @@
if (!navigationDelegate)
return;
- // FIXME: Set up the navigation response object.
auto navigationResponse = adoptNS([[WKNavigationResponse alloc] init]);
[navigationResponse setFrame:adoptNS([[WKFrameInfo alloc] initWithWebFrameProxy:*frame]).get()];
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes