Bug 539478 GenerateValidFilename() is deprecated: use validateFileName() in SeaMonkey r=Neil a=Callek for CLOSED TREE
authorPhilip Chee <philip.chee@gmail.com>
Sat, 29 May 2010 10:54:47 +0800
changeset 5746 232288e6614ca951cf7636f9af59f20d0e989930
parent 5745 55b715a0f0cb47760ff27f79e4c59053f22963b0
child 5747 1f8b22f0dc0daccf781cb97f4aabedec2e651a11
push idunknown
push userunknown
push dateunknown
reviewersNeil, Callek
bugs539478
Bug 539478 GenerateValidFilename() is deprecated: use validateFileName() in SeaMonkey r=Neil a=Callek for CLOSED TREE
editor/ui/composer/content/ComposerCommands.js
suite/common/utilityOverlay.js
--- a/editor/ui/composer/content/ComposerCommands.js
+++ b/editor/ui/composer/content/ComposerCommands.js
@@ -804,20 +804,20 @@ function GetSuggestedFileName(aDocumentU
 
       // grab the file name
       var url = validateFileName(decodeURIComponent(docURI.fileBaseName));
       if (url)
         return url+extension;
     } catch(e) {}
   } 
 
-  // check if there is a title we can use
-  var title = GetDocumentTitle();
-  // generate a valid filename, if we can't just go with "untitled"
-  return GenerateValidFilename(title, extension) || GetString("untitled") + extension;
+  // check if there is a title we can use to generate a valid filename,
+  // if we can't, just go with "untitled"
+  var title = validateFileName(GetDocumentTitle()) || GetString("untitled");
+  return title + extension;
 }
 
 // returns file picker result
 function PromptForSaveLocation(aDoSaveAsText, aEditorType, aMIMEType, aDocumentURLString)
 {
   var dialogResult = {};
   dialogResult.filepickerClick = nsIFilePicker.returnCancel;
   dialogResult.resultingURI = "";
--- a/suite/common/utilityOverlay.js
+++ b/suite/common/utilityOverlay.js
@@ -810,32 +810,16 @@ function utilityOnUnload(aEvent)
 {
   Services.obs.removeObserver(offlineObserver, "network:offline-status-changed");
   Services.prefs.removeObserver("network.proxy.type", proxyTypeObserver);
 }
 
 addEventListener("load", utilityOnLoad, false);
 
 /**
- * @deprecated   Please use validateFileName from contentAreaUtils.js directly.
- */
-function GenerateValidFilename(filename, extension)
-{
-  if (filename) // we have a title; let's see if it's usable
-  {
-    // clean up the filename to make it usable and
-    // then trim whitespace from beginning and end
-    filename = validateFileName(filename).trim();
-    if (filename.length > 0)
-      return filename + extension;
-  }
-  return null;
-}
-
-/**
  * example use:
  *   suggestUniqueFileName("testname", ".txt", ["testname.txt", "testname(2).txt"])
  *   returns "testname(3).txt"
  * does not check file system for existing files
  *
  * @param aBaseName base name for generating unique filenames.
  *
  * @param aExtension extension name to use for the generated filename.