Bug 28085
Summary: | Unnecessary 'goto' confuses flow of control in WebHTMLView | ||
---|---|---|---|
Product: | WebKit | Reporter: | Jens Alfke <jens> |
Component: | Platform | Assignee: | Nobody <webkit-unassigned> |
Status: | RESOLVED CONFIGURATION CHANGED | ||
Severity: | Normal | CC: | ahmad.saleem792, ap |
Priority: | P4 | ||
Version: | 528+ (Nightly build) | ||
Hardware: | Mac | ||
OS: | OS X 10.5 |
Jens Alfke
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) {
...
}
}
Attachments | ||
---|---|---|
Add attachment proposed patch, testcase, etc. |
Ahmad Saleem
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.