Changeset 274640 in webkit
- Timestamp:
- Mar 18, 2021, 4:12:35 AM (5 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 2 edited
-
ChangeLog (modified) (1 diff)
-
platform/network/soup/WebKitFormDataInputStream.cpp (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r274639 r274640 1 2021-03-18 Carlos Garcia Campos <cgarcia@igalia.com> 2 3 [SOUP] SOUP3 crashes inside soup_message_set_request_body 4 https://bugs.webkit.org/show_bug.cgi?id=223236 5 6 Reviewed by Adrian Perez de Castro. 7 8 Make WebKitFormDataInputStream implement GPollableInputStream. 9 10 * platform/network/soup/WebKitFormDataInputStream.cpp: 11 (webkitFormDataInputStreamNew): 12 (webkitFormDataInputStreamCanPoll): 13 (webkitFormDataInputStreamIsReadable): 14 (webkitFormDataInputStreamCreateSource): 15 (webkitFormDataInputStreamPollableInterfaceInit): 16 1 17 2021-03-18 Lauro Moura <lmoura@igalia.com> 2 18 -
trunk/Source/WebCore/platform/network/soup/WebKitFormDataInputStream.cpp
r272410 r274640 38 38 unsigned nextIndex; 39 39 long long currentStreamRangeLength; 40 bool canPoll; 40 41 }; 41 42 42 WEBKIT_DEFINE_TYPE(WebKitFormDataInputStream, webkit_form_data_input_stream, G_TYPE_INPUT_STREAM) 43 static void webkitFormDataInputStreamPollableInterfaceInit(GPollableInputStreamInterface*); 44 45 WEBKIT_DEFINE_TYPE_WITH_CODE(WebKitFormDataInputStream, webkit_form_data_input_stream, G_TYPE_INPUT_STREAM, 46 G_IMPLEMENT_INTERFACE(G_TYPE_POLLABLE_INPUT_STREAM, webkitFormDataInputStreamPollableInterfaceInit)) 43 47 44 48 static bool webkitFormDataInputStreamCreateNextStream(WebKitFormDataInputStream* stream, GCancellable* cancellable) … … 131 135 stream->priv->currentStreamRangeLength = BlobDataItem::toEndOfFile; 132 136 137 // GFileInputStream is not pollable, so the stream is only pollable if FormData doesn't contain EncodedFileData elements. 138 stream->priv->canPoll = true; 139 for (const auto& element : stream->priv->formData->elements()) { 140 if (WTF::holds_alternative<FormDataElement::EncodedFileData>(element.data)) { 141 stream->priv->canPoll = false; 142 break; 143 } 144 } 145 133 146 return adoptGRef(G_INPUT_STREAM((stream))); 134 147 } … … 146 159 return g_memory_output_stream_steal_as_bytes(G_MEMORY_OUTPUT_STREAM(outputStream.get())); 147 160 } 161 162 static gboolean webkitFormDataInputStreamCanPoll(GPollableInputStream* stream) 163 { 164 auto* priv = WEBKIT_FORM_DATA_INPUT_STREAM(stream)->priv; 165 return priv->canPoll; 166 } 167 168 static gboolean webkitFormDataInputStreamIsReadable(GPollableInputStream* stream) 169 { 170 auto* priv = WEBKIT_FORM_DATA_INPUT_STREAM(stream)->priv; 171 return priv->currentStream || priv->nextIndex < priv->formData->elements().size(); 172 } 173 174 static GSource* webkitFormDataInputStreamCreateSource(GPollableInputStream* stream, GCancellable* cancellable) 175 { 176 GRefPtr<GSource> base = adoptGRef(g_timeout_source_new(0)); 177 return g_pollable_source_new_full(stream, base.get(), cancellable); 178 } 179 180 static void webkitFormDataInputStreamPollableInterfaceInit(GPollableInputStreamInterface* iface) 181 { 182 iface->can_poll = webkitFormDataInputStreamCanPoll; 183 iface->is_readable = webkitFormDataInputStreamIsReadable; 184 iface->create_source = webkitFormDataInputStreamCreateSource; 185 }
Note:
See TracChangeset
for help on using the changeset viewer.