Reviewed by Geoff.
authorap <ap@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 8 Dec 2006 18:25:13 +0000 (18:25 +0000)
committerap <ap@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 8 Dec 2006 18:25:13 +0000 (18:25 +0000)
        http://bugs.webkit.org/show_bug.cgi?id=6275
        XMLHttpRequest.getResponseHeader should return a null string for non-existent headers

WebCore:
        * bindings/js/JSXMLHttpRequest.cpp:
        (KJS::JSXMLHttpRequestProtoFunc::callAsFunction):
        Convert null getResponseHeader strings to JS null, rather than undefined.

LayoutTests:
        * http/tests/xmlhttprequest/methods-async-expected.txt:
        * http/tests/xmlhttprequest/methods-expected.txt:
        * http/tests/xmlhttprequest/methods-lower-case-expected.txt:
        Updated the results.

        * http/tests/xmlhttprequest/web-apps/008-expected.txt:
        * http/tests/xmlhttprequest/web-apps/008-test.asis:
        * http/tests/xmlhttprequest/web-apps/008.html:
        Changed to test both missing and empty headers, also test case insensitivity
        of header names.
        Please note that neither Firefox nor IE passes this test now - the former returns
        null in both cases, and the latter returns empty strings.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@18078 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/http/tests/xmlhttprequest/methods-async-expected.txt
LayoutTests/http/tests/xmlhttprequest/methods-expected.txt
LayoutTests/http/tests/xmlhttprequest/methods-lower-case-expected.txt
LayoutTests/http/tests/xmlhttprequest/web-apps/008-expected.txt
LayoutTests/http/tests/xmlhttprequest/web-apps/008-test.asis
LayoutTests/http/tests/xmlhttprequest/web-apps/008.html
WebCore/ChangeLog
WebCore/bindings/js/JSXMLHttpRequest.cpp

index 58a77499e33d9aede9cfbeca0fd3f6df4b7471be..4be505cbbec705132588e4f803d0f42e81556d25 100644 (file)
@@ -1,3 +1,23 @@
+2006-12-08  Alexey Proskuryakov  <ap@webkit.org>
+
+        Reviewed by Geoff.
+
+        http://bugs.webkit.org/show_bug.cgi?id=6275
+        XMLHttpRequest.getResponseHeader should return a null string for non-existent headers
+
+        * http/tests/xmlhttprequest/methods-async-expected.txt:
+        * http/tests/xmlhttprequest/methods-expected.txt:
+        * http/tests/xmlhttprequest/methods-lower-case-expected.txt:
+        Updated the results.
+
+        * http/tests/xmlhttprequest/web-apps/008-expected.txt:
+        * http/tests/xmlhttprequest/web-apps/008-test.asis:
+        * http/tests/xmlhttprequest/web-apps/008.html:
+        Changed to test both missing and empty headers, also test case insensitivity
+        of header names.
+        Please note that neither Firefox nor IE passes this test now - the former returns
+        null in both cases, and the latter returns empty strings.
+
 2006-12-08  Alexey Proskuryakov  <ap@webkit.org>
 
         Reviewed by Darin.
index 55b37c987a8ef900ab3a2f747feee328410381f3..2f1ae08dccaf22620911052e26095a18f8b5752d 100644 (file)
@@ -1,24 +1,24 @@
 Tests for bug 3812 - GET and POST should not be the only HTTP methods implemented in XMLHttpRequest.
 
-GET(""): GET(undefined bytes), Content-Type: undefined
-GET(null): GET(undefined bytes), Content-Type: undefined
-GET("123"): GET(undefined bytes), Content-Type: undefined
+GET(""): GET(null bytes), Content-Type: null
+GET(null): GET(null bytes), Content-Type: null
+GET("123"): GET(null bytes), Content-Type: null
 POST(""): POST(0 bytes), Content-Type: application/xml
-POST(null): POST(0 bytes), Content-Type: undefined
+POST(null): POST(0 bytes), Content-Type: null
 POST("123"): POST(3 bytes), Content-Type: application/xml
 PUT(""): PUT(0 bytes), Content-Type: application/xml
-PUT(null): PUT(0 bytes), Content-Type: undefined
+PUT(null): PUT(0 bytes), Content-Type: null
 PUT("123"): PUT(3 bytes), Content-Type: application/xml
 DELETE(""): DELETE(0 bytes), Content-Type: application/xml
-DELETE(null): DELETE(0 bytes), Content-Type: undefined
+DELETE(null): DELETE(0 bytes), Content-Type: null
 DELETE("123"): DELETE(3 bytes), Content-Type: application/xml
-HEAD(""): HEAD(0 bytes), Content-Type: undefined
-HEAD(null): HEAD(0 bytes), Content-Type: undefined
-HEAD("123"): HEAD(0 bytes), Content-Type: undefined
+HEAD(""): HEAD(0 bytes), Content-Type: null
+HEAD(null): HEAD(0 bytes), Content-Type: null
+HEAD("123"): HEAD(0 bytes), Content-Type: null
 WKFOOBAR(""): WKFOOBAR(0 bytes), Content-Type: application/xml
-WKFOOBAR(null): WKFOOBAR(0 bytes), Content-Type: undefined
+WKFOOBAR(null): WKFOOBAR(0 bytes), Content-Type: null
 WKFOOBAR("123"): WKFOOBAR(3 bytes), Content-Type: application/xml
 SEARCH(""): SEARCH(0 bytes), Content-Type: application/xml
-SEARCH(null): SEARCH(0 bytes), Content-Type: undefined
+SEARCH(null): SEARCH(0 bytes), Content-Type: null
 SEARCH("123"): SEARCH(3 bytes), Content-Type: application/xml
 
index 55b37c987a8ef900ab3a2f747feee328410381f3..2f1ae08dccaf22620911052e26095a18f8b5752d 100644 (file)
@@ -1,24 +1,24 @@
 Tests for bug 3812 - GET and POST should not be the only HTTP methods implemented in XMLHttpRequest.
 
-GET(""): GET(undefined bytes), Content-Type: undefined
-GET(null): GET(undefined bytes), Content-Type: undefined
-GET("123"): GET(undefined bytes), Content-Type: undefined
+GET(""): GET(null bytes), Content-Type: null
+GET(null): GET(null bytes), Content-Type: null
+GET("123"): GET(null bytes), Content-Type: null
 POST(""): POST(0 bytes), Content-Type: application/xml
-POST(null): POST(0 bytes), Content-Type: undefined
+POST(null): POST(0 bytes), Content-Type: null
 POST("123"): POST(3 bytes), Content-Type: application/xml
 PUT(""): PUT(0 bytes), Content-Type: application/xml
-PUT(null): PUT(0 bytes), Content-Type: undefined
+PUT(null): PUT(0 bytes), Content-Type: null
 PUT("123"): PUT(3 bytes), Content-Type: application/xml
 DELETE(""): DELETE(0 bytes), Content-Type: application/xml
-DELETE(null): DELETE(0 bytes), Content-Type: undefined
+DELETE(null): DELETE(0 bytes), Content-Type: null
 DELETE("123"): DELETE(3 bytes), Content-Type: application/xml
-HEAD(""): HEAD(0 bytes), Content-Type: undefined
-HEAD(null): HEAD(0 bytes), Content-Type: undefined
-HEAD("123"): HEAD(0 bytes), Content-Type: undefined
+HEAD(""): HEAD(0 bytes), Content-Type: null
+HEAD(null): HEAD(0 bytes), Content-Type: null
+HEAD("123"): HEAD(0 bytes), Content-Type: null
 WKFOOBAR(""): WKFOOBAR(0 bytes), Content-Type: application/xml
-WKFOOBAR(null): WKFOOBAR(0 bytes), Content-Type: undefined
+WKFOOBAR(null): WKFOOBAR(0 bytes), Content-Type: null
 WKFOOBAR("123"): WKFOOBAR(3 bytes), Content-Type: application/xml
 SEARCH(""): SEARCH(0 bytes), Content-Type: application/xml
-SEARCH(null): SEARCH(0 bytes), Content-Type: undefined
+SEARCH(null): SEARCH(0 bytes), Content-Type: null
 SEARCH("123"): SEARCH(3 bytes), Content-Type: application/xml
 
index 99e5f5ac54e7c1835c6e25b6842ded0e31d115f4..6b7fd54d85ceab7f2275b5ae35f9ea43d426c8d0 100644 (file)
@@ -1,9 +1,9 @@
 Tests for bug 8099 - XMLHttpRequest lowercase post requests broken.
 
-get(""): GET(undefined bytes), Content-Type: undefined
+get(""): GET(null bytes), Content-Type: null
 post(""): POST(0 bytes), Content-Type: application/xml
 DoIt(""): DoIt(0 bytes), Content-Type: application/xml
-get(""): GET(undefined bytes), Content-Type: undefined
+get(""): GET(null bytes), Content-Type: null
 post(""): POST(0 bytes), Content-Type: application/xml
 DoIt(""): DoIt(0 bytes), Content-Type: application/xml
 
index 896fa4268b3bfb9ec358e58db80dafc3df5bfb64..9976b1209210cc652f254b83ce47536314f7bbf9 100644 (file)
@@ -1,3 +1,3 @@
-FAIL ("test1", "a, b", "undefined")
+PASS
 
 
index 946c81b4a1a9ed725e325dd872ee0bcaab6961df..eb9b1ce56a4559a3bd28d87ba4fc0ebf16e42619 100644 (file)
@@ -1,5 +1,6 @@
 Test1: test1
 test2: a
-test2: b
+Test2: b
+test3:
 
 BODY
\ No newline at end of file
index d29d82dd09c4164484ebd83cd2e347ded17b21f5..1e43639cf638283195d2ce1a3a840bf5eeb0b6e0 100644 (file)
    var r = new XMLHttpRequest();
    r.open('GET', '008-test.asis', false);
    r.send(null);
+
+// Test modified for WebKit, because the specification for missing headers has changed.
+// http://bugs.webkit.org/show_bug.cgi?id=6275
    var s1 = r.getResponseHeader('test1');
    var s2 = r.getResponseHeader('test2');
    var s3 = r.getResponseHeader('test3');
-   p.firstChild.data = (s1 == 'test1' && s2 == 'a, b' && s3 == '') ? 'PASS' : 'FAIL ("' + s1 + '", "' + s2 + '", "' + s3 + '")';
+   var s4 = r.getResponseHeader('test4');
+   p.firstChild.data = (s1 == 'test1' && s2 == 'a, b' && s3 == '' && s4 == null) ? 'PASS' : 'FAIL ("' + s1 + '", "' + s2 + '", "' + s3 + '", "' + s4 + '")';
   </script>
  </body>
 </html>
index 5b62c3605a13650c618c269dc6b357b5e190037a..bd10bfd8e881dca89e05f9bfd5a39b0758fbbfb1 100644 (file)
@@ -1,3 +1,14 @@
+2006-12-08  Alexey Proskuryakov  <ap@webkit.org>
+
+        Reviewed by Geoff.
+
+        http://bugs.webkit.org/show_bug.cgi?id=6275
+        XMLHttpRequest.getResponseHeader should return a null string for non-existent headers
+
+        * bindings/js/JSXMLHttpRequest.cpp:
+        (KJS::JSXMLHttpRequestProtoFunc::callAsFunction):
+        Convert null getResponseHeader strings to JS null, rather than undefined.
+
 2006-12-08  Alexey Proskuryakov  <ap@webkit.org>
 
         Reviewed by Darin.
index 245e4235957f659ab6ebb34eeddbc6d25e6d318b..8ac8f9562133f0a2ff05302cb570bf242b0a379f 100644 (file)
@@ -191,7 +191,7 @@ JSValue* JSXMLHttpRequestProtoFunc::callAsFunction(ExecState* exec, JSObject* th
             if (args.size() < 1)
                 return throwError(exec, SyntaxError, "Not enough arguments");
 
-            return jsStringOrUndefined(request->m_impl->getResponseHeader(args[0]->toString(exec)));
+            return jsStringOrNull(request->m_impl->getResponseHeader(args[0]->toString(exec)));
 
         case JSXMLHttpRequest::Open: {
             if (args.size() < 2)