[webkit-changes] [WebKit/WebKit] a4c2e8: Make FormDataConsumer RefCounted
youennf
noreply at github.com
Fri Aug 23 01:10:22 PDT 2024
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: a4c2e8d62285d948d697c7f53e6e7e24b8540114
https://github.com/WebKit/WebKit/commit/a4c2e8d62285d948d697c7f53e6e7e24b8540114
Author: Youenn Fablet <youenn at apple.com>
Date: 2024-08-23 (Fri, 23 Aug 2024)
Changed paths:
M Source/WebCore/Modules/fetch/FetchBodyConsumer.cpp
M Source/WebCore/Modules/fetch/FetchBodyConsumer.h
M Source/WebCore/Modules/fetch/FormDataConsumer.cpp
M Source/WebCore/Modules/fetch/FormDataConsumer.h
Log Message:
-----------
Make FormDataConsumer RefCounted
https://bugs.webkit.org/show_bug.cgi?id=278518
rdar://134491795
Reviewed by Chris Dumez.
To apply the hardening of protecting a weak pointer, we make FormDataConsumer RefCounted.
We can then protect it in FormDataConsumer::consumeFile and FormDataConsumer::consumeBlob.
We update FetchBodyConsumer to store a RefPtr<FormDataConsumer>.
We can no longer pass a reference to FetchBodyConsumer in FormDataConsumer callback since FormDataConsumer can outlive FetchBodyConsumer.
So we remove the reference and we store m_type in the first FormDataConsumer callback.
For the second callback, the FetchBodyConsumer reference was used to cancel the FormDataConsumer if we were not able to enqueue data in the ReadableStream.
We are now updating the callback to return true (to continue the load) or false (to stop the load).
We update FetchBodyConsumer and FormDataConsumer accordingly.
Covered by existing tests.
* Source/WebCore/Modules/fetch/FetchBodyConsumer.cpp:
(WebCore::FetchBodyConsumer::resolveWithFormData):
(WebCore::FetchBodyConsumer::consumeFormDataAsStream):
* Source/WebCore/Modules/fetch/FetchBodyConsumer.h:
* Source/WebCore/Modules/fetch/FormDataConsumer.cpp:
(WebCore::FormDataConsumer::create):
(WebCore::FormDataConsumer::FormDataConsumer):
(WebCore::FormDataConsumer::~FormDataConsumer):
(WebCore::FormDataConsumer::read):
(WebCore::FormDataConsumer::consumeFile):
(WebCore::FormDataConsumer::consumeBlob):
(WebCore::FormDataConsumer::consume):
* Source/WebCore/Modules/fetch/FormDataConsumer.h:
Canonical link: https://commits.webkit.org/282653@main
To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications
More information about the webkit-changes
mailing list