From 01f869dea1279aba3c8c1af1cbb8c268e32469b6 Mon Sep 17 00:00:00 2001 From: "jbetak%netscape.com" Date: Tue, 29 Feb 2000 21:38:17 +0000 Subject: [PATCH] a=bobj, r=matt, bug 24027, beefed up error handling for charsets without lable/title, changed save filter to accept pref IDs >1 characters --- .../resources/content/pref-charset.js | 57 ++++++++++++------- 1 file changed, 35 insertions(+), 22 deletions(-) diff --git a/xpfe/components/prefwindow/resources/content/pref-charset.js b/xpfe/components/prefwindow/resources/content/pref-charset.js index 9f27bb1c6270..fea6eefc5039 100644 --- a/xpfe/components/prefwindow/resources/content/pref-charset.js +++ b/xpfe/components/prefwindow/resources/content/pref-charset.js @@ -62,7 +62,7 @@ function LoadAvailableCharSets() try { tit = ccm.GetCharsetTitle(atom); } catch (ex) { - //tit = str; //ignore charset detectors without a title + tit = str; //don't ignore charset detectors without a title } try { @@ -70,7 +70,7 @@ function LoadAvailableCharSets() visible = false; } catch (ex) { visible = true; - dump('Getting invisible for:' + str + ' failed!\n'); + //dump('Getting invisible for:' + str + ' failed!\n'); } } //atom @@ -80,6 +80,9 @@ function LoadAvailableCharSets() availCharsetDict[i][0] = tit; availCharsetDict[i][1] = str; availCharsetDict[i][2] = visible; + if (tit) {} + else dump('Not label for :' + str + ', ' + tit+'\n'); + } //str } //for @@ -88,33 +91,41 @@ function LoadAvailableCharSets() if (availCharsetDict) for (i = 0; i < availCharsetDict.length; i++) { - if (availCharsetDict[i][2]) { + try { //let's beef up our error handling for charsets without label / title - // Create a treerow for the new charset - var item = document.createElement('treeitem'); - var row = document.createElement('treerow'); - var cell = document.createElement('treecell'); + if (availCharsetDict[i][2]) { + + // Create a treerow for the new charset + var item = document.createElement('treeitem'); + var row = document.createElement('treerow'); + var cell = document.createElement('treecell'); - tit = availCharsetDict[i][0]; - str = availCharsetDict[i][1]; + tit = availCharsetDict[i][0]; + str = availCharsetDict[i][1]; - // Copy over the attributes - cell.setAttribute('value', tit); - cell.setAttribute('id', str); + // Copy over the attributes + cell.setAttribute('value', tit); + cell.setAttribute('id', str); - // Add it to the active charsets tree - item.appendChild(row); - row.appendChild(cell); - available_charsets_treeroot.appendChild(item); + // Add it to the active charsets tree + item.appendChild(row); + row.appendChild(cell); + available_charsets_treeroot.appendChild(item); - // Select first item - if (i == 0) { - } + // Select first item + if (i == 0) { + } - dump("*** Added Available Charset: " + tit + "\n"); + dump("*** Added Available Charset: " + tit + "\n"); - } //if visible + } //if visible + + } //try + + catch (ex) { + dump("*** Failed to add Avail. Charset: " + tit + "\n"); + } //catch } //for @@ -454,6 +465,8 @@ function Save() // Iterate through the 'active charsets tree to collect the charsets // that the user has chosen. + dump('Entering Save() function.\n'); + var active_charsets = document.getElementById('active_charsets'); var active_charsets_treeroot = document.getElementById('active_charsets_root'); @@ -469,7 +482,7 @@ function Save() cell = row.firstChild; charsetid = cell.getAttribute('id'); - if (charsetid.length > 4) { + if (charsetid.length > 1) { num_charsets++;