[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:36:28 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit 8d5ee834104af0b60ef6aa1b0e3a686aac188828
Author: cblu <cblu at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Sep 5 20:38:08 2002 +0000

    	Fixed 3021365 - Crash failing to load plugin from local file
    
            * Plugins.subproj/WebPluginStream.h:
            * Plugins.subproj/WebPluginStream.m:
            (-[WebNetscapePluginStream receivedData:withHandle:]):
            (-[WebNetscapePluginStream receivedError:]):
            (-[WebNetscapePluginStream receivedData:withDataSource:]):
            (-[WebNetscapePluginStream handleDidReceiveData:data:]):
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@1970 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index 8211ada..0efd46b 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,3 +1,14 @@
+2002-09-05  Chris Blumenberg  <cblu at apple.com>
+
+	Fixed 3021365 - Crash failing to load plugin from local file
+
+        * Plugins.subproj/WebPluginStream.h:
+        * Plugins.subproj/WebPluginStream.m:
+        (-[WebNetscapePluginStream receivedData:withHandle:]):
+        (-[WebNetscapePluginStream receivedError:]):
+        (-[WebNetscapePluginStream receivedData:withDataSource:]):
+        (-[WebNetscapePluginStream handleDidReceiveData:data:]):
+
 2002-09-05  Ken Kocienda  <kocienda at apple.com>
 
         The first use of the WebResourceResponse object. This is just a baby step, though.
diff --git a/WebKit/ChangeLog-2002-12-03 b/WebKit/ChangeLog-2002-12-03
index 8211ada..0efd46b 100644
--- a/WebKit/ChangeLog-2002-12-03
+++ b/WebKit/ChangeLog-2002-12-03
@@ -1,3 +1,14 @@
+2002-09-05  Chris Blumenberg  <cblu at apple.com>
+
+	Fixed 3021365 - Crash failing to load plugin from local file
+
+        * Plugins.subproj/WebPluginStream.h:
+        * Plugins.subproj/WebPluginStream.m:
+        (-[WebNetscapePluginStream receivedData:withHandle:]):
+        (-[WebNetscapePluginStream receivedError:]):
+        (-[WebNetscapePluginStream receivedData:withDataSource:]):
+        (-[WebNetscapePluginStream handleDidReceiveData:data:]):
+
 2002-09-05  Ken Kocienda  <kocienda at apple.com>
 
         The first use of the WebResourceResponse object. This is just a baby step, though.
diff --git a/WebKit/Plugins.subproj/WebPluginStream.h b/WebKit/Plugins.subproj/WebPluginStream.h
index 08fa4e2..78f75be 100644
--- a/WebKit/Plugins.subproj/WebPluginStream.h
+++ b/WebKit/Plugins.subproj/WebPluginStream.h
@@ -21,7 +21,6 @@
     int32 offset;
     NPStream npStream;
     NSString *path;
-    NSString *mimeType;
     NSDictionary *attributes;
     
     void *notifyData;
diff --git a/WebKit/Plugins.subproj/WebPluginStream.m b/WebKit/Plugins.subproj/WebPluginStream.m
index e3f3d7b..0a2d023 100644
--- a/WebKit/Plugins.subproj/WebPluginStream.m
+++ b/WebKit/Plugins.subproj/WebPluginStream.m
@@ -3,6 +3,7 @@
 	Copyright (c) 2002, Apple, Inc. All rights reserved.
 */
 
+#import <WebKit/npapi.h>
 #import <WebKit/WebLoadProgress.h>
 #import <WebKit/WebPluginStream.h>
 #import <WebKit/WebView.h>
@@ -16,10 +17,9 @@
 #import <WebFoundation/WebResourceRequest.h>
 
 @interface WebNetscapePluginStream (ClassInternal)
-- (void)receivedData:(NSData *)data;
+- (void)receivedData:(NSData *)data withHandle:(WebResourceHandle *)handle;
 - (void)receivedError:(NPError)error;
 - (void)finishedLoadingWithData:(NSData *)data;
-- (void)setUpGlobalsWithHandle:(WebResourceHandle *)handle;
 @end
 
 @interface WebNetscapePluginStream (WebResourceClient) <WebResourceClient>
@@ -113,33 +113,40 @@
     view = nil;
 }
 
-- (void)setUpGlobalsWithHandle:(WebResourceHandle *)handle
-{
-    NSString *URLString = [[handle URL] absoluteString];
-    char *cURL = (char *)malloc([URLString cStringLength]+1);
-    [URLString getCString:cURL];
-
-    npStream.ndata = self;
-    npStream.URL = cURL;
-    npStream.end = 0;
-    npStream.lastmodified = 0;
-    npStream.notifyData = notifyData;
-    offset = 0;
-    
-    mimeType = [[handle contentType] retain];
-}
-
-- (void)receivedData:(NSData *)data
-{
-    int32 numBytes;
-    NPError npErr;
-    
+- (void)receivedData:(NSData *)data withHandle:(WebResourceHandle *)handle
+{    
     if(isFirstChunk){
-        isFirstChunk = NO;
+
+        NSString *mimeType = [handle contentType];
+        NSString *URLString = [[handle URL] absoluteString];
+        char *cURL = (char *)malloc([URLString cStringLength]+1);
+        [URLString getCString:cURL];
+
+        NSNumber *timeInterval = [handle attributeForKey:@"Last-Modified"];
+        uint32 lastModified;
+        
+        if(timeInterval){
+            NSTimeInterval lastModifiedInterval = [[NSDate dateWithTimeIntervalSinceReferenceDate:[timeInterval doubleValue]] timeIntervalSince1970];
+            if(lastModifiedInterval < 0){
+                lastModified = 0;
+            }else{
+                lastModified = (uint32)lastModifiedInterval;
+            }
+        }else{
+            lastModified = 0;
+        }
         
-        //FIXME: Need a way to check if stream is seekable
+        npStream.ndata = self;
+        npStream.URL = cURL;
+        npStream.end = [handle contentLength];
+        npStream.lastmodified = lastModified;
+        npStream.notifyData = notifyData;
         
-        npErr = NPP_NewStream(instance, (char *)[mimeType cString], &npStream, NO, &transferMode);
+        offset = 0;
+        
+        // FIXME: Need a way to check if stream is seekable
+        
+        NPError npErr = NPP_NewStream(instance, (char *)[mimeType cString], &npStream, NO, &transferMode);
         WEBKITDEBUGLEVEL(WEBKIT_LOG_PLUGINS, "NPP_NewStream: %d %s\n", npErr, [[URL absoluteString] cString]);
         
         if(npErr != NPERR_NO_ERROR){
@@ -158,6 +165,8 @@
             [self stop];
             return;
         }
+        
+        isFirstChunk = NO;
     }
 
     if(transferMode == NP_ASFILE || transferMode == NP_ASFILEONLY) {
@@ -166,7 +175,7 @@
     }
 
     if(transferMode != NP_ASFILEONLY){
-        numBytes = NPP_WriteReady(instance, &npStream);
+        int32 numBytes = NPP_WriteReady(instance, &npStream);
         WEBKITDEBUGLEVEL(WEBKIT_LOG_PLUGINS, "NPP_WriteReady bytes=%lu\n", numBytes);
         
         numBytes = NPP_Write(instance, &npStream, offset, [data length], (void *)[data bytes]);
@@ -178,10 +187,11 @@
 
 - (void)receivedError:(NPError)error
 {
-    NPError npErr;
-    
-    npErr = NPP_DestroyStream(instance, &npStream, error);
-    WEBKITDEBUGLEVEL(WEBKIT_LOG_PLUGINS, "NPP_DestroyStream: %d\n", npErr);
+    // Don't report error before we've called NPP_NewStream
+    if(!isFirstChunk){
+        NPError npErr = NPP_DestroyStream(instance, &npStream, error);
+        WEBKITDEBUGLEVEL(WEBKIT_LOG_PLUGINS, "NPP_DestroyStream: %d\n", npErr);
+    }
 }
 
 - (void)finishedLoadingWithData:(NSData *)data
@@ -229,10 +239,9 @@
         instance = [view pluginInstance];
 
         [self getFunctionPointersFromPluginView:view];
-        [self setUpGlobalsWithHandle:[dataSource _mainHandle]];
     }
-    
-    [self receivedData:data];
+
+    [self receivedData:data withHandle:[dataSource _mainHandle]];
 }
 
 - (void)receivedError:(WebError *)error withDataSource:(WebDataSource *)dataSource
@@ -269,10 +278,7 @@
 {
     WebController *webController = [view webController];
 
-    if(isFirstChunk){
-        [self setUpGlobalsWithHandle:handle];
-    }
-    [self receivedData:data];
+    [self receivedData:data withHandle:handle];
     
     [webController _receivedProgress:[WebLoadProgress progressWithResourceHandle:handle]
         forResourceHandle: handle fromDataSource: [view webDataSource] complete: NO];

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list