[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 06:05:08 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit 6aed319e870ba88ba0ca1f41eae6ac53590dad04
Author: cblu <cblu at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Mon Apr 15 19:26:10 2002 +0000

            * MIME.subproj/IFContentHandler.m: (-[IFContentHandler HTMLDocument]):
    
            Made sure I didn't unnecessarily allocate html document strings
    
            * MIME.subproj/IFDownloadHandler.h:
            * MIME.subproj/IFDownloadHandler.m: (-[IFDownloadHandler suggestedFilename]),
            (-[IFDownloadHandler openAfterDownload:]):
    
            Added the mentioned API's
    
            * MIME.subproj/IFDownloadHandlerPrivate.h:
            * MIME.subproj/IFDownloadHandlerPrivate.m: (-[IFDownloadHandlerPrivate init]),
            (-[IFDownloadHandlerPrivate dealloc]), (-[IFDownloadHandlerPrivate
            _suggestedFilename]), (-[IFDownloadHandlerPrivate _cancelDownload]),
            (-[IFDownloadHandlerPrivate _storeAtPath:]), (-[IFDownloadHandlerPrivate
            _finishedDownload]), (-[IFDownloadHandlerPrivate _openAfterDownload:]),
            (-[IFDownloadHandlerPrivate _openFile]), (-[IFDownloadHandlerPrivate _saveFile]),
            (-[IFDownloadHandler _initWithURLHandle:mimeHandler:]):
    
            Cleaned up and added a lot error checking code to IFDownloadHandlerPrivate
    
            * Plugins.subproj/IFNullPluginView.mm: (-[IFNullPluginView
            initWithFrame:mimeType:arguments:]), (-[IFNullPluginView drawRect:]):
    
            Made sure I didn't unnecessarily allocate images
    
            * Resources/plugin_document_template.html:
    
            Plugins now have 100% of the window
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@1011 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index 3c6ba8a..ac12af3 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,3 +1,35 @@
+2002-04-15  Chris Blumenberg  <set EMAIL_ADDRESS environment variable>
+
+	* MIME.subproj/IFContentHandler.m: (-[IFContentHandler HTMLDocument]):
+
+	Made sure I didn't unnecessarily allocate html document strings
+
+	* MIME.subproj/IFDownloadHandler.h:
+	* MIME.subproj/IFDownloadHandler.m: (-[IFDownloadHandler suggestedFilename]),
+	(-[IFDownloadHandler openAfterDownload:]):
+
+	Added the mentioned API's
+
+	* MIME.subproj/IFDownloadHandlerPrivate.h:
+	* MIME.subproj/IFDownloadHandlerPrivate.m: (-[IFDownloadHandlerPrivate init]),
+	(-[IFDownloadHandlerPrivate dealloc]), (-[IFDownloadHandlerPrivate
+	_suggestedFilename]), (-[IFDownloadHandlerPrivate _cancelDownload]),
+	(-[IFDownloadHandlerPrivate _storeAtPath:]), (-[IFDownloadHandlerPrivate
+	_finishedDownload]), (-[IFDownloadHandlerPrivate _openAfterDownload:]),
+	(-[IFDownloadHandlerPrivate _openFile]), (-[IFDownloadHandlerPrivate _saveFile]),
+	(-[IFDownloadHandler _initWithURLHandle:mimeHandler:]):
+
+	Cleaned up and added a lot error checking code to IFDownloadHandlerPrivate
+
+	* Plugins.subproj/IFNullPluginView.mm: (-[IFNullPluginView
+	initWithFrame:mimeType:arguments:]), (-[IFNullPluginView drawRect:]):
+
+	Made sure I didn't unnecessarily allocate images
+
+	* Resources/plugin_document_template.html:
+
+	Plugins now have 100% of the window
+
 2002-04-12  Chris Blumenberg  <cblu at apple.com>
 
 	Fixed build failure. Forgot to make IFDownloadHandler.h
diff --git a/WebKit/ChangeLog-2002-12-03 b/WebKit/ChangeLog-2002-12-03
index 3c6ba8a..ac12af3 100644
--- a/WebKit/ChangeLog-2002-12-03
+++ b/WebKit/ChangeLog-2002-12-03
@@ -1,3 +1,35 @@
+2002-04-15  Chris Blumenberg  <set EMAIL_ADDRESS environment variable>
+
+	* MIME.subproj/IFContentHandler.m: (-[IFContentHandler HTMLDocument]):
+
+	Made sure I didn't unnecessarily allocate html document strings
+
+	* MIME.subproj/IFDownloadHandler.h:
+	* MIME.subproj/IFDownloadHandler.m: (-[IFDownloadHandler suggestedFilename]),
+	(-[IFDownloadHandler openAfterDownload:]):
+
+	Added the mentioned API's
+
+	* MIME.subproj/IFDownloadHandlerPrivate.h:
+	* MIME.subproj/IFDownloadHandlerPrivate.m: (-[IFDownloadHandlerPrivate init]),
+	(-[IFDownloadHandlerPrivate dealloc]), (-[IFDownloadHandlerPrivate
+	_suggestedFilename]), (-[IFDownloadHandlerPrivate _cancelDownload]),
+	(-[IFDownloadHandlerPrivate _storeAtPath:]), (-[IFDownloadHandlerPrivate
+	_finishedDownload]), (-[IFDownloadHandlerPrivate _openAfterDownload:]),
+	(-[IFDownloadHandlerPrivate _openFile]), (-[IFDownloadHandlerPrivate _saveFile]),
+	(-[IFDownloadHandler _initWithURLHandle:mimeHandler:]):
+
+	Cleaned up and added a lot error checking code to IFDownloadHandlerPrivate
+
+	* Plugins.subproj/IFNullPluginView.mm: (-[IFNullPluginView
+	initWithFrame:mimeType:arguments:]), (-[IFNullPluginView drawRect:]):
+
+	Made sure I didn't unnecessarily allocate images
+
+	* Resources/plugin_document_template.html:
+
+	Plugins now have 100% of the window
+
 2002-04-12  Chris Blumenberg  <cblu at apple.com>
 
 	Fixed build failure. Forgot to make IFDownloadHandler.h
diff --git a/WebKit/MIME.subproj/IFContentHandler.m b/WebKit/MIME.subproj/IFContentHandler.m
index 05dee87..69bf2ae 100644
--- a/WebKit/MIME.subproj/IFContentHandler.m
+++ b/WebKit/MIME.subproj/IFContentHandler.m
@@ -40,6 +40,7 @@ static BOOL textDocumentLoaded = NO;
                     [data release];
                 }
             }
+            imageDocumentLoaded = YES;
         }
         return [NSString stringWithFormat:imageDocumentTemplate, URLString, URLString];
     }
@@ -53,9 +54,10 @@ static BOOL textDocumentLoaded = NO;
                     pluginDocumentTemplate = [[NSString alloc] initWithData:data encoding:NSASCIIStringEncoding];
                     [data release];
                 }
-            }            
+            }    
+            pluginDocumentLoaded = YES;        
         }
-        return [NSString stringWithFormat:pluginDocumentTemplate, URLString, URLString, MIMEType];    
+        return [NSString stringWithFormat:pluginDocumentTemplate, URLString, URLString, MIMEType, @"%", @"%"];    
     }
 
     else if(handlerType == IFMIMEHANDLERTYPE_TEXT){    
@@ -67,7 +69,8 @@ static BOOL textDocumentLoaded = NO;
                     textDocumentTemplate = [[NSString alloc] initWithData:data encoding:NSASCIIStringEncoding];
                     [data release];
                 }
-            }        
+            }
+            textDocumentLoaded = YES;        
         }
         return [NSString stringWithFormat:textDocumentTemplate, URLString];
     }
diff --git a/WebKit/MIME.subproj/IFDownloadHandler.h b/WebKit/MIME.subproj/IFDownloadHandler.h
index c29894c..0962512 100644
--- a/WebKit/MIME.subproj/IFDownloadHandler.h
+++ b/WebKit/MIME.subproj/IFDownloadHandler.h
@@ -17,7 +17,8 @@
 
 - (NSURL *) url;
 - (IFMIMEHandler *) mimeHandler;
+- (NSString *) suggestedFilename;
 - (void) cancelDownload;
 - (void) storeAtPath:(NSString *)path;
-- (void) setOpenAfterDownload:(BOOL)open;
+- (void) openAfterDownload:(BOOL)open;
 @end
diff --git a/WebKit/MIME.subproj/IFDownloadHandler.m b/WebKit/MIME.subproj/IFDownloadHandler.m
index 7333773..f8573f5 100644
--- a/WebKit/MIME.subproj/IFDownloadHandler.m
+++ b/WebKit/MIME.subproj/IFDownloadHandler.m
@@ -21,6 +21,11 @@
     return [((IFDownloadHandlerPrivate *)_downloadHandlerPrivate) _mimeHandler];
 }
 
+- (NSString *) suggestedFilename
+{
+    return [((IFDownloadHandlerPrivate *)_downloadHandlerPrivate) _suggestedFilename];
+}
+
 - (void) cancelDownload
 {
     [((IFDownloadHandlerPrivate *)_downloadHandlerPrivate) _cancelDownload];
@@ -36,9 +41,9 @@
     [_downloadHandlerPrivate release];
 }
 
-- (void) setOpenAfterDownload:(BOOL)open
+- (void) openAfterDownload:(BOOL)open
 {
-    [((IFDownloadHandlerPrivate *)_downloadHandlerPrivate) _setOpenAfterDownload:open];
+    [((IFDownloadHandlerPrivate *)_downloadHandlerPrivate) _openAfterDownload:open];
 }
 
 @end
diff --git a/WebKit/MIME.subproj/IFDownloadHandlerPrivate.h b/WebKit/MIME.subproj/IFDownloadHandlerPrivate.h
index 82244a5..e9e4478 100644
--- a/WebKit/MIME.subproj/IFDownloadHandlerPrivate.h
+++ b/WebKit/MIME.subproj/IFDownloadHandlerPrivate.h
@@ -15,17 +15,20 @@
     IFMIMEHandler *mimeHandler;
     IFURLHandle *urlHandle;
     NSString *path;
-    BOOL openAfterDownload;
+    BOOL shouldOpen, downloadCompleted;
 }
 
 - (void) _setMIMEHandler:(IFMIMEHandler *) mHandler;
 - (void) _setURLHandle:(IFURLHandle *)uHandle;
 - (NSURL *) _url;
 - (IFMIMEHandler *) _mimeHandler;
+- (NSString *) _suggestedFilename;
 - (void) _cancelDownload;
 - (void) _storeAtPath:(NSString *)newPath;
 - (void) _finishedDownload;
-- (void) _setOpenAfterDownload:(BOOL)open;
+- (void) _openAfterDownload:(BOOL)open;
+- (void) _openFile;
+- (void) _saveFile;
 
 @end
 
diff --git a/WebKit/MIME.subproj/IFDownloadHandlerPrivate.m b/WebKit/MIME.subproj/IFDownloadHandlerPrivate.m
index ec5bad2..0ae7b2b 100644
--- a/WebKit/MIME.subproj/IFDownloadHandlerPrivate.m
+++ b/WebKit/MIME.subproj/IFDownloadHandlerPrivate.m
@@ -8,17 +8,28 @@
 
 #import <WebKit/IFDownloadHandlerPrivate.h>
 #import <ApplicationServices/ApplicationServices.h>
+#import <Carbon/Carbon.h>
 
 @implementation IFDownloadHandlerPrivate
 
 
 - init
 {
-    //FIXME: we should not open files by default
-    openAfterDownload = YES;
+    shouldOpen = NO;
+    downloadCompleted = NO;
     return self;
 }
 
+- (void) dealloc
+{
+    if(!downloadCompleted){
+        [self _cancelDownload];
+    }
+    [mimeHandler release];
+    [urlHandle release];
+    [path release];
+}
+
 - (void) _setMIMEHandler:(IFMIMEHandler *) mHandler
 {
     mimeHandler = [mHandler retain];
@@ -39,29 +50,41 @@
     return mimeHandler;
 }
 
+- (NSString *) _suggestedFilename
+{
+    //FIXME: need a better way to get a file name out of a URL
+    return [[[urlHandle url] absoluteString] lastPathComponent];
+}
+
 - (void) _cancelDownload
 {
-    NSFileManager *fileManager;
-    
-    [urlHandle cancelLoadInBackground];
-    if(path){
-        fileManager = [NSFileManager defaultManager];
-        [fileManager removeFileAtPath:path handler:nil];
-    }
+    if(!downloadCompleted)
+        [urlHandle cancelLoadInBackground];
 }
 
 - (void) _storeAtPath:(NSString *)newPath
 {
-    NSFileManager *fileManager=nil;
-    
-    if(path){
-        [fileManager movePath:path toPath:newPath handler:nil];
-        [path release];
-    }
     path = [newPath retain];
+    if(downloadCompleted)
+        [self _saveFile];
 }
 
-- (void) _openDownloadedFile
+- (void) _finishedDownload
+{    
+    downloadCompleted = YES;
+
+    if(path)
+        [self _saveFile];
+}
+
+- (void) _openAfterDownload:(BOOL)open
+{
+    shouldOpen = open;
+    if(shouldOpen && path && downloadCompleted)
+        [self _openFile];
+}
+
+- (void) _openFile
 {
     CFURLRef pathURL;
     pathURL = CFURLCreateWithFileSystemPath(kCFAllocatorDefault, (CFStringRef)path, kCFURLPOSIXPathStyle, FALSE);
@@ -70,43 +93,26 @@
     CFRelease(pathURL);
 }
 
-- (void) _finishedDownload
+- (void) _saveFile
 {
     NSFileManager *fileManager;
-    NSString *filename;
     
-    if(!path){
-        //FIXME: need a better way to get a file name out of a URL
-        //FIXME: need to save temp file in file cache or somewhere else
-        filename = [[[urlHandle url] absoluteString] lastPathComponent];
-        path = [NSHomeDirectory() stringByAppendingPathComponent:[NSString stringWithFormat:@"Desktop/%@", filename]];
-        [path retain];
-    }
-    fileManager = [NSFileManager defaultManager];
-    [fileManager createFileAtPath:path contents:[urlHandle resourceData] attributes:nil];
-    
-    //FIXME: need to send FNNotify here
-    NSLog(@"Downloaded completed. Saved to: %@", path);
-    
-    if(openAfterDownload)
-        [self _openDownloadedFile];
-}
-
-- (void) _setOpenAfterDownload:(BOOL)open
-{
-    openAfterDownload = open;
     if(path){
-        [self _openDownloadedFile];
+        // FIXME: Should probably not replace existing file
+        // FIXME: Should report error if there is one
+        fileManager = [NSFileManager defaultManager];
+        [fileManager createFileAtPath:path contents:[urlHandle resourceData] attributes:nil];
+        NSLog(@"Download complete. Saved to: %@", path);
+        
+        // Send Finder notification
+        NSLog(@"Notifying Finder");
+        FNNotifyByPath([[path stringByDeletingLastPathComponent] cString], kFNDirectoryModifiedMessage, kNilOptions);
+        
+        if(shouldOpen)
+            [self _openFile];
     }
 }
 
-- (void) dealloc
-{
-    [mimeHandler release];
-    [urlHandle release];
-    [path release];
-}
-
 @end
 
 @implementation IFDownloadHandler (IFPrivate)
@@ -116,6 +122,9 @@
     ((IFDownloadHandlerPrivate *)_downloadHandlerPrivate) = [[IFDownloadHandlerPrivate alloc] init];
     [((IFDownloadHandlerPrivate *)_downloadHandlerPrivate) _setURLHandle:uHandle];
     [((IFDownloadHandlerPrivate *)_downloadHandlerPrivate) _setMIMEHandler:mHandler];
+    
+    NSLog(@"Downloading: %@", [uHandle url]);
+    
     return self;
 }
 
diff --git a/WebKit/Plugins.subproj/IFNullPluginView.mm b/WebKit/Plugins.subproj/IFNullPluginView.mm
index 6b82cc1..a8f9206 100644
--- a/WebKit/Plugins.subproj/IFNullPluginView.mm
+++ b/WebKit/Plugins.subproj/IFNullPluginView.mm
@@ -8,6 +8,10 @@
 #import "IFWebView.h"
 #import "IFBaseWebController.h"
 
+
+static BOOL imageLoaded = NO;
+static NSImage *image = nil;
+
 @implementation IFNullPluginView
 
 static id IFNullPluginMake(NSRect rect, NSString *mimeType, NSDictionary *arguments) 
@@ -26,10 +30,15 @@ static id IFNullPluginMake(NSRect rect, NSString *mimeType, NSDictionary *argume
     
     self = [super initWithFrame:frame];
     if (self) {
+    
         // Set the view's image to the null plugin icon
-        bundle = [NSBundle bundleWithIdentifier:@"com.apple.webkit"];
-        imagePath = [bundle pathForResource:@"nullplugin" ofType:@"tiff"];
-        [self setImage:[[NSImage alloc] initWithContentsOfFile:imagePath]];
+        if(!imageLoaded){
+            bundle = [NSBundle bundleWithIdentifier:@"com.apple.webkit"];
+            imagePath = [bundle pathForResource:@"nullplugin" ofType:@"tiff"];
+            image = [[NSImage alloc] initWithContentsOfFile:imagePath];
+            imageLoaded = YES;
+        }
+        [self setImage:image];
         
         pluginPageString = [arguments objectForKey:@"pluginspage"];
         if(pluginPageString)
@@ -37,7 +46,7 @@ static id IFNullPluginMake(NSRect rect, NSString *mimeType, NSDictionary *argume
         if(mime)
             mimeType = [mime retain];
         
-        errorSent = false;
+        errorSent = NO;
     }
     return self;
 }
@@ -65,7 +74,7 @@ static id IFNullPluginMake(NSRect rect, NSString *mimeType, NSDictionary *argume
         webView = [self findSuperview:@"IFWebView"];
         webController = [webView controller];
         [webController pluginNotFoundForMIMEType:mimeType pluginPageURL:pluginPage];
-        errorSent = TRUE;
+        errorSent = YES;
     }
 }
 
diff --git a/WebKit/Plugins.subproj/WebNullPluginView.m b/WebKit/Plugins.subproj/WebNullPluginView.m
index 6b82cc1..a8f9206 100644
--- a/WebKit/Plugins.subproj/WebNullPluginView.m
+++ b/WebKit/Plugins.subproj/WebNullPluginView.m
@@ -8,6 +8,10 @@
 #import "IFWebView.h"
 #import "IFBaseWebController.h"
 
+
+static BOOL imageLoaded = NO;
+static NSImage *image = nil;
+
 @implementation IFNullPluginView
 
 static id IFNullPluginMake(NSRect rect, NSString *mimeType, NSDictionary *arguments) 
@@ -26,10 +30,15 @@ static id IFNullPluginMake(NSRect rect, NSString *mimeType, NSDictionary *argume
     
     self = [super initWithFrame:frame];
     if (self) {
+    
         // Set the view's image to the null plugin icon
-        bundle = [NSBundle bundleWithIdentifier:@"com.apple.webkit"];
-        imagePath = [bundle pathForResource:@"nullplugin" ofType:@"tiff"];
-        [self setImage:[[NSImage alloc] initWithContentsOfFile:imagePath]];
+        if(!imageLoaded){
+            bundle = [NSBundle bundleWithIdentifier:@"com.apple.webkit"];
+            imagePath = [bundle pathForResource:@"nullplugin" ofType:@"tiff"];
+            image = [[NSImage alloc] initWithContentsOfFile:imagePath];
+            imageLoaded = YES;
+        }
+        [self setImage:image];
         
         pluginPageString = [arguments objectForKey:@"pluginspage"];
         if(pluginPageString)
@@ -37,7 +46,7 @@ static id IFNullPluginMake(NSRect rect, NSString *mimeType, NSDictionary *argume
         if(mime)
             mimeType = [mime retain];
         
-        errorSent = false;
+        errorSent = NO;
     }
     return self;
 }
@@ -65,7 +74,7 @@ static id IFNullPluginMake(NSRect rect, NSString *mimeType, NSDictionary *argume
         webView = [self findSuperview:@"IFWebView"];
         webController = [webView controller];
         [webController pluginNotFoundForMIMEType:mimeType pluginPageURL:pluginPage];
-        errorSent = TRUE;
+        errorSent = YES;
     }
 }
 
diff --git a/WebKit/Resources/plugin_document_template.html b/WebKit/Resources/plugin_document_template.html
index d21d289..faa70b7 100644
--- a/WebKit/Resources/plugin_document_template.html
+++ b/WebKit/Resources/plugin_document_template.html
@@ -17,8 +17,6 @@
 <title>%@</title>
 </head>
 <body>
-<br>
-<br>
-<center><embed src="%@" type="%@" width=600 height=400 wkfullmode></center>
+<center><embed src="%@" type="%@" width=100%@ height=100%@ wkfullmode></center>
 </body>
 </html>
\ No newline at end of file

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list