[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:58:24 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit cade37d29a12124cf4390e563f0cf76e53ec3457
Author: cblu <cblu at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Mon Sep 29 22:05:49 2003 +0000

    	Fixed: <rdar://problem/3422739>: Plug-in streams not cancelled when plug-in returns error from NPP_NewStream
    
            Reviewed by mjs.
    
            * Plugins.subproj/WebBaseNetscapePluginStream.h: renamed receivedError to cancelWithReason
            * Plugins.subproj/WebBaseNetscapePluginStream.m:
            (-[WebBaseNetscapePluginStream startStreamWithURL:expectedContentLength:lastModifiedDate:MIMEType:]): call cancelWithReason if NPP_NewStream returns an error
            (-[WebBaseNetscapePluginStream cancelWithReason:]): renamed
            (-[WebBaseNetscapePluginStream finishedLoadingWithData:]): tweak
            * Plugins.subproj/WebNetscapePluginRepresentation.m:
            (-[WebNetscapePluginRepresentation receivedError:withDataSource:]): call renamed cancelWithReason
    	(-[WebNetscapePluginRepresentation cancelWithReason:]): new override, stop load then call super
            * Plugins.subproj/WebNetscapePluginStream.m:
            (-[WebNetscapePluginStream cancelWithReason:]): new override, stop load then call super
            (-[WebNetscapePluginStream stop]): call cancelWithReason
            (-[WebNetscapePluginConnectionDelegate connection:didReceiveResponse:]): call renamed cancelWithReason
            (-[WebNetscapePluginConnectionDelegate connection:didFailWithError:]): call renamed cancelWithReason
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@5079 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index 3cac7d6..8146e20 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,3 +1,23 @@
+2003-09-29  Chris Blumenberg  <cblu at apple.com>
+
+	Fixed: <rdar://problem/3422739>: Plug-in streams not cancelled when plug-in returns error from NPP_NewStream
+
+        Reviewed by mjs.
+
+        * Plugins.subproj/WebBaseNetscapePluginStream.h: renamed receivedError to cancelWithReason
+        * Plugins.subproj/WebBaseNetscapePluginStream.m:
+        (-[WebBaseNetscapePluginStream startStreamWithURL:expectedContentLength:lastModifiedDate:MIMEType:]): call cancelWithReason if NPP_NewStream returns an error
+        (-[WebBaseNetscapePluginStream cancelWithReason:]): renamed
+        (-[WebBaseNetscapePluginStream finishedLoadingWithData:]): tweak
+        * Plugins.subproj/WebNetscapePluginRepresentation.m:
+        (-[WebNetscapePluginRepresentation receivedError:withDataSource:]): call renamed cancelWithReason
+	(-[WebNetscapePluginRepresentation cancelWithReason:]): new override, stop load then call super
+        * Plugins.subproj/WebNetscapePluginStream.m:
+        (-[WebNetscapePluginStream cancelWithReason:]): new override, stop load then call super
+        (-[WebNetscapePluginStream stop]): call cancelWithReason
+        (-[WebNetscapePluginConnectionDelegate connection:didReceiveResponse:]): call renamed cancelWithReason
+        (-[WebNetscapePluginConnectionDelegate connection:didFailWithError:]): call renamed cancelWithReason
+
 2003-09-25  Maciej Stachowiak  <mjs at apple.com>
 
 	Roll out build system change since it did not actually work. :-(
diff --git a/WebKit/Plugins.subproj/WebBaseNetscapePluginStream.h b/WebKit/Plugins.subproj/WebBaseNetscapePluginStream.h
index 31bf1d0..eff20b6 100644
--- a/WebKit/Plugins.subproj/WebBaseNetscapePluginStream.h
+++ b/WebKit/Plugins.subproj/WebBaseNetscapePluginStream.h
@@ -41,7 +41,7 @@
                   MIMEType:(NSString *)MIMEType;
 - (void)startStreamWithResponse:(NSURLResponse *)r;
 - (void)receivedData:(NSData *)data;
-- (void)receivedError:(NPReason)reason;
+- (void)cancelWithReason:(NPReason)theReason;
 - (void)finishedLoadingWithData:(NSData *)data;
 - (uint16)transferMode;
 
diff --git a/WebKit/Plugins.subproj/WebBaseNetscapePluginStream.m b/WebKit/Plugins.subproj/WebBaseNetscapePluginStream.m
index 11e5e44..229c190 100644
--- a/WebKit/Plugins.subproj/WebBaseNetscapePluginStream.m
+++ b/WebKit/Plugins.subproj/WebBaseNetscapePluginStream.m
@@ -14,6 +14,8 @@
 #import <Foundation/NSFileManager_NSURLExtras.h>
 #import <Foundation/NSURL_NSURLExtras.h>
 
+#define WEB_REASON_NONE -1
+
 @implementation WebBaseNetscapePluginStream
 
 - (void)dealloc
@@ -83,7 +85,7 @@
     
     transferMode = NP_NORMAL;
     offset = 0;
-    reason = -1;
+    reason = WEB_REASON_NONE;
 
     // FIXME: Need a way to check if stream is seekable
 
@@ -92,7 +94,8 @@
 
     if (npErr != NPERR_NO_ERROR) {
         ERROR("NPP_NewStream failed with error: %d URLString: %s", npErr, [URL _web_URLCString]);
-        stream.ndata = nil;
+        // Calling cancelWithReason with WEB_REASON_NONE cancels the load, but doesn't call NPP_DestroyStream.
+        [self cancelWithReason:WEB_REASON_NONE];
         return;
     }
 
@@ -108,7 +111,7 @@
             break;
         case NP_SEEK:
             ERROR("Stream type: NP_SEEK not yet supported");
-            // FIXME: Need to properly handle this error.
+            [self cancelWithReason:NPRES_NETWORK_ERR];
             break;
         default:
             ERROR("unknown stream type");
@@ -125,7 +128,7 @@
 
 - (void)destroyStream
 {
-    if (![plugin isLoaded] || !stream.ndata || [deliveryData length] > 0 || reason == -1) {
+    if (![plugin isLoaded] || !stream.ndata || [deliveryData length] > 0 || reason == WEB_REASON_NONE) {
         return;
     }
     
@@ -154,11 +157,12 @@
     [self destroyStream];
 }
 
-- (void)receivedError:(NPError)error
+- (void)cancelWithReason:(NPReason)theReason
 {
     // Stop any pending data from being streamed.
     [deliveryData setLength:0];
-    [self destroyStreamWithReason:error];
+    [self destroyStreamWithReason:theReason];
+    stream.ndata = nil;
 }
 
 - (void)finishedLoadingWithData:(NSData *)data
@@ -167,33 +171,31 @@
         return;
     }
     
-    if ((transferMode == NP_ASFILE || transferMode == NP_ASFILEONLY) && [data length] > 0) {
-        if (!path) {
-            path = strdup("/tmp/WebKitPlugInStreamXXXXXX");
-            int fd = mkstemp(path);
-            if (fd == -1) {
-                // This should almost never happen.
-                ERROR("can't make temporary file, almost certainly a problem with /tmp");
-                // This is not a network error, but the only error codes are "network error" and "user break".
-                [self receivedError:NPRES_NETWORK_ERR];
-                free(path);
-                path = NULL;
-                return;
-            }
-            int dataLength = [data length];
-            int byteCount = write(fd, [data bytes], dataLength);
-            if (byteCount != dataLength) {
-                // This happens only rarely, when we are out of disk space or have a disk I/O error.
-                ERROR("error writing to temporary file, errno %d", errno);
-                close(fd);
-                // This is not a network error, but the only error codes are "network error" and "user break".
-                [self receivedError:NPRES_NETWORK_ERR];
-                free(path);
-                path = NULL;
-                return;
-            }
+    if ((transferMode == NP_ASFILE || transferMode == NP_ASFILEONLY) && [data length] > 0 && !path) {
+        path = strdup("/tmp/WebKitPlugInStreamXXXXXX");
+        int fd = mkstemp(path);
+        if (fd == -1) {
+            // This should almost never happen.
+            ERROR("can't make temporary file, almost certainly a problem with /tmp");
+            // This is not a network error, but the only error codes are "network error" and "user break".
+            [self cancelWithReason:NPRES_NETWORK_ERR];
+            free(path);
+            path = NULL;
+            return;
+        }
+        int dataLength = [data length];
+        int byteCount = write(fd, [data bytes], dataLength);
+        if (byteCount != dataLength) {
+            // This happens only rarely, when we are out of disk space or have a disk I/O error.
+            ERROR("error writing to temporary file, errno %d", errno);
             close(fd);
+            // This is not a network error, but the only error codes are "network error" and "user break".
+            [self cancelWithReason:NPRES_NETWORK_ERR];
+            free(path);
+            path = NULL;
+            return;
         }
+        close(fd);
     }
 
     [self destroyStreamWithReason:NPRES_DONE];
diff --git a/WebKit/Plugins.subproj/WebNetscapePluginRepresentation.m b/WebKit/Plugins.subproj/WebNetscapePluginRepresentation.m
index 89890ab..9f2a14f 100644
--- a/WebKit/Plugins.subproj/WebNetscapePluginRepresentation.m
+++ b/WebKit/Plugins.subproj/WebNetscapePluginRepresentation.m
@@ -64,12 +64,18 @@
     }
     
     if ([error code] == NSURLErrorCancelled) {
-        [self receivedError:NPRES_USER_BREAK];
+        [self cancelWithReason:NPRES_USER_BREAK];
     } else {
-        [self receivedError:NPRES_NETWORK_ERR];
+        [self cancelWithReason:NPRES_NETWORK_ERR];
     }
 }
 
+- (void)cancelWithReason:(NPReason)theReason;
+{
+    [[_dataSource webFrame] stopLoading];
+    [super cancelWithReason:NPRES_USER_BREAK];
+}
+
 - (void)finishedLoadingWithDataSource:(WebDataSource *)ds
 {    
     if ([self isPluginViewStarted]) {
diff --git a/WebKit/Plugins.subproj/WebNetscapePluginStream.m b/WebKit/Plugins.subproj/WebNetscapePluginStream.m
index dd19e4e..5c6ce04 100644
--- a/WebKit/Plugins.subproj/WebNetscapePluginStream.m
+++ b/WebKit/Plugins.subproj/WebNetscapePluginStream.m
@@ -65,14 +65,15 @@
     _startingRequest = nil;
 }
 
-- (void)stop
+- (void)cancelWithReason:(NPReason)cancelWithReason
 {
     [_loader cancel];
-    // Since the plug-in is notified of the stream when the response is received,
-    // only report an error if the response has been received.
-    if ([_loader response]) {
-        [self receivedError:NPRES_USER_BREAK];
-    }
+    [super cancelWithReason:cancelWithReason];
+}
+
+- (void)stop
+{
+    [self cancelWithReason:NPRES_USER_BREAK];
 }
 
 @end
@@ -108,7 +109,7 @@
     [super connection:con didReceiveResponse:theResponse];
     if ([theResponse isKindOfClass:[NSHTTPURLResponse class]] &&
         [NSHTTPURLResponse isErrorStatusCode:[(NSHTTPURLResponse *)theResponse statusCode]]) {
-        [stream receivedError:NPRES_NETWORK_ERR];
+        [stream cancelWithReason:NPRES_NETWORK_ERR];
         NSError *error = [NSError _webKitErrorWithDomain:NSURLErrorDomain
                                                     code:NSURLErrorFileDoesNotExist
                                                      URL:[theResponse URL]];
@@ -144,7 +145,7 @@
     // anything including possibly releasing self; one example of this is 3266216
     [self retain];
     [[view webView] _receivedError:result fromDataSource:[view dataSource]];
-    [stream receivedError:NPRES_NETWORK_ERR];
+    [stream cancelWithReason:NPRES_NETWORK_ERR];
     [super connection:con didFailWithError:result];
     [self release];
 }

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list