Bug 28085 - Unnecessary 'goto' confuses flow of control in WebHTMLView
Summary: Unnecessary 'goto' confuses flow of control in WebHTMLView
Status: RESOLVED CONFIGURATION CHANGED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Platform (show other bugs)
Version: 528+ (Nightly build)
Hardware: Mac OS X 10.5
: P4 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-08-07 14:14 PDT by Jens Alfke
Modified: 2023-10-20 11:47 PDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jens Alfke 2009-08-07 14:14:20 PDT
I was just looking through WebHTMLView and found this strange code in the -namesOfPromisedFilesDroppedAtDestination: method:

- (NSArray *)namesOfPromisedFilesDroppedAtDestination:(NSURL *)dropDestination
{
    NSFileWrapper *wrapper = nil;
    NSURL *draggingImageURL = nil;
    
    if (WebCore::CachedImage* tiffResource = [self promisedDragTIFFDataSource]) {
        
        SharedBuffer *buffer = static_cast<CachedResource*>(tiffResource)->data();
        if (!buffer)
            goto noPromisedData;
        
        ...
    }
noPromisedData:
    
There's no reason to use a goto there; maybe there was once some complex code in between the goto and the label, but not currently. It can easily be simplified to:

        if (buffer) {
            ...
        }
    }
Comment 1 Ahmad Saleem 2023-10-20 07:27:02 PDT
I am unable to find 'goto' as of today:

https://searchfox.org/wubkat/source/Source/WebKitLegacy/mac/WebView/WebHTMLView.mm#4343

I think this might have changed over the years and this can be marked as 'RESOLVED CONFIGURATION CHANGED'?

@Alexey - no idea, who would be right person to conclude on this.