[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677

darin darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 06:53:16 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit 7a3a4bb32289bd0bfc05ebfd4e84c0a2c60eceaa
Author: darin <darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Oct 23 17:49:10 2002 +0000

    	- fix bug where plugins crashed closing a stream that was never opened
    
            * Plugins.subproj/WebBaseNetscapePluginStream.h: Change type for parameter of
    	receivedError: to NPReason. It's not NPError.
            * Plugins.subproj/WebBaseNetscapePluginStream.m:
            (-[WebBaseNetscapePluginStream dealloc]): Assert that stream is destroyed by
    	checking stream.ndata.
            (-[WebBaseNetscapePluginStream setResponse:]): Set stream.ndata to nil if the
    	stream is not successfully created by NPP_NewStream.
            (-[WebBaseNetscapePluginStream destroyStreamWithReason:]): Added. Destroys the
    	stream, but only if it's present. Also set stream.ndata to nil. This was the bug fix.
            (-[WebBaseNetscapePluginStream receivedError:]): Call destroyStreamWithReason:.
            (-[WebBaseNetscapePluginStream finishedLoadingWithData:]): Call destroyStreamWithReason:.
    
            * English.lproj/Localizable.strings: Update.
            * English.lproj/StringsNotToBeLocalized.txt: Update.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@2437 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index 2ceef2f..b7cc098 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,3 +1,22 @@
+2002-10-23  Darin Adler  <darin at apple.com>
+
+	- fix bug where plugins crashed closing a stream that was never opened
+
+        * Plugins.subproj/WebBaseNetscapePluginStream.h: Change type for parameter of
+	receivedError: to NPReason. It's not NPError.
+        * Plugins.subproj/WebBaseNetscapePluginStream.m:
+        (-[WebBaseNetscapePluginStream dealloc]): Assert that stream is destroyed by
+	checking stream.ndata.
+        (-[WebBaseNetscapePluginStream setResponse:]): Set stream.ndata to nil if the
+	stream is not successfully created by NPP_NewStream.
+        (-[WebBaseNetscapePluginStream destroyStreamWithReason:]): Added. Destroys the
+	stream, but only if it's present. Also set stream.ndata to nil. This was the bug fix.
+        (-[WebBaseNetscapePluginStream receivedError:]): Call destroyStreamWithReason:.
+        (-[WebBaseNetscapePluginStream finishedLoadingWithData:]): Call destroyStreamWithReason:.
+
+        * English.lproj/Localizable.strings: Update.
+        * English.lproj/StringsNotToBeLocalized.txt: Update.
+
 2002-10-23  Chris Blumenberg  <cblu at apple.com>
 
 	Forgot to add WebPluginController back to the project after I had a project conflict.
diff --git a/WebKit/ChangeLog-2002-12-03 b/WebKit/ChangeLog-2002-12-03
index 2ceef2f..b7cc098 100644
--- a/WebKit/ChangeLog-2002-12-03
+++ b/WebKit/ChangeLog-2002-12-03
@@ -1,3 +1,22 @@
+2002-10-23  Darin Adler  <darin at apple.com>
+
+	- fix bug where plugins crashed closing a stream that was never opened
+
+        * Plugins.subproj/WebBaseNetscapePluginStream.h: Change type for parameter of
+	receivedError: to NPReason. It's not NPError.
+        * Plugins.subproj/WebBaseNetscapePluginStream.m:
+        (-[WebBaseNetscapePluginStream dealloc]): Assert that stream is destroyed by
+	checking stream.ndata.
+        (-[WebBaseNetscapePluginStream setResponse:]): Set stream.ndata to nil if the
+	stream is not successfully created by NPP_NewStream.
+        (-[WebBaseNetscapePluginStream destroyStreamWithReason:]): Added. Destroys the
+	stream, but only if it's present. Also set stream.ndata to nil. This was the bug fix.
+        (-[WebBaseNetscapePluginStream receivedError:]): Call destroyStreamWithReason:.
+        (-[WebBaseNetscapePluginStream finishedLoadingWithData:]): Call destroyStreamWithReason:.
+
+        * English.lproj/Localizable.strings: Update.
+        * English.lproj/StringsNotToBeLocalized.txt: Update.
+
 2002-10-23  Chris Blumenberg  <cblu at apple.com>
 
 	Forgot to add WebPluginController back to the project after I had a project conflict.
diff --git a/WebKit/English.lproj/Localizable.strings b/WebKit/English.lproj/Localizable.strings
index 8db90ed..c570a74 100644
Binary files a/WebKit/English.lproj/Localizable.strings and b/WebKit/English.lproj/Localizable.strings differ
diff --git a/WebKit/English.lproj/StringsNotToBeLocalized.txt b/WebKit/English.lproj/StringsNotToBeLocalized.txt
index 47ccba4..b21b773 100644
--- a/WebKit/English.lproj/StringsNotToBeLocalized.txt
+++ b/WebKit/English.lproj/StringsNotToBeLocalized.txt
@@ -153,6 +153,7 @@
 "text/xml"
 "tiff"
 "url_icon"
+"~"
 Bookmarks.subproj/WebBookmarkList.m:"Children"
 Bookmarks.subproj/WebBookmarkList.m:"Title"
 Bookmarks.subproj/WebBookmarkProxy.m:"Title"
diff --git a/WebKit/Plugins.subproj/WebBaseNetscapePluginStream.h b/WebKit/Plugins.subproj/WebBaseNetscapePluginStream.h
index 4076778..7081b11 100644
--- a/WebKit/Plugins.subproj/WebBaseNetscapePluginStream.h
+++ b/WebKit/Plugins.subproj/WebBaseNetscapePluginStream.h
@@ -31,7 +31,7 @@
 - (void)setPluginPointer:(NPP)pluginPointer;
 - (void)setResponse:(WebResourceResponse *)theReponse;
 - (void)receivedData:(NSData *)data;
-- (void)receivedError:(NPError)error;
+- (void)receivedError:(NPReason)reason;
 - (void)finishedLoadingWithData:(NSData *)data;
 
 @end
diff --git a/WebKit/Plugins.subproj/WebBaseNetscapePluginStream.m b/WebKit/Plugins.subproj/WebBaseNetscapePluginStream.m
index 7d4732a..bb1df17 100644
--- a/WebKit/Plugins.subproj/WebBaseNetscapePluginStream.m
+++ b/WebKit/Plugins.subproj/WebBaseNetscapePluginStream.m
@@ -14,13 +14,17 @@
 @implementation WebBaseNetscapePluginStream
 
 - (void)dealloc
-{    
-    if(path){
+{
+    ASSERT(stream.ndata == nil);
+
+    if (path) {
         [[NSFileManager defaultManager] removeFileAtPath:path handler:nil];
-        [path release];
     }
-    free((void *)stream.URL);
+
     [URL release];
+    free((void *)stream.URL);
+    [path release];
+
     [super dealloc];
 }
 
@@ -43,17 +47,15 @@
     [URL release];
     URL = [[response URL] retain];
     
-    NSString *mimeType = [response contentType];
     NSString *URLString = [URL absoluteString];
     char *cURL = (char *)malloc([URLString cStringLength]+1);
     [URLString getCString:cURL];
 
-    NSNumber *timeInterval = nil;
     uint32 lastModified = 0;
 
     if ([response isKindOfClass:[WebHTTPResourceResponse class]]) {
-        timeInterval = [[(WebHTTPResourceResponse *)response headers] objectForKey:@"Last-Modified"];
-        if(timeInterval){
+        NSNumber *timeInterval = [[(WebHTTPResourceResponse *)response headers] objectForKey:@"Last-Modified"];
+        if(timeInterval) {
             NSTimeInterval lastModifiedInterval;
             lastModifiedInterval = [[NSDate dateWithTimeIntervalSinceReferenceDate:[timeInterval doubleValue]] timeIntervalSince1970];
             if(lastModifiedInterval > 0){
@@ -68,35 +70,43 @@
     stream.lastmodified = lastModified;
     stream.notifyData = notifyData;
 
-
     // FIXME: Need a way to check if stream is seekable
 
     NPError npErr;
-    npErr = NPP_NewStream(instance, (char *)[mimeType cString], &stream, NO, &transferMode);
-    LOG(Plugins, "NPP_NewStream: %d %s", npErr, [[URL absoluteString] cString]);
+    npErr = NPP_NewStream(instance, (char *)[[response contentType] cString], &stream, NO, &transferMode);
+    LOG(Plugins, "NPP_NewStream: %d %@", npErr, URL);
 
-    if(npErr != NPERR_NO_ERROR){
+    if (npErr != NPERR_NO_ERROR) {
+        stream.ndata = nil;
         // FIXME: Need to properly handle this error.
         return;
     }
 
-    if(transferMode == NP_NORMAL)
-        LOG(Plugins, "Stream type: NP_NORMAL");
-    else if(transferMode == NP_ASFILEONLY)
-        LOG(Plugins, "Stream type: NP_ASFILEONLY");
-    else if(transferMode == NP_ASFILE)
-        LOG(Plugins, "Stream type: NP_ASFILE");
-    else if(transferMode == NP_SEEK){
-        LOG(Plugins, "Stream type: NP_SEEK not yet supported");
-        // FIXME: Need to properly handle this error.
-        return;
+    switch (transferMode) {
+        case NP_NORMAL:
+            LOG(Plugins, "Stream type: NP_NORMAL");
+            break;
+        case NP_ASFILEONLY:
+            LOG(Plugins, "Stream type: NP_ASFILEONLY");
+            break;
+        case NP_ASFILE:
+            LOG(Plugins, "Stream type: NP_ASFILE");
+            break;
+        case NP_SEEK:
+            ERROR("Stream type: NP_SEEK not yet supported");
+            // FIXME: Need to properly handle this error.
+            break;
+        default:
+            ERROR("unknown stream type");
     }
 }
 
 - (void)receivedData:(NSData *)data
 {   
-    if(transferMode != NP_ASFILEONLY){
-        int32 numBytes = NPP_WriteReady(instance, &stream);
+    if (transferMode != NP_ASFILEONLY) {
+        int32 numBytes;
+        
+        numBytes = NPP_WriteReady(instance, &stream);
         LOG(Plugins, "NPP_WriteReady bytes=%lu", numBytes);
         
         numBytes = NPP_Write(instance, &stream, offset, [data length], (void *)[data bytes]);
@@ -106,40 +116,44 @@
     }
 }
 
-- (void)receivedError:(NPError)error
+- (void)destroyStreamWithReason:(NPReason)reason
 {
+    if (!stream.ndata) {
+        return;
+    }
     NPError npErr;
-    npErr = NPP_DestroyStream(instance, &stream, error);
+    npErr = NPP_DestroyStream(instance, &stream, reason);
     LOG(Plugins, "NPP_DestroyStream: %d", npErr);
+    stream.ndata = nil;
+}
+
+- (void)receivedError:(NPError)reason
+{
+    [self destroyStreamWithReason:reason];
 }
 
 - (void)finishedLoadingWithData:(NSData *)data
 {
-    NPError npErr;
-    NSFileManager *fileManager;
-    NSString *filename, *carbonPath;
-    
-    filename = [[URL path] lastPathComponent];
+    NSString *filename = [[URL path] lastPathComponent];
     if(transferMode == NP_ASFILE || transferMode == NP_ASFILEONLY) {
         // FIXME: Need to use something like mkstemp?
         path = [[NSString stringWithFormat:@"/tmp/%@", filename] retain];        
-        fileManager = [NSFileManager defaultManager];
+        NSFileManager *fileManager = [NSFileManager defaultManager];
         [fileManager removeFileAtPath:path handler:nil];
         [fileManager createFileAtPath:path contents:data attributes:nil];
         
         // FIXME: Will cString use the correct character set?
-        carbonPath = [[NSFileManager defaultManager] _web_carbonPathForPath:path];
+        NSString *carbonPath = [[NSFileManager defaultManager] _web_carbonPathForPath:path];
         NPP_StreamAsFile(instance, &stream, [carbonPath cString]);
-        LOG(Plugins, "NPP_StreamAsFile: %s", [carbonPath cString]);
+        LOG(Plugins, "NPP_StreamAsFile: %@", carbonPath);
     }
-    npErr = NPP_DestroyStream(instance, &stream, NPRES_DONE);
-    LOG(Plugins, "NPP_DestroyStream: %d", npErr);
+
+    [self destroyStreamWithReason:NPRES_DONE];
     
-    if(notifyData){
+    if (notifyData) {
         NPP_URLNotify(instance, [[URL absoluteString] cString], NPRES_DONE, notifyData);
         LOG(Plugins, "NPP_URLNotify");
     }
 }
 
 @end
-

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list