Title: [161051] trunk
Revision
161051
Author
[email protected]
Date
2013-12-24 00:05:56 -0800 (Tue, 24 Dec 2013)

Log Message

XMLHttpRequest: status and statusText throw DOM Exception 11 when the state is UNSENT or OPENED.
https://bugs.webkit.org/show_bug.cgi?id=45994

Reviewed by Alexey Proskuryakov.

Source/WebCore:

Merged https://chromium.googlesource.com/chromium/blink/+/23c90460de16e04c5aba7ed942fba76cb79fdb9b.

Latest XHR spec says that XHR should return 0 and an empty string when it's in UNSENT or OPENED state
or error flag is set: http://www.w3.org/TR/2012/WD-XMLHttpRequest-20121206/#the-status-attribute

* xml/XMLHttpRequest.cpp:
(WebCore::XMLHttpRequest::status):
(WebCore::XMLHttpRequest::statusText):
* xml/XMLHttpRequest.h:
* xml/XMLHttpRequest.idl:

LayoutTests:

Rebaselined and fixed tests as done in https://chromium.googlesource.com/chromium/blink/+/23c90460de16e04c5aba7ed942fba76cb79fdb9b.

* http/tests/xmlhttprequest/exceptions-expected.txt:
* http/tests/xmlhttprequest/exceptions.html:
* http/tests/xmlhttprequest/status-after-abort-expected.txt:
* http/tests/xmlhttprequest/zero-length-response-expected.txt:

* js/dom/dfg-custom-getter-throw-expected.txt:
* js/dom/script-tests/dfg-custom-getter-throw-inlined.js: Fixed the test.
(foo): Use responseText instead of status so that it throws when responseType is "arraybuffer".
(bar): Set responseType to "arraybuffer" to cause an exception to be thrown.
* js/dom/script-tests/dfg-custom-getter-throw.js: Ditto.
(foo):
(bar):

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (161050 => 161051)


--- trunk/LayoutTests/ChangeLog	2013-12-24 07:44:52 UTC (rev 161050)
+++ trunk/LayoutTests/ChangeLog	2013-12-24 08:05:56 UTC (rev 161051)
@@ -1,3 +1,25 @@
+2013-12-23  Ryosuke Niwa  <[email protected]>
+
+        XMLHttpRequest: status and statusText throw DOM Exception 11 when the state is UNSENT or OPENED.
+        https://bugs.webkit.org/show_bug.cgi?id=45994
+
+        Reviewed by Alexey Proskuryakov.
+
+        Rebaselined and fixed tests as done in https://chromium.googlesource.com/chromium/blink/+/23c90460de16e04c5aba7ed942fba76cb79fdb9b.
+
+        * http/tests/xmlhttprequest/exceptions-expected.txt:
+        * http/tests/xmlhttprequest/exceptions.html:
+        * http/tests/xmlhttprequest/status-after-abort-expected.txt:
+        * http/tests/xmlhttprequest/zero-length-response-expected.txt:
+
+        * js/dom/dfg-custom-getter-throw-expected.txt:
+        * js/dom/script-tests/dfg-custom-getter-throw-inlined.js: Fixed the test.
+        (foo): Use responseText instead of status so that it throws when responseType is "arraybuffer".
+        (bar): Set responseType to "arraybuffer" to cause an exception to be thrown.
+        * js/dom/script-tests/dfg-custom-getter-throw.js: Ditto.
+        (foo):
+        (bar):
+
 2013-12-23  Mihnea Ovidenie  <[email protected]>
 
         [CSSRegions] Fix fast/regions/assert-flow-thread-compositing.html test description

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


--- trunk/LayoutTests/http/tests/xmlhttprequest/exceptions-expected.txt	2013-12-24 07:44:52 UTC (rev 161050)
+++ trunk/LayoutTests/http/tests/xmlhttprequest/exceptions-expected.txt	2013-12-24 08:05:56 UTC (rev 161051)
@@ -6,8 +6,6 @@
 open()
 PASS: req.setRequestHeader() threw exception TypeError: Not enough arguments.
 PASS: req.setRequestHeader("Foo") threw exception TypeError: Not enough arguments.
-PASS: req.status() threw exception Error: InvalidStateError: DOM Exception 11.
-PASS: req.statusText() threw exception Error: InvalidStateError: DOM Exception 11.
 send()
 PASS: req.send(null) threw exception Error: InvalidStateError: DOM Exception 11.
 PASS: req.setRequestHeader("Foo", "bar") threw exception Error: InvalidStateError: DOM Exception 11.

Modified: trunk/LayoutTests/http/tests/xmlhttprequest/exceptions.html (161050 => 161051)


--- trunk/LayoutTests/http/tests/xmlhttprequest/exceptions.html	2013-12-24 07:44:52 UTC (rev 161050)
+++ trunk/LayoutTests/http/tests/xmlhttprequest/exceptions.html	2013-12-24 08:05:56 UTC (rev 161051)
@@ -64,8 +64,6 @@
     
     shouldThrow('req.setRequestHeader()');
     shouldThrow('req.setRequestHeader("Foo")');
-    shouldThrow('req.status()');
-    shouldThrow('req.statusText()');
     
     req.send(null);
     log("send()");

Modified: trunk/LayoutTests/http/tests/xmlhttprequest/status-after-abort-expected.txt (161050 => 161051)


--- trunk/LayoutTests/http/tests/xmlhttprequest/status-after-abort-expected.txt	2013-12-24 07:44:52 UTC (rev 161050)
+++ trunk/LayoutTests/http/tests/xmlhttprequest/status-after-abort-expected.txt	2013-12-24 08:05:56 UTC (rev 161051)
@@ -2,15 +2,15 @@
 
 A newly created request. Response status: 0; statusText: ''; readyState: 0
 Opening...
-Onreadystatechange. Response status: [exception]; statusText: '[exception]'; readyState: 1
-Opened request. Response status: [exception]; statusText: '[exception]'; readyState: 1
-Sent request. Response status: [exception]; statusText: '[exception]'; readyState: 1
+Onreadystatechange. Response status: 0; statusText: ''; readyState: 1
+Opened request. Response status: 0; statusText: ''; readyState: 1
+Sent request. Response status: 0; statusText: ''; readyState: 1
 Onreadystatechange. Response status: 200; statusText: 'OK'; readyState: 2
 Onreadystatechange. Response status: 200; statusText: 'OK'; readyState: 3
 Onreadystatechange. Response status: 200; statusText: 'OK'; readyState: 4
 Aborting the request...
-After aborting the request. Response status: 200; statusText: 'OK'; readyState: 0
+After aborting the request. Response status: 0; statusText: ''; readyState: 0
 Reopening the request to check that the status is reset...
-Onreadystatechange. Response status: [exception]; statusText: '[exception]'; readyState: 1
+Onreadystatechange. Response status: 0; statusText: ''; readyState: 1
 Done.
 

Modified: trunk/LayoutTests/http/tests/xmlhttprequest/zero-length-response-expected.txt (161050 => 161051)


--- trunk/LayoutTests/http/tests/xmlhttprequest/zero-length-response-expected.txt	2013-12-24 07:44:52 UTC (rev 161050)
+++ trunk/LayoutTests/http/tests/xmlhttprequest/zero-length-response-expected.txt	2013-12-24 08:05:56 UTC (rev 161051)
@@ -8,14 +8,14 @@
   ResponseXML serialized: n/a
 after setting onreadystatechange: Uninitialized
 onreadystatechange: Open
-  Exception getting status: InvalidStateError: DOM Exception 11
-  Exception getting StatusText: InvalidStateError: DOM Exception 11
+  Status: 0
+  StatusText: ""
   ResponseText: ""
   ResponseXML: null
   ResponseXML serialized: n/a
 after open(): Open
-  Exception getting status: InvalidStateError: DOM Exception 11
-  Exception getting StatusText: InvalidStateError: DOM Exception 11
+  Status: 0
+  StatusText: ""
   ResponseText: ""
   ResponseXML: null
   ResponseXML serialized: n/a

Modified: trunk/LayoutTests/js/dom/dfg-custom-getter-throw-expected.txt (161050 => 161051)


--- trunk/LayoutTests/js/dom/dfg-custom-getter-throw-expected.txt	2013-12-24 07:44:52 UTC (rev 161050)
+++ trunk/LayoutTests/js/dom/dfg-custom-getter-throw-expected.txt	2013-12-24 08:05:56 UTC (rev 161051)
@@ -3,106 +3,106 @@
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 
-PASS bar(i >= 100) is "Returned result: 0"
-PASS bar(i >= 100) is "Returned result: 0"
-PASS bar(i >= 100) is "Returned result: 0"
-PASS bar(i >= 100) is "Returned result: 0"
-PASS bar(i >= 100) is "Returned result: 0"
-PASS bar(i >= 100) is "Returned result: 0"
-PASS bar(i >= 100) is "Returned result: 0"
-PASS bar(i >= 100) is "Returned result: 0"
-PASS bar(i >= 100) is "Returned result: 0"
-PASS bar(i >= 100) is "Returned result: 0"
-PASS bar(i >= 100) is "Returned result: 0"
-PASS bar(i >= 100) is "Returned result: 0"
-PASS bar(i >= 100) is "Returned result: 0"
-PASS bar(i >= 100) is "Returned result: 0"
-PASS bar(i >= 100) is "Returned result: 0"
-PASS bar(i >= 100) is "Returned result: 0"
-PASS bar(i >= 100) is "Returned result: 0"
-PASS bar(i >= 100) is "Returned result: 0"
-PASS bar(i >= 100) is "Returned result: 0"
-PASS bar(i >= 100) is "Returned result: 0"
-PASS bar(i >= 100) is "Returned result: 0"
-PASS bar(i >= 100) is "Returned result: 0"
-PASS bar(i >= 100) is "Returned result: 0"
-PASS bar(i >= 100) is "Returned result: 0"
-PASS bar(i >= 100) is "Returned result: 0"
-PASS bar(i >= 100) is "Returned result: 0"
-PASS bar(i >= 100) is "Returned result: 0"
-PASS bar(i >= 100) is "Returned result: 0"
-PASS bar(i >= 100) is "Returned result: 0"
-PASS bar(i >= 100) is "Returned result: 0"
-PASS bar(i >= 100) is "Returned result: 0"
-PASS bar(i >= 100) is "Returned result: 0"
-PASS bar(i >= 100) is "Returned result: 0"
-PASS bar(i >= 100) is "Returned result: 0"
-PASS bar(i >= 100) is "Returned result: 0"
-PASS bar(i >= 100) is "Returned result: 0"
-PASS bar(i >= 100) is "Returned result: 0"
-PASS bar(i >= 100) is "Returned result: 0"
-PASS bar(i >= 100) is "Returned result: 0"
-PASS bar(i >= 100) is "Returned result: 0"
-PASS bar(i >= 100) is "Returned result: 0"
-PASS bar(i >= 100) is "Returned result: 0"
-PASS bar(i >= 100) is "Returned result: 0"
-PASS bar(i >= 100) is "Returned result: 0"
-PASS bar(i >= 100) is "Returned result: 0"
-PASS bar(i >= 100) is "Returned result: 0"
-PASS bar(i >= 100) is "Returned result: 0"
-PASS bar(i >= 100) is "Returned result: 0"
-PASS bar(i >= 100) is "Returned result: 0"
-PASS bar(i >= 100) is "Returned result: 0"
-PASS bar(i >= 100) is "Returned result: 0"
-PASS bar(i >= 100) is "Returned result: 0"
-PASS bar(i >= 100) is "Returned result: 0"
-PASS bar(i >= 100) is "Returned result: 0"
-PASS bar(i >= 100) is "Returned result: 0"
-PASS bar(i >= 100) is "Returned result: 0"
-PASS bar(i >= 100) is "Returned result: 0"
-PASS bar(i >= 100) is "Returned result: 0"
-PASS bar(i >= 100) is "Returned result: 0"
-PASS bar(i >= 100) is "Returned result: 0"
-PASS bar(i >= 100) is "Returned result: 0"
-PASS bar(i >= 100) is "Returned result: 0"
-PASS bar(i >= 100) is "Returned result: 0"
-PASS bar(i >= 100) is "Returned result: 0"
-PASS bar(i >= 100) is "Returned result: 0"
-PASS bar(i >= 100) is "Returned result: 0"
-PASS bar(i >= 100) is "Returned result: 0"
-PASS bar(i >= 100) is "Returned result: 0"
-PASS bar(i >= 100) is "Returned result: 0"
-PASS bar(i >= 100) is "Returned result: 0"
-PASS bar(i >= 100) is "Returned result: 0"
-PASS bar(i >= 100) is "Returned result: 0"
-PASS bar(i >= 100) is "Returned result: 0"
-PASS bar(i >= 100) is "Returned result: 0"
-PASS bar(i >= 100) is "Returned result: 0"
-PASS bar(i >= 100) is "Returned result: 0"
-PASS bar(i >= 100) is "Returned result: 0"
-PASS bar(i >= 100) is "Returned result: 0"
-PASS bar(i >= 100) is "Returned result: 0"
-PASS bar(i >= 100) is "Returned result: 0"
-PASS bar(i >= 100) is "Returned result: 0"
-PASS bar(i >= 100) is "Returned result: 0"
-PASS bar(i >= 100) is "Returned result: 0"
-PASS bar(i >= 100) is "Returned result: 0"
-PASS bar(i >= 100) is "Returned result: 0"
-PASS bar(i >= 100) is "Returned result: 0"
-PASS bar(i >= 100) is "Returned result: 0"
-PASS bar(i >= 100) is "Returned result: 0"
-PASS bar(i >= 100) is "Returned result: 0"
-PASS bar(i >= 100) is "Returned result: 0"
-PASS bar(i >= 100) is "Returned result: 0"
-PASS bar(i >= 100) is "Returned result: 0"
-PASS bar(i >= 100) is "Returned result: 0"
-PASS bar(i >= 100) is "Returned result: 0"
-PASS bar(i >= 100) is "Returned result: 0"
-PASS bar(i >= 100) is "Returned result: 0"
-PASS bar(i >= 100) is "Returned result: 0"
-PASS bar(i >= 100) is "Returned result: 0"
-PASS bar(i >= 100) is "Returned result: 0"
-PASS bar(i >= 100) is "Returned result: 0"
+PASS bar(i >= 100) is "Returned result: "
+PASS bar(i >= 100) is "Returned result: "
+PASS bar(i >= 100) is "Returned result: "
+PASS bar(i >= 100) is "Returned result: "
+PASS bar(i >= 100) is "Returned result: "
+PASS bar(i >= 100) is "Returned result: "
+PASS bar(i >= 100) is "Returned result: "
+PASS bar(i >= 100) is "Returned result: "
+PASS bar(i >= 100) is "Returned result: "
+PASS bar(i >= 100) is "Returned result: "
+PASS bar(i >= 100) is "Returned result: "
+PASS bar(i >= 100) is "Returned result: "
+PASS bar(i >= 100) is "Returned result: "
+PASS bar(i >= 100) is "Returned result: "
+PASS bar(i >= 100) is "Returned result: "
+PASS bar(i >= 100) is "Returned result: "
+PASS bar(i >= 100) is "Returned result: "
+PASS bar(i >= 100) is "Returned result: "
+PASS bar(i >= 100) is "Returned result: "
+PASS bar(i >= 100) is "Returned result: "
+PASS bar(i >= 100) is "Returned result: "
+PASS bar(i >= 100) is "Returned result: "
+PASS bar(i >= 100) is "Returned result: "
+PASS bar(i >= 100) is "Returned result: "
+PASS bar(i >= 100) is "Returned result: "
+PASS bar(i >= 100) is "Returned result: "
+PASS bar(i >= 100) is "Returned result: "
+PASS bar(i >= 100) is "Returned result: "
+PASS bar(i >= 100) is "Returned result: "
+PASS bar(i >= 100) is "Returned result: "
+PASS bar(i >= 100) is "Returned result: "
+PASS bar(i >= 100) is "Returned result: "
+PASS bar(i >= 100) is "Returned result: "
+PASS bar(i >= 100) is "Returned result: "
+PASS bar(i >= 100) is "Returned result: "
+PASS bar(i >= 100) is "Returned result: "
+PASS bar(i >= 100) is "Returned result: "
+PASS bar(i >= 100) is "Returned result: "
+PASS bar(i >= 100) is "Returned result: "
+PASS bar(i >= 100) is "Returned result: "
+PASS bar(i >= 100) is "Returned result: "
+PASS bar(i >= 100) is "Returned result: "
+PASS bar(i >= 100) is "Returned result: "
+PASS bar(i >= 100) is "Returned result: "
+PASS bar(i >= 100) is "Returned result: "
+PASS bar(i >= 100) is "Returned result: "
+PASS bar(i >= 100) is "Returned result: "
+PASS bar(i >= 100) is "Returned result: "
+PASS bar(i >= 100) is "Returned result: "
+PASS bar(i >= 100) is "Returned result: "
+PASS bar(i >= 100) is "Returned result: "
+PASS bar(i >= 100) is "Returned result: "
+PASS bar(i >= 100) is "Returned result: "
+PASS bar(i >= 100) is "Returned result: "
+PASS bar(i >= 100) is "Returned result: "
+PASS bar(i >= 100) is "Returned result: "
+PASS bar(i >= 100) is "Returned result: "
+PASS bar(i >= 100) is "Returned result: "
+PASS bar(i >= 100) is "Returned result: "
+PASS bar(i >= 100) is "Returned result: "
+PASS bar(i >= 100) is "Returned result: "
+PASS bar(i >= 100) is "Returned result: "
+PASS bar(i >= 100) is "Returned result: "
+PASS bar(i >= 100) is "Returned result: "
+PASS bar(i >= 100) is "Returned result: "
+PASS bar(i >= 100) is "Returned result: "
+PASS bar(i >= 100) is "Returned result: "
+PASS bar(i >= 100) is "Returned result: "
+PASS bar(i >= 100) is "Returned result: "
+PASS bar(i >= 100) is "Returned result: "
+PASS bar(i >= 100) is "Returned result: "
+PASS bar(i >= 100) is "Returned result: "
+PASS bar(i >= 100) is "Returned result: "
+PASS bar(i >= 100) is "Returned result: "
+PASS bar(i >= 100) is "Returned result: "
+PASS bar(i >= 100) is "Returned result: "
+PASS bar(i >= 100) is "Returned result: "
+PASS bar(i >= 100) is "Returned result: "
+PASS bar(i >= 100) is "Returned result: "
+PASS bar(i >= 100) is "Returned result: "
+PASS bar(i >= 100) is "Returned result: "
+PASS bar(i >= 100) is "Returned result: "
+PASS bar(i >= 100) is "Returned result: "
+PASS bar(i >= 100) is "Returned result: "
+PASS bar(i >= 100) is "Returned result: "
+PASS bar(i >= 100) is "Returned result: "
+PASS bar(i >= 100) is "Returned result: "
+PASS bar(i >= 100) is "Returned result: "
+PASS bar(i >= 100) is "Returned result: "
+PASS bar(i >= 100) is "Returned result: "
+PASS bar(i >= 100) is "Returned result: "
+PASS bar(i >= 100) is "Returned result: "
+PASS bar(i >= 100) is "Returned result: "
+PASS bar(i >= 100) is "Returned result: "
+PASS bar(i >= 100) is "Returned result: "
+PASS bar(i >= 100) is "Returned result: "
+PASS bar(i >= 100) is "Returned result: "
+PASS bar(i >= 100) is "Returned result: "
+PASS bar(i >= 100) is "Returned result: "
+PASS bar(i >= 100) is "Returned result: "
 PASS bar(i >= 100) is "Threw exception: Error: InvalidStateError: DOM Exception 11"
 PASS bar(i >= 100) is "Threw exception: Error: InvalidStateError: DOM Exception 11"
 PASS bar(i >= 100) is "Threw exception: Error: InvalidStateError: DOM Exception 11"

Modified: trunk/LayoutTests/js/dom/script-tests/dfg-custom-getter-throw-inlined.js (161050 => 161051)


--- trunk/LayoutTests/js/dom/script-tests/dfg-custom-getter-throw-inlined.js	2013-12-24 07:44:52 UTC (rev 161050)
+++ trunk/LayoutTests/js/dom/script-tests/dfg-custom-getter-throw-inlined.js	2013-12-24 08:05:56 UTC (rev 161051)
@@ -3,17 +3,18 @@
 );
 
 function foo(x) {
-    return x.status;
+    return x.responseText;
 }
 
 function baz(x) {
     return foo(x);
 }
 
-function bar(doOpen) {
+function bar(binary) {
     var x = new XMLHttpRequest();
-    if (doOpen)
-        x.open("GET", "http://foo.bar.com/");
+    x.open("GET", "http://foo.bar.com/");
+    if (binary)
+        x.responseType = "arraybuffer";
     try {
         return "Returned result: " + baz(x);
     } catch (e) {
@@ -25,7 +26,7 @@
 silentTestPass = true;
 
 for (var i = 0; i < 200; i = dfgIncrement({f:baz, i:i + 1, n:50})) {
-    shouldBe("bar(i >= 100)", i >= 100 ? "\"Threw exception: Error: InvalidStateError: DOM Exception 11\"" : "\"Returned result: 0\"");
+    shouldBe("bar(i >= 100)", i >= 100 ? "\"Threw exception: Error: InvalidStateError: DOM Exception 11\"" : "\"Returned result: \"");
 }
 
 

Modified: trunk/LayoutTests/js/dom/script-tests/dfg-custom-getter-throw.js (161050 => 161051)


--- trunk/LayoutTests/js/dom/script-tests/dfg-custom-getter-throw.js	2013-12-24 07:44:52 UTC (rev 161050)
+++ trunk/LayoutTests/js/dom/script-tests/dfg-custom-getter-throw.js	2013-12-24 08:05:56 UTC (rev 161051)
@@ -3,13 +3,14 @@
 );
 
 function foo(x) {
-    return x.status;
+    return x.responseText;
 }
 
-function bar(doOpen) {
+function bar(binary) {
     var x = new XMLHttpRequest();
-    if (doOpen)
-        x.open("GET", "http://foo.bar.com/");
+    x.open("GET", "http://foo.bar.com/");
+    if (binary)
+        x.responseType = "arraybuffer";
     try {
         return "Returned result: " + foo(x);
     } catch (e) {
@@ -18,7 +19,7 @@
 }
 
 for (var i = 0; i < 200; ++i) {
-    shouldBe("bar(i >= 100)", i >= 100 ? "\"Threw exception: Error: InvalidStateError: DOM Exception 11\"" : "\"Returned result: 0\"");
+    shouldBe("bar(i >= 100)", i >= 100 ? "\"Threw exception: Error: InvalidStateError: DOM Exception 11\"" : "\"Returned result: \"");
 }
 
 

Modified: trunk/Source/WebCore/ChangeLog (161050 => 161051)


--- trunk/Source/WebCore/ChangeLog	2013-12-24 07:44:52 UTC (rev 161050)
+++ trunk/Source/WebCore/ChangeLog	2013-12-24 08:05:56 UTC (rev 161051)
@@ -1,5 +1,23 @@
 2013-12-23  Ryosuke Niwa  <[email protected]>
 
+        XMLHttpRequest: status and statusText throw DOM Exception 11 when the state is UNSENT or OPENED.
+        https://bugs.webkit.org/show_bug.cgi?id=45994
+
+        Reviewed by Alexey Proskuryakov.
+
+        Merged https://chromium.googlesource.com/chromium/blink/+/23c90460de16e04c5aba7ed942fba76cb79fdb9b.
+
+        Latest XHR spec says that XHR should return 0 and an empty string when it's in UNSENT or OPENED state
+        or error flag is set: http://www.w3.org/TR/2012/WD-XMLHttpRequest-20121206/#the-status-attribute
+
+        * xml/XMLHttpRequest.cpp:
+        (WebCore::XMLHttpRequest::status):
+        (WebCore::XMLHttpRequest::statusText):
+        * xml/XMLHttpRequest.h:
+        * xml/XMLHttpRequest.idl:
+
+2013-12-23  Ryosuke Niwa  <[email protected]>
+
         Crash in ReplaceSelectionCommand
         https://bugs.webkit.org/show_bug.cgi?id=126107
 

Modified: trunk/Source/WebCore/xml/XMLHttpRequest.cpp (161050 => 161051)


--- trunk/Source/WebCore/xml/XMLHttpRequest.cpp	2013-12-24 07:44:52 UTC (rev 161050)
+++ trunk/Source/WebCore/xml/XMLHttpRequest.cpp	2013-12-24 08:05:56 UTC (rev 161051)
@@ -1089,30 +1089,25 @@
     return DOMImplementation::isXMLMIMEType(responseMIMEType().lower());
 }
 
-int XMLHttpRequest::status(ExceptionCode& ec) const
+int XMLHttpRequest::status() const
 {
+    if (m_state == UNSENT || m_state == OPENED || m_error)
+        return 0;
+
     if (m_response.httpStatusCode())
         return m_response.httpStatusCode();
 
-    if (m_state == OPENED) {
-        // Firefox only raises an exception in this state; we match it.
-        // Note the case of local file requests, where we have no HTTP response code! Firefox never raises an exception for those, but we match HTTP case for consistency.
-        ec = INVALID_STATE_ERR;
-    }
-
     return 0;
 }
 
-String XMLHttpRequest::statusText(ExceptionCode& ec) const
+String XMLHttpRequest::statusText() const
 {
+    if (m_state == UNSENT || m_state == OPENED || m_error)
+        return String();
+
     if (!m_response.httpStatusText().isNull())
         return m_response.httpStatusText();
 
-    if (m_state == OPENED) {
-        // See comments in status() above.
-        ec = INVALID_STATE_ERR;
-    }
-
     return String();
 }
 

Modified: trunk/Source/WebCore/xml/XMLHttpRequest.h (161050 => 161051)


--- trunk/Source/WebCore/xml/XMLHttpRequest.h	2013-12-24 07:44:52 UTC (rev 161050)
+++ trunk/Source/WebCore/xml/XMLHttpRequest.h	2013-12-24 08:05:56 UTC (rev 161051)
@@ -85,8 +85,8 @@
     virtual ScriptExecutionContext* scriptExecutionContext() const OVERRIDE { return ActiveDOMObject::scriptExecutionContext(); }
 
     const URL& url() const { return m_url; }
-    String statusText(ExceptionCode&) const;
-    int status(ExceptionCode&) const;
+    String statusText() const;
+    int status() const;
     State readyState() const;
     bool withCredentials() const { return m_includeCredentials; }
     void setWithCredentials(bool, ExceptionCode&);

Modified: trunk/Source/WebCore/xml/XMLHttpRequest.idl (161050 => 161051)


--- trunk/Source/WebCore/xml/XMLHttpRequest.idl	2013-12-24 07:44:52 UTC (rev 161050)
+++ trunk/Source/WebCore/xml/XMLHttpRequest.idl	2013-12-24 08:05:56 UTC (rev 161051)
@@ -88,8 +88,8 @@
     [SetterRaisesException] attribute XMLHttpRequestResponseType responseType;
     [GetterRaisesException, CachedAttribute, CustomGetter] readonly attribute Object response;
 
-    [GetterRaisesException] readonly attribute unsigned short status;
-    [GetterRaisesException] readonly attribute DOMString statusText;
+    readonly attribute unsigned short status;
+    readonly attribute DOMString statusText;
 
     // Extension
     void overrideMimeType(DOMString override);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to