[Pkg-mozext-commits] [wot] 179/226: Fixed #73 Broken encoding again when commenting via RW

David Prévot taffit at moszumanska.debian.org
Fri May 1 00:35:49 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 7e95462c7e0ab381ec01d230799633e443337d55
Author: Sergey Andryukhin <sorgoz at yandex.com>
Date:   Fri Oct 25 11:19:04 2013 +0300

    Fixed #73 Broken encoding again when commenting via RW
---
 content/api.js | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/content/api.js b/content/api.js
index 96b6eb9..172fa17 100644
--- a/content/api.js
+++ b/content/api.js
@@ -1349,12 +1349,11 @@ var wot_api_comments = {
             pref_pending_name = _this.PENDING_COMMENT_SID + target;
 
         // try to restore pending submission first
-        var state_json = wot_prefs.getChar(pref_pending_name);
-        var state = state_json ? JSON.parse(state_json) : {
+        var state = wot_prefs.getJSON(pref_pending_name, {
             target: target,
             comment_data: {},
             tries: 0
-        };
+        });
 
         // if params are given, it means we are on normal way of sending data (not on retrying)
         if (comment && votes) {
@@ -1370,7 +1369,7 @@ var wot_api_comments = {
             return;
         }
 
-        wot_prefs.setChar(pref_pending_name, JSON.stringify(state));    // remember the submission
+        wot_prefs.setJSON(pref_pending_name, state);    // remember the submission
 
         state.comment_data['target'] = target;
 
@@ -1408,11 +1407,10 @@ var wot_api_comments = {
             pref_pending_name = _this.PENDING_REMOVAL_SID + target;
 
         // try to restore pending submission first
-        var state_json = wot_prefs.getChar(pref_pending_name, null);
-        var state = state_json ? JSON.parse(state_json) : {
+        var state = wot_prefs.getJSON(pref_pending_name, {
             target: target,
             tries: 0
-        };
+        });
 
         if (++state.tries > _this.MAX_TRIES) {
             wdump("api.comments.submit: failed " + target + " (max tries)");
@@ -1420,7 +1418,7 @@ var wot_api_comments = {
             return;
         }
 
-        wot_prefs.setChar(pref_pending_name, JSON.stringify(state));    // remember the submission
+        wot_prefs.setJSON(pref_pending_name, state);    // remember the submission
 
         _this.call("remove",
             {

-- 
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