Sfoglia il codice sorgente

LibWeb: Explicitly clear read requests for default stream reader

Expecting the list to be cleared from the move() is quite strange and
not particularly clear. Explicitly clear the requests instead.
Shannon Booth 1 anno fa
parent
commit
e08072ac2b

+ 3 - 1
Userland/Libraries/LibWeb/Streams/AbstractOperations.cpp

@@ -425,9 +425,11 @@ WebIDL::ExceptionOr<void> readable_stream_reader_generic_release(ReadableStreamG
 void readable_stream_default_reader_error_read_requests(ReadableStreamDefaultReader& reader, JS::Value error)
 {
     // 1. Let readRequests be reader.[[readRequests]].
-    // 2. Set reader.[[readRequests]] to a new empty list.
     auto read_requests = move(reader.read_requests());
 
+    // 2. Set reader.[[readRequests]] to a new empty list.
+    reader.read_requests().clear();
+
     // 3. For each readRequest of readRequests,
     for (auto& read_request : read_requests) {
         // 1. Perform readRequest’s error steps, given e.