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


The following commit has been merged in the debian/unstable branch:
commit 98ca41778936f41858a11da4d35cba2674ab35df
Author: darin <darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Mon Oct 14 20:33:07 2002 +0000

            * Bookmarks.subproj/WebBookmark.m:
            (+[WebBookmark bookmarkFromDictionaryRepresentation:withGroup:]):
            * Bookmarks.subproj/WebBookmarkLeaf.m:
            (-[WebBookmarkLeaf initFromDictionaryRepresentation:withGroup:]):
            * Bookmarks.subproj/WebBookmarkList.m:
            (-[WebBookmarkList initFromDictionaryRepresentation:withGroup:]):
            * Bookmarks.subproj/WebBookmarkProxy.m:
            (-[WebBookmarkProxy initFromDictionaryRepresentation:withGroup:]):
    	Add checking since we don't "trust" the dictionary passed in.
    
            * History.subproj/WebHistoryItem.m:
            (-[WebHistoryItem initFromDictionaryRepresentation:]):
    	Add FIXME about adding the checking.
    
            * Bookmarks.subproj/WebBookmarkGroup.m:
            (-[WebBookmarkGroup initWithFile:]): Use copy, not retain.
    
            * WebView.subproj/WebControllerPrivate.m:
            (-[WebControllerPrivate dealloc]): Fix storage leak by releasing
    	the default context menu delegate.
    
            * WebView.subproj/WebControllerPrivate.h: Tweak.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@2317 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit/Bookmarks.subproj/WebBookmark.m b/WebKit/Bookmarks.subproj/WebBookmark.m
index 1925366..fb04067 100644
--- a/WebKit/Bookmarks.subproj/WebBookmark.m
+++ b/WebKit/Bookmarks.subproj/WebBookmark.m
@@ -133,11 +133,15 @@
 
 + (WebBookmark *)bookmarkFromDictionaryRepresentation:(NSDictionary *)dict withGroup:(WebBookmarkGroup *)group
 {
-    NSString *typeString;
+    NSString *typeString = [dict objectForKey:WebBookmarkTypeKey];
+    
+    if (![typeString isKindOfClass:[NSString class]]) {
+        ERROR("bad dictionary");
+        return nil;
+    }
     
     Class class = nil;
     
-    typeString = [dict objectForKey:WebBookmarkTypeKey];
     if ([typeString isEqualToString:WebBookmarkTypeListValue]) {
         class = [WebBookmarkList class];
     } else if ([typeString isEqualToString:WebBookmarkTypeLeafValue]) {
diff --git a/WebKit/Bookmarks.subproj/WebBookmarkGroup.m b/WebKit/Bookmarks.subproj/WebBookmarkGroup.m
index e8c7a73..76f426b 100644
--- a/WebKit/Bookmarks.subproj/WebBookmarkGroup.m
+++ b/WebKit/Bookmarks.subproj/WebBookmarkGroup.m
@@ -31,9 +31,9 @@
         return nil;
     }
 
-    _bookmarksByID = [[NSMutableDictionary dictionary] retain];
+    _bookmarksByID = [[NSMutableDictionary alloc] init];
 
-    _file = [file retain];
+    _file = [file copy];
     [self _setTopBookmark:nil];
 
     // read history from disk
@@ -44,8 +44,8 @@
 
 - (void)dealloc
 {
-    [_topBookmark release];
     [_file release];
+    [_topBookmark release];
     [_bookmarksByID release];
     [super dealloc];
 }
@@ -209,7 +209,7 @@
     start = CFAbsoluteTimeGetCurrent();
     result = [self _loadBookmarkGroupGuts];
 
-    if (result == YES) {
+    if (result) {
         duration = CFAbsoluteTimeGetCurrent() - start;
         LOG(Timing, "loading %d bookmarks from %@ took %f seconds",
             [[self topBookmark] _numberOfDescendants], [self file], duration);
@@ -246,7 +246,7 @@
     start = CFAbsoluteTimeGetCurrent();
     result = [self _saveBookmarkGroupGuts];
     
-    if (result == YES) {
+    if (result) {
         duration = CFAbsoluteTimeGetCurrent() - start;
         LOG(Timing, "saving %d bookmarks to %@ took %f seconds",
             [[self topBookmark] _numberOfDescendants], [self file], duration);
diff --git a/WebKit/Bookmarks.subproj/WebBookmarkLeaf.m b/WebKit/Bookmarks.subproj/WebBookmarkLeaf.m
index b727515..e5d6258 100644
--- a/WebKit/Bookmarks.subproj/WebBookmarkLeaf.m
+++ b/WebKit/Bookmarks.subproj/WebBookmarkLeaf.m
@@ -47,13 +47,19 @@
 {
     ASSERT_ARG(dict, dict != nil);
 
+    if (![[dict objectForKey:URIDictionaryKey] isKindOfClass:[NSDictionary class]]
+        || ![[dict objectForKey:URLStringKey] isKindOfClass:[NSString class]]) {
+        ERROR("bad dictionary");
+        return nil;
+    }
+
     [super init];
 
     [self _setGroup:group];
     
-    _entry = [[[WebHistoryItem alloc] initFromDictionaryRepresentation:
-        [dict objectForKey:URIDictionaryKey]] retain];
-    _URLString = [[dict objectForKey:URLStringKey] retain];
+    _entry = [[WebHistoryItem alloc] initFromDictionaryRepresentation:
+        [dict objectForKey:URIDictionaryKey]];
+    _URLString = [[dict objectForKey:URLStringKey] copy];
 
     return self;
 }
diff --git a/WebKit/Bookmarks.subproj/WebBookmarkList.m b/WebKit/Bookmarks.subproj/WebBookmarkList.m
index 044d18a..d7074f4 100644
--- a/WebKit/Bookmarks.subproj/WebBookmarkList.m
+++ b/WebKit/Bookmarks.subproj/WebBookmarkList.m
@@ -32,6 +32,14 @@
 - (id)initFromDictionaryRepresentation:(NSDictionary *)dict withGroup:(WebBookmarkGroup *)group
 {
     ASSERT_ARG(dict, dict != nil);
+
+    if (![[dict objectForKey:WebBookmarkTypeKey] isKindOfClass:[NSString class]]
+        || ([dict objectForKey:TitleKey] && ![[dict objectForKey:TitleKey] isKindOfClass:[NSString class]])
+        || ([dict objectForKey:ChildrenKey] && ![[dict objectForKey:ChildrenKey] isKindOfClass:[NSArray class]])) {
+        ERROR("bad dictionary");
+        return nil;
+    }
+
     if (![[dict objectForKey:WebBookmarkTypeKey] isEqualToString:WebBookmarkTypeListValue]) {
         ERROR("Can't initialize Bookmark list from non-list type");
         return nil;
@@ -41,21 +49,18 @@
 
     [self _setGroup:group];
 
-    _title = [[dict objectForKey:TitleKey] retain];
+    _title = [[dict objectForKey:TitleKey] copy];
     _list = [[NSMutableArray alloc] init];
 
     NSArray *storedChildren = [dict objectForKey:ChildrenKey];
-    if (storedChildren != nil) {
-        unsigned count = [storedChildren count];
-        unsigned indexRead;
-        unsigned indexWritten = 0;
-        for (indexRead = 0; indexRead < count; ++indexRead) {
-            WebBookmark *child = [WebBookmark bookmarkFromDictionaryRepresentation:[storedChildren objectAtIndex:indexRead]
-                                                           withGroup:group];	
-
-            if (child != nil) {
-                [self insertChild:child atIndex:indexWritten++];
-            }
+    unsigned count = [storedChildren count];
+    unsigned indexRead;
+    unsigned indexWritten = 0;
+    for (indexRead = 0; indexRead < count; ++indexRead) {
+        WebBookmark *child = [WebBookmark bookmarkFromDictionaryRepresentation:[storedChildren objectAtIndex:indexRead]
+                                                                     withGroup:group];	
+        if (child != nil) {
+            [self insertChild:child atIndex:indexWritten++];
         }
     }
 
diff --git a/WebKit/Bookmarks.subproj/WebBookmarkProxy.m b/WebKit/Bookmarks.subproj/WebBookmarkProxy.m
index 616c208..49213a8 100644
--- a/WebKit/Bookmarks.subproj/WebBookmarkProxy.m
+++ b/WebKit/Bookmarks.subproj/WebBookmarkProxy.m
@@ -27,6 +27,10 @@
 
 - (id)initFromDictionaryRepresentation:(NSDictionary *)dict withGroup:(WebBookmarkGroup *)group
 {
+    if (![[dict objectForKey:WebBookmarkTypeKey] isKindOfClass:[NSString class]]) {
+        ERROR("bad dictionary");
+        return nil;
+    }
     if (![[dict objectForKey:WebBookmarkTypeKey] isEqualToString:WebBookmarkTypeProxyValue]) {
         ERROR("Can't initialize Bookmark proxy from non-proxy type");
         return nil;
diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index 0cff080..3f6a59e 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,3 +1,28 @@
+2002-10-14  Darin Adler  <darin at apple.com>
+
+        * Bookmarks.subproj/WebBookmark.m:
+        (+[WebBookmark bookmarkFromDictionaryRepresentation:withGroup:]):
+        * Bookmarks.subproj/WebBookmarkLeaf.m:
+        (-[WebBookmarkLeaf initFromDictionaryRepresentation:withGroup:]):
+        * Bookmarks.subproj/WebBookmarkList.m:
+        (-[WebBookmarkList initFromDictionaryRepresentation:withGroup:]):
+        * Bookmarks.subproj/WebBookmarkProxy.m:
+        (-[WebBookmarkProxy initFromDictionaryRepresentation:withGroup:]):
+	Add checking since we don't "trust" the dictionary passed in.
+
+        * History.subproj/WebHistoryItem.m:
+        (-[WebHistoryItem initFromDictionaryRepresentation:]):
+	Add FIXME about adding the checking.
+
+        * Bookmarks.subproj/WebBookmarkGroup.m:
+        (-[WebBookmarkGroup initWithFile:]): Use copy, not retain.
+
+        * WebView.subproj/WebControllerPrivate.m:
+        (-[WebControllerPrivate dealloc]): Fix storage leak by releasing
+	the default context menu delegate.
+
+        * WebView.subproj/WebControllerPrivate.h: Tweak.
+
 2002-10-14  Chris Blumenberg  <cblu at apple.com>
 
 	Made WebNetscapePluginStream retain a WebNetscapePluginEmbeddedView not a WebBaseNetscapePluginView.
diff --git a/WebKit/ChangeLog-2002-12-03 b/WebKit/ChangeLog-2002-12-03
index 0cff080..3f6a59e 100644
--- a/WebKit/ChangeLog-2002-12-03
+++ b/WebKit/ChangeLog-2002-12-03
@@ -1,3 +1,28 @@
+2002-10-14  Darin Adler  <darin at apple.com>
+
+        * Bookmarks.subproj/WebBookmark.m:
+        (+[WebBookmark bookmarkFromDictionaryRepresentation:withGroup:]):
+        * Bookmarks.subproj/WebBookmarkLeaf.m:
+        (-[WebBookmarkLeaf initFromDictionaryRepresentation:withGroup:]):
+        * Bookmarks.subproj/WebBookmarkList.m:
+        (-[WebBookmarkList initFromDictionaryRepresentation:withGroup:]):
+        * Bookmarks.subproj/WebBookmarkProxy.m:
+        (-[WebBookmarkProxy initFromDictionaryRepresentation:withGroup:]):
+	Add checking since we don't "trust" the dictionary passed in.
+
+        * History.subproj/WebHistoryItem.m:
+        (-[WebHistoryItem initFromDictionaryRepresentation:]):
+	Add FIXME about adding the checking.
+
+        * Bookmarks.subproj/WebBookmarkGroup.m:
+        (-[WebBookmarkGroup initWithFile:]): Use copy, not retain.
+
+        * WebView.subproj/WebControllerPrivate.m:
+        (-[WebControllerPrivate dealloc]): Fix storage leak by releasing
+	the default context menu delegate.
+
+        * WebView.subproj/WebControllerPrivate.h: Tweak.
+
 2002-10-14  Chris Blumenberg  <cblu at apple.com>
 
 	Made WebNetscapePluginStream retain a WebNetscapePluginEmbeddedView not a WebBaseNetscapePluginView.
diff --git a/WebKit/History.subproj/WebHistoryItem.m b/WebKit/History.subproj/WebHistoryItem.m
index 4a6afa1..c7ca5d2 100644
--- a/WebKit/History.subproj/WebHistoryItem.m
+++ b/WebKit/History.subproj/WebHistoryItem.m
@@ -251,6 +251,8 @@
 
 - (id)initFromDictionaryRepresentation:(NSDictionary *)dict
 {
+    // FIXME: Make robust against bad dictionary contents.
+
     [super init];
     
     NSString *storedURLString = [dict objectForKey: @""];
@@ -259,11 +261,10 @@
         [self _retainIconInDatabase:YES];
     }
     
-    _title = [[dict objectForKey: @"title"] copy];
-    _displayTitle = [[dict objectForKey: @"displayTitle"] copy];
+    _title = [[dict objectForKey:@"title"] copy];
+    _displayTitle = [[dict objectForKey:@"displayTitle"] copy];
     _lastVisitedDate = [[NSCalendarDate alloc] initWithTimeIntervalSinceReferenceDate:
-        [[dict objectForKey: @"lastVisitedDate"] doubleValue]];
-    
+        [[dict objectForKey:@"lastVisitedDate"] doubleValue]];
     
     return self;
 }
diff --git a/WebKit/WebView.subproj/WebControllerPrivate.h b/WebKit/WebView.subproj/WebControllerPrivate.h
index 97231ca..98825ac 100644
--- a/WebKit/WebView.subproj/WebControllerPrivate.h
+++ b/WebKit/WebView.subproj/WebControllerPrivate.h
@@ -17,10 +17,11 @@
     id <WebResourceLoadDelegate> resourceProgressDelegate;
     id <WebResourceLoadDelegate> downloadProgressDelegate;
     id <WebContextMenuDelegate> contextMenuDelegate;
-    id <WebContextMenuDelegate> defaultContextMenuDelegate;
     id <WebControllerPolicyDelegate> policyDelegate;
     id <WebLocationChangeDelegate> locationChangeDelegate;
     
+    id <WebContextMenuDelegate> defaultContextMenuDelegate;
+
     WebBackForwardList *backForwardList;
     BOOL useBackForwardList;
     
diff --git a/WebKit/WebView.subproj/WebControllerPrivate.m b/WebKit/WebView.subproj/WebControllerPrivate.m
index 80b9cae..2ec1987 100644
--- a/WebKit/WebView.subproj/WebControllerPrivate.m
+++ b/WebKit/WebView.subproj/WebControllerPrivate.m
@@ -62,6 +62,7 @@
     [mainFrame _controllerWillBeDeallocated];
     
     [mainFrame release];
+    [defaultContextMenuDelegate release];
     [backForwardList release];
     [applicationNameForUserAgent release];
     [userAgentOverride release];
@@ -96,7 +97,6 @@
     return newFrame;
 }
 
-
 - (id<WebContextMenuDelegate>)_defaultContextMenuDelegate
 {
     return _private->defaultContextMenuDelegate;
diff --git a/WebKit/WebView.subproj/WebViewPrivate.h b/WebKit/WebView.subproj/WebViewPrivate.h
index 97231ca..98825ac 100644
--- a/WebKit/WebView.subproj/WebViewPrivate.h
+++ b/WebKit/WebView.subproj/WebViewPrivate.h
@@ -17,10 +17,11 @@
     id <WebResourceLoadDelegate> resourceProgressDelegate;
     id <WebResourceLoadDelegate> downloadProgressDelegate;
     id <WebContextMenuDelegate> contextMenuDelegate;
-    id <WebContextMenuDelegate> defaultContextMenuDelegate;
     id <WebControllerPolicyDelegate> policyDelegate;
     id <WebLocationChangeDelegate> locationChangeDelegate;
     
+    id <WebContextMenuDelegate> defaultContextMenuDelegate;
+
     WebBackForwardList *backForwardList;
     BOOL useBackForwardList;
     
diff --git a/WebKit/WebView.subproj/WebViewPrivate.m b/WebKit/WebView.subproj/WebViewPrivate.m
index 80b9cae..2ec1987 100644
--- a/WebKit/WebView.subproj/WebViewPrivate.m
+++ b/WebKit/WebView.subproj/WebViewPrivate.m
@@ -62,6 +62,7 @@
     [mainFrame _controllerWillBeDeallocated];
     
     [mainFrame release];
+    [defaultContextMenuDelegate release];
     [backForwardList release];
     [applicationNameForUserAgent release];
     [userAgentOverride release];
@@ -96,7 +97,6 @@
     return newFrame;
 }
 
-
 - (id<WebContextMenuDelegate>)_defaultContextMenuDelegate
 {
     return _private->defaultContextMenuDelegate;

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list