Changeset 94633 in webkit


Ignore:
Timestamp:
Sep 6, 2011, 9:25:01 PM (14 years ago)
Author:
rniwa@webkit.org
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:
Location:
trunk/Source
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r94627 r94633  
     12011-09-06  Ryosuke Niwa  <rniwa@webkit.org>
     2
     3        fast/forms/suggested-value-crash.html crashes on Windows
     4        https://bugs.webkit.org/show_bug.cgi?id=67688
     5
     6        Reviewed by Adam Barth.
     7
     8        The crash was caused because functions in internals were accessing uninitialized QualifiedNames.
     9        Fixed the bug by avoiding to link to inputTag and textareaTag. Instead, we resort to toInputElement
     10        and string comparison.
     11
     12        * testing/Internals.cpp:
     13        (WebCore::Internals::wasLastChangeUserEdit):
     14        (WebCore::Internals::suggestedValue):
     15        (WebCore::Internals::setSuggestedValue):
     16
    1172011-09-06  Mark Hahnenberg  <mhahnenberg@apple.com>
    218
  • trunk/Source/WebCore/testing/Internals.cpp

    r94586 r94633  
    294294    }
    295295
    296     if (textField->hasTagName(HTMLNames::inputTag))
    297         return static_cast<HTMLInputElement*>(textField)->lastChangeWasUserEdit();
    298 
    299     if (textField->hasTagName(HTMLNames::textareaTag))
     296    if (HTMLInputElement* inputElement = textField->toInputElement())
     297        return inputElement->lastChangeWasUserEdit();
     298
     299    // FIXME: We should be using hasTagName instead but Windows port doesn't link QualifiedNames properly.
     300    if (textField->tagName() == "TEXTAREA")
    300301        return static_cast<HTMLTextAreaElement*>(textField)->lastChangeWasUserEdit();
    301302
     
    304305}
    305306
    306 String Internals::suggestedValue(Element* inputElement, ExceptionCode& ec)
    307 {
     307String Internals::suggestedValue(Element* element, ExceptionCode& ec)
     308{
     309    if (!element) {
     310        ec = INVALID_ACCESS_ERR;
     311        return String();
     312    }
     313
     314    HTMLInputElement* inputElement = element->toInputElement();
    308315    if (!inputElement) {
    309         ec = INVALID_ACCESS_ERR;
    310         return String();
    311     }
    312 
    313     if (!inputElement->hasTagName(HTMLNames::inputTag)) {
    314316        ec = INVALID_NODE_TYPE_ERR;
    315317        return String();
    316318    }
    317319
    318     return static_cast<HTMLInputElement*>(inputElement)->suggestedValue();
    319 }
    320 
    321 void Internals::setSuggestedValue(Element* inputElement, const String& value, ExceptionCode& ec)
    322 {
     320    return inputElement->suggestedValue();
     321}
     322
     323void Internals::setSuggestedValue(Element* element, const String& value, ExceptionCode& ec)
     324{
     325    if (!element) {
     326        ec = INVALID_ACCESS_ERR;
     327        return;
     328    }
     329
     330    HTMLInputElement* inputElement = element->toInputElement();
    323331    if (!inputElement) {
    324         ec = INVALID_ACCESS_ERR;
    325         return;
    326     }
    327 
    328     if (!inputElement->hasTagName(HTMLNames::inputTag)) {
    329332        ec = INVALID_NODE_TYPE_ERR;
    330333        return;
    331334    }
    332335
    333     static_cast<HTMLInputElement*>(inputElement)->setSuggestedValue(value);
    334 }
    335 
    336 }
     336    inputElement->setSuggestedValue(value);
     337}
     338
     339}
  • trunk/Source/WebKit2/ChangeLog

    r94627 r94633  
     12011-09-06  Ryosuke Niwa  <rniwa@webkit.org>
     2
     3        fast/forms/suggested-value-crash.html crashes on Windows
     4        https://bugs.webkit.org/show_bug.cgi?id=67688
     5
     6        Reviewed by Adam Barth.
     7
     8        Removed sybmols for inputTag and textareaTag. Added the symbol for StringImpl::equal.
     9
     10        * win/WebKit2.def:
     11        * win/WebKit2CFLite.def:
     12
    1132011-09-06  Mark Hahnenberg  <mhahnenberg@apple.com>
    214
  • trunk/Source/WebKit2/win/WebKit2.def

    r94586 r94633  
    152152        ?createWrapper@WebCore@@YA?AVJSValue@JSC@@PAVExecState@3@PAVJSDOMGlobalObject@1@PAVNode@1@@Z
    153153        ?ensureShadowRoot@Element@WebCore@@QAEPAVShadowRoot@2@XZ
     154        ?equal@WTF@@YA_NPBVStringImpl@1@PBD@Z
    154155        ?externalRepresentation@WebCore@@YA?AVString@WTF@@PAVElement@1@I@Z
    155156        ?getCachedDOMStructure@WebCore@@YAPAVStructure@JSC@@PAVJSDOMGlobalObject@1@PBUClassInfo@3@@Z
    156157        ?getElementById@TreeScope@WebCore@@QBEPAVElement@2@ABVAtomicString@WTF@@@Z
    157158        ?isPreloaded@CachedResourceLoader@WebCore@@QBE_NABVString@WTF@@@Z
    158         ?inputTag@HTMLNames@WebCore@@3VQualifiedName@2@B
    159159        ?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
    160160        ?lastChangeWasUserEdit@HTMLTextFormControlElement@WebCore@@QBE_NXZ
     
    170170        ?shadowRoot@Element@WebCore@@QBEPAVShadowRoot@2@XZ
    171171        ?suggestedValue@HTMLInputElement@WebCore@@QBEABVString@WTF@@XZ
    172         ?textareaTag@HTMLNames@WebCore@@3VQualifiedName@2@B
    173172        ?toDocument@WebCore@@YAPAVDocument@1@VJSValue@JSC@@@Z
    174173        ?toElement@WebCore@@YAPAVElement@1@VJSValue@JSC@@@Z
  • trunk/Source/WebKit2/win/WebKit2CFLite.def

    r94586 r94633  
    144144        ?createWrapper@WebCore@@YA?AVJSValue@JSC@@PAVExecState@3@PAVJSDOMGlobalObject@1@PAVNode@1@@Z
    145145        ?ensureShadowRoot@Element@WebCore@@QAEPAVShadowRoot@2@XZ
     146        ?equal@WTF@@YA_NPBVStringImpl@1@PBD@Z
    146147        ?externalRepresentation@WebCore@@YA?AVString@WTF@@PAVElement@1@I@Z
    147148        ?getCachedDOMStructure@WebCore@@YAPAVStructure@JSC@@PAVJSDOMGlobalObject@1@PBUClassInfo@3@@Z
    148149        ?getElementById@TreeScope@WebCore@@QBEPAVElement@2@ABVAtomicString@WTF@@@Z
    149150        ?isPreloaded@CachedResourceLoader@WebCore@@QBE_NABVString@WTF@@@Z
    150         ?inputTag@HTMLNames@WebCore@@3VQualifiedName@2@B
    151151        ?toJS@WebCore@@YA?AVJSValue@JSC@@PAVExecState@3@PAVJSDOMGlobalObject@1@PAVClientRect@1@@Z
    152152        ?updateLayoutIgnorePendingStylesheets@Document@WebCore@@QAEXXZ
     
    164164        ?shadowRoot@Element@WebCore@@QBEPAVShadowRoot@2@XZ
    165165        ?suggestedValue@HTMLInputElement@WebCore@@QBEABVString@WTF@@XZ
    166         ?textareaTag@HTMLNames@WebCore@@3VQualifiedName@2@B
    167166        ?toDocument@WebCore@@YAPAVDocument@1@VJSValue@JSC@@@Z
    168167        ?toElement@WebCore@@YAPAVElement@1@VJSValue@JSC@@@Z
Note: See TracChangeset for help on using the changeset viewer.