diff --git a/mozilla/toolkit/content/contentAreaUtils.js b/mozilla/toolkit/content/contentAreaUtils.js index 328bed644a6..d2c2bc3f601 100644 --- a/mozilla/toolkit/content/contentAreaUtils.js +++ b/mozilla/toolkit/content/contentAreaUtils.js @@ -884,14 +884,15 @@ function getNormalizedLeafName(aFile, aDefaultExtension) { if (!aDefaultExtension) return aFile; - + +#ifdef XP_WIN + // Remove trailing dots and spaces on windows + aFile = aFile.replace(/[\s.]+$/, ""); +#endif + // Fix up the file name we're saving to to include the default extension - const stdURLContractID = "@mozilla.org/network/standard-url;1"; - const stdURLIID = Components.interfaces.nsIURL; - var url = Components.classes[stdURLContractID].createInstance(stdURLIID); - url.filePath = aFile; - - if (url.fileExtension != aDefaultExtension) + var i = aFile.lastIndexOf("."); + if (aFile.substr(i + 1) != aDefaultExtension) return aFile + "." + aDefaultExtension; return aFile;