Bug 1832149 Comment 9 Edit History

Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.

I had some success in getting the "Download message..." to display in status bar when a new message is downloaded from imap server. However, I don't know exactly why this fixes it or what has changed since about v110 (last version that showed correct status bar) that now requires this:
```
diff --git a/mailnews/imap/src/nsImapService.cpp b/mailnews/imap/src/nsImapService.cpp
--- a/mailnews/imap/src/nsImapService.cpp
+++ b/mailnews/imap/src/nsImapService.cpp
@@ -2352,32 +2353,54 @@ NS_IMETHODIMP nsImapService::NewChannel(
     if (msgDocShell) {
       nsCOMPtr<nsIProgressEventSink> prevEventSink;
       channel->GetProgressEventSink(getter_AddRefs(prevEventSink));
       nsCOMPtr<nsIInterfaceRequestor> docIR(do_QueryInterface(msgDocShell));
       channel->SetNotificationCallbacks(docIR);
       // we want to use our existing event sink.
       if (prevEventSink) channel->SetProgressEventSink(prevEventSink);
     }
   }
+  else {
+    printf("gds: no window on url\n");
+    nsCOMPtr<nsIMsgMailSession> mailSession = do_GetService(
+        "@mozilla.org/messenger/services/session;1", &rv);
+    NS_ENSURE_SUCCESS(rv, rv);
+    nsCOMPtr<nsIMsgWindow> msgWindow;
+    rv = mailSession->GetTopmostMsgWindow(getter_AddRefs(msgWindow));
+    if (NS_SUCCEEDED(rv) && msgWindow) {
+      mailnewsUrl->SetMsgWindow(msgWindow);
+      nsCOMPtr<nsIMsgStatusFeedback> statusFeedback;
+      msgWindow->GetStatusFeedback(getter_AddRefs(statusFeedback));
+      nsCOMPtr<nsIProgressEventSink>eventSink = do_QueryInterface(statusFeedback);
+      channel->SetProgressEventSink(eventSink);
+    }
+  }
+
   // the imap url holds a weak reference so we can pass the channel into the
   // imap protocol when we actually run the url.
   imapUrl->SetMockChannel(channel);
```
This also causes the progress bar graph to  shows when a new message is downloaded from the server. 

But when I open an existing message from storage (offline or disk cache) it should also show in status "Loading message..." along with the bar graph, but that still doesn't appear.  I haven't been able to find a way to show "Loading message..." which should be displayed here:
https://searchfox.org/comm-central/rev/2fe8694a034fc959c6fd761b5b8f22f368d5463f/mailnews/base/src/nsMsgStatusFeedback.cpp#78

I notice also that at v110 and earlier, the header displays first and then the body. But after 110, the body downloads and displays first and then the header (subject etc) so the download process seems slower but not sure that it really is. This is mostly noticeable with large messages (e.g., 100 MB) and not as apparent with small or average sized messages.
I had some success in getting the "Download message..." to display in status bar when a new message is downloaded from imap server. However, I don't know exactly why this fixes it or what has changed since about v110 (last version that showed correct status bar) that now requires this:
```
diff --git a/mailnews/imap/src/nsImapService.cpp b/mailnews/imap/src/nsImapService.cpp
--- a/mailnews/imap/src/nsImapService.cpp
+++ b/mailnews/imap/src/nsImapService.cpp
@@ -2352,32 +2353,54 @@ NS_IMETHODIMP nsImapService::NewChannel(
     if (msgDocShell) {
       nsCOMPtr<nsIProgressEventSink> prevEventSink;
       channel->GetProgressEventSink(getter_AddRefs(prevEventSink));
       nsCOMPtr<nsIInterfaceRequestor> docIR(do_QueryInterface(msgDocShell));
       channel->SetNotificationCallbacks(docIR);
       // we want to use our existing event sink.
       if (prevEventSink) channel->SetProgressEventSink(prevEventSink);
     }
   }
+  else {
+    printf("gds: no window on url\n");
+    nsCOMPtr<nsIMsgMailSession> mailSession = do_GetService(
+        "@mozilla.org/messenger/services/session;1", &rv);
+    NS_ENSURE_SUCCESS(rv, rv);
+    nsCOMPtr<nsIMsgWindow> msgWindow;
+    rv = mailSession->GetTopmostMsgWindow(getter_AddRefs(msgWindow));
+    if (NS_SUCCEEDED(rv) && msgWindow) {
+      mailnewsUrl->SetMsgWindow(msgWindow);
+      nsCOMPtr<nsIMsgStatusFeedback> statusFeedback;
+      msgWindow->GetStatusFeedback(getter_AddRefs(statusFeedback));
+      nsCOMPtr<nsIProgressEventSink>eventSink = do_QueryInterface(statusFeedback);
+      channel->SetProgressEventSink(eventSink);
+    }
+  }
+
   // the imap url holds a weak reference so we can pass the channel into the
   // imap protocol when we actually run the url.
   imapUrl->SetMockChannel(channel);
```
This also causes the progress bar graph to  shows when a new message is downloaded from the server. 

But when I open an existing message from storage (offline or disk cache) it should also show in status "Loading message..." along with the bar graph, but that still doesn't appear.  I haven't been able to find a way to show "Loading message..." which should be displayed here:
https://searchfox.org/comm-central/rev/2fe8694a034fc959c6fd761b5b8f22f368d5463f/mailnews/base/src/nsMsgStatusFeedback.cpp#78

I notice also that at v110 and earlier, the header displays first and then the body. But after 110, the body downloads and displays first and then the header (subject etc) so the download and message load processes seems slower but not sure that they really are. This is mostly noticeable with large messages (e.g., 100 MB) and not as apparent with small or average sized messages.

Back to Bug 1832149 Comment 9