Make the sync loader handle streams that close on EOF (e.g. data: URLs). Bug379957, r=biesi, sr=peterv
authorbzbarsky@mit.edu
Mon, 07 May 2007 15:11:53 -0700
changeset 1262 1fb6c663ab926ee924086a70bb1e1112df995c2c
parent 1261 3a39d383b779339f083714588ef607ad9d8001b9
child 1263 a9a8bbdd59ea7674f03f8cc67a005520cc55c115
push idunknown
push userunknown
push dateunknown
reviewersbiesi, peterv
bugs379957
milestone1.9a5pre
Make the sync loader handle streams that close on EOF (e.g. data: URLs). Bug379957, r=biesi, sr=peterv
content/base/src/nsSyncLoadService.cpp
--- a/content/base/src/nsSyncLoadService.cpp
+++ b/content/base/src/nsSyncLoadService.cpp
@@ -476,16 +476,20 @@ nsSyncLoadService::PushSyncStreamToListe
 
     // Load
     aListener->OnStartRequest(aChannel, nsnull);
     PRUint32 sourceOffset = 0;
     while (1) {
         PRUint32 readCount = 0;
         rv = aIn->Available(&readCount);
         if (NS_FAILED(rv) || !readCount) {
+            if (rv == NS_BASE_STREAM_CLOSED) {
+                // End of file, but not an error
+                rv = NS_OK;
+            }
             break;
         }
 
         rv = aListener->OnDataAvailable(aChannel, nsnull, aIn, sourceOffset,
                                         readCount);
         if (NS_FAILED(rv)) {
             break;
         }