⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 173552 in webkit


Ignore:
Timestamp:
Sep 11, 2014, 7:27:06 PM (12 years ago)
Author:
commit-queue@webkit.org
Message:

The overrideMimeType in XMLHttpRequest should throw the exception.
​https://bugs.webkit.org/show_bug.cgi?id=136699

Patch by Shivakumar JM <​shiva.jm@samsung.com> on 2014-09-11
Reviewed by Darin Adler.

Source/WebCore:

No new tests, modifed test http/tests/xmlhttprequest/exceptions.html.

Set XMLHttpRequest::overrideMimeType to throw an "InvalidStateError" exception, if the state is LOADING or DONE.

  • xml/XMLHttpRequest.cpp:

(WebCore::XMLHttpRequest::overrideMimeType):

  • xml/XMLHttpRequest.h:
  • xml/XMLHttpRequest.idl:

LayoutTests:

Added test to check for "InvalidStateError" exception for overrideMimeType.

  • http/tests/xmlhttprequest/exceptions-expected.txt:
  • http/tests/xmlhttprequest/exceptions.html:
Location:
trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r173548 r173552  
     12014-09-11  Shivakumar JM  <shiva.jm@samsung.com>
     2
     3        The overrideMimeType in XMLHttpRequest should throw the exception.
     4        https://bugs.webkit.org/show_bug.cgi?id=136699
     5
     6        Reviewed by Darin Adler.
     7
     8        Added test to check for "InvalidStateError" exception for overrideMimeType.
     9
     10        * http/tests/xmlhttprequest/exceptions-expected.txt:
     11        * http/tests/xmlhttprequest/exceptions.html:
     12
    1132014-09-11  Chris Fleizach  <cfleizach@apple.com>
    214
  • trunk/LayoutTests/http/tests/xmlhttprequest/exceptions-expected.txt

    r165229 r173552  
    99send()
    1010PASS: req.send(null) threw exception Error: InvalidStateError: DOM Exception 11.
     11PASS: req.overrideMimeType("text/plain") threw exception Error: InvalidStateError: DOM Exception 11.
    1112PASS: req.setRequestHeader("Foo", "bar") threw exception Error: InvalidStateError: DOM Exception 11.
    1213PASS: req.getResponseHeader() threw exception TypeError: Not enough arguments.
  • trunk/LayoutTests/http/tests/xmlhttprequest/exceptions.html

    r165229 r173552  
    7070
    7171    shouldThrow('req.send(null)');
     72    shouldThrow('req.overrideMimeType("text/plain")');
    7273    shouldThrow('req.setRequestHeader("Foo", "bar")');
    7374    shouldThrow('req.getResponseHeader()');
  • trunk/Source/WebCore/ChangeLog

    r173551 r173552  
     12014-09-11  Shivakumar JM  <shiva.jm@samsung.com>
     2
     3        The overrideMimeType in XMLHttpRequest should throw the exception.
     4        https://bugs.webkit.org/show_bug.cgi?id=136699
     5
     6        Reviewed by Darin Adler.
     7
     8        No new tests, modifed test http/tests/xmlhttprequest/exceptions.html.
     9
     10        Set XMLHttpRequest::overrideMimeType to throw an "InvalidStateError" exception, if the state is LOADING or DONE.
     11
     12        * xml/XMLHttpRequest.cpp:
     13        (WebCore::XMLHttpRequest::overrideMimeType):
     14        * xml/XMLHttpRequest.h:
     15        * xml/XMLHttpRequest.idl:
     16
    1172014-09-11  Joseph Pecoraro  <pecoraro@apple.com>
    218
  • trunk/Source/WebCore/xml/XMLHttpRequest.cpp

    r173507 r173552  
    907907}
    908908
    909 void XMLHttpRequest::overrideMimeType(const String& override)
    910 {
     909void XMLHttpRequest::overrideMimeType(const String& override, ExceptionCode& ec)
     910{
     911    if (m_state == LOADING || m_state == DONE) {
     912        ec = INVALID_STATE_ERR;
     913        return;
     914    }
     915
    911916    m_mimeTypeOverride = override;
    912917}
  • trunk/Source/WebCore/xml/XMLHttpRequest.h

    r171931 r173552  
    103103    void abort();
    104104    void setRequestHeader(const String& name, const String& value, ExceptionCode&);
    105     void overrideMimeType(const String& override);
     105    void overrideMimeType(const String& override, ExceptionCode&);
    106106    bool doneWithoutErrors() const { return !m_error && m_state == DONE; }
    107107    String getAllResponseHeaders() const;
  • trunk/Source/WebCore/xml/XMLHttpRequest.idl

    r171824 r173552  
    9292
    9393    // Extension
    94     void overrideMimeType(DOMString override);
     94    [RaisesException] void overrideMimeType(DOMString override);
    9595
    9696    // EventTarget interface
Note: See TracChangeset for help on using the changeset viewer.