From 8e95c79c7c5f8d7bc0bf76065b4335499255f873 Mon Sep 17 00:00:00 2001 From: "bnesse%netscape.com" Date: Wed, 17 May 2006 02:34:23 +0000 Subject: [PATCH] Bug 98476. Gracefully handle error returned from saving of preferences file. r=sfraser, sr=alecf. --- suite/common/pref/nsPrefWindow.js | 21 ++++++++++++++++++- suite/common/pref/pref.xul | 2 ++ .../common/pref/prefutilities.properties | 2 ++ 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/suite/common/pref/nsPrefWindow.js b/suite/common/pref/nsPrefWindow.js index 8c96146f4791..fec164441b67 100644 --- a/suite/common/pref/nsPrefWindow.js +++ b/suite/common/pref/nsPrefWindow.js @@ -254,7 +254,26 @@ nsPrefWindow.prototype = } } } - this.pref.savePrefFile(null); + try + { + this.pref.savePrefFile(null); + } + catch (e) + { + try + { + var prefUtilBundle = document.getElementById("bundle_prefutilities"); + var alertText = prefUtilBundle.getString("prefSaveFailedAlert"); + var titleText = prefUtilBundle.getString("prefSaveFailedTitle"); + var promptService = Components.classes["@mozilla.org/embedcomp/prompt-service;1"] + .getService(Components.interfaces.nsIPromptService); + promptService.alert(window, titleText, alertText); + } + catch (e) + { + dump(e + "\n"); + } + } }, switchPage: diff --git a/suite/common/pref/pref.xul b/suite/common/pref/pref.xul index 5736b8f02738..7d1c31726af6 100644 --- a/suite/common/pref/pref.xul +++ b/suite/common/pref/pref.xul @@ -60,6 +60,8 @@ +