Title: [94633] trunk/Source
Revision
94633
Author
[email protected]
Date
2011-09-06 21:25:01 -0700 (Tue, 06 Sep 2011)

Log Message

fast/forms/suggested-value-crash.html crashes on Windows
https://bugs.webkit.org/show_bug.cgi?id=67688

Reviewed by Adam Barth.

Source/WebCore: 

The crash was caused because functions in internals were accessing uninitialized QualifiedNames.
Fixed the bug by avoiding to link to inputTag and textareaTag. Instead, we resort to toInputElement
and string comparison.

* testing/Internals.cpp:
(WebCore::Internals::wasLastChangeUserEdit):
(WebCore::Internals::suggestedValue):
(WebCore::Internals::setSuggestedValue):

Source/WebKit2: 

Removed sybmols for inputTag and textareaTag. Added the symbol for StringImpl::equal.

* win/WebKit2.def:
* win/WebKit2CFLite.def:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (94632 => 94633)


--- trunk/Source/WebCore/ChangeLog	2011-09-07 04:22:26 UTC (rev 94632)
+++ trunk/Source/WebCore/ChangeLog	2011-09-07 04:25:01 UTC (rev 94633)
@@ -1,3 +1,19 @@
+2011-09-06  Ryosuke Niwa  <[email protected]>
+
+        fast/forms/suggested-value-crash.html crashes on Windows
+        https://bugs.webkit.org/show_bug.cgi?id=67688
+
+        Reviewed by Adam Barth.
+
+        The crash was caused because functions in internals were accessing uninitialized QualifiedNames.
+        Fixed the bug by avoiding to link to inputTag and textareaTag. Instead, we resort to toInputElement
+        and string comparison.
+
+        * testing/Internals.cpp:
+        (WebCore::Internals::wasLastChangeUserEdit):
+        (WebCore::Internals::suggestedValue):
+        (WebCore::Internals::setSuggestedValue):
+
 2011-09-06  Mark Hahnenberg  <[email protected]>
 
         Unzip initialization lists and constructors in JSCell hierarchy (5/7)

Modified: trunk/Source/WebCore/testing/Internals.cpp (94632 => 94633)


--- trunk/Source/WebCore/testing/Internals.cpp	2011-09-07 04:22:26 UTC (rev 94632)
+++ trunk/Source/WebCore/testing/Internals.cpp	2011-09-07 04:25:01 UTC (rev 94633)
@@ -293,44 +293,47 @@
         return false;
     }
 
-    if (textField->hasTagName(HTMLNames::inputTag))
-        return static_cast<HTMLInputElement*>(textField)->lastChangeWasUserEdit();
+    if (HTMLInputElement* inputElement = textField->toInputElement())
+        return inputElement->lastChangeWasUserEdit();
 
-    if (textField->hasTagName(HTMLNames::textareaTag))
+    // FIXME: We should be using hasTagName instead but Windows port doesn't link QualifiedNames properly.
+    if (textField->tagName() == "TEXTAREA")
         return static_cast<HTMLTextAreaElement*>(textField)->lastChangeWasUserEdit();
 
     ec = INVALID_NODE_TYPE_ERR;
     return false;
 }
 
-String Internals::suggestedValue(Element* inputElement, ExceptionCode& ec)
+String Internals::suggestedValue(Element* element, ExceptionCode& ec)
 {
-    if (!inputElement) {
+    if (!element) {
         ec = INVALID_ACCESS_ERR;
         return String();
     }
 
-    if (!inputElement->hasTagName(HTMLNames::inputTag)) {
+    HTMLInputElement* inputElement = element->toInputElement();
+    if (!inputElement) {
         ec = INVALID_NODE_TYPE_ERR;
         return String();
     }
 
-    return static_cast<HTMLInputElement*>(inputElement)->suggestedValue();
+    return inputElement->suggestedValue();
 }
 
-void Internals::setSuggestedValue(Element* inputElement, const String& value, ExceptionCode& ec)
+void Internals::setSuggestedValue(Element* element, const String& value, ExceptionCode& ec)
 {
-    if (!inputElement) {
+    if (!element) {
         ec = INVALID_ACCESS_ERR;
         return;
     }
 
-    if (!inputElement->hasTagName(HTMLNames::inputTag)) {
+    HTMLInputElement* inputElement = element->toInputElement();
+    if (!inputElement) {
         ec = INVALID_NODE_TYPE_ERR;
         return;
     }
 
-    static_cast<HTMLInputElement*>(inputElement)->setSuggestedValue(value);
+    inputElement->setSuggestedValue(value);
 }
 
 }

Modified: trunk/Source/WebKit2/ChangeLog (94632 => 94633)


--- trunk/Source/WebKit2/ChangeLog	2011-09-07 04:22:26 UTC (rev 94632)
+++ trunk/Source/WebKit2/ChangeLog	2011-09-07 04:25:01 UTC (rev 94633)
@@ -1,3 +1,15 @@
+2011-09-06  Ryosuke Niwa  <[email protected]>
+
+        fast/forms/suggested-value-crash.html crashes on Windows
+        https://bugs.webkit.org/show_bug.cgi?id=67688
+
+        Reviewed by Adam Barth.
+
+        Removed sybmols for inputTag and textareaTag. Added the symbol for StringImpl::equal.
+
+        * win/WebKit2.def:
+        * win/WebKit2CFLite.def:
+
 2011-09-06  Mark Hahnenberg  <[email protected]>
 
         Unzip initialization lists and constructors in JSCell hierarchy (5/7)

Modified: trunk/Source/WebKit2/win/WebKit2.def (94632 => 94633)


--- trunk/Source/WebKit2/win/WebKit2.def	2011-09-07 04:22:26 UTC (rev 94632)
+++ trunk/Source/WebKit2/win/WebKit2.def	2011-09-07 04:25:01 UTC (rev 94633)
@@ -151,11 +151,11 @@
         ?create@ShadowContentElement@WebCore@@SA?AV?$PassRefPtr@VShadowContentElement@WebCore@@@WTF@@PAVDocument@2@@Z
         ?createWrapper@WebCore@@YA?AVJSValue@JSC@@PAVExecState@3@PAVJSDOMGlobalObject@1@PAVNode@1@@Z
         ?ensureShadowRoot@Element@WebCore@@QAEPAVShadowRoot@2@XZ
+        ?equal@WTF@@YA_NPBVStringImpl@1@PBD@Z
         ?externalRepresentation@WebCore@@YA?AVString@WTF@@PAVElement@1@I@Z
         ?getCachedDOMStructure@WebCore@@YAPAVStructure@JSC@@PAVJSDOMGlobalObject@1@PBUClassInfo@3@@Z
         ?getElementById@TreeScope@WebCore@@QBEPAVElement@2@ABVAtomicString@WTF@@@Z
         ?isPreloaded@CachedResourceLoader@WebCore@@QBE_NABVString@WTF@@@Z
-        ?inputTag@HTMLNames@WebCore@@3VQualifiedName@2@B
         ?jsStringSlowCase@WebCore@@YA?AVJSValue@JSC@@PAVExecState@3@AAV?$HashMap@PAVStringImpl@WTF@@V?$Weak@VJSString@JSC@@@JSC@@UStringHash@2@U?$HashTraits@PAVStringImpl@WTF@@@2@U?$HashTraits@V?$Weak@VJSString@JSC@@@JSC@@@2@@WTF@@PAVStringImpl@6@@Z
         ?lastChangeWasUserEdit@HTMLTextFormControlElement@WebCore@@QBE_NXZ
         ?markersFor@DocumentMarkerController@WebCore@@QAE?AV?$Vector@PAVDocumentMarker@WebCore@@$0A@@WTF@@PAVNode@2@@Z
@@ -169,7 +169,6 @@
         ?settings@Document@WebCore@@QBEPAVSettings@2@XZ
         ?shadowRoot@Element@WebCore@@QBEPAVShadowRoot@2@XZ
         ?suggestedValue@HTMLInputElement@WebCore@@QBEABVString@WTF@@XZ
-        ?textareaTag@HTMLNames@WebCore@@3VQualifiedName@2@B
         ?toDocument@WebCore@@YAPAVDocument@1@VJSValue@JSC@@@Z
         ?toElement@WebCore@@YAPAVElement@1@VJSValue@JSC@@@Z
         ?toJS@WebCore@@YA?AVJSValue@JSC@@PAVExecState@3@PAVJSDOMGlobalObject@1@PAVClientRect@1@@Z

Modified: trunk/Source/WebKit2/win/WebKit2CFLite.def (94632 => 94633)


--- trunk/Source/WebKit2/win/WebKit2CFLite.def	2011-09-07 04:22:26 UTC (rev 94632)
+++ trunk/Source/WebKit2/win/WebKit2CFLite.def	2011-09-07 04:25:01 UTC (rev 94633)
@@ -143,11 +143,11 @@
         ?create@ShadowContentElement@WebCore@@SA?AV?$PassRefPtr@VShadowContentElement@WebCore@@@WTF@@PAVDocument@2@@Z
         ?createWrapper@WebCore@@YA?AVJSValue@JSC@@PAVExecState@3@PAVJSDOMGlobalObject@1@PAVNode@1@@Z
         ?ensureShadowRoot@Element@WebCore@@QAEPAVShadowRoot@2@XZ
+        ?equal@WTF@@YA_NPBVStringImpl@1@PBD@Z
         ?externalRepresentation@WebCore@@YA?AVString@WTF@@PAVElement@1@I@Z
         ?getCachedDOMStructure@WebCore@@YAPAVStructure@JSC@@PAVJSDOMGlobalObject@1@PBUClassInfo@3@@Z
         ?getElementById@TreeScope@WebCore@@QBEPAVElement@2@ABVAtomicString@WTF@@@Z
         ?isPreloaded@CachedResourceLoader@WebCore@@QBE_NABVString@WTF@@@Z
-        ?inputTag@HTMLNames@WebCore@@3VQualifiedName@2@B
         ?toJS@WebCore@@YA?AVJSValue@JSC@@PAVExecState@3@PAVJSDOMGlobalObject@1@PAVClientRect@1@@Z
         ?updateLayoutIgnorePendingStylesheets@Document@WebCore@@QAEXXZ
         ?jsStringSlowCase@WebCore@@YA?AVJSValue@JSC@@PAVExecState@3@AAV?$HashMap@PAVStringImpl@WTF@@V?$Weak@VJSString@JSC@@@JSC@@UStringHash@2@U?$HashTraits@PAVStringImpl@WTF@@@2@U?$HashTraits@V?$Weak@VJSString@JSC@@@JSC@@@2@@WTF@@PAVStringImpl@6@@Z
@@ -163,7 +163,6 @@
         ?settings@Document@WebCore@@QBEPAVSettings@2@XZ
         ?shadowRoot@Element@WebCore@@QBEPAVShadowRoot@2@XZ
         ?suggestedValue@HTMLInputElement@WebCore@@QBEABVString@WTF@@XZ
-        ?textareaTag@HTMLNames@WebCore@@3VQualifiedName@2@B
         ?toDocument@WebCore@@YAPAVDocument@1@VJSValue@JSC@@@Z
         ?toElement@WebCore@@YAPAVElement@1@VJSValue@JSC@@@Z
         ?toJS@WebCore@@YA?AVJSValue@JSC@@PAVExecState@3@PAVJSDOMGlobalObject@1@PAVNode@1@@Z
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to