Calendar Picker: Fix a crash by changing input type.
authortkent@chromium.org <tkent@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 10 May 2012 06:13:00 +0000 (06:13 +0000)
committertkent@chromium.org <tkent@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 10 May 2012 06:13:00 +0000 (06:13 +0000)
https://bugs.webkit.org/show_bug.cgi?id=86007

Reviewed by Hajime Morita.

.:

* ManualTests/forms/calendar-picker-crash-by-type-change.html: Added.

Source/WebCore:

Manual test: forms/calendar-picker-crash-by-type-change.html

* html/shadow/CalendarPickerElement.cpp:
(WebCore::CalendarPickerElement::~CalendarPickerElement):
Added. Make sure the popup is closed.
* html/shadow/CalendarPickerElement.h:
(CalendarPickerElement): Add declaration of the destructor.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@116611 268f45cc-cd09-0410-ab3c-d52691b4dbfc

ChangeLog
ManualTests/forms/calendar-picker-crash-by-type-change.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/html/shadow/CalendarPickerElement.cpp
Source/WebCore/html/shadow/CalendarPickerElement.h

index 91df3c7..6bab89e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2012-05-09  Kent Tamura  <tkent@chromium.org>
+
+        Calendar Picker: Fix a crash by changing input type.
+        https://bugs.webkit.org/show_bug.cgi?id=86007
+
+        Reviewed by Hajime Morita.
+
+        * ManualTests/forms/calendar-picker-crash-by-type-change.html: Added.
+
 2012-05-09  Gyuyoung Kim  <gyuyoung.kim@samsung.com>
 
         Move suspendAnimations to use Internals interface.
diff --git a/ManualTests/forms/calendar-picker-crash-by-type-change.html b/ManualTests/forms/calendar-picker-crash-by-type-change.html
new file mode 100644 (file)
index 0000000..7be901b
--- /dev/null
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<script>
+var input = document.createElement('input')
+input.type = 'date'
+var event = document.createEvent('KeyboardEvent')
+event.initKeyboardEvent('keydown', false, false, null, 'Down')
+input.dispatchEvent(event)
+input.type = 'color'
+</script>
+<p>Success if the browser didn't crash.</p>
index fa525bd..ac7a15a 100644 (file)
@@ -1,3 +1,18 @@
+2012-05-09  Kent Tamura  <tkent@chromium.org>
+
+        Calendar Picker: Fix a crash by changing input type.
+        https://bugs.webkit.org/show_bug.cgi?id=86007
+
+        Reviewed by Hajime Morita.
+
+        Manual test: forms/calendar-picker-crash-by-type-change.html
+
+        * html/shadow/CalendarPickerElement.cpp:
+        (WebCore::CalendarPickerElement::~CalendarPickerElement):
+        Added. Make sure the popup is closed.
+        * html/shadow/CalendarPickerElement.h:
+        (CalendarPickerElement): Add declaration of the destructor.
+
 2012-05-09  Gyuyoung Kim  <gyuyoung.kim@samsung.com>
 
         Move suspendAnimations to use Internals interface.
index 75eeef6..1a7b49f 100644 (file)
@@ -68,6 +68,12 @@ PassRefPtr<CalendarPickerElement> CalendarPickerElement::create(Document* docume
     return adoptRef(new CalendarPickerElement(document));
 }
 
+CalendarPickerElement::~CalendarPickerElement()
+{
+    closePopup();
+    ASSERT(!m_popup);
+}
+
 RenderObject* CalendarPickerElement::createRenderer(RenderArena* arena, RenderStyle*)
 {
     return new (arena) RenderDetailsMarker(this);
index 6bd208e..e6f6a4d 100644 (file)
@@ -43,6 +43,7 @@ class PagePopup;
 class CalendarPickerElement : public HTMLDivElement, public PagePopupClient {
 public:
     static PassRefPtr<CalendarPickerElement> create(Document*);
+    virtual ~CalendarPickerElement();
     void openPopup();
     void closePopup();