Bug 539478 GenerateValidFilename() is deprecated: use validateFileName() in SeaMonkey r=Neil a=Callek for CLOSED TREE
--- 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.