Reviewed by Eric.
authorap <ap@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 23 Sep 2006 18:44:00 +0000 (18:44 +0000)
committerap <ap@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 23 Sep 2006 18:44:00 +0000 (18:44 +0000)
commit9f86e69d48f45b03eae122599fe7f51b48390c07
treec1a8f5d3d323d15232ff6d4257693203dbb9e074
parenta6d84846f8c6c48ce39f0daa22567bec71d640cd
    Reviewed by Eric.

        http://bugzilla.opendarwin.org/show_bug.cgi?id=4872
        XMLHttpRequest fails to throw an exception when there is a security violation
        (mismatching domains)

        Raise an exception if there is a security violation, and also in cases required by
        the current draft of XHR specification.

WebCore:
        * bindings/js/JSXMLHttpRequest.cpp:
        (KJS::JSXMLHttpRequest::getValueProperty): Raise an exception if a DOM method reports one.
        (KJS::JSXMLHttpRequestProtoFunc::callAsFunction): Raise an exception if a DOM method
        reports one, and also if there were too few arguments passed.

        * bindings/js/kjs_binding.cpp:
        (KJS::setDOMException): Added support for custom XHR exceptions.

        * xml/xmlhttprequest.h: Changed state names to match the current spec. Defined an
        exception code range for XHR exceptions.

        * xml/xmlhttprequest.cpp:
        (WebCore::XMLHttpRequest::open): Removed a check for m_aborted that could never succeed.
        (WebCore::XMLHttpRequest::send):
        (WebCore::XMLHttpRequest::setRequestHeader):
        (WebCore::XMLHttpRequest::getStatus):
        (WebCore::XMLHttpRequest::getStatusText):
        (WebCore::XMLHttpRequest::processSyncLoadResults):
        (WebCore::XMLHttpRequest::receivedAllData):
        (WebCore::XMLHttpRequest::receivedData):

LayoutTests:
        * http/tests/xmlhttprequest/exceptions-expected.txt: Added.
        * http/tests/xmlhttprequest/exceptions.html: Added.

        * http/tests/xmlhttprequest/extra-parameters-expected.txt: Added.
        * http/tests/xmlhttprequest/extra-parameters.html: Added.
        * http/tests/xmlhttprequest/resources/post-echo.cgi: Added.
        Test that passing too many parameters is OK (Firefox behavior; WinIE raises an exception).

        * fast/dom/xmlhttprequest-get-expected.txt: Updated results.

        * http/tests/xmlhttprequest/zero-length-response-expected.txt:
        * http/tests/xmlhttprequest/zero-length-response-sync-expected.txt:
        * http/tests/xmlhttprequest/zero-length-response-sync.html:
        * http/tests/xmlhttprequest/zero-length-response.html:
        Updated results and changed state names to match the current spec.

        * http/tests/xmlhttprequest/resources/zero-length.xml: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@16543 268f45cc-cd09-0410-ab3c-d52691b4dbfc
17 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/dom/xmlhttprequest-get-expected.txt
LayoutTests/http/tests/xmlhttprequest/exceptions-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/xmlhttprequest/exceptions.html [new file with mode: 0644]
LayoutTests/http/tests/xmlhttprequest/extra-parameters-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/xmlhttprequest/extra-parameters.html [new file with mode: 0644]
LayoutTests/http/tests/xmlhttprequest/resources/post-echo.cgi [new file with mode: 0755]
LayoutTests/http/tests/xmlhttprequest/resources/zero-length.xml [new file with mode: 0644]
LayoutTests/http/tests/xmlhttprequest/zero-length-response-expected.txt
LayoutTests/http/tests/xmlhttprequest/zero-length-response-sync-expected.txt
LayoutTests/http/tests/xmlhttprequest/zero-length-response-sync.html
LayoutTests/http/tests/xmlhttprequest/zero-length-response.html
WebCore/ChangeLog
WebCore/bindings/js/JSXMLHttpRequest.cpp
WebCore/bindings/js/kjs_binding.cpp
WebCore/xml/xmlhttprequest.cpp
WebCore/xml/xmlhttprequest.h