Bug 791367 - nsDOMFileReader::ReadFileContent opens a channel without associating it with a load group; r=smaug,khuey
authorEhsan Akhgari <ehsan@mozilla.com>
Mon, 17 Sep 2012 11:24:39 -0400
changeset 107485 4b9ae51cb797644f0e56d766d833fa58c631041d
parent 107484 68d1a96a3b7ae7271c36736e851a56f99d64922d
child 107486 9d0128d60f9a48a88c45f6cb06e0035a55994e01
push id82
push usershu@rfrn.org
push dateFri, 05 Oct 2012 13:20:22 +0000
reviewerssmaug, khuey
bugs791367
milestone18.0a1
Bug 791367 - nsDOMFileReader::ReadFileContent opens a channel without associating it with a load group; r=smaug,khuey
content/base/src/nsDOMFileReader.cpp
--- a/content/base/src/nsDOMFileReader.cpp
+++ b/content/base/src/nsDOMFileReader.cpp
@@ -405,17 +405,27 @@ nsDOMFileReader::ReadFileContent(JSConte
     // After the channel is created it will own whatever is backing
     // the DOMFile.
     nsDOMFileInternalUrlHolder urlHolder(mFile, mPrincipal);
 
     nsCOMPtr<nsIURI> uri;
     rv = NS_NewURI(getter_AddRefs(uri), urlHolder.mUrl);
     NS_ENSURE_SUCCESS(rv, rv);
 
-    rv = NS_NewChannel(getter_AddRefs(mChannel), uri);
+    nsCOMPtr<nsILoadGroup> loadGroup;
+    if (HasOrHasHadOwner()) {
+      NS_ENSURE_STATE(GetOwner());
+      nsIDocument* doc = GetOwner()->GetExtantDoc();
+      if (doc) {
+        loadGroup = doc->GetDocumentLoadGroup();
+      }
+    }
+
+    rv = NS_NewChannel(getter_AddRefs(mChannel), uri, nullptr, loadGroup,
+                       nullptr, nsIRequest::LOAD_BACKGROUND);
     NS_ENSURE_SUCCESS(rv, rv);
   }
 
   //Obtain the total size of the file before reading
   mTotal = mozilla::dom::kUnknownSize;
   mFile->GetSize(&mTotal);
 
   rv = mChannel->AsyncOpen(this, nullptr);