Skip to content
  • ap's avatar
    Reviewed by Eric. · 37b0558e
    ap authored
            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: http://svn.webkit.org/repository/webkit/trunk@16543 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    37b0558e