Skip to content

Commit

Permalink
Merge 254410@main - Fix parsing of negative age values in CORS prefet…
Browse files Browse the repository at this point in the history
…ch responses

https://bugs.webkit.org/show_bug.cgi?id=244959

Reviewed by Darin Adler.

This aligns our behavior with Blink and Gecko.

* LayoutTests/imported/w3c/web-platform-tests/cors/preflight-cache-expected.txt:
* Source/WebCore/loader/CrossOriginPreflightResultCache.cpp:
(WebCore::parseAccessControlMaxAge):

Canonical link: https://commits.webkit.org/254410@main

(cherry picked from commit 46bb540)
  • Loading branch information
cdumez authored and aperezdc committed Sep 13, 2022
1 parent 575970d commit cad61bb
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Expand Up @@ -5,6 +5,6 @@ PASS Test preflight
PASS preflight for x-print should be cached
PASS age = blank, should be cached
PASS age = 0, should not be cached
FAIL age = -1, should not be cached assert_equals: did preflight expected "1" but got "0"
PASS age = -1, should not be cached
PASS preflight first request, second from cache, wait, third should preflight again

2 changes: 1 addition & 1 deletion Source/WebCore/loader/CrossOriginPreflightResultCache.cpp
Expand Up @@ -48,7 +48,7 @@ CrossOriginPreflightResultCache::CrossOriginPreflightResultCache()
static bool parseAccessControlMaxAge(const String& string, Seconds& expiryDelta)
{
// FIXME: This should probably reject strings that have a leading "+".
auto parsedInteger = parseInteger<uint64_t>(string);
auto parsedInteger = parseInteger<int64_t>(string);
expiryDelta = Seconds(static_cast<double>(parsedInteger.value_or(0)));
return parsedInteger.has_value();
}
Expand Down

0 comments on commit cad61bb

Please sign in to comment.