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

rjw rjw at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 06:03:06 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit 821c0796ea9e1a0962df19d7782b1776a97abae1
Author: rjw <rjw at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Apr 5 03:07:12 2002 +0000

            Lazily dealloc controller and data source ONLY after all loads
            have completed.
    
            Extra bulletproofing to prevent script execution when in partially
            dealloced state.
    
            Guarantee that browser document isn't dangling after
            deallocing the WebController.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@970 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog-2002-12-03 b/WebCore/ChangeLog-2002-12-03
index 9b99be0..402740e 100644
--- a/WebCore/ChangeLog-2002-12-03
+++ b/WebCore/ChangeLog-2002-12-03
@@ -1,3 +1,10 @@
+2002-04-04  Richard Williamson  <rjw at apple.com>
+
+        Extra bulletproofing to prevent script execution when in partially
+        dealloced state.
+        
+	* src/kdelibs/khtml/html/htmltokenizer.cpp: (HTMLTokenizer::scriptExecution):
+
 2002-04-04  Chris Blumenberg  <cblu at apple.com>
 
 	* src/kwq/WCPlugin.mm: (-[WCPlugin load]):
diff --git a/WebCore/ChangeLog-2003-10-25 b/WebCore/ChangeLog-2003-10-25
index 9b99be0..402740e 100644
--- a/WebCore/ChangeLog-2003-10-25
+++ b/WebCore/ChangeLog-2003-10-25
@@ -1,3 +1,10 @@
+2002-04-04  Richard Williamson  <rjw at apple.com>
+
+        Extra bulletproofing to prevent script execution when in partially
+        dealloced state.
+        
+	* src/kdelibs/khtml/html/htmltokenizer.cpp: (HTMLTokenizer::scriptExecution):
+
 2002-04-04  Chris Blumenberg  <cblu at apple.com>
 
 	* src/kwq/WCPlugin.mm: (-[WCPlugin load]):
diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index 9b99be0..402740e 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,10 @@
+2002-04-04  Richard Williamson  <rjw at apple.com>
+
+        Extra bulletproofing to prevent script execution when in partially
+        dealloced state.
+        
+	* src/kdelibs/khtml/html/htmltokenizer.cpp: (HTMLTokenizer::scriptExecution):
+
 2002-04-04  Chris Blumenberg  <cblu at apple.com>
 
 	* src/kwq/WCPlugin.mm: (-[WCPlugin load]):
diff --git a/WebCore/khtml/html/htmltokenizer.cpp b/WebCore/khtml/html/htmltokenizer.cpp
index eac5ec2..961290e 100644
--- a/WebCore/khtml/html/htmltokenizer.cpp
+++ b/WebCore/khtml/html/htmltokenizer.cpp
@@ -452,9 +452,23 @@ void HTMLTokenizer::scriptExecution( const QString& str, QString scriptURL,
                                      int baseLine)
 {
     bool oldscript = script;
-    m_executingScript++;
     script = false;
     QString url;
+    
+#ifdef APPLE_CHANGES
+    if (view->part()){
+        m_executingScript++;
+        if (scriptURL.isNull())
+            url = static_cast<DocumentImpl*>(view->part()->document().handle())->URL();
+        else
+            url = scriptURL;
+    
+        view->part()->executeScript(url,baseLine,Node(),str);
+        m_executingScript--;
+        script = oldscript;
+    }
+#else
+    m_executingScript++;
     if (scriptURL.isNull())
       url = static_cast<DocumentImpl*>(view->part()->document().handle())->URL();
     else
@@ -463,6 +477,7 @@ void HTMLTokenizer::scriptExecution( const QString& str, QString scriptURL,
     view->part()->executeScript(url,baseLine,Node(),str);
     m_executingScript--;
     script = oldscript;
+#endif
 }
 
 void HTMLTokenizer::parseComment(DOMStringIt &src)
diff --git a/WebCore/src/kdelibs/khtml/html/htmltokenizer.cpp b/WebCore/src/kdelibs/khtml/html/htmltokenizer.cpp
index eac5ec2..961290e 100644
--- a/WebCore/src/kdelibs/khtml/html/htmltokenizer.cpp
+++ b/WebCore/src/kdelibs/khtml/html/htmltokenizer.cpp
@@ -452,9 +452,23 @@ void HTMLTokenizer::scriptExecution( const QString& str, QString scriptURL,
                                      int baseLine)
 {
     bool oldscript = script;
-    m_executingScript++;
     script = false;
     QString url;
+    
+#ifdef APPLE_CHANGES
+    if (view->part()){
+        m_executingScript++;
+        if (scriptURL.isNull())
+            url = static_cast<DocumentImpl*>(view->part()->document().handle())->URL();
+        else
+            url = scriptURL;
+    
+        view->part()->executeScript(url,baseLine,Node(),str);
+        m_executingScript--;
+        script = oldscript;
+    }
+#else
+    m_executingScript++;
     if (scriptURL.isNull())
       url = static_cast<DocumentImpl*>(view->part()->document().handle())->URL();
     else
@@ -463,6 +477,7 @@ void HTMLTokenizer::scriptExecution( const QString& str, QString scriptURL,
     view->part()->executeScript(url,baseLine,Node(),str);
     m_executingScript--;
     script = oldscript;
+#endif
 }
 
 void HTMLTokenizer::parseComment(DOMStringIt &src)
diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index 493b697..d16addd 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,3 +1,17 @@
+2002-04-04  Richard Williamson  <rjw at apple.com>
+
+        Lazily dealloc controller and data source ONLY after all loads
+        have completed.
+        
+	* WebView.subproj/IFBaseWebController.mm: (-[_IFControllerHolder
+	initWithController:]), (-[_IFControllerHolder _checkReadyToDealloc:]),
+	(-[IFBaseWebController dealloc]), (-[IFBaseWebController release]):
+	* WebView.subproj/IFBaseWebControllerPrivate.mm: (-[IFBaseWebControllerPrivate
+	_clearControllerReferences:]), (-[IFBaseWebControllerPrivate dealloc]):
+	* WebView.subproj/IFWebDataSource.mm: (-[_IFDataSourceHolder
+	initWithDataSource:]), (-[_IFDataSourceHolder _checkReadyToDealloc:]),
+	(-[IFWebDataSource release]):
+
 2002-04-04  Kenneth Kocienda  <kocienda at apple.com>
 
         Hack to handle displaying image URLs. The trick is to sense when
diff --git a/WebKit/ChangeLog-2002-12-03 b/WebKit/ChangeLog-2002-12-03
index 493b697..d16addd 100644
--- a/WebKit/ChangeLog-2002-12-03
+++ b/WebKit/ChangeLog-2002-12-03
@@ -1,3 +1,17 @@
+2002-04-04  Richard Williamson  <rjw at apple.com>
+
+        Lazily dealloc controller and data source ONLY after all loads
+        have completed.
+        
+	* WebView.subproj/IFBaseWebController.mm: (-[_IFControllerHolder
+	initWithController:]), (-[_IFControllerHolder _checkReadyToDealloc:]),
+	(-[IFBaseWebController dealloc]), (-[IFBaseWebController release]):
+	* WebView.subproj/IFBaseWebControllerPrivate.mm: (-[IFBaseWebControllerPrivate
+	_clearControllerReferences:]), (-[IFBaseWebControllerPrivate dealloc]):
+	* WebView.subproj/IFWebDataSource.mm: (-[_IFDataSourceHolder
+	initWithDataSource:]), (-[_IFDataSourceHolder _checkReadyToDealloc:]),
+	(-[IFWebDataSource release]):
+
 2002-04-04  Kenneth Kocienda  <kocienda at apple.com>
 
         Hack to handle displaying image URLs. The trick is to sense when
diff --git a/WebKit/WebView.subproj/IFBaseWebController.mm b/WebKit/WebView.subproj/IFBaseWebController.mm
index a38fc1c..df18675 100644
--- a/WebKit/WebView.subproj/IFBaseWebController.mm
+++ b/WebKit/WebView.subproj/IFBaseWebController.mm
@@ -13,63 +13,31 @@
 
 #import <WebKit/WebKitDebug.h>
 
-
-// IFObjectHolder holds objects as keys in dictionaries without
-// copying.
- at interface IFObjectHolder : NSObject
+ at interface _IFControllerHolder : NSObject
 {
-    id object;
+    IFBaseWebController *controller;
 }
-
-+ holderWithObject: o;
-- initWithObject: o;
-- (void)dealloc;
-- object;
-
+- initWithController: (IFBaseWebController *)c;
+- (void)_checkReadyToDealloc: userInfo;
 @end
-
- at implementation IFObjectHolder
-
-+ holderWithObject: o
-{
-    return [[[IFObjectHolder alloc] initWithObject: o] autorelease];
-}
-
-- initWithObject: o
-{
-    [super init];
-    object = [o retain];
-    return self;
-}
-
-- (void)dealloc
-{
-    [object release];
-    [super dealloc];
-}
-
-- (id)copyWithZone:(NSZone *)zone
-{
-    return [self retain];
-}
-
-- (unsigned)hash
-{
-    return [object hash];
-}
-
-- object
+ at implementation _IFControllerHolder
+- initWithController: (IFBaseWebController *)c
 {
-    return object;
+    controller = c;	// Non-retained
+    return [super init];
 }
 
-- (BOOL)isEqual:(id)anObject
+- (void)_checkReadyToDealloc: userInfo
 {
-    return object == [anObject object];
+    if (![[[controller mainFrame] dataSource] isLoading] && ![[[controller mainFrame] provisionalDataSource] isLoading])
+        [controller dealloc];
+    else {
+        [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector: @selector(_checkReadyToDealloc:) userInfo: nil repeats:FALSE];
+    }
 }
-
 @end
 
+
 @implementation IFBaseWebController
 
 - init
@@ -93,10 +61,21 @@
 
 - (void)dealloc
 {
-    [_controllerPrivate release];
+    [_controllerPrivate autorelease];
     [super dealloc];
 }
 
+
+- (oneway void)release {
+    if ([self retainCount] == 1){
+        _IFControllerHolder *ch = [[[_IFControllerHolder alloc] initWithController: self] autorelease];
+        [[self mainFrame] stopLoading];
+        [NSTimer scheduledTimerWithTimeInterval:1.0 target:ch selector: @selector(_checkReadyToDealloc:) userInfo: nil repeats:FALSE];
+        return;
+    }
+    [super release];
+}
+
 - (void)setDirectsAllLinksToSystemBrowser: (BOOL)flag
 {
     [NSException raise:IFMethodNotYetImplemented format:@"IFBaseWebController::setDirectsAllLinksToSystemBrowser: is not implemented"];
diff --git a/WebKit/WebView.subproj/IFBaseWebControllerPrivate.mm b/WebKit/WebView.subproj/IFBaseWebControllerPrivate.mm
index 9b3ca12..1a20cf4 100644
--- a/WebKit/WebView.subproj/IFBaseWebControllerPrivate.mm
+++ b/WebKit/WebView.subproj/IFBaseWebControllerPrivate.mm
@@ -23,10 +23,29 @@
     return self;
 }
 
+- (void)_clearControllerReferences: (IFWebFrame *)aFrame
+{
+    NSArray *frames;
+    IFWebFrame *nextFrame;
+    int i, count;
+        
+    [aFrame _setController: nil];
+
+    // Walk the frame tree, niling the controller.
+    frames = [[aFrame dataSource] children];
+    count = [frames count];
+    for (i = 0; i < count; i++){
+        nextFrame = [frames objectAtIndex: i];
+        [self _clearControllerReferences: nextFrame];
+    }
+}
+
 - (void)dealloc
 {
+    [self _clearControllerReferences: mainFrame];
+
     [mainFrame reset];
-    [mainFrame _setController: nil];
+    
     [mainFrame autorelease];
     [super dealloc];
 }
diff --git a/WebKit/WebView.subproj/IFWebDataSource.mm b/WebKit/WebView.subproj/IFWebDataSource.mm
index 9468536..5d8b4ba 100644
--- a/WebKit/WebView.subproj/IFWebDataSource.mm
+++ b/WebKit/WebView.subproj/IFWebDataSource.mm
@@ -11,6 +11,30 @@
 
 #include <WCWebDataSource.h>
 
+ at interface _IFDataSourceHolder : NSObject
+{
+    IFWebDataSource *dataSource;
+}
+- initWithDataSource: (IFWebDataSource *)c;
+- (void)_checkReadyToDealloc: userInfo;
+ at end
+ at implementation _IFDataSourceHolder
+- initWithDataSource: (IFWebDataSource *)d
+{
+    dataSource = d;	// Non-retained
+    return [super init];
+}
+
+- (void)_checkReadyToDealloc: userInfo
+{
+    if (![dataSource isLoading])
+        [dataSource dealloc];
+    else {
+        [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector: @selector(_checkReadyToDealloc:) userInfo: nil repeats:FALSE];
+    }
+}
+ at end
+
 @implementation IFWebDataSource
 
 static id IFWebDataSourceMake(void *url) 
@@ -37,9 +61,14 @@ static id IFWebDataSourceMake(void *url)
     return self;
 }
 
-- retain
-{
-    return [super retain];
+- (oneway void)release {
+    if ([self retainCount] == 1){
+        _IFDataSourceHolder *ch = [[[_IFDataSourceHolder alloc] initWithDataSource: self] autorelease];
+        [self stopLoading];
+        [NSTimer scheduledTimerWithTimeInterval:1.0 target:ch selector: @selector(_checkReadyToDealloc:) userInfo: nil repeats:FALSE];
+        return;
+    }
+    [super release];
 }
 
 - (void)dealloc
diff --git a/WebKit/WebView.subproj/WebDataSource.m b/WebKit/WebView.subproj/WebDataSource.m
index 9468536..5d8b4ba 100644
--- a/WebKit/WebView.subproj/WebDataSource.m
+++ b/WebKit/WebView.subproj/WebDataSource.m
@@ -11,6 +11,30 @@
 
 #include <WCWebDataSource.h>
 
+ at interface _IFDataSourceHolder : NSObject
+{
+    IFWebDataSource *dataSource;
+}
+- initWithDataSource: (IFWebDataSource *)c;
+- (void)_checkReadyToDealloc: userInfo;
+ at end
+ at implementation _IFDataSourceHolder
+- initWithDataSource: (IFWebDataSource *)d
+{
+    dataSource = d;	// Non-retained
+    return [super init];
+}
+
+- (void)_checkReadyToDealloc: userInfo
+{
+    if (![dataSource isLoading])
+        [dataSource dealloc];
+    else {
+        [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector: @selector(_checkReadyToDealloc:) userInfo: nil repeats:FALSE];
+    }
+}
+ at end
+
 @implementation IFWebDataSource
 
 static id IFWebDataSourceMake(void *url) 
@@ -37,9 +61,14 @@ static id IFWebDataSourceMake(void *url)
     return self;
 }
 
-- retain
-{
-    return [super retain];
+- (oneway void)release {
+    if ([self retainCount] == 1){
+        _IFDataSourceHolder *ch = [[[_IFDataSourceHolder alloc] initWithDataSource: self] autorelease];
+        [self stopLoading];
+        [NSTimer scheduledTimerWithTimeInterval:1.0 target:ch selector: @selector(_checkReadyToDealloc:) userInfo: nil repeats:FALSE];
+        return;
+    }
+    [super release];
 }
 
 - (void)dealloc

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list