Give CString an equality operator to fix a bug in HTMLFormElement::formData
authoraroben <aroben@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 1 Jul 2007 04:53:25 +0000 (04:53 +0000)
committeraroben <aroben@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 1 Jul 2007 04:53:25 +0000 (04:53 +0000)
commit46ba7bbd8f661132f9f8bdc3762bc55dcfaa699a
tree474999540ccfdb85fb5042954c05ad8e384dfa60
parent5d932d7f35729f30034e0c49b98f7de8362d5ccc
Give CString an equality operator to fix a bug in HTMLFormElement::formData

WebCore:

        Give CString an equality operator to fix a bug in HTMLFormElement::formData

        The bug was spotted by MSVC /W4. The problem was that we were comparing
        a CString to a char* using ==, but CString had no equality operator.
        The result was that the CString was being cast to a const char* and a
        pointer comparison was being done, which would (essentially) always
        return false.

        There are two parts to the fix: get rid of CString's const char*
        casting operator, and add an equality operator. Previous uses of the
        casting operator have been changed to use CString::data().

        Test: http/misc/isindex-formdata.html

        Reviewed by Oliver.

        * dom/XMLTokenizer.cpp:
        (WebCore::parseXMLDocumentFragment):
        * html/HTMLDocument.cpp:
        (WebCore::HTMLDocument::determineParseMode):
        * html/HTMLFormElement.cpp:
        (WebCore::HTMLFormElement::formData):
        * loader/TextResourceDecoder.cpp:
        (WebCore::TextResourceDecoder::checkForCSSCharset):
        * platform/CString.cpp:
        (WebCore::operator==):
        * platform/CString.h:
        * platform/KURL.cpp:
        (WebCore::encodeRelativeString):
        * platform/StringImpl.cpp:
        (WebCore::StringImpl::toDouble):
        * platform/network/cf/FormDataStreamCFNet.cpp:
        (WebCore::setHTTPBody):
        * platform/network/mac/FormDataStreamMac.mm:
        (WebCore::setHTTPBody):
        * platform/win/ClipboardUtilitiesWin.cpp:
        (WebCore::markupToCF_HTML):
        * plugins/win/PluginPackageWin.cpp:
        (WebCore::splitString):
        * plugins/win/PluginStreamWin.cpp:
        (WebCore::PluginStreamWin::startStream):
        (WebCore::PluginStreamWin::destroyStream):
        (WebCore::PluginStreamWin::sendJavaScriptStream):
        (WebCore::PluginStreamWin::didFinishLoading):
        * plugins/win/PluginViewWin.cpp:
        (WebCore::PluginViewWin::start):
        (WebCore::createUTF8String):
        (WebCore::PluginViewWin::userAgent):
        * xml/XSLStyleSheet.cpp:
        (WebCore::XSLStyleSheet::locateStylesheetSubResource):
        * xml/XSLTProcessor.cpp:
        (WebCore::xsltParamArrayFromParameterMap):

LayoutTests:

        New test that makes sure we handle putting isindex into form data correctly.

        Reviewed by Oliver.

        * http/tests/misc/isindex-formdata-expected.txt: Added.
        * http/tests/misc/isindex-formdata.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@23906 268f45cc-cd09-0410-ab3c-d52691b4dbfc
19 files changed:
LayoutTests/ChangeLog
LayoutTests/http/tests/misc/isindex-formdata-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/misc/isindex-formdata.html [new file with mode: 0755]
WebCore/ChangeLog
WebCore/dom/XMLTokenizer.cpp
WebCore/html/HTMLDocument.cpp
WebCore/html/HTMLFormElement.cpp
WebCore/loader/TextResourceDecoder.cpp
WebCore/platform/CString.cpp
WebCore/platform/CString.h
WebCore/platform/KURL.cpp
WebCore/platform/StringImpl.cpp
WebCore/platform/network/cf/FormDataStreamCFNet.cpp
WebCore/platform/network/mac/FormDataStreamMac.mm
WebCore/platform/win/ClipboardUtilitiesWin.cpp
WebCore/plugins/win/PluginStreamWin.cpp
WebCore/plugins/win/PluginViewWin.cpp
WebCore/xml/XSLStyleSheet.cpp
WebCore/xml/XSLTProcessor.cpp