Bug 1503438 - replace some findSubFolder() uses by getChildNamed() in NNTP and tests. r=jorgk
authoraceman <acelists@atlas.sk>
Tue, 30 Oct 2018 17:43:00 +0100
changeset 33633 8b4648e6ba485708e26ac3e7a23bb3b62220be13
parent 33632 89c98293e4af398d5e642aaedec9f6f08e2e8a9c
child 33634 d5940f87ebd34bdd50c664682e06fcfda2f10bb1
push id388
push userclokep@gmail.com
push dateMon, 28 Jan 2019 20:54:56 +0000
reviewersjorgk
bugs1503438
Bug 1503438 - replace some findSubFolder() uses by getChildNamed() in NNTP and tests. r=jorgk
mail/test/mozmill/folder-display/test-deletion-from-virtual-folders.js
mail/test/mozmill/folder-display/test-mail-views.js
mail/test/mozmill/search-window/test-search-window.js
mailnews/news/src/nsNntpIncomingServer.cpp
--- a/mail/test/mozmill/folder-display/test-deletion-from-virtual-folders.js
+++ b/mail/test/mozmill/folder-display/test-deletion-from-virtual-folders.js
@@ -129,17 +129,17 @@ function _open_first_message() {
   // Open the window with the message
   switch_tab(tabFolder);
   msgc = open_selected_message_in_new_window();
   assert_selected_and_displayed(msgc, curMessage);
 }
 
 
 function test_open_first_message_in_virtual_folder() {
-  folder = baseFolder.findSubFolder(baseFolder.prettyName + "-Important");
+  folder = baseFolder.getChildNamed(baseFolder.prettyName + "-Important");
   if (!folder)
     throw new Error("DeletionFromVirtualFoldersA-Important was not created!");
 
   _open_first_message();
 }
 
 /**
  * Perform a deletion from the folder tab, verify the others update correctly
--- a/mail/test/mozmill/folder-display/test-mail-views.js
+++ b/mail/test/mozmill/folder-display/test-mail-views.js
@@ -66,16 +66,16 @@ function subtest_save_mail_view(savc) {
   savc.assertValue(savc.aid("searchVal0", {crazyDeck: 0}), "$label1");
 
   // - save it
   savc.window.onOK();
 }
 
 function test_verify_saved_mail_view() {
   // - make sure the folder got created
-  savedFolder = baseFolder.findSubFolder(baseFolder.prettyName + "-Important");
+  savedFolder = baseFolder.getChildNamed(baseFolder.prettyName + "-Important");
   if (!savedFolder)
     throw new Error("MailViewA-Important was not created!");
 
   // - go in the folder and make sure the right messages are displayed
   be_in_folder(savedFolder);
   assert_messages_in_view(setTagged, mc);
 }
--- a/mail/test/mozmill/search-window/test-search-window.js
+++ b/mail/test/mozmill/search-window/test-search-window.js
@@ -256,15 +256,15 @@ function test_close_search_window() {
   swc = null;
 }
 
 /**
  * Make sure the folder showed up with the right name, and that displaying it
  *  has the right contents.
  */
 function test_verify_saved_search() {
-  let savedFolder = folder.findSubFolder("SearchSaved");
+  let savedFolder = folder.getChildNamed("SearchSaved");
   if (savedFolder == null)
     throw new Error("Saved folder did not show up.");
 
   be_in_folder(savedFolder);
   assert_messages_in_view(setFooBar);
 }
--- a/mailnews/news/src/nsNntpIncomingServer.cpp
+++ b/mailnews/news/src/nsNntpIncomingServer.cpp
@@ -1161,32 +1161,24 @@ nsNntpIncomingServer::Unsubscribe(const 
   NS_ENSURE_ARG_POINTER(aUnicharName);
 
   nsresult rv;
 
   nsCOMPtr <nsIMsgFolder> serverFolder;
   rv = GetRootMsgFolder(getter_AddRefs(serverFolder));
   if (NS_FAILED(rv))
     return rv;
-
   if (!serverFolder)
     return NS_ERROR_FAILURE;
 
-  // to handle non-ASCII newsgroup names, we store them internally as escaped.
-  // so we need to escape and encode the name, in order to find it.
-  nsAutoCString escapedName;
-  rv = NS_MsgEscapeEncodeURLPath(nsDependentString(aUnicharName), escapedName);
-
-  nsCOMPtr <nsIMsgFolder> newsgroupFolder;
-  rv = serverFolder->FindSubFolder(escapedName,
+  nsCOMPtr<nsIMsgFolder> newsgroupFolder;
+  rv = serverFolder->GetChildNamed(nsDependentString(aUnicharName),
                                    getter_AddRefs(newsgroupFolder));
-
   if (NS_FAILED(rv))
     return rv;
-
   if (!newsgroupFolder)
     return NS_ERROR_FAILURE;
 
   rv = serverFolder->PropagateDelete(newsgroupFolder, true /* delete storage */, nullptr);
   if (NS_FAILED(rv))
     return rv;
 
   // since we've unsubscribed to a newsgroup, the newsrc needs to be written out