Title: [202909] trunk
Revision
202909
Author
[email protected]
Date
2016-07-07 09:03:18 -0700 (Thu, 07 Jul 2016)

Log Message

[Fetch API] Response.redirect should throw a RangeError in case of bad status code
https://bugs.webkit.org/show_bug.cgi?id=159507

Patch by Youenn Fablet <[email protected]> on 2016-07-07
Reviewed by Alex Christensen.

LayoutTests/imported/w3c:

* web-platform-tests/fetch/api/response/response-static-redirect-expected.txt:

Source/WebCore:

Covered by rebased test.

* Modules/fetch/FetchResponse.cpp:
(WebCore::FetchResponse::redirect): Throw a RangeError in case of bad status.

Modified Paths

Diff

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (202908 => 202909)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2016-07-07 16:00:20 UTC (rev 202908)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2016-07-07 16:03:18 UTC (rev 202909)
@@ -1,3 +1,12 @@
+2016-07-07  Youenn Fablet  <[email protected]>
+
+        [Fetch API] Response.redirect should throw a RangeError in case of bad status code
+        https://bugs.webkit.org/show_bug.cgi?id=159507
+
+        Reviewed by Alex Christensen.
+
+        * web-platform-tests/fetch/api/response/response-static-redirect-expected.txt:
+
 2016-07-06  Chris Dumez  <[email protected]>
 
         Document.title setter does not work for SVG documents

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-static-redirect-expected.txt (202908 => 202909)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-static-redirect-expected.txt	2016-07-07 16:00:20 UTC (rev 202908)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-static-redirect-expected.txt	2016-07-07 16:03:18 UTC (rev 202909)
@@ -6,8 +6,8 @@
 PASS Check response returned by static method redirect(), status = 307 
 PASS Check response returned by static method redirect(), status = 308 
 PASS Check error returned when giving invalid url to redirect() 
-FAIL Check error returned when giving invalid status to redirect(), status = 200 assert_throws: Expect RangeError exception function "function () { Response.redirect(url, invalidStatus); }" threw object "TypeError: Type error" ("TypeError") expected object "RangeError" ("RangeError")
-FAIL Check error returned when giving invalid status to redirect(), status = 309 assert_throws: Expect RangeError exception function "function () { Response.redirect(url, invalidStatus); }" threw object "TypeError: Type error" ("TypeError") expected object "RangeError" ("RangeError")
-FAIL Check error returned when giving invalid status to redirect(), status = 400 assert_throws: Expect RangeError exception function "function () { Response.redirect(url, invalidStatus); }" threw object "TypeError: Type error" ("TypeError") expected object "RangeError" ("RangeError")
-FAIL Check error returned when giving invalid status to redirect(), status = 500 assert_throws: Expect RangeError exception function "function () { Response.redirect(url, invalidStatus); }" threw object "TypeError: Type error" ("TypeError") expected object "RangeError" ("RangeError")
+PASS Check error returned when giving invalid status to redirect(), status = 200 
+PASS Check error returned when giving invalid status to redirect(), status = 309 
+PASS Check error returned when giving invalid status to redirect(), status = 400 
+PASS Check error returned when giving invalid status to redirect(), status = 500 
 

Modified: trunk/Source/WebCore/ChangeLog (202908 => 202909)


--- trunk/Source/WebCore/ChangeLog	2016-07-07 16:00:20 UTC (rev 202908)
+++ trunk/Source/WebCore/ChangeLog	2016-07-07 16:03:18 UTC (rev 202909)
@@ -1,3 +1,15 @@
+2016-07-07  Youenn Fablet  <[email protected]>
+
+        [Fetch API] Response.redirect should throw a RangeError in case of bad status code
+        https://bugs.webkit.org/show_bug.cgi?id=159507
+
+        Reviewed by Alex Christensen.
+
+        Covered by rebased test.
+
+        * Modules/fetch/FetchResponse.cpp:
+        (WebCore::FetchResponse::redirect): Throw a RangeError in case of bad status.
+
 2016-07-05  Jer Noble  <[email protected]>
 
         Ownership between WebPlaybackSessionInterfaceMac and WebPlaybackControlsManager is backwards.

Modified: trunk/Source/WebCore/Modules/fetch/FetchResponse.cpp (202908 => 202909)


--- trunk/Source/WebCore/Modules/fetch/FetchResponse.cpp	2016-07-07 16:00:20 UTC (rev 202908)
+++ trunk/Source/WebCore/Modules/fetch/FetchResponse.cpp	2016-07-07 16:03:18 UTC (rev 202909)
@@ -65,7 +65,7 @@
         return nullptr;
     }
     if (!isRedirectStatus(status)) {
-        ec = TypeError;
+        ec = RangeError;
         return nullptr;
     }
     auto redirectResponse = adoptRef(*new FetchResponse(context, { }, FetchHeaders::create(FetchHeaders::Guard::Immutable), { }));
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to