2006-04-28 Eric Seidel <eseidel@apple.com>
authoreseidel <eseidel@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 28 Apr 2006 19:51:57 +0000 (19:51 +0000)
committereseidel <eseidel@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 28 Apr 2006 19:51:57 +0000 (19:51 +0000)
        Reviewed by darin.

        Misc. style cleanup.
        http://bugzilla.opendarwin.org/show_bug.cgi?id=8643

        * Misc/WebIconDatabase.m:
        (-[NSMutableDictionary iconForURL:withSize:cache:]):
        (-[NSMutableDictionary iconURLForURL:]):
        (-[NSMutableDictionary retainIconForURL:]):
        (-[NSMutableDictionary releaseIconForURL:]):
        (-[WebIconDatabase _setIcon:forIconURL:]):
        (-[WebIconDatabase _iconsForIconURLString:]):
        (-[WebIconDatabase _forgetIconForIconURLString:]):
        (-[WebIconDatabase _releaseIconForIconURLString:]):
        (-[WebIconDatabase _iconsBySplittingRepresentationsOfIcon:]):
        * Plugins/WebBasePluginPackage.m:
        (+[WebBasePluginPackage pluginWithPath:]):
        (-[WebBasePluginPackage pathByResolvingSymlinksAndAliasesInPath:]):
        (-[WebBasePluginPackage initWithPath:]):
        (-[WebBasePluginPackage getPluginInfoFromBundleAndMIMEDictionary:]):
        (-[WebBasePluginPackage pListForPath:createFile:]):
        (-[WebBasePluginPackage getPluginInfoFromPLists]):
        (-[WebBasePluginPackage load]):
        (-[WebBasePluginPackage setMIMEToExtensionsDictionary:]):
        (-[WebBasePluginPackage isNativeLibraryData:]):
        (-[NSArray _web_lowercaseStrings]):
        * Plugins/WebNetscapePluginPackage.m:
        (-[WebNetscapePluginPackage openResourceFile]):
        (-[WebNetscapePluginPackage closeResourceFile:]):
        (-[WebNetscapePluginPackage stringForStringListID:andIndex:]):
        (-[WebNetscapePluginPackage getPluginInfoFromResources]):
        (-[WebNetscapePluginPackage initWithPath:]):
        (-[WebNetscapePluginPackage executableType]):
        (-[WebNetscapePluginPackage unloadWithoutShutdown]):
        (-[WebNetscapePluginPackage load]):
        (-[WebNetscapePluginPackage unload]):
        * Plugins/WebNetscapePluginRepresentation.m:
        (-[WebNetscapePluginRepresentation redeliverStream]):
        * Plugins/WebPluginDatabase.m:
        (+[WebPluginDatabase installedPlugins]):
        (-[WebPluginDatabase pluginForKey:withEnumeratorSelector:]):
        (-[WebPluginDatabase pluginForExtension:]):
        (pluginLocations):
        (-[WebPluginDatabase init]):
        (-[WebPluginDatabase refresh]):
        * Plugins/npapi.m:
        (NPN_MemAlloc):
        (NPN_MemFree):
        (pluginViewForInstance):
        * WebCoreSupport/WebSubresourceLoader.m:
        (+[WebSubresourceLoader startLoadingResource:withRequest:customHeaders:referrer:forDataSource:]):
        (-[WebSubresourceLoader willSendRequest:redirectResponse:]):
        * WebView/WebDataSource.m:
        (-[WebDataSource isLoading]):
        * WebView/WebFrame.m:
        (-[WebFrame _loadDataSource:withLoadType:formState:]):
        (-[WebFrame _subframeIsLoading]):
        * WebView/WebView.m:
        (-[WebView initWithFrame:]):
        (-[WebView initWithFrame:frameName:groupName:]):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@14105 268f45cc-cd09-0410-ab3c-d52691b4dbfc

12 files changed:
WebKit/ChangeLog
WebKit/Misc/WebIconDatabase.m
WebKit/Plugins/WebBasePluginPackage.m
WebKit/Plugins/WebNetscapePluginPackage.m
WebKit/Plugins/WebNetscapePluginRepresentation.m
WebKit/Plugins/WebPluginDatabase.m
WebKit/Plugins/npapi.m
WebKit/WebCoreSupport/WebSubresourceLoader.m
WebKit/WebView/WebDataSource.m
WebKit/WebView/WebFrame.m
WebKit/WebView/WebHTMLView.m
WebKit/WebView/WebView.m

index fdde37853f27bfd791a60d07eadacb7408eec8d7..cd9d3aaf89207365916db836dad30e11bc5a2f41 100644 (file)
@@ -1,3 +1,66 @@
+2006-04-28  Eric Seidel  <eseidel@apple.com>
+
+        Reviewed by darin.
+
+        Misc. style cleanup.
+        http://bugzilla.opendarwin.org/show_bug.cgi?id=8643
+
+        * Misc/WebIconDatabase.m:
+        (-[NSMutableDictionary iconForURL:withSize:cache:]):
+        (-[NSMutableDictionary iconURLForURL:]):
+        (-[NSMutableDictionary retainIconForURL:]):
+        (-[NSMutableDictionary releaseIconForURL:]):
+        (-[WebIconDatabase _setIcon:forIconURL:]):
+        (-[WebIconDatabase _iconsForIconURLString:]):
+        (-[WebIconDatabase _forgetIconForIconURLString:]):
+        (-[WebIconDatabase _releaseIconForIconURLString:]):
+        (-[WebIconDatabase _iconsBySplittingRepresentationsOfIcon:]):
+        * Plugins/WebBasePluginPackage.m:
+        (+[WebBasePluginPackage pluginWithPath:]):
+        (-[WebBasePluginPackage pathByResolvingSymlinksAndAliasesInPath:]):
+        (-[WebBasePluginPackage initWithPath:]):
+        (-[WebBasePluginPackage getPluginInfoFromBundleAndMIMEDictionary:]):
+        (-[WebBasePluginPackage pListForPath:createFile:]):
+        (-[WebBasePluginPackage getPluginInfoFromPLists]):
+        (-[WebBasePluginPackage load]):
+        (-[WebBasePluginPackage setMIMEToExtensionsDictionary:]):
+        (-[WebBasePluginPackage isNativeLibraryData:]):
+        (-[NSArray _web_lowercaseStrings]):
+        * Plugins/WebNetscapePluginPackage.m:
+        (-[WebNetscapePluginPackage openResourceFile]):
+        (-[WebNetscapePluginPackage closeResourceFile:]):
+        (-[WebNetscapePluginPackage stringForStringListID:andIndex:]):
+        (-[WebNetscapePluginPackage getPluginInfoFromResources]):
+        (-[WebNetscapePluginPackage initWithPath:]):
+        (-[WebNetscapePluginPackage executableType]):
+        (-[WebNetscapePluginPackage unloadWithoutShutdown]):
+        (-[WebNetscapePluginPackage load]):
+        (-[WebNetscapePluginPackage unload]):
+        * Plugins/WebNetscapePluginRepresentation.m:
+        (-[WebNetscapePluginRepresentation redeliverStream]):
+        * Plugins/WebPluginDatabase.m:
+        (+[WebPluginDatabase installedPlugins]):
+        (-[WebPluginDatabase pluginForKey:withEnumeratorSelector:]):
+        (-[WebPluginDatabase pluginForExtension:]):
+        (pluginLocations):
+        (-[WebPluginDatabase init]):
+        (-[WebPluginDatabase refresh]):
+        * Plugins/npapi.m:
+        (NPN_MemAlloc):
+        (NPN_MemFree):
+        (pluginViewForInstance):
+        * WebCoreSupport/WebSubresourceLoader.m:
+        (+[WebSubresourceLoader startLoadingResource:withRequest:customHeaders:referrer:forDataSource:]):
+        (-[WebSubresourceLoader willSendRequest:redirectResponse:]):
+        * WebView/WebDataSource.m:
+        (-[WebDataSource isLoading]):
+        * WebView/WebFrame.m:
+        (-[WebFrame _loadDataSource:withLoadType:formState:]):
+        (-[WebFrame _subframeIsLoading]):
+        * WebView/WebView.m:
+        (-[WebView initWithFrame:]):
+        (-[WebView initWithFrame:frameName:groupName:]):
+
 2006-04-26  Tim Omernick  <timo@apple.com>
 
         Reviewed by Geoff.
index 59e92ff24a90a922346a44b0262bdba14e3c2c0a..0c057d758044ffdce0d3881ccc9692d0d1af5fe0 100644 (file)
@@ -148,19 +148,16 @@ NSSize WebIconLargeSize = {128, 128};
     ASSERT(size.width);
     ASSERT(size.height);
     
-    if (!URL || ![self _isEnabled]) {
+    if (!URL || ![self _isEnabled])
         return [self defaultIconWithSize:size];
-    }
 
-    if ([URL _webkit_isFileURL]) {
+    if ([URL _webkit_isFileURL])
         return [self _iconForFileURL:URL withSize:size];
-    }
     
     NSString *iconURLString = [_private->pageURLToIconURL objectForKey:URL];
-    if (!iconURLString) {
+    if (!iconURLString)
         // Don't have it
         return [self defaultIconWithSize:size];
-    }
 
     NSMutableDictionary *icons = [self _iconsForIconURLString:iconURLString];
     if (!icons) {
@@ -183,9 +180,8 @@ NSSize WebIconLargeSize = {128, 128};
 
 - (NSString *)iconURLForURL:(NSString *)URL
 {
-    if (![self _isEnabled]) {
+    if (![self _isEnabled])
         return nil;
-    }
     return URL ? [_private->pageURLToIconURL objectForKey:URL] : nil;
 }
 
@@ -211,9 +207,8 @@ NSSize WebIconLargeSize = {128, 128};
 {
     ASSERT(URL);
     
-    if (![self _isEnabled]) {
+    if (![self _isEnabled])
         return;
-    }
     
     int retainCount = (int)(void *)CFDictionaryGetValue(_private->pageURLToRetainCount, URL);
     CFDictionarySetValue(_private->pageURLToRetainCount, URL, (void *)(retainCount + 1));
@@ -223,9 +218,8 @@ NSSize WebIconLargeSize = {128, 128};
 {
     ASSERT(pageURL);
     
-    if (![self _isEnabled]) {
+    if (![self _isEnabled])
         return;
-    }    
     
     int retainCount = (int)(void *)CFDictionaryGetValue(_private->pageURLToRetainCount, pageURL);
     
@@ -353,9 +347,8 @@ NSSize WebIconLargeSize = {128, 128};
     
     NSMutableDictionary *icons = [self _iconsBySplittingRepresentationsOfIcon:icon];
     
-    if (!icons) {
+    if (!icons)
         return;
-    }
     
     [_private->iconURLToIcons setObject:icons forKey:iconURL];
     
@@ -636,21 +629,17 @@ NSSize WebIconLargeSize = {128, 128};
 {
     ASSERT(iconURLString);
 
-    if ([_private->iconURLsWithNoIcons containsObject:iconURLString]) {
+    if ([_private->iconURLsWithNoIcons containsObject:iconURLString])
        return nil;
-    }
     
     NSMutableDictionary *icons = [_private->iconURLToIcons objectForKey:iconURLString];
 
-    if (icons) {
+    if (icons)
        return icons;
-    }
        
     // Not in memory, check disk
-    if(![_private->iconsOnDiskWithURLs containsObject:iconURLString]){
+    if(![_private->iconsOnDiskWithURLs containsObject:iconURLString])
         return nil;
-    }
-
     
 #if !LOG_DISABLED         
     double start = CFAbsoluteTimeGetCurrent();
@@ -751,9 +740,9 @@ NSSize WebIconLargeSize = {128, 128};
     [iconURLString retain];
     id URLs = [_private->iconURLToPageURLs objectForKey:iconURLString];
     if (URLs != nil) {
-        if ([URLs isKindOfClass:[NSMutableSet class]]) {
+        if ([URLs isKindOfClass:[NSMutableSet class]])
             [_private->pageURLToIconURL removeObjectsForKeys:[URLs allObjects]];
-        else {
+        else {
             ASSERT([URLs isKindOfClass:[NSString class]]);
             [_private->pageURLToIconURL removeObjectForKey:URLs];
         }
@@ -769,10 +758,9 @@ NSSize WebIconLargeSize = {128, 128};
     
     int retainCount = (int)(void *)CFDictionaryGetValue(_private->iconURLToExtraRetainCount, iconURLString);
 
-    if (retainCount <= 0) {
-        ASSERT_NOT_REACHED();
+    ASSERT(retainCount > 0);
+    if (retainCount <= 0)
         return;
-    }
     
     int newRetainCount = retainCount - 1;
     if (newRetainCount == 0) {
@@ -891,9 +879,8 @@ NSSize WebIconLargeSize = {128, 128};
         [subIcon release];
     }
 
-    if([icons count] > 0){
+    if([icons count] > 0)
         return icons;
-    }
 
     LOG_ERROR("icon has no representations");
     
index 29d4f8f459c45f200c744f2fe21dd2b6a11863c8..284148d6b6f2516d93effa1db1b4dcd45977dca0 100644 (file)
@@ -56,9 +56,8 @@
 {
     WebBasePluginPackage *pluginPackage = [[WebPluginPackage alloc] initWithPath:pluginPath];
 
-    if (!pluginPackage) {
+    if (!pluginPackage)
         pluginPackage = [[WebNetscapePluginPackage alloc] initWithPath:pluginPath];
-    }
 
     return [pluginPackage autorelease];
 }
     OSStatus err;
 
     err = FSPathMakeRef((const UInt8 *)[thePath fileSystemRepresentation], &fref, NULL);
-    if (err != noErr) {
+    if (err != noErr)
         return newPath;
-    }
 
     Boolean targetIsFolder;
     Boolean wasAliased;
     err = FSResolveAliasFileWithMountFlags(&fref, TRUE, &targetIsFolder, &wasAliased, kResolveAliasFileNoUI);
-    if (err != noErr) {
+    if (err != noErr)
         return newPath;
-    }
 
     if (wasAliased) {
         CFURLRef URL = CFURLCreateFromFSRef(kCFAllocatorDefault, &fref);
@@ -96,9 +93,9 @@
     return newPath;
 }
 
-- initWithPath:(NSString *)pluginPath
+- (id)initWithPath:(NSString *)pluginPath
 {
-    [super init];
+    self = [super init];
     extensionToMIME = [[NSMutableDictionary alloc] init];
     path = [[self pathByResolvingSymlinksAndAliasesInPath:pluginPath] retain];
     bundle = [[NSBundle alloc] initWithPath:path];
 
 - (BOOL)getPluginInfoFromBundleAndMIMEDictionary:(NSDictionary *)MIMETypes
 {
-    if (!bundle) {
+    if (!bundle)
         return NO;
-    }
     
     if (!MIMETypes) {
         MIMETypes = [bundle objectForInfoDictionaryKey:WebPluginMIMETypesKey];
-        if (!MIMETypes) {
+        if (!MIMETypes)
             return NO;
-        }
     }
 
     NSMutableDictionary *MIMEToExtensionsDictionary = [NSMutableDictionary dictionary];
         
         // FIXME: Consider storing disabled MIME types.
         NSNumber *isEnabled = [MIMEDictionary objectForKey:WebPluginTypeEnabledKey];
-        if (isEnabled && [isEnabled boolValue] == NO) {
+        if (isEnabled && [isEnabled boolValue] == NO)
             continue;
-        }
 
         extensions = [[MIMEDictionary objectForKey:WebPluginExtensionsKey] _web_lowercaseStrings];
-        if ([extensions count] == 0) {
+        if ([extensions count] == 0)
             extensions = [NSArray arrayWithObject:@""];
-        }
 
         MIME = [MIME lowercaseString];
 
         [MIMEToExtensionsDictionary setObject:extensions forKey:MIME];
 
         description = [MIMEDictionary objectForKey:WebPluginTypeDescriptionKey];
-        if (!description) {
+        if (!description)
             description = @"";
-        }
 
         [MIMEToDescriptionDictionary setObject:description forKey:MIME];
     }
     NSString *filename = [self filename];
 
     NSString *theName = [bundle objectForInfoDictionaryKey:WebPluginNameKey];
-    if (!theName) {
+    if (!theName)
         theName = filename;
-    }
     [self setName:theName];
 
     description = [bundle objectForInfoDictionaryKey:WebPluginDescriptionKey];
-    if (!description) {
+    if (!description)
         description = filename;
-    }
     [self setPluginDescription:description];
 
     return YES;
 
 - (NSDictionary *)pListForPath:(NSString *)pListPath createFile:(BOOL)createFile
 {
-    if (createFile && [self load] && BP_CreatePluginMIMETypesPreferences) {
+    if (createFile && [self load] && BP_CreatePluginMIMETypesPreferences)
         BP_CreatePluginMIMETypesPreferences();
-    }
     
     NSDictionary *pList = nil;
     NSData *data = [NSData dataWithContentsOfFile:pListPath];
 
 - (BOOL)getPluginInfoFromPLists
 {
-    if (!bundle) {
+    if (!bundle)
         return NO;
-    }
     
     NSDictionary *MIMETypes = nil;
     NSString *pListFilename = [bundle objectForInfoDictionaryKey:WebPluginMIMETypesFilenameKey];
         if (pList) {
             // If the plist isn't localized, have the plug-in recreate it in the preferred language.
             NSString *localizationName = [pList objectForKey:WebPluginLocalizationNameKey];
-            if (![localizationName isEqualToString:[[self class] preferredLocalizationName]]) {
+            if (![localizationName isEqualToString:[[self class] preferredLocalizationName]])
                 pList = [self pListForPath:pListPath createFile:YES];
-            }
             MIMETypes = [pList objectForKey:WebPluginMIMETypesKey];
-        } else {
+        } else
             // Plist doesn't exist, ask the plug-in to create it.
             MIMETypes = [[self pListForPath:pListPath createFile:YES] objectForKey:WebPluginMIMETypesKey];
-        }
     }
     
     // Pass the MIME dictionary to the superclass to parse it.
 
 - (BOOL)load
 {
-    if (isLoaded && bundle != nil && BP_CreatePluginMIMETypesPreferences == NULL) {
+    if (isLoaded && bundle && !BP_CreatePluginMIMETypesPreferences)
         BP_CreatePluginMIMETypesPreferences = (BP_CreatePluginMIMETypesPreferencesFuncPtr)CFBundleGetFunctionPointerForName(cfBundle, CFSTR("BP_CreatePluginMIMETypesPreferences"));
-    }
     return isLoaded;
 }
 
         extensionEnumerator = [extensions objectEnumerator];
 
         while ((extension = [extensionEnumerator nextObject]) != nil) {
-            if (![extension isEqualToString:@""]) {
+            if (![extension isEqualToString:@""])
                 [extensionToMIME setObject:MIME forKey:extension];
-            }
         }
     }
 }
         const NXArchInfo *localArch = NXGetLocalArchInfo();
         if (localArch != NULL) {
             struct mach_header *header = (struct mach_header *)[data bytes];
-            if (header->magic == MH_MAGIC) {
+            if (header->magic == MH_MAGIC)
                 return (header->cputype == localArch->cputype);
-            }
-            if (header->magic == MH_CIGAM) {
+            if (header->magic == MH_CIGAM)
                 return ((cpu_type_t) OSSwapInt32(header->cputype) == localArch->cputype);
-            }
         }
     }
     return YES;
     NSString *string;
 
     while ((string = [strings nextObject]) != nil) {
-        if ([string isKindOfClass:[NSString class]]) {
+        if ([string isKindOfClass:[NSString class]])
             [lowercaseStrings addObject:[string lowercaseString]];
-        }
     }
 
     return lowercaseStrings;
index 822573b599fa38d82a954826b915a67c43cc8758..27bb15d5e2de0cbc458f4ff8766c67f3b8d6612f 100644 (file)
@@ -73,13 +73,12 @@ static TransitionVector tVectorForFunctionPointer(FunctionPointer);
     FSRef fref;
     OSErr err;
     
-    if (isBundle) {
+    if (isBundle)
         return CFBundleOpenBundleResourceMap(cfBundle);
-    else {
+    else {
         err = FSPathMakeRef((const UInt8 *)[path fileSystemRepresentation], &fref, NULL);
-        if (err != noErr) {
+        if (err != noErr)
             return -1;
-        }
         
         return FSOpenResFile(&fref, fsRdPerm);
     }
@@ -87,11 +86,10 @@ static TransitionVector tVectorForFunctionPointer(FunctionPointer);
 
 - (void)closeResourceFile:(SInt16)resRef
 {
-    if (isBundle) {
+    if (isBundle)
         CFBundleCloseBundleResourceMap(cfBundle, resRef);
-    } else {
+    else
         CloseResFile(resRef);
-    }
 }
 
 - (NSString *)stringForStringListID:(SInt16)stringListID andIndex:(SInt16)index
@@ -102,14 +100,12 @@ static TransitionVector tVectorForFunctionPointer(FunctionPointer);
         return nil;
     }
     unsigned char *p = (unsigned char *)*stringHandle;
-    if (p == NULL) {
+    if (!p)
         return nil;
-    }
     
     // Check the index against the length of the string list, then skip the length.
-    if (index < 1 || index > *(SInt16 *)p) {
+    if (index < 1 || index > *(SInt16 *)p)
         return nil;
-    }
     p += sizeof(SInt16);
     
     // Skip any strings that come before the one we are looking for.
@@ -123,19 +119,16 @@ static TransitionVector tVectorForFunctionPointer(FunctionPointer);
 - (BOOL)getPluginInfoFromResources
 {
     SInt16 resRef = [self openResourceFile];
-    if (resRef == -1) {
+    if (resRef == -1)
         return NO;
-    }
     
     UseResFile(resRef);
-    if (ResError() != noErr) {
+    if (ResError() != noErr)
         return NO;
-    }
 
     NSString *MIME, *extensionsList, *description;
     NSArray *extensions;
-    NSRange r;
-    uint i;
+    unsigned i;
     
     NSMutableDictionary *MIMEToExtensionsDictionary = [NSMutableDictionary dictionary];
     NSMutableDictionary *MIMEToDescriptionDictionary = [NSMutableDictionary dictionary];
@@ -143,33 +136,23 @@ static TransitionVector tVectorForFunctionPointer(FunctionPointer);
     for (i=1; 1; i+=2) {
         MIME = [[self stringForStringListID:MIMEListStringStringNumber
                                    andIndex:i] lowercaseString];
-        if (!MIME) {
+        if (!MIME)
             break;
-        }
-
-        // FIXME: Avoid mime types with semi-colons because KJS can't properly parse them using KWQKConfigBase
-        r = [MIME rangeOfString:@";"];
-        if (r.length > 0) {
-            continue;
-        }
 
-        extensionsList = [[self stringForStringListID:MIMEListStringStringNumber
-                                             andIndex:i+1] lowercaseString];
+        extensionsList = [[self stringForStringListID:MIMEListStringStringNumber andIndex:i+1] lowercaseString];
         if (extensionsList) {
             extensions = [extensionsList componentsSeparatedByString:@","];
             [MIMEToExtensionsDictionary setObject:extensions forKey:MIME];
-        } else {
+        } else
             // DRM and WMP claim MIMEs without extensions. Use a @"" extension in this case.
             [MIMEToExtensionsDictionary setObject:[NSArray arrayWithObject:@""] forKey:MIME];
-        }
         
         description = [self stringForStringListID:MIMEDescriptionStringNumber
                                          andIndex:[MIMEToExtensionsDictionary count]];
-        if (description) {
+        if (description)
             [MIMEToDescriptionDictionary setObject:description forKey:MIME];
-        } else {
+        else
             [MIMEToDescriptionDictionary setObject:@"" forKey:MIME];
-        }
     }
 
     [self setMIMEToDescriptionDictionary:MIMEToDescriptionDictionary];
@@ -178,16 +161,14 @@ static TransitionVector tVectorForFunctionPointer(FunctionPointer);
     NSString *filename = [self filename];
     
     description = [self stringForStringListID:PluginNameOrDescriptionStringNumber andIndex:1];
-    if (!description) {
+    if (!description)
         description = filename;
-    }
     [self setPluginDescription:description];
     
     
     NSString *theName = [self stringForStringListID:PluginNameOrDescriptionStringNumber andIndex:2];
-    if (!theName) {
+    if (!theName)
         theName = filename;
-    }
     [self setName:theName];
     
     [self closeResourceFile:resRef];
@@ -195,7 +176,7 @@ static TransitionVector tVectorForFunctionPointer(FunctionPointer);
     return YES;
 }
 
-- initWithPath:(NSString *)pluginPath
+- (id)initWithPath:(NSString *)pluginPath
 {
     [super initWithPath:pluginPath];
 
@@ -259,11 +240,10 @@ static TransitionVector tVectorForFunctionPointer(FunctionPointer);
 
 - (WebExecutableType)executableType
 {
-    if (isCFM) {
+    if (isCFM)
         return WebCFMExecutableType;
-    } else {
+    else
         return WebMachOExecutableType;
-    }
 }
 
 - (BOOL)isLoaded
@@ -273,22 +253,19 @@ static TransitionVector tVectorForFunctionPointer(FunctionPointer);
 
 - (void)unloadWithoutShutdown
 {
-    if (!isLoaded) {
+    if (!isLoaded)
         return;
-    }
 
-    if (resourceRef != -1) {
+    if (resourceRef != -1)
         [self closeResourceFile:resourceRef];
-    }
 
-    if (isBundle) {
+    if (isBundle)
         CFBundleUnloadExecutable(cfBundle);
-    } else {
+    else
 #if !__LP64__
         // CFM is not supported in 64-bit
         WebCloseConnection(&connID);
 #endif
-    }
 
     LOG(Plugins, "Plugin Unloaded");
     isLoaded = NO;
@@ -321,14 +298,12 @@ static TransitionVector tVectorForFunctionPointer(FunctionPointer);
 #endif
     LOG(Plugins, "%f Load timing started for: %@", start, [self name]);
 
-    if (isLoaded) {
+    if (isLoaded)
         return YES;
-    }
     
     if (isBundle) {
-        if (!CFBundleLoadExecutable(cfBundle)) {
+        if (!CFBundleLoadExecutable(cfBundle))
             goto abort;
-        }
 #if !LOG_DISABLED
         CFAbsoluteTime currentTime = CFAbsoluteTimeGetCurrent();
         CFAbsoluteTime duration = currentTime - start;
@@ -338,16 +313,14 @@ static TransitionVector tVectorForFunctionPointer(FunctionPointer);
         
         if (isCFM) {
             pluginMainFunc = (MainFuncPtr)CFBundleGetFunctionPointerForName(cfBundle, CFSTR("main") );
-            if (!pluginMainFunc) {
+            if (!pluginMainFunc)
                 goto abort;
-            }
         } else {
             NP_Initialize = (NP_InitializeFuncPtr)CFBundleGetFunctionPointerForName(cfBundle, CFSTR("NP_Initialize"));
             NP_GetEntryPoints = (NP_GetEntryPointsFuncPtr)CFBundleGetFunctionPointerForName(cfBundle, CFSTR("NP_GetEntryPoints"));
             NPP_Shutdown = (NPP_ShutdownProcPtr)CFBundleGetFunctionPointerForName(cfBundle, CFSTR("NP_Shutdown"));
-            if (!NP_Initialize || !NP_GetEntryPoints || !NPP_Shutdown) {
+            if (!NP_Initialize || !NP_GetEntryPoints || !NPP_Shutdown)
                 goto abort;
-            }
         }
     } else {
 #if __LP64__
@@ -448,17 +421,15 @@ static TransitionVector tVectorForFunctionPointer(FunctionPointer);
         NPP_ShutdownProcPtr shutdownFunction;
         npErr = pluginMainFunc(&browserFuncs, &pluginFuncs, &shutdownFunction);
         NPP_Shutdown = (NPP_ShutdownProcPtr)functionPointerForTVector((TransitionVector)shutdownFunction);
-        if (!isBundle) {
+        if (!isBundle)
             // Don't free pluginMainFunc if we got it from a bundle because it is owned by CFBundle in that case.
             free(pluginMainFunc);
-        }
         
         // Workaround for 3270576. The RealPlayer plug-in fails to load if its preference file is out of date.
         // Launch the RealPlayer application to refresh the file.
         if (npErr != NPERR_NO_ERROR) {
-            if (npErr == NPERR_MODULE_LOAD_FAILED_ERROR && [[self filename] isEqualToString:RealPlayerPluginFilename]) {
+            if (npErr == NPERR_MODULE_LOAD_FAILED_ERROR && [[self filename] isEqualToString:RealPlayerPluginFilename])
                 [self launchRealPlayer];
-            }
             goto abort;
         }
 #if !LOG_DISABLED
@@ -487,7 +458,7 @@ static TransitionVector tVectorForFunctionPointer(FunctionPointer);
 
         // LiveConnect support
         NPP_GetJavaClass = (NPP_GetJavaClassProcPtr)functionPointerForTVector((TransitionVector)pluginFuncs.javaClass);
-        if (NPP_GetJavaClass){
+        if (NPP_GetJavaClass) {
             LOG(LiveConnect, "%@:  CFM entry point for NPP_GetJavaClass = %p", [self name], NPP_GetJavaClass);
         } else {
             LOG(LiveConnect, "%@:  no entry point for NPP_GetJavaClass", [self name]);
@@ -541,9 +512,8 @@ static TransitionVector tVectorForFunctionPointer(FunctionPointer);
 #endif
         LOG(Plugins, "%f NP_Initialize timing started", initializeStart);
         npErr = NP_Initialize(&browserFuncs);
-        if (npErr != NPERR_NO_ERROR) {
+        if (npErr != NPERR_NO_ERROR)
             goto abort;
-        }
 #if !LOG_DISABLED
         CFAbsoluteTime currentTime = CFAbsoluteTimeGetCurrent();
         CFAbsoluteTime duration = currentTime - initializeStart;
@@ -551,9 +521,8 @@ static TransitionVector tVectorForFunctionPointer(FunctionPointer);
         LOG(Plugins, "%f NP_Initialize took %f seconds", currentTime, duration);
 
         npErr = NP_GetEntryPoints(&pluginFuncs);
-        if (npErr != NPERR_NO_ERROR) {
+        if (npErr != NPERR_NO_ERROR)
             goto abort;
-        }
         
         pluginSize = pluginFuncs.size;
         pluginVersion = pluginFuncs.version;
@@ -596,9 +565,8 @@ abort:
     
 - (void)unload
 {
-    if (!isLoaded) {
+    if (!isLoaded)
         return;
-    }
     
     LOG(Plugins, "Unloading %@...", name);
 
index bb52548a8d866c2b09af5bab13c0da79e19121e3..503e629c758e7e08d944b323fe7d5c81ec6a4d27 100644 (file)
             _dataLengthReceived = 0;
             [self receivedData:data withDataSource:_dataSource];
             if (![_dataSource isLoading]) {
-                if (_error) {
+                if (_error)
                     [self receivedError:_error withDataSource:_dataSource];
-                } else {
+                else
                     [self finishedLoadingWithDataSource:_dataSource];
-                }
             }
         }
     }
index 9f5f284c1c765345aaa635494e1bc3d269ffe8e1..01707ce68432460b03928924a38a2c21cb7feab8 100644 (file)
@@ -48,9 +48,8 @@ static WebPluginDatabase *database = nil;
 
 + (WebPluginDatabase *)installedPlugins 
 {
-    if (!database) {
+    if (!database)
         database = [[WebPluginDatabase alloc] init];
-    }
     return database;
 }
 
@@ -63,19 +62,16 @@ static WebPluginDatabase *database = nil;
     while ((plugin = [pluginEnumerator nextObject]) != nil) {
         if ([[[plugin performSelector:enumeratorSelector] allObjects] containsObject:key]) {
             if ([plugin isKindOfClass:[WebPluginPackage class]]) {
-                if (webPlugin == nil) {
+                if (!webPlugin)
                     webPlugin = plugin;
-                }
             } else if([plugin isKindOfClass:[WebNetscapePluginPackage class]]) {
                 WebExecutableType executableType = [(WebNetscapePluginPackage *)plugin executableType];
                 if (executableType == WebCFMExecutableType) {
-                    if (CFMPlugin == nil) {
+                    if (!CFMPlugin)
                         CFMPlugin = plugin;
-                    }
                 } else if (executableType == WebMachOExecutableType) {
-                    if (machoPlugin == nil) {
+                    if (!machoPlugin)
                         machoPlugin = plugin;
-                    }
                 } else {
                     ASSERT_NOT_REACHED();
                 }
@@ -87,19 +83,18 @@ static WebPluginDatabase *database = nil;
 
     // Allow other plug-ins to win over QT because if the user has installed a plug-in that can handle a type
     // that the QT plug-in can handle, they probably intended to override QT.
-    if (webPlugin && ![webPlugin isQuickTimePlugIn]) {
+    if (webPlugin && ![webPlugin isQuickTimePlugIn])
         return webPlugin;
-    } else if (machoPlugin && ![machoPlugin isQuickTimePlugIn]) {
+    else if (machoPlugin && ![machoPlugin isQuickTimePlugIn])
         return machoPlugin;
-    } else if (CFMPlugin && ![CFMPlugin isQuickTimePlugIn]) {
+    else if (CFMPlugin && ![CFMPlugin isQuickTimePlugIn])
         return CFMPlugin;
-    } else if (webPlugin) {
+    else if (webPlugin)
         return webPlugin;
-    } else if (machoPlugin) {
+    else if (machoPlugin)
         return machoPlugin;
-    } else if (CFMPlugin) {
+    else if (CFMPlugin)
         return CFMPlugin;
-    }
     return nil;
 }
 
@@ -118,9 +113,8 @@ static WebPluginDatabase *database = nil;
         // and find the a plug-in from the MIME type. This is done in case the plug-in has not fully specified
         // an extension <-> MIME type mapping.
         NSString *MIMEType = WKGetMIMETypeForExtension(extension);
-        if ([MIMEType length] > 0) {
+        if ([MIMEType length] > 0)
             plugin = [self pluginForMIMEType:MIMEType];
-        }
     }
     return plugin;
 }
@@ -149,9 +143,8 @@ static NSArray *pluginLocations(void)
     // The purpose is to allow non-admin users to update their plug-ins.
     NSMutableArray *array = [NSMutableArray arrayWithCapacity:[extensionPlugInPaths count] + 3];
     
-    if (extensionPlugInPaths) {
+    if (extensionPlugInPaths)
         [array addObjectsFromArray:extensionPlugInPaths];
-    }
     
     [array addObject:[NSHomeDirectory() stringByAppendingPathComponent:@"Library/Internet Plug-Ins"]];
     [array addObject:@"/Library/Internet Plug-Ins"];
@@ -160,15 +153,11 @@ static NSArray *pluginLocations(void)
     return array;
 }
 
-- init
+- (id)init
 {
     self = [super init];
-    if (self == nil) {
-        return nil;
-    }
     [self refresh];
     return self;
-    
 }
     
 - (void)refresh
@@ -228,9 +217,8 @@ static NSArray *pluginLocations(void)
     NSString *MIMEType;
     while ((MIMEType = [keyEnumerator nextObject]) != nil) {
         Class class = [MIMEToViewClass objectForKey:MIMEType];
-        if (class == [WebNetscapePluginDocumentView class] || class == [WebPluginDocumentView class]) {
+        if (class == [WebNetscapePluginDocumentView class] || class == [WebPluginDocumentView class])
             [WebView _unregisterViewClassAndRepresentationClassForMIMEType:MIMEType];
-        }
     }
     
     // Build a list of MIME types.
@@ -245,22 +233,19 @@ static NSArray *pluginLocations(void)
     NSEnumerator *MIMEEnumerator = [[MIMETypes allObjects] objectEnumerator];
     [MIMETypes release];
     while ((MIMEType = [MIMEEnumerator nextObject]) != nil) {
-        if ([WebView canShowMIMETypeAsHTML:MIMEType]) {
+        if ([WebView canShowMIMETypeAsHTML:MIMEType])
             // Don't allow plug-ins to override our core HTML types.
             continue;
-        }
         plugin = [self pluginForMIMEType:MIMEType];
-        if ([plugin isJavaPlugIn]) {
+        if ([plugin isJavaPlugIn])
             // Don't register the Java plug-in for a document view since Java files should be downloaded when not embedded.
             continue;
-        }
-        if ([plugin isQuickTimePlugIn] && [[WebFrameView _viewTypesAllowImageTypeOmission:NO] objectForKey:MIMEType] != nil) {
+        if ([plugin isQuickTimePlugIn] && [[WebFrameView _viewTypesAllowImageTypeOmission:NO] objectForKey:MIMEType])
             // Don't allow the QT plug-in to override any types because it claims many that we can handle ourselves.
             continue;
-        }
-        if ([plugin isKindOfClass:[WebNetscapePluginPackage class]]) {
+        if ([plugin isKindOfClass:[WebNetscapePluginPackage class]])
             [WebView registerViewClass:[WebNetscapePluginDocumentView class] representationClass:[WebNetscapePluginRepresentation class] forMIMEType:MIMEType];
-        else {
+        else {
             ASSERT([plugin isKindOfClass:[WebPluginPackage class]]);
             [WebView registerViewClass:[WebPluginDocumentView class] representationClass:[WebPluginDocumentView class] forMIMEType:MIMEType];
         }
index a601e4849c0e1dd1eea436786bb7453c9b65fc39..7ac68d5a1e6bd1b62d88ecbec3c64807643db17f 100644 (file)
@@ -37,13 +37,11 @@ WebBaseNetscapePluginView *pluginViewForInstance(NPP instance);
 
 void* NPN_MemAlloc(uint32 size)
 {
-    //LOG(Plugins, "NPN_MemAlloc");
     return malloc(size);
 }
 
 void NPN_MemFree(void* ptr)
 {
-    //LOG(Plugins, "NPN_MemFree");
     free(ptr);
 }
 
@@ -71,11 +69,10 @@ NPError NPN_RequestRead(NPStream* stream, NPByteRange* rangeList)
 // This specifically works around Flash and Shockwave. When we call NPP_New, they call NPN_UserAgent with a NULL instance.
 WebBaseNetscapePluginView *pluginViewForInstance(NPP instance)
 {
-    if (instance && instance->ndata) {
+    if (instance && instance->ndata)
         return (WebBaseNetscapePluginView *)instance->ndata;
-    } else {
+    else
         return [WebBaseNetscapePluginView currentPluginView];
-    }
 }
 
 NPError NPN_GetURLNotify(NPP instance, const char* URL, const char* target, void* notifyData)
index 3b6896411e75dba5910a5f74fe2e8b841f7e7874..8d405d7928ae2082e11d6517d42190b1b1bc23ea 100644 (file)
@@ -74,7 +74,7 @@
 
     NSEnumerator *e = [customHeaders keyEnumerator];
     NSString *key;
-    while ((key = (NSString *)[e nextObject]) != nil) {
+    while ((key = [e nextObject])) {
        [newRequest addValue:[customHeaders objectForKey:key] forHTTPHeaderField:key];
     }
 
@@ -91,9 +91,8 @@
     [newRequest setMainDocumentURL:[[[[_webView mainFrame] dataSource] request] URL]];
     [newRequest _web_setHTTPUserAgent:[_webView userAgentForURL:[newRequest URL]]];
             
-    if (![loader loadWithRequest:newRequest]) {
+    if (![loader loadWithRequest:newRequest])
         loader = nil;
-    }
     
     return loader;
 }
     NSURL *oldURL = [request URL];
     NSURLRequest *clientRequest = [super willSendRequest:newRequest redirectResponse:redirectResponse];
     
-    if (clientRequest != nil && oldURL != [clientRequest URL] && ![oldURL isEqual:[clientRequest URL]]) {
+    if (clientRequest != nil && oldURL != [clientRequest URL] && ![oldURL isEqual:[clientRequest URL]])
        [coreLoader redirectedToURL:[clientRequest URL]];
-    }
 
     return clientRequest;
 }
index 14684da94ff9d4cb4fd8fd9f2fa7e23c5208d41b..dc9a6ad919468fe834bb030e8f3413a363cac766 100644 (file)
@@ -1017,12 +1017,10 @@ static inline void addTypesFromClass(NSMutableDictionary *allTypes, Class class,
     // Once a frame has loaded, we no longer need to consider subresources,
     // but we still need to consider subframes.
     if ([[self webFrame] _state] != WebFrameStateComplete) {
-        if (!_private->primaryLoadComplete && _private->loading) {
+        if (!_private->primaryLoadComplete && _private->loading)
             return YES;
-        }
-        if ([_private->subresourceLoaders count]) {
+        if ([_private->subresourceLoaders count])
             return YES;
-        }
         if (![[[self webFrame] _bridge] doneProcessingData])
             return YES;
     }
index 5a6a9943280f51a8a3aac01770f172b4a556368f..728b3a1fe3642a11be1f5a36175366368e3c2840 100644 (file)
@@ -2345,8 +2345,7 @@ static CFAbsoluteTime _timeOfLastCompletedLoad;
     ASSERT([self webView] != nil);
 
     // Unfortunately the view must be non-nil, this is ultimately due
-    // to KDE parser requiring a KHTMLView.  Once we settle on a final
-    // KDE drop we should fix this dependency.
+    // to parser requiring a FrameView.  We should fix this dependency.
 
     ASSERT([self frameView] != nil);
 
@@ -2762,20 +2761,11 @@ static CFAbsoluteTime _timeOfLastCompletedLoad;
 
 - (BOOL)_subframeIsLoading
 {
-    // Put in the auto-release pool because it's common to call this from a run loop source,
-    // and then the entire list of frames lasts until the next autorelease.
-    // FIXME: is this really still true? we use _firstChildFrame/_nextSiblingFrame now 
-    // which does not make a copy.
-    NSAutoreleasePool *pool = [NSAutoreleasePool new];
-
-    WebFrame *frame;
-    for (frame = [self _firstChildFrame]; frame; frame = [frame _nextSiblingFrame])
+    // It's most likely that the last added frame is the last to load so we walk backwards.
+    for (WebFrame *frame = [self _lastChildFrame]; frame; frame = [frame _previousSiblingFrame])
         if ([[frame dataSource] isLoading] || [[frame provisionalDataSource] isLoading])
-            break;
-
-    [pool drain];
-    
-    return frame != nil;
+            return YES;
+    return NO;
 }
 
 - (void)_addPlugInView:(NSView *)plugInView
index 9bf86cf478620003218b4f9d5abb133248ab3999..23a66651b3b113551d85f07a316453eaf87c2210 100644 (file)
@@ -497,13 +497,11 @@ void *_NSSoftLinkingGetFrameworkFuncPtr(NSString *inUmbrellaFrameworkName,
     // which uses the URL of the resource for the fragment that it returns.
     NSString *extension = [name pathExtension];
     NSString *MIMEType = nil;
-    if ([extension length] != 0) {
+    if ([extension length] != 0)
         MIMEType = WKGetMIMETypeForExtension(extension);
-    }
     // Only support image resources.
-    if (MIMEType == nil || ![[[WebImageRendererFactory sharedFactory] supportedMIMETypes] containsObject:MIMEType]) {
+    if (MIMEType == nil || ![[[WebImageRendererFactory sharedFactory] supportedMIMETypes] containsObject:MIMEType])
         return nil;
-    }
     NSURL *URL = [NSURL _web_URLWithUserTypedString:[NSString stringWithFormat:@"/%@", name] relativeToURL:[NSURL _web_uniqueWebDataURL]];
     WebResource *resource = [[[WebResource alloc] initWithData:data
                                                            URL:URL
index 73b1189f22eb4dabd9509abd90a1040fd3e03391..aeaef8e217f17c6910918008c3828189f3bac664 100644 (file)
@@ -1603,12 +1603,12 @@ NSMutableDictionary *countInvocations;
                                                  name:WebPreferencesChangedNotification object:[self preferences]];
 }
 
-- initWithFrame:(NSRect)f
+- (id)initWithFrame:(NSRect)f
 {
     return [self initWithFrame:f frameName:nil groupName:nil];
 }
 
-- initWithFrame:(NSRect)f frameName:(NSString *)frameName groupName:(NSString *)groupName;
+- (id)initWithFrame:(NSRect)f frameName:(NSString *)frameName groupName:(NSString *)groupName;
 {
     self = [super initWithFrame:f];
     if (!self)