From 2c8cc3e0cd9eaa1822fbcf6065788225b0c6d41f Mon Sep 17 00:00:00 2001 From: "timeless%mozdev.org" Date: Fri, 2 Sep 2005 04:48:28 +0000 Subject: [PATCH] Bug 305679 please look before leaping for mimeInfo.primaryExtension also enforcing catch...{/} r=neil sr=neil git-svn-id: svn://10.0.0.236/trunk@179531 18797224-902f-48f8-a5cc-f745e15eee43 --- .../resources/content/contentAreaUtils.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/mozilla/xpfe/communicator/resources/content/contentAreaUtils.js b/mozilla/xpfe/communicator/resources/content/contentAreaUtils.js index 306e8a3e5a7..bf4fe34be2e 100644 --- a/mozilla/xpfe/communicator/resources/content/contentAreaUtils.js +++ b/mozilla/xpfe/communicator/resources/content/contentAreaUtils.js @@ -500,7 +500,8 @@ function poseFilePicker(aFpP) // Try and pull in download directory pref try { dir = branch.getComplexValue(kDownloadDirPref, nsILocalFile); - } catch (e) { } + } catch (e) { + } var autoDownload = branch.getBoolPref("autoDownload"); if (autoDownload && dir && dir.exists()) { @@ -519,7 +520,8 @@ function poseFilePicker(aFpP) try { if (dir.exists()) fp.displayDirectory = dir; - } catch (e) { } + } catch (e) { + } fp.defaultExtension = aFpP.fileInfo.fileExt; fp.defaultString = getNormalizedLeafName(aFpP.fileInfo.fileName, @@ -888,13 +890,14 @@ function getDefaultExtension(aFilename, aURI, aContentType) } else { try { - return mimeInfo.primaryExtension; + if (mimeInfo) + return mimeInfo.primaryExtension; } catch (e) { - // Fall back on the extensions in the filename and URI for lack - // of anything better. - return ext || urlext; } + // Fall back on the extensions in the filename and URI for lack + // of anything better. + return ext || urlext; } }