[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677
cblu
cblu at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 07:22:22 UTC 2009
The following commit has been merged in the debian/unstable branch:
commit a7bf8de87ced8ea9b06f6a9674789bc8c8afd4a7
Author: cblu <cblu at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Tue Jan 28 22:08:25 2003 +0000
Fixed: 3156172 - No filename correction when downloading images via drag & drop
Reviewed by mjs, john, trey.
* WebView.subproj/WebControllerPrivate.h:
* WebView.subproj/WebControllerPrivate.m:
(-[WebController _downloadURL:]): call _downloadURL:toDirectory:
(-[WebController _downloadURL:toDirectory:]): call -[WebFrame _downloadRequest:toDirectory:]
* WebView.subproj/WebDataSourcePrivate.h:
* WebView.subproj/WebDataSourcePrivate.m:
(-[WebDataSourcePrivate dealloc]): release the download directory
(-[WebDataSource _setDownloadDirectory:]): new
(-[WebDataSource _downloadDirectory]): new
* WebView.subproj/WebFramePrivate.h:
* WebView.subproj/WebFramePrivate.m:
(-[WebFrame _downloadRequest:toDirectory:]): renamed
* WebView.subproj/WebHTMLView.m:
(-[WebHTMLView namesOfPromisedFilesDroppedAtDestination:]): call -[WebController _downloadURL:toDirectory:]
* WebView.subproj/WebImageView.m:
(-[WebImageView namesOfPromisedFilesDroppedAtDestination:]): call -[WebController _downloadURL:toDirectory:]
* WebView.subproj/WebMainResourceClient.m:
(-[WebMainResourceClient continueAfterContentPolicy:response:]): if the data source has a download directory, use it plus the filename from the response as download path
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@3480 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index 8460677..b7adca6 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,3 +1,28 @@
+2003-01-28 Chris Blumenberg <cblu at apple.com>
+
+ Fixed: 3156172 - No filename correction when downloading images via drag & drop
+
+ Reviewed by mjs, john, trey.
+
+ * WebView.subproj/WebControllerPrivate.h:
+ * WebView.subproj/WebControllerPrivate.m:
+ (-[WebController _downloadURL:]): call _downloadURL:toDirectory:
+ (-[WebController _downloadURL:toDirectory:]): call -[WebFrame _downloadRequest:toDirectory:]
+ * WebView.subproj/WebDataSourcePrivate.h:
+ * WebView.subproj/WebDataSourcePrivate.m:
+ (-[WebDataSourcePrivate dealloc]): release the download directory
+ (-[WebDataSource _setDownloadDirectory:]): new
+ (-[WebDataSource _downloadDirectory]): new
+ * WebView.subproj/WebFramePrivate.h:
+ * WebView.subproj/WebFramePrivate.m:
+ (-[WebFrame _downloadRequest:toDirectory:]): renamed
+ * WebView.subproj/WebHTMLView.m:
+ (-[WebHTMLView namesOfPromisedFilesDroppedAtDestination:]): call -[WebController _downloadURL:toDirectory:]
+ * WebView.subproj/WebImageView.m:
+ (-[WebImageView namesOfPromisedFilesDroppedAtDestination:]): call -[WebController _downloadURL:toDirectory:]
+ * WebView.subproj/WebMainResourceClient.m:
+ (-[WebMainResourceClient continueAfterContentPolicy:response:]): if the data source has a download directory, use it plus the filename from the response as download path
+
2003-01-28 Trey Matteson <trey at apple.com>
2940179 - Arrow cursor should change to link cursor after click of link in non-frontmost window
diff --git a/WebKit/WebView.subproj/WebControllerPrivate.h b/WebKit/WebView.subproj/WebControllerPrivate.h
index 103a7d7..ba8c7f9 100644
--- a/WebKit/WebView.subproj/WebControllerPrivate.h
+++ b/WebKit/WebView.subproj/WebControllerPrivate.h
@@ -56,7 +56,7 @@ enum { NumUserAgentStringTypes = WinIE + 1 };
+ (NSString *)_MIMETypeForFile:(NSString *)path;
+ (NSArray *)_supportedImageMIMETypes;
- (void)_downloadURL:(NSURL *)URL;
-- (void)_downloadURL:(NSURL *)URL toPath:(NSString *)path;
+- (void)_downloadURL:(NSURL *)URL toDirectory:(NSString *)directoryPath;
- (BOOL)_defersCallbacks;
- (void)_setDefersCallbacks:(BOOL)defers;
diff --git a/WebKit/WebView.subproj/WebControllerPrivate.m b/WebKit/WebView.subproj/WebControllerPrivate.m
index a0bb6cd..048c9e0 100644
--- a/WebKit/WebView.subproj/WebControllerPrivate.m
+++ b/WebKit/WebView.subproj/WebControllerPrivate.m
@@ -220,15 +220,17 @@
- (void)_downloadURL:(NSURL *)URL
{
- [self _downloadURL:URL toPath:nil];
+ [self _downloadURL:URL toDirectory:nil];
}
-- (void)_downloadURL:(NSURL *)URL toPath:(NSString *)path
+- (void)_downloadURL:(NSURL *)URL toDirectory:(NSString *)directory
{
+ ASSERT(URL);
+
WebResourceRequest *request = [[WebResourceRequest alloc] initWithURL:URL];
WebFrame *webFrame = [self mainFrame];
- [webFrame _downloadRequest:request toPath:path];
+ [webFrame _downloadRequest:request toDirectory:directory];
[request release];
}
diff --git a/WebKit/WebView.subproj/WebDataSourcePrivate.h b/WebKit/WebView.subproj/WebDataSourcePrivate.h
index f8a01fa..2928c56 100644
--- a/WebKit/WebView.subproj/WebDataSourcePrivate.h
+++ b/WebKit/WebView.subproj/WebDataSourcePrivate.h
@@ -86,6 +86,7 @@
BOOL isDownloading;
NSString *downloadPath;
+ NSString *downloadDirectory;
BOOL justOpenedForTargetedLink;
@@ -146,6 +147,8 @@
- (void)_setLastCheckedRequest:(WebResourceRequest *)request;
- (void)_setIsDownloading:(BOOL)isDownloading;
- (void)_setDownloadPath:(NSString *)downloadPath;
+- (void)_setDownloadDirectory:(NSString *)downloadDirectory;
+- (NSString *)_downloadDirectory;
- (void)_setJustOpenedForTargetedLink:(BOOL)justOpened;
- (BOOL)_justOpenedForTargetedLink;
- (void)_setStoredInPageCache:(BOOL)f;
diff --git a/WebKit/WebView.subproj/WebDataSourcePrivate.m b/WebKit/WebView.subproj/WebDataSourcePrivate.m
index 2f58bb4..b337278 100644
--- a/WebKit/WebView.subproj/WebDataSourcePrivate.m
+++ b/WebKit/WebView.subproj/WebDataSourcePrivate.m
@@ -64,6 +64,7 @@
[triggeringAction release];
[lastCheckedRequest release];
[downloadPath release];
+ [downloadDirectory release];
[responses release];
[super dealloc];
@@ -641,10 +642,36 @@
- (void)_setDownloadPath:(NSString *)downloadPath
{
- [downloadPath retain];
+ if (_private->downloadPath == downloadPath) {
+ return;
+ }
[_private->downloadPath release];
_private->downloadPath = [downloadPath copy];
- [downloadPath release];
+
+ // Have either a download path or directory, not both at once.
+ [_private->downloadDirectory release];
+ _private->downloadDirectory = nil;
+}
+
+- (void)_setDownloadDirectory:(NSString *)downloadDirectory
+{
+ ASSERT(_private->downloadPath == nil);
+
+ if (_private->downloadDirectory == downloadDirectory) {
+ return;
+ }
+ [_private->downloadDirectory release];
+ _private->downloadDirectory = [downloadDirectory copy];
+}
+
+- (NSString *)_downloadDirectory
+{
+ if (_private->downloadPath) {
+ ASSERT(_private->downloadDirectory == nil);
+ return [_private->downloadPath stringByDeletingLastPathComponent];
+ }
+
+ return _private->downloadDirectory;
}
- (void)_setJustOpenedForTargetedLink:(BOOL)justOpened
diff --git a/WebKit/WebView.subproj/WebFramePrivate.h b/WebKit/WebView.subproj/WebFramePrivate.h
index 2eb8fb7..100e165 100644
--- a/WebKit/WebView.subproj/WebFramePrivate.h
+++ b/WebKit/WebView.subproj/WebFramePrivate.h
@@ -147,7 +147,7 @@ typedef enum {
- (void)_loadDataSource:(WebDataSource *)dataSource withLoadType:(WebFrameLoadType)type;
-- (void)_downloadRequest:(WebResourceRequest *)request toPath:(NSString *)path;
+- (void)_downloadRequest:(WebResourceRequest *)request toDirectory:(NSString *)directory;
- (void)_setJustOpenedForTargetedLink:(BOOL)justOpened;
diff --git a/WebKit/WebView.subproj/WebFramePrivate.m b/WebKit/WebView.subproj/WebFramePrivate.m
index dd27f28..5c8ab8e 100644
--- a/WebKit/WebView.subproj/WebFramePrivate.m
+++ b/WebKit/WebView.subproj/WebFramePrivate.m
@@ -1763,11 +1763,14 @@ static CFAbsoluteTime _timeOfLastCompletedLoad;
[self _checkNavigationPolicyForRequest:[newDataSource request] dataSource:newDataSource andCall:self withSelector:@selector(_continueLoadRequestAfterNavigationPolicy:request:)];
}
-- (void)_downloadRequest:(WebResourceRequest *)request toPath:(NSString *)path
+- (void)_downloadRequest:(WebResourceRequest *)request toDirectory:(NSString *)directory
{
WebDataSource *dataSource = [[WebDataSource alloc] initWithRequest:request];
[dataSource _setIsDownloading:YES];
- [dataSource _setDownloadPath:path];
+
+ if (directory != nil && [directory isAbsolutePath]) {
+ [dataSource _setDownloadDirectory:directory];
+ }
[self _loadDataSource:dataSource withLoadType:WebFrameLoadTypeStandard];
diff --git a/WebKit/WebView.subproj/WebHTMLView.m b/WebKit/WebView.subproj/WebHTMLView.m
index d9a2cd1..7301d1f 100644
--- a/WebKit/WebView.subproj/WebHTMLView.m
+++ b/WebKit/WebView.subproj/WebHTMLView.m
@@ -666,13 +666,16 @@
if (!_private->draggingImageURL) {
return nil;
}
-
- NSString *filename = [[_private->draggingImageURL path] lastPathComponent];
- NSString *path = [[dropDestination path] stringByAppendingPathComponent:filename];
- [[self _controller] _downloadURL:_private->draggingImageURL toPath:path];
-
- return [NSArray arrayWithObject:filename];
+ [[self _controller] _downloadURL:_private->draggingImageURL toDirectory:[dropDestination path]];
+
+ // FIXME: The file is supposed to be created at this point so the Finder places the file
+ // where the drag ended. Since we can't create the file until the download starts,
+ // this fails. Even if we did create the file at this point, the Finder doesn't
+ // place the file in the right place anyway (2825055).
+ // FIXME: We may return a different filename than the file that we will create.
+ // Since the file isn't created at this point anwyway, it doesn't matter what we return.
+ return [NSArray arrayWithObject:[[_private->draggingImageURL path] lastPathComponent]];
}
- (void)mouseUp: (NSEvent *)event
diff --git a/WebKit/WebView.subproj/WebImageView.m b/WebKit/WebView.subproj/WebImageView.m
index cca5e79..7a9e69f 100644
--- a/WebKit/WebView.subproj/WebImageView.m
+++ b/WebKit/WebView.subproj/WebImageView.m
@@ -187,12 +187,15 @@
- (NSArray *)namesOfPromisedFilesDroppedAtDestination:(NSURL *)dropDestination
{
NSURL *URL = [representation URL];
- NSString *filename = [[URL path] lastPathComponent];
- NSString *path = [[dropDestination path] stringByAppendingPathComponent:filename];
-
- [[self controller] _downloadURL:URL toPath:path];
-
- return [NSArray arrayWithObject:filename];
+ [[self controller] _downloadURL:URL toDirectory:[dropDestination path]];
+
+ // FIXME: The file is supposed to be created at this point so the Finder places the file
+ // where the drag ended. Since we can't create the file until the download starts,
+ // this fails. Even if we did create the file at this point, the Finder doesn't
+ // place the file in the right place anyway (2825055).
+ // FIXME: We may return a different filename than the file that we will create.
+ // Since the file isn't created at this point anwyway, it doesn't matter what we return.
+ return [NSArray arrayWithObject:[[URL path] lastPathComponent]];
}
- (void)draggedImage:(NSImage *)anImage endedAt:(NSPoint)aPoint operation:(NSDragOperation)operation
diff --git a/WebKit/WebView.subproj/WebMainResourceClient.m b/WebKit/WebView.subproj/WebMainResourceClient.m
index 2142128..d646a27 100644
--- a/WebKit/WebView.subproj/WebMainResourceClient.m
+++ b/WebKit/WebView.subproj/WebMainResourceClient.m
@@ -28,6 +28,7 @@
#import <WebKit/WebKitLogging.h>
#import <WebKit/WebLocationChangeDelegate.h>
#import <WebKit/WebResourceLoadDelegate.h>
+#import <WebKit/WebResourceResponseExtras.h>
#import <WebKit/WebStandardPanelsPrivate.h>
#import <WebKit/WebView.h>
@@ -190,17 +191,23 @@
case WebPolicySave:
[dataSource _setIsDownloading:YES];
-
- if ([dataSource downloadPath] == nil) {
- NSString *savePath = [[[dataSource controller] policyDelegate]
- savePathForResponse:r andRequest:req];
- // FIXME: Maybe there a cleaner way handle the bad filename case?
- if ([savePath length] == 0 || ![savePath isAbsolutePath]) {
- ERROR("Nil, empty or non-absolute path returned from savePathForResponse:andRequest:.");
- [self stopLoadingForPolicyChange];
- return;
+
+ NSString *path = [dataSource downloadPath];
+ if (path == nil || ![path isAbsolutePath]) {
+ NSString *directory = [dataSource _downloadDirectory];
+ if (directory != nil && [directory isAbsolutePath]) {
+ path = [directory stringByAppendingPathComponent:[r suggestedFilenameForSaving]];
+ } else {
+ path = [[[dataSource controller] policyDelegate] savePathForResponse:r andRequest:req];
+ // FIXME: Maybe there a cleaner way handle the bad filename case?
+ if (path == nil || ![path isAbsolutePath]) {
+ ERROR("Nil or non-absolute path returned from savePathForResponse:andRequest:.");
+ [self stopLoadingForPolicyChange];
+ return;
+ }
}
- [dataSource _setDownloadPath:savePath];
+
+ [dataSource _setDownloadPath:path];
}
[self interruptForPolicyChangeAndKeepLoading:YES];
diff --git a/WebKit/WebView.subproj/WebMainResourceLoader.m b/WebKit/WebView.subproj/WebMainResourceLoader.m
index 2142128..d646a27 100644
--- a/WebKit/WebView.subproj/WebMainResourceLoader.m
+++ b/WebKit/WebView.subproj/WebMainResourceLoader.m
@@ -28,6 +28,7 @@
#import <WebKit/WebKitLogging.h>
#import <WebKit/WebLocationChangeDelegate.h>
#import <WebKit/WebResourceLoadDelegate.h>
+#import <WebKit/WebResourceResponseExtras.h>
#import <WebKit/WebStandardPanelsPrivate.h>
#import <WebKit/WebView.h>
@@ -190,17 +191,23 @@
case WebPolicySave:
[dataSource _setIsDownloading:YES];
-
- if ([dataSource downloadPath] == nil) {
- NSString *savePath = [[[dataSource controller] policyDelegate]
- savePathForResponse:r andRequest:req];
- // FIXME: Maybe there a cleaner way handle the bad filename case?
- if ([savePath length] == 0 || ![savePath isAbsolutePath]) {
- ERROR("Nil, empty or non-absolute path returned from savePathForResponse:andRequest:.");
- [self stopLoadingForPolicyChange];
- return;
+
+ NSString *path = [dataSource downloadPath];
+ if (path == nil || ![path isAbsolutePath]) {
+ NSString *directory = [dataSource _downloadDirectory];
+ if (directory != nil && [directory isAbsolutePath]) {
+ path = [directory stringByAppendingPathComponent:[r suggestedFilenameForSaving]];
+ } else {
+ path = [[[dataSource controller] policyDelegate] savePathForResponse:r andRequest:req];
+ // FIXME: Maybe there a cleaner way handle the bad filename case?
+ if (path == nil || ![path isAbsolutePath]) {
+ ERROR("Nil or non-absolute path returned from savePathForResponse:andRequest:.");
+ [self stopLoadingForPolicyChange];
+ return;
+ }
}
- [dataSource _setDownloadPath:savePath];
+
+ [dataSource _setDownloadPath:path];
}
[self interruptForPolicyChangeAndKeepLoading:YES];
diff --git a/WebKit/WebView.subproj/WebViewPrivate.h b/WebKit/WebView.subproj/WebViewPrivate.h
index 103a7d7..ba8c7f9 100644
--- a/WebKit/WebView.subproj/WebViewPrivate.h
+++ b/WebKit/WebView.subproj/WebViewPrivate.h
@@ -56,7 +56,7 @@ enum { NumUserAgentStringTypes = WinIE + 1 };
+ (NSString *)_MIMETypeForFile:(NSString *)path;
+ (NSArray *)_supportedImageMIMETypes;
- (void)_downloadURL:(NSURL *)URL;
-- (void)_downloadURL:(NSURL *)URL toPath:(NSString *)path;
+- (void)_downloadURL:(NSURL *)URL toDirectory:(NSString *)directoryPath;
- (BOOL)_defersCallbacks;
- (void)_setDefersCallbacks:(BOOL)defers;
diff --git a/WebKit/WebView.subproj/WebViewPrivate.m b/WebKit/WebView.subproj/WebViewPrivate.m
index a0bb6cd..048c9e0 100644
--- a/WebKit/WebView.subproj/WebViewPrivate.m
+++ b/WebKit/WebView.subproj/WebViewPrivate.m
@@ -220,15 +220,17 @@
- (void)_downloadURL:(NSURL *)URL
{
- [self _downloadURL:URL toPath:nil];
+ [self _downloadURL:URL toDirectory:nil];
}
-- (void)_downloadURL:(NSURL *)URL toPath:(NSString *)path
+- (void)_downloadURL:(NSURL *)URL toDirectory:(NSString *)directory
{
+ ASSERT(URL);
+
WebResourceRequest *request = [[WebResourceRequest alloc] initWithURL:URL];
WebFrame *webFrame = [self mainFrame];
- [webFrame _downloadRequest:request toPath:path];
+ [webFrame _downloadRequest:request toDirectory:directory];
[request release];
}
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list