Bug 29929 - Need to check NULL frame in EventHandler::updateDragAndDrop.
Summary: Need to check NULL frame in EventHandler::updateDragAndDrop.
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore JavaScript (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Jian Li
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-09-30 10:02 PDT by Jian Li
Modified: 2009-09-30 10:56 PDT (History)
0 users

See Also:


Attachments
Proposed Patch (4.71 KB, patch)
2009-09-30 10:09 PDT, Jian Li
darin: review+
jianli: commit-queue-
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jian Li 2009-09-30 10:02:44 PDT
We need to check NULL frame in EventHandler::updateDragAndDrop. Otherwise, if we drag something to an iframe with invalid source, it might crash.
Comment 1 Jian Li 2009-09-30 10:09:18 PDT
Created attachment 40379 [details]
Proposed Patch
Comment 2 Darin Adler 2009-09-30 10:10:51 PDT
Comment on attachment 40379 [details]
Proposed Patch

> -            if (newTarget->hasTagName(frameTag) || newTarget->hasTagName(iframeTag))
> -                accept = static_cast<HTMLFrameElementBase*>(newTarget)->contentFrame()->eventHandler()->updateDragAndDrop(event, clipboard);
> +            Frame* frame = (newTarget->hasTagName(frameTag) || newTarget->hasTagName(iframeTag)) 
> +                            ? static_cast<HTMLFrameElementBase*>(newTarget)->contentFrame() : 0;

We don't line up ? characters like this. In fact, I'm not sure why it's indented the way it is. Just indent four characters as you would anywhere else.

r=me
Comment 3 Jian Li 2009-09-30 10:16:41 PDT
(In reply to comment #2)
> (From update of attachment 40379 [details])
> > -            if (newTarget->hasTagName(frameTag) || newTarget->hasTagName(iframeTag))
> > -                accept = static_cast<HTMLFrameElementBase*>(newTarget)->contentFrame()->eventHandler()->updateDragAndDrop(event, clipboard);
> > +            Frame* frame = (newTarget->hasTagName(frameTag) || newTarget->hasTagName(iframeTag)) 
> > +                            ? static_cast<HTMLFrameElementBase*>(newTarget)->contentFrame() : 0;
> 
> We don't line up ? characters like this. In fact, I'm not sure why it's
> indented the way it is. Just indent four characters as you would anywhere else.
> 
> r=me

I just copied the same code structure from the nearby code. I will fix both
occurrences when I land the change. Thanks.
Comment 4 Jian Li 2009-09-30 10:56:20 PDT
Committed as http://trac.webkit.org/changeset/48934.