[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:20:13 UTC 2009
The following commit has been merged in the debian/unstable branch:
commit d3ed1c91cedcae71fb06d4c723bc7ba2507ee139
Author: cblu <cblu at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Fri Jan 17 19:24:54 2003 +0000
WebFoundation:
Fixed: 3143656 - crash in MIMETypeForFile when a large QT movie is dragged over window
Removed all unnecessary content sniffing as that work is already done in WebResourceLoad.
Reviewed by darin.
* CacheLoader.subproj/WebResourceLoad.m:
(-[WebResourceLoad _sendResponseMetadataCallbackCheckingPreconditions:]): only sniff here, call _web_guessedMIMEType
* Misc.subproj/WebMultipartForm.m: include WebNSDataExtras
* Misc.subproj/WebNSDataExtras.h: Added.
* Misc.subproj/WebNSDataExtras.m: Added.
(-[NSMutableData _web_appendFormat:]):
(-[NSMutableData _web_appendEncodedString:format:arguments:]):
(-[NSMutableData _web_appendEncodedString:format:]):
(-[NSData _web_guessedMIMEType]): was _guessMIMEType in WebResourceLoad
* Misc.subproj/WebNSMutableDataExtras.h: Removed.
* Misc.subproj/WebNSMutableDataExtras.m: Removed.
* Misc.subproj/WebNSStringExtras.h: removed 2 unneeded methods
* Misc.subproj/WebNSStringExtras.m:
* ProtocolHandlers.subproj/WebFileProtocolHandler.m:
(-[WebFileProtocolHandler didLoadData:]): get the MIME type from the extension, don't sniff
* ProtocolHandlers.subproj/WebSimpleHTTPProtocolHandler.m:
(-[WebSimpleHTTPProtocolHandler _extractResponseStatusLineFromBytes:length:]): don't sniff
* WebFoundation.pbproj/project.pbxproj:
WebKit:
Fixed: 3143656 - crash in MIMETypeForFile when a large QT movie is dragged over window
Reviewed by darin.
* WebView.subproj/WebControllerPrivate.m:
(+[WebController _MIMETypeForFile:]): rewrote, now calls _web_guessedMIMEType
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@3349 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index 9879efc..2217e41 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,3 +1,12 @@
+2003-01-17 Chris Blumenberg <cblu at apple.com>
+
+ Fixed: 3143656 - crash in MIMETypeForFile when a large QT movie is dragged over window
+
+ Reviewed by darin.
+
+ * WebView.subproj/WebControllerPrivate.m:
+ (+[WebController _MIMETypeForFile:]): rewrote, now calls _web_guessedMIMEType
+
2003-01-17 Darin Adler <darin at apple.com>
- compressed all our non-compressed TIFF files
diff --git a/WebKit/WebView.subproj/WebControllerPrivate.m b/WebKit/WebView.subproj/WebControllerPrivate.m
index 344d886..1e763d0 100644
--- a/WebKit/WebView.subproj/WebControllerPrivate.m
+++ b/WebKit/WebView.subproj/WebControllerPrivate.m
@@ -21,6 +21,7 @@
#import <WebFoundation/WebCacheLoaderConstants.h>
#import <WebFoundation/WebError.h>
#import <WebFoundation/WebFileTypeMappings.h>
+#import <WebFoundation/WebNSDataExtras.h>
#import <WebFoundation/WebNSStringExtras.h>
#import <WebFoundation/WebResourceHandle.h>
#import <WebFoundation/WebResourceRequest.h>
@@ -169,29 +170,30 @@
}
}
-+ (NSString *)_MIMETypeForFile: (NSString *)path
++ (NSString *)_MIMETypeForFile:(NSString *)path
{
- NSString *result;
NSString *extension = [path pathExtension];
-
- if ([extension isEqualToString:@""]) {
- result = @"text/html";
+ NSString *MIMEType = nil;
+
+ // Get the MIME type from the extension.
+ if ([extension length] != 0) {
+ MIMEType = [[WebFileTypeMappings sharedMappings] MIMETypeForExtension:extension];
}
- else {
- result = [[WebFileTypeMappings sharedMappings] MIMETypeForExtension:extension];
- if (!result || [result isEqualToString:@"application/octet-stream"]) {
- NSString *contents = [[NSString alloc] initWithData:[NSData dataWithContentsOfFile:path]
- encoding:NSASCIIStringEncoding];
- if([contents _web_looksLikeHTMLDocument]){
- result = @"text/html";
- }else{
- result = @"application/octet-stream";
- }
- [contents release];
+
+ // If we can't get a known MIME type from the extension, sniff.
+ if ([MIMEType length] == 0 || [MIMEType isEqualToString:@"application/octet-stream"]) {
+ NSFileHandle *handle = [NSFileHandle fileHandleForReadingAtPath:path];
+ NSData *data = [handle readDataOfLength:GUESS_MIME_TYPE_PEEK_LENGTH];
+ [handle closeFile];
+ if ([data length] != 0) {
+ MIMEType = [data _web_guessedMIMEType];
+ }
+ if ([MIMEType length] == 0){
+ MIMEType = @"application/octet-stream";
}
}
-
- return result;
+
+ return MIMEType;
}
+ (NSArray *)_supportedImageMIMETypes
diff --git a/WebKit/WebView.subproj/WebViewPrivate.m b/WebKit/WebView.subproj/WebViewPrivate.m
index 344d886..1e763d0 100644
--- a/WebKit/WebView.subproj/WebViewPrivate.m
+++ b/WebKit/WebView.subproj/WebViewPrivate.m
@@ -21,6 +21,7 @@
#import <WebFoundation/WebCacheLoaderConstants.h>
#import <WebFoundation/WebError.h>
#import <WebFoundation/WebFileTypeMappings.h>
+#import <WebFoundation/WebNSDataExtras.h>
#import <WebFoundation/WebNSStringExtras.h>
#import <WebFoundation/WebResourceHandle.h>
#import <WebFoundation/WebResourceRequest.h>
@@ -169,29 +170,30 @@
}
}
-+ (NSString *)_MIMETypeForFile: (NSString *)path
++ (NSString *)_MIMETypeForFile:(NSString *)path
{
- NSString *result;
NSString *extension = [path pathExtension];
-
- if ([extension isEqualToString:@""]) {
- result = @"text/html";
+ NSString *MIMEType = nil;
+
+ // Get the MIME type from the extension.
+ if ([extension length] != 0) {
+ MIMEType = [[WebFileTypeMappings sharedMappings] MIMETypeForExtension:extension];
}
- else {
- result = [[WebFileTypeMappings sharedMappings] MIMETypeForExtension:extension];
- if (!result || [result isEqualToString:@"application/octet-stream"]) {
- NSString *contents = [[NSString alloc] initWithData:[NSData dataWithContentsOfFile:path]
- encoding:NSASCIIStringEncoding];
- if([contents _web_looksLikeHTMLDocument]){
- result = @"text/html";
- }else{
- result = @"application/octet-stream";
- }
- [contents release];
+
+ // If we can't get a known MIME type from the extension, sniff.
+ if ([MIMEType length] == 0 || [MIMEType isEqualToString:@"application/octet-stream"]) {
+ NSFileHandle *handle = [NSFileHandle fileHandleForReadingAtPath:path];
+ NSData *data = [handle readDataOfLength:GUESS_MIME_TYPE_PEEK_LENGTH];
+ [handle closeFile];
+ if ([data length] != 0) {
+ MIMEType = [data _web_guessedMIMEType];
+ }
+ if ([MIMEType length] == 0){
+ MIMEType = @"application/octet-stream";
}
}
-
- return result;
+
+ return MIMEType;
}
+ (NSArray *)_supportedImageMIMETypes
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list