Title: [173552] trunk
Revision
173552
Author
[email protected]
Date
2014-09-11 19:27:06 -0700 (Thu, 11 Sep 2014)

Log Message

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

Patch by Shivakumar JM <[email protected]> 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:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (173551 => 173552)


--- trunk/LayoutTests/ChangeLog	2014-09-12 01:50:24 UTC (rev 173551)
+++ trunk/LayoutTests/ChangeLog	2014-09-12 02:27:06 UTC (rev 173552)
@@ -1,3 +1,15 @@
+2014-09-11  Shivakumar JM  <[email protected]>
+
+        The overrideMimeType in XMLHttpRequest should throw the exception.
+        https://bugs.webkit.org/show_bug.cgi?id=136699
+
+        Reviewed by Darin Adler.
+
+        Added test to check for "InvalidStateError" exception for overrideMimeType.
+
+        * http/tests/xmlhttprequest/exceptions-expected.txt:
+        * http/tests/xmlhttprequest/exceptions.html:
+
 2014-09-11  Chris Fleizach  <[email protected]>
 
         AX: Size of web view in Safari as reported by AX changes when adding/removing bars is wrong

Modified: trunk/LayoutTests/http/tests/xmlhttprequest/exceptions-expected.txt (173551 => 173552)


--- trunk/LayoutTests/http/tests/xmlhttprequest/exceptions-expected.txt	2014-09-12 01:50:24 UTC (rev 173551)
+++ trunk/LayoutTests/http/tests/xmlhttprequest/exceptions-expected.txt	2014-09-12 02:27:06 UTC (rev 173552)
@@ -8,6 +8,7 @@
 PASS: req.setRequestHeader("Foo") threw exception TypeError: Not enough arguments.
 send()
 PASS: req.send(null) threw exception Error: InvalidStateError: DOM Exception 11.
+PASS: req.overrideMimeType("text/plain") threw exception Error: InvalidStateError: DOM Exception 11.
 PASS: req.setRequestHeader("Foo", "bar") threw exception Error: InvalidStateError: DOM Exception 11.
 PASS: req.getResponseHeader() threw exception TypeError: Not enough arguments.
 PASS: req.open() threw exception TypeError: Not enough arguments.

Modified: trunk/LayoutTests/http/tests/xmlhttprequest/exceptions.html (173551 => 173552)


--- trunk/LayoutTests/http/tests/xmlhttprequest/exceptions.html	2014-09-12 01:50:24 UTC (rev 173551)
+++ trunk/LayoutTests/http/tests/xmlhttprequest/exceptions.html	2014-09-12 02:27:06 UTC (rev 173552)
@@ -69,6 +69,7 @@
     log("send()");
 
     shouldThrow('req.send(null)');
+    shouldThrow('req.overrideMimeType("text/plain")');
     shouldThrow('req.setRequestHeader("Foo", "bar")');
     shouldThrow('req.getResponseHeader()');
 

Modified: trunk/Source/WebCore/ChangeLog (173551 => 173552)


--- trunk/Source/WebCore/ChangeLog	2014-09-12 01:50:24 UTC (rev 173551)
+++ trunk/Source/WebCore/ChangeLog	2014-09-12 02:27:06 UTC (rev 173552)
@@ -1,3 +1,19 @@
+2014-09-11  Shivakumar JM  <[email protected]>
+
+        The overrideMimeType in XMLHttpRequest should throw the exception.
+        https://bugs.webkit.org/show_bug.cgi?id=136699
+
+        Reviewed by Darin Adler.
+
+        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:
+
 2014-09-11  Joseph Pecoraro  <[email protected]>
 
         Web Inspector: Occasional ASSERT closing web inspector

Modified: trunk/Source/WebCore/xml/XMLHttpRequest.cpp (173551 => 173552)


--- trunk/Source/WebCore/xml/XMLHttpRequest.cpp	2014-09-12 01:50:24 UTC (rev 173551)
+++ trunk/Source/WebCore/xml/XMLHttpRequest.cpp	2014-09-12 02:27:06 UTC (rev 173552)
@@ -906,8 +906,13 @@
     unsetPendingActivity(this);
 }
 
-void XMLHttpRequest::overrideMimeType(const String& override)
+void XMLHttpRequest::overrideMimeType(const String& override, ExceptionCode& ec)
 {
+    if (m_state == LOADING || m_state == DONE) {
+        ec = INVALID_STATE_ERR;
+        return;
+    }
+
     m_mimeTypeOverride = override;
 }
 

Modified: trunk/Source/WebCore/xml/XMLHttpRequest.h (173551 => 173552)


--- trunk/Source/WebCore/xml/XMLHttpRequest.h	2014-09-12 01:50:24 UTC (rev 173551)
+++ trunk/Source/WebCore/xml/XMLHttpRequest.h	2014-09-12 02:27:06 UTC (rev 173552)
@@ -102,7 +102,7 @@
     void send(JSC::ArrayBufferView*, ExceptionCode&);
     void abort();
     void setRequestHeader(const String& name, const String& value, ExceptionCode&);
-    void overrideMimeType(const String& override);
+    void overrideMimeType(const String& override, ExceptionCode&);
     bool doneWithoutErrors() const { return !m_error && m_state == DONE; }
     String getAllResponseHeaders() const;
     String getResponseHeader(const String& name) const;

Modified: trunk/Source/WebCore/xml/XMLHttpRequest.idl (173551 => 173552)


--- trunk/Source/WebCore/xml/XMLHttpRequest.idl	2014-09-12 01:50:24 UTC (rev 173551)
+++ trunk/Source/WebCore/xml/XMLHttpRequest.idl	2014-09-12 02:27:06 UTC (rev 173552)
@@ -91,7 +91,7 @@
     readonly attribute DOMString statusText;
 
     // Extension
-    void overrideMimeType(DOMString override);
+    [RaisesException] void overrideMimeType(DOMString override);
 
     // EventTarget interface
     void addEventListener(DOMString type, 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to