https://bugs.webkit.org/show_bug.cgi?id=76572
<rdar://problem/6421825>
Reviewed by Sam Weinig.
Made policy delegate log suggested file name when resource has Content-Disposition: attachment.
WebKitTestRunner does not have a policy delegate yet, bug 42546.
* DumpRenderTree/mac/PolicyDelegate.mm:
(dispositionTypeFromContentDispositionHeader):
(-[PolicyDelegate webView:decidePolicyForMIMEType:request:frame:decisionListener:]):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@105369
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2012-01-18 Alexey Proskuryakov <ap@apple.com>
+
+ Need infrastructure to test Content-Disposition filename encoding support
+ https://bugs.webkit.org/show_bug.cgi?id=76572
+ <rdar://problem/6421825>
+
+ Reviewed by Sam Weinig.
+
+ Added a very simple test just to check that it works.
+
+ * http/tests/download: Added.
+ * http/tests/download/basic-ascii-expected.txt: Added.
+ * http/tests/download/basic-ascii.html: Added.
+ * http/tests/download/resources: Added.
+ * http/tests/download/resources/basic-ascii.php: Added.
+ * platform/chromium/test_expectations.txt:
+ * platform/efl/Skipped:
+ * platform/gtk/Skipped:
+ * platform/qt/Skipped:
+ * platform/win/Skipped:
+ * platform/wk2/Skipped:
+
2012-01-18 James Robinson <jamesr@chromium.org>
[chromium] Update a few chromium expectations.
--- /dev/null
+Policy delegate: attempt to load http://127.0.0.1:8000/download/resources/basic-ascii.php with navigation type 'other'
+Policy delegate: resource is an attachment, suggested file name 'test file.txt'
+Download file name should be "test file.txt".
+
+
--- /dev/null
+<meta charset="koi8-r">
+<script>
+if (window.layoutTestController) {
+ layoutTestController.dumpAsText();
+ layoutTestController.setCustomPolicyDelegate(true, true);
+}
+</script>
+<p>Download file name should be "test file.txt".</p>
+<iframe src="resources/basic-ascii.php"></iframe>
--- /dev/null
+<?php
+header("Content-Disposition: attachment; filename=test file.txt");
+header("Content-Type: text/plain");
+?>
+
+Test file content.
// RenderSVGRoot now reports a correct size.
BUGWK76646 : svg/foreignObject/text-tref-02-b.svg = TEXT
+
+// Need to implement file name logging.
+BUGWK76572 : http/tests/download = FAIL
fast/loader/onload-policy-ignore-for-frame.html
fast/loader/policy-delegate-action-hit-test-zoomed.html
fast/loader/reload-policy-delegate.html
+http/tests/download
# EFL's LayoutTestController does not implement setScrollbarPolicy
fast/overflow/scrollbar-restored-and-then-locked.html
# https://bugs.webkit.org/show_bug.cgi?id=76048
fast/text/font-kerning.html
+
+# Needs custom policy delegate enhancement to log downloads
+http/tests/download
# https://bugs.webkit.org/show_bug.cgi?id=76566
http/tests/inspector/console-resource-errors.html
http/tests/inspector/console-cross-origin-iframe-logging.html
+
+# Needs custom policy delegate enhancement to log downloads
+http/tests/download
# Needs custom policy delegate enhancement in DRT
http/tests/navigation/post-goback-repost-policy.html
+http/tests/download
# Needs scheduleAsynchronousClick method for EventSender
fast/events/popup-blocking-click-in-iframe.html
http/tests/misc/policy-delegate-called-twice.html
http/tests/misc/redirect-to-external-url.html
http/tests/security/feed-urls-from-remote.html
+http/tests/download
# WebKitTestRunner needs layoutTestController.setDashboardCompatibilityMode
# <https://bugs.webkit.org/show_bug.cgi?id=42547>
+2012-01-18 Alexey Proskuryakov <ap@apple.com>
+
+ Need infrastructure to test Content-Disposition filename encoding support
+ https://bugs.webkit.org/show_bug.cgi?id=76572
+ <rdar://problem/6421825>
+
+ Reviewed by Sam Weinig.
+
+ Made policy delegate log suggested file name when resource has Content-Disposition: attachment.
+
+ WebKitTestRunner does not have a policy delegate yet, bug 42546.
+
+ * DumpRenderTree/mac/PolicyDelegate.mm:
+ (dispositionTypeFromContentDispositionHeader):
+ (-[PolicyDelegate webView:decidePolicyForMIMEType:request:frame:decisionListener:]):
+
2012-01-18 Ojan Vafai <ojan@chromium.org>
Fix tests from http://trac.webkit.org/changeset/105332.
#import "DumpRenderTree.h"
#import "LayoutTestController.h"
#import <WebKit/DOMElement.h>
+#import <WebKit/WebFrame.h>
#import <WebKit/WebPolicyDelegate.h>
#import <WebKit/WebView.h>
printf("%s\n", [message UTF8String]);
}
+static NSString *dispositionTypeFromContentDispositionHeader(NSString *header)
+{
+ NSMutableString *result = [[[[header componentsSeparatedByString:@";"] objectAtIndex:0] mutableCopy] autorelease];
+ if (result)
+ CFStringTrimWhitespace((CFMutableStringRef)result);
+ return result;
+}
+
+- (void)webView:(WebView *)c decidePolicyForMIMEType:(NSString *)type
+ request:(NSURLRequest *)request
+ frame:(WebFrame *)frame
+ decisionListener:(id<WebPolicyDecisionListener>)listener
+{
+ NSHTTPURLResponse *HTTPResponse = (NSHTTPURLResponse *)[[frame provisionalDataSource] response];
+ if (![HTTPResponse isKindOfClass:[NSHTTPURLResponse class]])
+ HTTPResponse = nil;
+
+ NSString *dispositionType = dispositionTypeFromContentDispositionHeader([[HTTPResponse allHeaderFields] objectForKey:@"Content-Disposition"]);
+ if (dispositionType && [dispositionType compare:@"attachment" options:NSCaseInsensitiveSearch] == NSOrderedSame) {
+ printf("Policy delegate: resource is an attachment, suggested file name '%s'\n", [[HTTPResponse suggestedFilename] UTF8String]);
+ [listener ignore];
+ return;
+ }
+
+ [listener use];
+}
+
- (void)setPermissive:(BOOL)permissive
{
permissiveDelegate = permissive;