[Webkit-unassigned] [Bug 63929] A 'change' event is not triggered on a multiple file form when selected files are changed

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Jul 5 19:01:03 PDT 2011


https://bugs.webkit.org/show_bug.cgi?id=63929


Kent Tamura <tkent at chromium.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #99774|review?                     |review-
               Flag|                            |




--- Comment #6 from Kent Tamura <tkent at chromium.org>  2011-07-05 19:01:03 PST ---
(From update of attachment 99774)
View in context: https://bugs.webkit.org/attachment.cgi?id=99774&action=review

> LayoutTests/fast/forms/file-input-change-event.html:93
> +function SingleFileSelected() {
> +    onChangeCalled = true;
> +}
> +
> +function MultipleFilesSelected() {
> +    onChangeCalled = true;
> +}
> +
> +function moveMouseToCenterOfElement(element) {

Inconsistent names.
SingleFileSelected -> singleFileSelected
MultipleFileSelected -> multipleFileSelected

> Source/WebCore/html/FileInputType.cpp:310
> +        // This call may cause destruction of this instance and thus must always be last in the function.
> +        input->HTMLElement::dispatchChangeEvent();
> +    }
> +    input->setChangedSinceLastFormControlChangeEvent(false);
>  }

The comment is lame. "This call" isn't on the last of the function.
In this case, you don't use 'this' after the dispatchChangeEvent() call.  So it's safe about 'this'.

However 'input' might be deleted by dispatchChangeEvent().  You need to protect 'input' by replacing:
 HTMLInputElement* input = element();
at the beginning of the function with
 RefPtr<HTMLInputElement> input = element();

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list