[Pkg-mozext-commits] [wot] 127/226: Fixed #53 Search settings are stored in a wrong way in prefs
David Prévot
taffit at moszumanska.debian.org
Fri May 1 00:35:43 UTC 2015
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository wot.
commit 04b8927ba97f9ee2d02f5970a6e3d1697e3e2c83
Author: Sergey Andryukhin <sorgoz at yandex.com>
Date: Sun Sep 1 16:40:00 2013 +0300
Fixed #53 Search settings are stored in a wrong way in prefs
---
content/config.js | 5 ++-
content/settings.js | 103 +++++++++++++++++++++++-----------------------------
2 files changed, 49 insertions(+), 59 deletions(-)
diff --git a/content/config.js b/content/config.js
index d97bb60..27178b6 100644
--- a/content/config.js
+++ b/content/config.js
@@ -19,7 +19,7 @@
*/
const WOT_PLATFORM = "firefox";
-const WOT_VERSION = "20130823";
+const WOT_VERSION = "20130827";
/*
* Constants
@@ -320,7 +320,8 @@ const wot_prefs_int = [
[ "warning_type_1", WOT_WARNING_DOM ],
[ "warning_type_2", WOT_WARNING_DOM ],
[ "warning_type_3", WOT_WARNING_NONE ],
- [ "warning_type_4", WOT_WARNING_NONE ]
+ [ "warning_type_4", WOT_WARNING_NONE ],
+ [ "settingsui_warntype", WOT_WARNING_DOM ] // just for UI, other value is WOT_WARNING_BLOCK
];
/* Search rules */
diff --git a/content/settings.js b/content/settings.js
index b2b0196..dd478e2 100644
--- a/content/settings.js
+++ b/content/settings.js
@@ -120,70 +120,59 @@ var wot_settings =
var inputs = content.getElementsByTagName("input");
for (var i = 0; i < inputs.length; ++i) {
- var preftype = inputs[i].getAttribute("wotpref");
-
- if (!preftype) {
- continue;
- }
-
- var id = inputs[i].getAttribute("id");
-
- if (!id) {
- continue;
- }
-
- var type = inputs[i].getAttribute("type");
-
- if (!type) {
- continue;
- }
-
- if ((type == "checkbox" || type == "radio") &&
- preftype == "bool") {
- if (!wot_prefs.setBool(id, inputs[i].checked)) {
- dump("wot_settings.onsave: setBool failed for " +
- id + "\n");
- }
- } else {
- var value = inputs[i].getAttribute("value");
-
- if (!value) {
- if (preftype == "string") {
- value = "";
- } else {
- dump("wot_settings.onsave: no value for " + id + "\n");
- continue;
- }
- }
-
- if (preftype == "bool") {
- if (!wot_prefs.setBool(id, (value == "true"))) {
- dump("wot_settings.onsave: setBool failed for " +
- id + "\n");
- }
- } else if (preftype == "int") {
- if (!wot_prefs.setInt(id, Number(value))) {
- dump("wot_settings.onsave: setInt failed for " +
- id + " and value " + value + "\n");
- }
- } else if (preftype == "string") {
- if (!wot_prefs.setChar(id, value)) {
- dump("wot_settings.onsave: setChar failed for " +
- id + "\n");
- }
- }
- }
+ try {
+ var preftype = inputs[i].getAttribute("wotpref"),
+ id = inputs[i].getAttribute("id"),
+ type = inputs[i].getAttribute("type");
+
+ if (!preftype || !id || !type) continue;
+
+ if ((type == "checkbox" || type == "radio") &&
+ preftype == "bool") {
+ if (!wot_prefs.setBool(id, inputs[i].checked)) {
+ wdump("wot_settings.onsave: setBool failed for " + id);
+ }
+ } else {
+ var value = inputs[i].getAttribute("value");
+
+ if (!value) {
+ if (preftype == "string") {
+ value = "";
+ } else {
+ wdump("wot_settings.onsave: no value for " + id);
+ continue;
+ }
+ }
+
+ if (preftype == "bool") {
+ if (!wot_prefs.setBool(id, (value == "true" || value == "1"))) {
+ wdump("wot_settings.onsave: setBool failed for " + id);
+ }
+ } else if (preftype == "int") {
+ if (!wot_prefs.setInt(id, Number(value))) {
+ wdump("wot_settings.onsave: setInt failed for " + id + " and value " + value);
+ }
+ } else if (preftype == "string") {
+ if (!wot_prefs.setChar(id, value)) {
+ wdump("wot_settings.onsave: setChar failed for " + id);
+ }
+ }
+ }
+ } catch (e) {
+ wdump("wot_settings.onsave(): failed for " + id + " with " + e);
+ }
}
wot_prefs.flush();
wot_settings.addscript(content, "wotsettings_saved();");
return;
} catch (e) {
- dump("wot_settings.onsave: failed with " + e + "\n");
+ wdump("wot_settings.onsave: failed with " + e);
}
+
try {
wot_settings.addscript(content, "wotsettings_failed();");
} catch (e) {
- dump("wot_settings.onsave: failed with " + e + "\n");
+ wdump("wot_settings.onsave: failed with " + e);
}
},
@@ -278,13 +267,13 @@ var wot_settings =
continue;
}
- var id = WOT_SEARCH + "-" + item.rule;
+ var id = WOT_SEARCH + "." + item.rule + ".enabled";
search_rules.push({
id: id,
display: item.display,
name: item.rule,
- state: item.enabled
+ state: item.enabled === undefined ? true : item.enabled
});
}
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/wot.git
More information about the Pkg-mozext-commits
mailing list