[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:42:49 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit a521727be12bb998f5a82de290a3ff0ff2e702d6
Author: cblu <cblu at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu May 22 00:57:26 2003 +0000

    		Fixed data source leak when viewing standalone plug-in content.
    
            Reviewed by rjw.
    
            * Plugins.subproj/WebBaseNetscapePluginStream.h: don't inherit from WebBaseResourceHandleDelegate
            * Plugins.subproj/WebBaseNetscapePluginStream.m:
            (-[WebBaseNetscapePluginStream transferMode]): new
            * Plugins.subproj/WebNetscapePluginRepresentation.m:
            (-[WebNetscapePluginRepresentation dealloc]): don't release the data source
            (-[WebNetscapePluginRepresentation setDataSource:]): don't retain the data source
            * Plugins.subproj/WebNetscapePluginStream.h:
            * Plugins.subproj/WebNetscapePluginStream.m:
            (-[WebNetscapePluginStream initWithRequest:pluginPointer:notifyData:]): create a WebNetscapePluginConnectionDelegate
            (-[WebNetscapePluginStream dealloc]): release the WebNetscapePluginConnectionDelegate
            (-[WebNetscapePluginStream start]): start the load on the WebNetscapePluginConnectionDelegate
            (-[WebNetscapePluginStream stop]): start the load on the WebNetscapePluginConnectionDelegate
            (-[WebNetscapePluginConnectionDelegate initWithStream:view:]): new class, inherits from WebBaseResourceHandleDelegate
            (-[WebNetscapePluginConnectionDelegate _releaseResources]):
            (-[WebNetscapePluginConnectionDelegate connection:didReceiveResponse:]):
            (-[WebNetscapePluginConnectionDelegate connection:didReceiveData:]):
            (-[WebNetscapePluginConnectionDelegate connectionDidFinishLoading:]):
            (-[WebNetscapePluginConnectionDelegate connection:didFailWithError:]):
            (-[WebNetscapePluginConnectionDelegate cancel]):
            * WebView.subproj/WebBaseResourceHandleDelegate.h:
            * WebView.subproj/WebBaseResourceHandleDelegate.m:
            (-[WebBaseResourceHandleDelegate response]): new
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@4409 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index 13e8e24..c143adc 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,3 +1,32 @@
+2003-05-21  Chris Blumenberg  <cblu at apple.com>
+
+		Fixed data source leak when viewing standalone plug-in content.
+
+        Reviewed by rjw.
+
+        * Plugins.subproj/WebBaseNetscapePluginStream.h: don't inherit from WebBaseResourceHandleDelegate
+        * Plugins.subproj/WebBaseNetscapePluginStream.m:
+        (-[WebBaseNetscapePluginStream transferMode]): new
+        * Plugins.subproj/WebNetscapePluginRepresentation.m:
+        (-[WebNetscapePluginRepresentation dealloc]): don't release the data source
+        (-[WebNetscapePluginRepresentation setDataSource:]): don't retain the data source
+        * Plugins.subproj/WebNetscapePluginStream.h:
+        * Plugins.subproj/WebNetscapePluginStream.m:
+        (-[WebNetscapePluginStream initWithRequest:pluginPointer:notifyData:]): create a WebNetscapePluginConnectionDelegate
+        (-[WebNetscapePluginStream dealloc]): release the WebNetscapePluginConnectionDelegate
+        (-[WebNetscapePluginStream start]): start the load on the WebNetscapePluginConnectionDelegate
+        (-[WebNetscapePluginStream stop]): start the load on the WebNetscapePluginConnectionDelegate
+        (-[WebNetscapePluginConnectionDelegate initWithStream:view:]): new class, inherits from WebBaseResourceHandleDelegate
+        (-[WebNetscapePluginConnectionDelegate _releaseResources]):
+        (-[WebNetscapePluginConnectionDelegate connection:didReceiveResponse:]):
+        (-[WebNetscapePluginConnectionDelegate connection:didReceiveData:]):
+        (-[WebNetscapePluginConnectionDelegate connectionDidFinishLoading:]):
+        (-[WebNetscapePluginConnectionDelegate connection:didFailWithError:]):
+        (-[WebNetscapePluginConnectionDelegate cancel]):
+        * WebView.subproj/WebBaseResourceHandleDelegate.h:
+        * WebView.subproj/WebBaseResourceHandleDelegate.m:
+        (-[WebBaseResourceHandleDelegate response]): new
+
 2003-05-21  Maciej Stachowiak  <mjs at apple.com>
 
         Reviewed by John.
diff --git a/WebKit/Plugins.subproj/WebBaseNetscapePluginStream.h b/WebKit/Plugins.subproj/WebBaseNetscapePluginStream.h
index 76d4103..4e837db 100644
--- a/WebKit/Plugins.subproj/WebBaseNetscapePluginStream.h
+++ b/WebKit/Plugins.subproj/WebBaseNetscapePluginStream.h
@@ -11,7 +11,7 @@
 @class WebNetscapePluginPackage;
 @class NSURLResponse;
 
- at interface WebBaseNetscapePluginStream : WebBaseResourceHandleDelegate
+ at interface WebBaseNetscapePluginStream : NSObject
 {
     NSURL *URL;
     NPP instance;
@@ -35,5 +35,6 @@
 - (void)receivedData:(NSData *)data;
 - (void)receivedError:(NPReason)reason;
 - (void)finishedLoadingWithData:(NSData *)data;
+- (uint16)transferMode;
 
 @end
diff --git a/WebKit/Plugins.subproj/WebBaseNetscapePluginStream.m b/WebKit/Plugins.subproj/WebBaseNetscapePluginStream.m
index 50ecacf..1c91d69 100644
--- a/WebKit/Plugins.subproj/WebBaseNetscapePluginStream.m
+++ b/WebKit/Plugins.subproj/WebBaseNetscapePluginStream.m
@@ -33,6 +33,11 @@
     [super dealloc];
 }
 
+- (uint16)transferMode
+{
+    return transferMode;
+}
+
 - (void)setPluginPointer:(NPP)pluginPointer
 {
     instance = pluginPointer;
diff --git a/WebKit/Plugins.subproj/WebNetscapePluginRepresentation.m b/WebKit/Plugins.subproj/WebNetscapePluginRepresentation.m
index 0a2b786..bd906db 100644
--- a/WebKit/Plugins.subproj/WebNetscapePluginRepresentation.m
+++ b/WebKit/Plugins.subproj/WebNetscapePluginRepresentation.m
@@ -21,15 +21,12 @@
 
 - (void)dealloc
 {
-    [_dataSource release];
     [_error release];
     [super dealloc];
 }
 
 - (void)setDataSource:(WebDataSource *)ds
 {
-    [ds retain];
-    [_dataSource release];
     _dataSource = ds;
 }
 
diff --git a/WebKit/Plugins.subproj/WebNetscapePluginStream.h b/WebKit/Plugins.subproj/WebNetscapePluginStream.h
index c104e1c..a7ae1d7 100644
--- a/WebKit/Plugins.subproj/WebNetscapePluginStream.h
+++ b/WebKit/Plugins.subproj/WebNetscapePluginStream.h
@@ -8,24 +8,21 @@
 #import <WebKit/npapi.h>
 #import <WebKit/WebBaseNetscapePluginStream.h>
 
- at class WebNetscapePluginEmbeddedView;
- at class NSURLConnection;
 @class NSURLRequest;
+ at class NSURLConnection;
+ at class WebNetscapePluginConnectionDelegate;
 
 
 @interface WebNetscapePluginStream : WebBaseNetscapePluginStream 
-{
-    WebNetscapePluginEmbeddedView *view;
-    NSMutableData *resourceData;
+{    
     NSURLRequest *_startingRequest;
+    WebNetscapePluginConnectionDelegate *_loader;
 }
 
 - (id)initWithRequest:(NSURLRequest *)theRequest
         pluginPointer:(NPP)thePluginPointer
            notifyData:(void *)theNotifyData;
-
 - (void)start;
-
 - (void)stop;
 
 @end
diff --git a/WebKit/Plugins.subproj/WebNetscapePluginStream.m b/WebKit/Plugins.subproj/WebNetscapePluginStream.m
index 358071c..3ea5cbd 100644
--- a/WebKit/Plugins.subproj/WebNetscapePluginStream.m
+++ b/WebKit/Plugins.subproj/WebNetscapePluginStream.m
@@ -13,6 +13,15 @@
 #import <Foundation/NSURLRequest.h>
 #import <Foundation/NSURLConnection.h>
 
+ at interface WebNetscapePluginConnectionDelegate : WebBaseResourceHandleDelegate
+{
+    WebNetscapePluginStream *stream;
+    WebBaseNetscapePluginView *view;
+    NSMutableData *resourceData;
+}
+- initWithStream:(WebNetscapePluginStream *)theStream view:(WebBaseNetscapePluginView *)theView;
+ at end
+
 @implementation WebNetscapePluginStream
 
 - initWithRequest:(NSURLRequest *)theRequest
@@ -21,7 +30,8 @@
 {
     [super init];
 
-    if(!theRequest || !thePluginPointer || ![WebView _canHandleRequest:theRequest]){
+    if (!theRequest || !thePluginPointer || ![WebView _canHandleRequest:theRequest]) {
+        [self release];
         return nil;
     }
 
@@ -29,19 +39,18 @@
 
     [self setPluginPointer:thePluginPointer];
 
-    view = [(WebNetscapePluginEmbeddedView *)instance->ndata retain];
-
-    [self setDataSource: [view dataSource]];
+    WebBaseNetscapePluginView *view = (WebBaseNetscapePluginView *)instance->ndata;
+    _loader = [[WebNetscapePluginConnectionDelegate alloc] initWithStream:self view:view]; 
+    [_loader setDataSource:[view dataSource]];
 
     notifyData = theNotifyData;
-    resourceData = [[NSMutableData alloc] init];
 
     return self;
 }
 
 - (void)dealloc
 {
-    [resourceData release];
+    [_loader release];
     [_startingRequest release];
     [super dealloc];
 }
@@ -49,69 +58,79 @@
 - (void)start
 {
     ASSERT(_startingRequest);
-    [self loadWithRequest:_startingRequest];
+    [_loader loadWithRequest:_startingRequest];
     [_startingRequest release];
     _startingRequest = nil;
 }
 
 - (void)stop
 {
-    if (view) {
-        [self cancel];
-    }
+    [_loader cancel];
 }
 
-- (void)cancel
+ at end
+
+ at implementation WebNetscapePluginConnectionDelegate
+
+- initWithStream:(WebNetscapePluginStream *)theStream view:(WebBaseNetscapePluginView *)theView
+{
+    [super init];
+    stream = [theStream retain];
+    view = [theView retain];
+    resourceData = [[NSMutableData alloc] init];
+    return self;
+}
+
+- (void)releaseResources
 {
+    [stream release];
+    stream = nil;
     [view release];
     view = nil;
-
-    [super cancel];
-
-    // Send error only if the response has been set (the URL is set with the response).
-    if (URL) {
-        [self receivedError:NPRES_USER_BREAK];
-    }
+    [resourceData release];
+    resourceData = nil;
+    [super releaseResources];
 }
 
 - (void)connection:(NSURLConnection *)con didReceiveResponse:(NSURLResponse *)theResponse
 {
-    [self setResponse:theResponse];
-    [super connection:con didReceiveResponse:theResponse];    
+    [stream setResponse:theResponse];
+    [super connection:con didReceiveResponse:theResponse];
 }
 
 - (void)connection:(NSURLConnection *)con didReceiveData:(NSData *)data
 {
-    if (transferMode == NP_ASFILE || transferMode == NP_ASFILEONLY) {
+    if ([stream transferMode] == NP_ASFILE || [stream transferMode] == NP_ASFILEONLY) {
         [resourceData appendData:data];
     }
-    
-    [self receivedData:data];
 
+    [stream receivedData:data];
     [super connection:con didReceiveData:data];
 }
 
 - (void)connectionDidFinishLoading:(NSURLConnection *)con
 {
     [[view webView] _finishedLoadingResourceFromDataSource:[view dataSource]];
-    [self finishedLoadingWithData:resourceData];
-
-    [view release];
-    view = nil;
-    
+    [stream finishedLoadingWithData:resourceData];
     [super connectionDidFinishLoading:con];
 }
 
 - (void)connection:(NSURLConnection *)con didFailWithError:(NSError *)result
 {
     [[view webView] _receivedError:result fromDataSource:[view dataSource]];
+    [stream receivedError:NPRES_NETWORK_ERR];
+    [super connection:con didFailWithError:result];
+}
 
-    [self receivedError:NPRES_NETWORK_ERR];
+- (void)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 ([self response]) {
+        [stream receivedError:NPRES_USER_BREAK];
+    }
 
-    [view release];
-    view = nil;
-    
-    [super connection:con didFailWithError:result];
+    [super cancel];
 }
 
 @end
diff --git a/WebKit/WebView.subproj/WebBaseResourceHandleDelegate.h b/WebKit/WebView.subproj/WebBaseResourceHandleDelegate.h
index d346379..3fa58ae 100644
--- a/WebKit/WebView.subproj/WebBaseResourceHandleDelegate.h
+++ b/WebKit/WebView.subproj/WebBaseResourceHandleDelegate.h
@@ -54,4 +54,7 @@
 
 - (void)setIdentifier:(id)ident;
 
+- (void)releaseResources;
+- (NSURLResponse *)response;
+
 @end
diff --git a/WebKit/WebView.subproj/WebBaseResourceHandleDelegate.m b/WebKit/WebView.subproj/WebBaseResourceHandleDelegate.m
index 522ed77..e5114ec 100644
--- a/WebKit/WebView.subproj/WebBaseResourceHandleDelegate.m
+++ b/WebKit/WebView.subproj/WebBaseResourceHandleDelegate.m
@@ -70,7 +70,7 @@
 
 @implementation WebBaseResourceHandleDelegate
 
-- (void)_releaseResources
+- (void)releaseResources
 {
     ASSERT(!reachedTerminalState);
     
@@ -309,7 +309,7 @@
     else
         [[WebDefaultResourceLoadDelegate sharedResourceLoadDelegate] webView:webView resource:identifier didFinishLoadingFromDataSource:dataSource];
 
-    [self _releaseResources];
+    [self releaseResources];
 }
 
 - (void)connection:(NSURLConnection *)con didFailWithError:(NSError *)result
@@ -319,7 +319,7 @@
     
     [[webView _resourceLoadDelegateForwarder] webView:webView resource:identifier didFailLoadingWithError:result fromDataSource:dataSource];
 
-    [self _releaseResources];
+    [self releaseResources];
 }
 
 - (void)cancelWithError:(NSError *)error
@@ -338,7 +338,7 @@
         [[webView _resourceLoadDelegateForwarder] webView:webView resource:identifier didFailLoadingWithError:error fromDataSource:dataSource];
     }
 
-    [self _releaseResources];
+    [self releaseResources];
 }
 
 - (void)cancel
@@ -363,4 +363,9 @@
     }
 }
 
+- (NSURLResponse *)response
+{
+    return response;
+}
+
 @end
diff --git a/WebKit/WebView.subproj/WebLoader.h b/WebKit/WebView.subproj/WebLoader.h
index d346379..3fa58ae 100644
--- a/WebKit/WebView.subproj/WebLoader.h
+++ b/WebKit/WebView.subproj/WebLoader.h
@@ -54,4 +54,7 @@
 
 - (void)setIdentifier:(id)ident;
 
+- (void)releaseResources;
+- (NSURLResponse *)response;
+
 @end
diff --git a/WebKit/WebView.subproj/WebLoader.m b/WebKit/WebView.subproj/WebLoader.m
index 522ed77..e5114ec 100644
--- a/WebKit/WebView.subproj/WebLoader.m
+++ b/WebKit/WebView.subproj/WebLoader.m
@@ -70,7 +70,7 @@
 
 @implementation WebBaseResourceHandleDelegate
 
-- (void)_releaseResources
+- (void)releaseResources
 {
     ASSERT(!reachedTerminalState);
     
@@ -309,7 +309,7 @@
     else
         [[WebDefaultResourceLoadDelegate sharedResourceLoadDelegate] webView:webView resource:identifier didFinishLoadingFromDataSource:dataSource];
 
-    [self _releaseResources];
+    [self releaseResources];
 }
 
 - (void)connection:(NSURLConnection *)con didFailWithError:(NSError *)result
@@ -319,7 +319,7 @@
     
     [[webView _resourceLoadDelegateForwarder] webView:webView resource:identifier didFailLoadingWithError:result fromDataSource:dataSource];
 
-    [self _releaseResources];
+    [self releaseResources];
 }
 
 - (void)cancelWithError:(NSError *)error
@@ -338,7 +338,7 @@
         [[webView _resourceLoadDelegateForwarder] webView:webView resource:identifier didFailLoadingWithError:error fromDataSource:dataSource];
     }
 
-    [self _releaseResources];
+    [self releaseResources];
 }
 
 - (void)cancel
@@ -363,4 +363,9 @@
     }
 }
 
+- (NSURLResponse *)response
+{
+    return response;
+}
+
 @end

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list