Bug 100932

Summary: User can change a disabled select (drop down box)
Product: WebKit Reporter: Kunihiko Sakamoto <ksakamoto>
Component: FormsAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: mifenton, tkent, webkit.review.bot, yosin
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: All   
Attachments:
Description Flags
Patch
none
Patch 2
none
Patch 3
none
Patch 4 none

Kunihiko Sakamoto
Reported 2012-11-01 02:27:44 PDT
Imported from http://crbug.com/158802 Focused select element is changeable even if it is disabled. Example URL: http://jsfiddle.net/langdonx/ymEZR/ If focused element becomes disabled, the element should lose focus. This is expected behavior within HTML5 spec: http://www.whatwg.org/specs/web-apps/current-work/multipage/editing.html#focus-management
Attachments
Patch (4.41 KB, patch)
2012-11-01 02:41 PDT, Kunihiko Sakamoto
no flags
Patch 2 (6.50 KB, patch)
2012-11-07 18:07 PST, Kunihiko Sakamoto
no flags
Patch 3 (4.49 KB, patch)
2012-11-07 18:33 PST, Kunihiko Sakamoto
no flags
Patch 4 (4.38 KB, patch)
2012-11-07 19:35 PST, Kunihiko Sakamoto
no flags
Kunihiko Sakamoto
Comment 1 2012-11-01 02:41:45 PDT
Kent Tamura
Comment 2 2012-11-01 03:19:12 PDT
Comment on attachment 171801 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=171801&action=review > Source/WebCore/html/HTMLFormControlElement.cpp:154 > + if (disabled() && focused()) > + blur(); > setNeedsWillValidateCheck(); Unfortunately, this is not acceptable. blur() dispatches a 'blur' event, and Event handler JavaScript code can delete |this| object. Probably we should make blur/focusout/DOMFocusOut/focus/focusin/DOMFocusIn events scoped-events, like I did in http://trac.webkit.org/changeset/132983
Alexey Proskuryakov
Comment 3 2012-11-01 10:08:15 PDT
When fixing this, please also add a test case for the issue Kent found in review.
Kunihiko Sakamoto
Comment 4 2012-11-07 18:07:57 PST
Kent Tamura
Comment 5 2012-11-07 18:12:26 PST
Comment on attachment 172905 [details] Patch 2 View in context: https://bugs.webkit.org/attachment.cgi?id=172905&action=review > Source/WebCore/ChangeLog:15 > + (WebCore::HTMLSelectElement::menuListDefaultEventHandler): > + (WebCore::HTMLSelectElement::listBoxDefaultEventHandler): > + (WebCore::HTMLSelectElement::defaultEventHandler): You changes are correct, but I think checking disabled() in the beginning of HTMLSelectElement::defaultEventHandler is enough and simpler.
Kunihiko Sakamoto
Comment 6 2012-11-07 18:33:04 PST
Kunihiko Sakamoto
Comment 7 2012-11-07 19:09:57 PST
Comment on attachment 172905 [details] Patch 2 View in context: https://bugs.webkit.org/attachment.cgi?id=172905&action=review >> Source/WebCore/ChangeLog:15 >> + (WebCore::HTMLSelectElement::defaultEventHandler): > > You changes are correct, but I think checking disabled() in the beginning of HTMLSelectElement::defaultEventHandler is enough and simpler. Done, thanks.
Kent Tamura
Comment 8 2012-11-07 19:13:07 PST
Comment on attachment 172911 [details] Patch 3 View in context: https://bugs.webkit.org/attachment.cgi?id=172911&action=review > Source/WebCore/html/HTMLSelectElement.cpp:1443 > + if (disabled() && (event->type() == eventNames().keydownEvent || event->type() == eventNames().keypressEvent)) { if (disabled()) { should be enough.
Kunihiko Sakamoto
Comment 9 2012-11-07 19:35:16 PST
Kunihiko Sakamoto
Comment 10 2012-11-07 19:35:49 PST
Comment on attachment 172911 [details] Patch 3 View in context: https://bugs.webkit.org/attachment.cgi?id=172911&action=review >> Source/WebCore/html/HTMLSelectElement.cpp:1443 >> + if (disabled() && (event->type() == eventNames().keydownEvent || event->type() == eventNames().keypressEvent)) { > > if (disabled()) { > should be enough. Done.
Kent Tamura
Comment 11 2012-11-07 21:43:34 PST
Comment on attachment 172918 [details] Patch 4 ok
WebKit Review Bot
Comment 12 2012-11-07 23:35:06 PST
Comment on attachment 172918 [details] Patch 4 Rejecting attachment 172918 [details] from commit-queue. New failing tests: inspector-protocol/debugger-terminate-dedicated-worker-while-paused.html Full output: http://queues.webkit.org/results/14766341
WebKit Review Bot
Comment 13 2012-11-08 00:18:18 PST
Comment on attachment 172918 [details] Patch 4 Clearing flags on attachment: 172918 Committed r133860: <http://trac.webkit.org/changeset/133860>
WebKit Review Bot
Comment 14 2012-11-08 00:18:22 PST
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.