        NS_ENSURE_SUCCESS(rv, rv);
 +      nsCOMPtr<nsIURI> fileObjURI;
 +      rv = ioService->NewFileURI(fileObj, getter_AddRefs(fileObjURI));
+ 
+-      rv = imageStream->Close();
+-      NS_ENSURE_SUCCESS(rv, rv);
 +      fileObj->GetPath(path);
 +
 +      nsCOMPtr<nsIDocument> doc = GetDocument();

   }
 
   // Show the new window.
@@ -2213,7 +2233,13 @@ nsCocoaWindow::SetDrawsTitle(bool aDrawTitle)
 {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
 

   void DoContentInserted(nsIDocument* aDocument, nsIContent* aContainer,
                          nsIContent* aChild, int32_t aIndexInContainer,
diff --git a/editor/libeditor/HTMLEditorDataTransfer.cpp b/editor/libeditor/HTMLEditorDataTransfer.cpp
index 1664cde6ecdf..ace2ec6964b6 100644
--- a/editor/libeditor/HTMLEditorDataTransfer.cpp
+++ b/editor/libeditor/HTMLEditorDataTransfer.cpp
@@ -81,6 +81,8 @@
