Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: eb7b1d25196e82c5d9f5410c8dd444c3b5d1a929
https://github.com/WebKit/WebKit/commit/eb7b1d25196e82c5d9f5410c8dd444c3b5d1a929
Author: Ahmad Saleem <[email protected]>
Date: 2026-07-29 (Wed, 29 Jul 2026)
Changed paths:
A
LayoutTests/imported/w3c/web-platform-tests/xhr/getallresponseheaders-after-reuse-expected.txt
A
LayoutTests/imported/w3c/web-platform-tests/xhr/getallresponseheaders-after-reuse.html
M Source/WebCore/xml/XMLHttpRequest.cpp
Log Message:
-----------
XMLHttpRequest.getAllResponseHeaders() returns the previous response's
headers when the object is reused
https://bugs.webkit.org/show_bug.cgi?id=320586
rdar://183561750
Reviewed by Alexey Proskuryakov.
getAllResponseHeaders() lazily builds the sorted, serialized header block
and caches it in m_allResponseHeaders, but nothing ever invalidated that
cache. Reusing an XMLHttpRequest object -- calling open() and send() a
second time -- kept returning the first response's header block for the
rest of the object's lifetime, since the cache is only ever written and
never cleared.
Clear it in clearResponseBuffers(), next to m_responseCacheIsValid, so it
is dropped both when open() resets the response state via clearResponse()
and when the load is aborted.
Firefox and Chrome both return the new response's headers here.
The test reuses one XMLHttpRequest object across two .asis resources, whose
responses are byte-exact, so the second getAllResponseHeaders() result can be
compared with assert_equals().
*
LayoutTests/imported/w3c/web-platform-tests/xhr/getallresponseheaders-after-reuse-expected.txt:
Added.
*
LayoutTests/imported/w3c/web-platform-tests/xhr/getallresponseheaders-after-reuse.html:
Added.
* Source/WebCore/xml/XMLHttpRequest.cpp:
(WebCore::XMLHttpRequest::clearResponseBuffers):
Canonical link: https://commits.webkit.org/318217@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications