[Pkg-mozext-commits] [wot] 192/226: Fixes #80 Wrap global variables
David Prévot
taffit at moszumanska.debian.org
Fri May 1 00:35:50 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 62c2ec9bba4b92390f026e0d8851364c8a4f34b2
Author: Sergey Andryukhin <sorgoz at yandex.com>
Date: Thu Jan 2 14:29:00 2014 +0200
Fixes #80 Wrap global variables
---
content/api.js | 52 ++++++++++++++++++++++++-------------------------
content/cache.js | 24 +++++++++++------------
content/categories.js | 24 +++++++++++------------
content/commands.js | 4 ++--
content/config.js | 7 -------
content/overlay.xul | 1 +
content/popup.js | 8 ++++----
content/prefs.js | 4 ++--
content/ratingwindow.js | 34 ++++++++++++++++----------------
content/search.js | 12 ++++++------
content/settings.js | 28 +++++++++++++-------------
content/storage.js | 6 +++---
content/tools.js | 28 ++++++++++++++++++++++++++
content/ui.js | 10 +++++-----
content/util.js | 12 ++++++------
content/warning.js | 6 +++---
16 files changed, 141 insertions(+), 119 deletions(-)
diff --git a/content/api.js b/content/api.js
index d4fdbb6..4d02ba7 100644
--- a/content/api.js
+++ b/content/api.js
@@ -395,7 +395,7 @@ var wot_api_query =
}
}
} catch (e) {
- wdump("wot_api_query.parse_users: failed with " + e);
+ wot_tools.wdump("wot_api_query.parse_users: failed with " + e);
}
},
@@ -417,7 +417,7 @@ var wot_api_query =
}
} catch (e) {
- wdump("wot_api_query.parse_status: failed with " + e);
+ wot_tools.wdump("wot_api_query.parse_status: failed with " + e);
}
}
};
@@ -730,7 +730,7 @@ var wot_api_submit =
if (!request) return;
var url = wot_core.wot_service_url() + wot_crypto.authenticate_query(qs);
-// wdump("API Submit: " + url);
+// wot_tools.wdump("API Submit: " + url);
request.open("GET", url);
@@ -954,13 +954,13 @@ var wot_pending =
var pref_name = Date.now();
if (wot_prefs.setChar("pending." + pref_name, JSON.stringify(obj))) {
-// wdump("Stored in prefs: " + JSON.stringify(obj));
+// wot_tools.wdump("Stored in prefs: " + JSON.stringify(obj));
return true;
}
wot_prefs.flush();
} catch (e) {
- wdump("wot_pending.store: failed with " + e);
+ wot_tools.wdump("wot_pending.store: failed with " + e);
}
return false;
@@ -997,7 +997,7 @@ var wot_pending =
var data = JSON.parse(json_data);
if (!data || !data.target) {
- wdump("wot_pending.parse: invalid entry: " + pref + ": " + json_data);
+ wot_tools.wdump("wot_pending.parse: invalid entry: " + pref + ": " + json_data);
this.clear(pref);
return null;
}
@@ -1039,11 +1039,11 @@ var wot_pending =
// }
// }
-// wdump("wot_pending.parse: " + pref + ": " + rv.target);
+// wot_tools.wdump("wot_pending.parse: " + pref + ": " + rv.target);
return rv;
} catch (e) {
- wdump("wot_pending.parse: failed with " + e);
+ wot_tools.wdump("wot_pending.parse: failed with " + e);
}
return null;
@@ -1097,7 +1097,7 @@ var wot_pending =
if (!parsed) continue;
-// wdump("API Submits Parsed: " + JSON.stringify(parsed));
+// wot_tools.wdump("API Submits Parsed: " + JSON.stringify(parsed));
wot_api_submit.send(pref, parsed.target, parsed.testimonies, parsed.votes);
@@ -1169,7 +1169,7 @@ var wot_keeper = {
var keeper_data = wot_storage.get(this.STORAGE_NAME, {});
return keeper_data[wot_keeper._fullname(target, name)] || null;
} catch (e) {
- wdump("wot_keeper.get_by_name() Failed with " + e);
+ wot_tools.wdump("wot_keeper.get_by_name() Failed with " + e);
}
return null;
},
@@ -1212,7 +1212,7 @@ var wot_keeper = {
wot_prefs.deleteBranch(b);
} catch (e) {
- wdump("move_from_prefs_to_storage() / ["+b+"] failed with " + e);
+ wot_tools.wdump("move_from_prefs_to_storage() / ["+b+"] failed with " + e);
}
}
wot_storage.flush();
@@ -1318,7 +1318,7 @@ var wot_api_comments = {
request.onload = function (event) {
if (!event || !event.target || event.target.status != 200 ||
!event.target.responseText) {
- wdump("api.comments.call.error: url = " + url + ", status = " + event.target.status);
+ wot_tools.wdump("api.comments.call.error: url = " + url + ", status = " + event.target.status);
if (typeof(on_error) == "function") {
on_error(request, event.target.status, {});
@@ -1326,7 +1326,7 @@ var wot_api_comments = {
return;
}
-// wdump("api.comments.call.success: url = " + url + ", status = " + event.target.status);
+// wot_tools.wdump("api.comments.call.success: url = " + url + ", status = " + event.target.status);
var data = JSON.parse(event.target.responseText);
@@ -1349,7 +1349,7 @@ var wot_api_comments = {
return true;
} catch (e) {
- wdump("wot_api_comments.call(): failed with " + e);
+ wot_tools.wdump("wot_api_comments.call(): failed with " + e);
}
return false;
@@ -1358,7 +1358,7 @@ var wot_api_comments = {
get: function(target) {
var _this = wot_api_comments;
-// wdump("wot_api_comments.get(target) " + target);
+// wot_tools.wdump("wot_api_comments.get(target) " + target);
if (target) {
_this.call("get",
@@ -1401,7 +1401,7 @@ var wot_api_comments = {
}
if (++state.tries > _this.MAX_TRIES) {
- wdump("FAIL: api.comments.submit: failed " + target + " (max tries)");
+ wot_tools.wdump("FAIL: api.comments.submit: failed " + target + " (max tries)");
wot_storage.clear(pref_pending_name);
return;
}
@@ -1422,7 +1422,7 @@ var wot_api_comments = {
if (request.status != 403) {
wot_api_comments.retry("submit", [ target ]);
} else {
- wdump("api.comment.submit: failed " + target + " (403)");
+ wot_tools.wdump("api.comment.submit: failed " + target + " (403)");
wot_storage.clear(wot_api_comments.PENDING_COMMENT_SID + target);
}
},
@@ -1450,7 +1450,7 @@ var wot_api_comments = {
});
if (++state.tries > _this.MAX_TRIES) {
- wdump("api.comments.submit: failed " + target + " (max tries)");
+ wot_tools.wdump("api.comments.submit: failed " + target + " (max tries)");
wot_storage.clear(pref_pending_name);
return;
}
@@ -1470,7 +1470,7 @@ var wot_api_comments = {
if (request.status != 403) {
wot_api_comments.retry("remove", [ target ]);
} else {
- wdump("api.comment.remove: failed " + target + " (403)");
+ wot_tools.wdump("api.comment.remove: failed " + target + " (403)");
wot_storage.clear(wot_api_comments.PENDING_REMOVAL_SID + target);
}
},
@@ -1509,7 +1509,7 @@ var wot_api_comments = {
}
} catch (e) {
- wdump("wot_api_comments.processpending() / ["+b+"] failed with " + e);
+ wot_tools.wdump("wot_api_comments.processpending() / ["+b+"] failed with " + e);
}
}
}
@@ -1517,7 +1517,7 @@ var wot_api_comments = {
},
pull_nonce: function (nonce) {
-// wdump("wot_api_comments._pull_once(nonce) " + nonce);
+// wot_tools.wdump("wot_api_comments._pull_once(nonce) " + nonce);
var _this = wot_api_comments,
target = null;
@@ -1531,7 +1531,7 @@ var wot_api_comments = {
},
is_error: function (error) {
-// wdump("wot_api_comments.is_error(error)" + error);
+// wot_tools.wdump("wot_api_comments.is_error(error)" + error);
var error_code = 0,
error_debug = "it is raining outside :(";
@@ -1544,14 +1544,14 @@ var wot_api_comments = {
}
if (error_code && error_code != WOT_COMMENTS.error_codes.COMMENT_NOT_FOUND) {
- wdump("Error is returned:" + error_code + " / " + error_debug + " / " + error);
+ wot_tools.wdump("Error is returned:" + error_code + " / " + error_debug + " / " + error);
}
return error_code; // if not zero, than it is error
},
on_get_comment_response: function (data) {
-// wdump("wot_api_comments.on_get_comment_response(data)" + JSON.stringify(data));
+// wot_tools.wdump("wot_api_comments.on_get_comment_response(data)" + JSON.stringify(data));
// check whether error occured or data arrived
var _this = wot_api_comments,
nonce = data ? data.nonce : null, // to recover target from response
@@ -1577,7 +1577,7 @@ var wot_api_comments = {
on_submit_comment_response: function (data) {
/* Handler for "Submit" responses. On success it updates the local cache */
-// wdump("wot_api_comments.on_submit_comment_response(data) " + data);
+// wot_tools.wdump("wot_api_comments.on_submit_comment_response(data) " + data);
var _this = wot_api_comments,
nonce = data.nonce, // to recover target from response
target = _this.pull_nonce(nonce),
@@ -1609,7 +1609,7 @@ var wot_api_comments = {
},
on_remove_comment_response: function (data) {
-// wdump("wot_api_comments.on_remove_comment_response(data) " + data);
+// wot_tools.wdump("wot_api_comments.on_remove_comment_response(data) " + data);
var _this = wot_api_comments,
nonce = data.nonce, // to recover target from response
diff --git a/content/cache.js b/content/cache.js
index ae5bb42..69ef589 100644
--- a/content/cache.js
+++ b/content/cache.js
@@ -29,7 +29,7 @@ var wot_hashtable =
this.bag = Components.classes["@mozilla.org/hash-property-bag;1"].
getService(Components.interfaces.nsIWritablePropertyBag);
} catch (e) {
- wdump("wot_hashtable.init: failed with: " + e);
+ wot_tools.wdump("wot_hashtable.init: failed with: " + e);
}
},
@@ -169,7 +169,7 @@ var wot_cache =
return;
}
-// wdump(name + ", " + property + ", " + value);
+// wot_tools.wdump(name + ", " + property + ", " + value);
wot_hashtable.set(pn, value);
},
@@ -273,7 +273,7 @@ var wot_cache =
this.set(name, "lowered_" + a, 0);
}
} catch (e) {
- wdump("wot_cache.create: failed with " + e);
+ wot_tools.wdump("wot_cache.create: failed with " + e);
}
},
@@ -304,7 +304,7 @@ var wot_cache =
this.remove(name, "lowered_" + a);
}
} catch (e) {
- wdump("wot_cache.destroy: failed with " + e);
+ wot_tools.wdump("wot_cache.destroy: failed with " + e);
}
},
@@ -353,7 +353,7 @@ var wot_cache =
var name = this.resolve_nonce(nonce);
if (!name) {
- wdump("wot_cache.add_target: unknown nonce: " + nonce);
+ wot_tools.wdump("wot_cache.add_target: unknown nonce: " + nonce);
return;
}
@@ -379,7 +379,7 @@ var wot_cache =
if (islink) {
if (this.get(name, "status") == WOT_QUERY_OK) {
- wdump("wot_cache.add_target: not overwriting on link for " + name);
+ wot_tools.wdump("wot_cache.add_target: not overwriting on link for " + name);
return;
}
this.set(name, "status", WOT_QUERY_LINK);
@@ -412,7 +412,7 @@ var wot_cache =
default:
// unknown node found inside TARGET tag
- wdump("Unknown tag " + child.localName + " inside the TARGET");
+ wot_tools.wdump("Unknown tag " + child.localName + " inside the TARGET");
}
child = child.nextSibling;
}
@@ -424,7 +424,7 @@ var wot_cache =
this.add_question(name, target.firstChild);
} catch (e) {
- wdump("ERROR: wot_cache.add_target: failed with " + e);
+ wot_tools.wdump("ERROR: wot_cache.add_target: failed with " + e);
}
},
@@ -458,7 +458,7 @@ var wot_cache =
}
}
} catch (e) {
- wdump("ERROR: wot_cache.add_application: failed with " + e);
+ wot_tools.wdump("ERROR: wot_cache.add_application: failed with " + e);
}
},
@@ -503,7 +503,7 @@ var wot_cache =
return cat;
} catch (e) {
- wdump("ERROR: wot_cache.add_category: failed with " + e);
+ wot_tools.wdump("ERROR: wot_cache.add_category: failed with " + e);
return {};
}
},
@@ -518,7 +518,7 @@ var wot_cache =
return this.process_attributes(attrs_list, hostname, node);
} catch (e) {
- wdump("ERROR: wot_cache.add_category: failed with " + e);
+ wot_tools.wdump("ERROR: wot_cache.add_category: failed with " + e);
return {};
}
},
@@ -573,7 +573,7 @@ var wot_cache =
}
}
} catch(e) {
- wdump("Failed to extract Question data from XML " + e);
+ wot_tools.wdump("Failed to extract Question data from XML " + e);
}
},
diff --git a/content/categories.js b/content/categories.js
index fddb947..b316725 100644
--- a/content/categories.js
+++ b/content/categories.js
@@ -48,7 +48,7 @@ var wot_categories = {
// this.pbi = null;
// }
} catch (e) {
- wdump("wot_categories.unload: failed with " + e);
+ wot_tools.wdump("wot_categories.unload: failed with " + e);
}
},
@@ -59,12 +59,12 @@ var wot_categories = {
// this.init_categories();
// }
// } catch (e) {
-// wdump("wot_search.observe: failed with " + e);
+// wot_tools.wdump("wot_search.observe: failed with " + e);
// }
// },
parse: function (categories_node) {
-// wdump("INFO: parse() categories");
+// wot_tools.wdump("INFO: parse() categories");
// process xml dom here and store to prefs
this.loading = true;
var i, j, gs_obj, cat_obj, res_grouping = [];
@@ -107,7 +107,7 @@ var wot_categories = {
for (i = 0; i < categories.length; i++) {
cat_obj = wot_util.copy_attrs(categories[i]);
if (isNaN(cat_obj.name) || cat_obj.text == null || cat_obj.text.length == 0) {
- wdump("WARN: wot_categories.parse(): empty malformed category is found. Skipped.");
+ wot_tools.wdump("WARN: wot_categories.parse(): empty malformed category is found. Skipped.");
continue;
}
@@ -148,7 +148,7 @@ var wot_categories = {
},
init_categories: function () {
-// wdump("INFO: init_categories()");
+// wot_tools.wdump("INFO: init_categories()");
/* Reads categories info from local preferences */
try {
@@ -186,7 +186,7 @@ var wot_categories = {
this.inited = true;
} catch (e) {
- wdump("wot_search.init_categories(): failed with " + e);
+ wot_tools.wdump("wot_search.init_categories(): failed with " + e);
}
},
@@ -218,7 +218,7 @@ var wot_categories = {
var cats_json = wot_cache.get(target, "cats"),
cats = (cats_json && cats_json.length > 0) ? JSON.parse(cats_json) : {};
-// wdump("target_categories:: " + JSON.stringify(cats));
+// wot_tools.wdump("target_categories:: " + JSON.stringify(cats));
return cats;
},
@@ -229,7 +229,7 @@ var wot_categories = {
var bl_json = wot_cache.get(target, "blacklists"),
bls = (bl_json && bl_json.length > 0) ? JSON.parse(bl_json) : [];
-// wdump("target_blacklists:: " + JSON.stringify(bls));
+// wot_tools.wdump("target_blacklists:: " + JSON.stringify(bls));
return bls;
},
@@ -267,7 +267,7 @@ var wot_categories = {
if (cat.c >= this.CATEGORY_THRESHOLD) res[i] = cat;
}
-// wdump("select_identified:: " + JSON.stringify(res));
+// wot_tools.wdump("select_identified:: " + JSON.stringify(res));
return res;
},
@@ -303,7 +303,7 @@ var wot_categories = {
});
sort_array.reverse();
} catch (e) {
- wdump("ERROR: wot_categories.rearrange_categories(): Failed to rearrange categories / 1", e);
+ wot_tools.wdump("ERROR: wot_categories.rearrange_categories(): Failed to rearrange categories / 1", e);
}
var alltogether = sort_array.slice(0);
@@ -317,7 +317,7 @@ var wot_categories = {
}
cs_array.reverse();
} catch (e) {
- wdump("ERROR: wot_categories.rearrange_categories(): Failed to rearrange categories / 2", e);
+ wot_tools.wdump("ERROR: wot_categories.rearrange_categories(): Failed to rearrange categories / 2", e);
}
}
@@ -327,7 +327,7 @@ var wot_categories = {
childsafety: cs_array
};
-// wdump("rearrange_categories:: " + JSON.stringify(res));
+// wot_tools.wdump("rearrange_categories:: " + JSON.stringify(res));
return res;
}
diff --git a/content/commands.js b/content/commands.js
index 1d68018..bc59b52 100644
--- a/content/commands.js
+++ b/content/commands.js
@@ -129,7 +129,7 @@ var wot_commands =
wot_prefs.setBool("enabled", wot_prefs.enabled);
wot_core.update();
} catch (e) {
- wdump("wot_commands.enabled: failed with " + e);
+ wot_tools.wdump("wot_commands.enabled: failed with " + e);
}
},
@@ -141,7 +141,7 @@ var wot_commands =
wot_core.update();
}
} catch (e) {
- wdump("wot_commands.refresh: failed with " + e);
+ wot_tools.wdump("wot_commands.refresh: failed with " + e);
}
},
diff --git a/content/config.js b/content/config.js
index f15676f..eddd40e 100644
--- a/content/config.js
+++ b/content/config.js
@@ -401,10 +401,3 @@ const WOT_COMMENTS = {
COMMENT_SAVE_FAILED: 18
}
};
-
-var wot_modules = [];
-
-// This function should be moved to other place
-function wdump (str) {
- dump(str + "\n");
-}
diff --git a/content/overlay.xul b/content/overlay.xul
index fef11bf..6563efa 100644
--- a/content/overlay.xul
+++ b/content/overlay.xul
@@ -26,6 +26,7 @@
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<script type="application/x-javascript" src="chrome://wot/content/config.js"/>
+ <script type="application/x-javascript" src="chrome://wot/content/tools.js"/>
<script type="application/x-javascript" src="chrome://wot/content/cache.js"/>
<script type="application/x-javascript" src="chrome://wot/content/categories.js"/>
<script type="application/x-javascript" src="chrome://wot/content/commands.js"/>
diff --git a/content/popup.js b/content/popup.js
index 23f1fcc..c3cd906 100644
--- a/content/popup.js
+++ b/content/popup.js
@@ -253,7 +253,7 @@ var wot_popup =
return true;
} catch (e) {
- wdump("wot_popup.loadlayer: failed with " + e);
+ wot_tools.wdump("wot_popup.loadlayer: failed with " + e);
}
return false;
},
@@ -405,7 +405,7 @@ var wot_popup =
var style = event_view.getComputedStyle(layer),
popupheight = Math.max(isNaN(style.height) ? 0 : style.height , wot_popup.height),
popupwidth = style.width || wot_popup.width;
-
+
var height = parseInt(event_view.innerHeight - wot_popup.barsize);
var width = 0 + event_view.innerWidth - wot_popup.barsize;
@@ -454,7 +454,7 @@ var wot_popup =
} else if ((posx + wot_popup.width) > (width + hscroll)) {
posx = width - wot_popup.width + hscroll;
}
-
+
var appearance = ++wot_popup.appearance;
if (layer.style.visibility != "hidden") {
@@ -471,7 +471,7 @@ var wot_popup =
}, wot_prefs.popup_show_delay);
}
} catch (e) {
- wdump("wot_popup.onmouseover: failed with " + e);
+ wot_tools.wdump("wot_popup.onmouseover: failed with " + e);
}
}
};
diff --git a/content/prefs.js b/content/prefs.js
index 0368347..7d8ebc1 100644
--- a/content/prefs.js
+++ b/content/prefs.js
@@ -215,7 +215,7 @@ var wot_prefs =
var json = this.getChar(name, null, false);
return json ? JSON.parse(wot_util.utf8_to_unicode(json)) : default_value;
} catch (e) {
- wdump("wot_prefs.getJSON(" + name + "): failed with " + e);
+ wot_tools.wdump("wot_prefs.getJSON(" + name + "): failed with " + e);
return default_value;
}
},
@@ -225,7 +225,7 @@ var wot_prefs =
var json = JSON.stringify(obj);
return this.setChar(name, wot_util.unicode_to_utf8(json), false);
} catch (e) {
- wdump("wot_prefs.getJSON(" + name + "): failed with " + e);
+ wot_tools.wdump("wot_prefs.getJSON(" + name + "): failed with " + e);
return false;
}
},
diff --git a/content/ratingwindow.js b/content/ratingwindow.js
index 773b9d9..e770540 100644
--- a/content/ratingwindow.js
+++ b/content/ratingwindow.js
@@ -52,7 +52,7 @@ var wot_rw = {
wot_prefs.setChar("last_message", wot_api_query.message_id);
}
} catch (e) {
- wdump("wot_rw.unseenmessage: failed with " + e);
+ wot_tools.wdump("wot_rw.unseenmessage: failed with " + e);
}
},
@@ -76,7 +76,7 @@ var wot_rw = {
/* Stores any pending testimonies */
wot_core.update();
} catch (e) {
- wdump("wot_rw.hide_popup: failed with " + e);
+ wot_tools.wdump("wot_rw.hide_popup: failed with " + e);
}
},
@@ -124,7 +124,7 @@ var wot_rw = {
rw.wot_bg.wot.core.moz_set_usermessage(JSON.stringify(msg_data));
} catch (e) {
- wdump("ERROR: wot_ratingwindow.update_messages(): Failed / " + e);
+ wot_tools.wdump("ERROR: wot_ratingwindow.update_messages(): Failed / " + e);
}
},
@@ -197,7 +197,7 @@ var wot_rw = {
update: function () {
// Updates content of Rating Window. RW must be already initialized (locales, categories info, etc).
-// wdump("RW.update()");
+// wot_tools.wdump("RW.update()");
if (!this.is_visible) return;
@@ -206,7 +206,7 @@ var wot_rw = {
rw_wot = this.get_rw_wot(),
target = wot_core.hostname;
-// wdump("\tTarget: " + target);
+// wot_tools.wdump("\tTarget: " + target);
if (!rw || !rw_doc || !rw_wot) return;
@@ -233,7 +233,7 @@ var wot_rw = {
}
}
-// wdump("\tdata: " + JSON.stringify(data));
+// wot_tools.wdump("\tdata: " + JSON.stringify(data));
rw_wot.ratingwindow.update(target, JSON.stringify(data));
},
@@ -263,10 +263,10 @@ var wot_rw = {
};
} catch (e) {
- wdump("ERROR: wot_rw.get_preferences() raised an exception: " + e);
+ wot_tools.wdump("ERROR: wot_rw.get_preferences() raised an exception: " + e);
}
-// wdump("prefs: " + JSON.stringify(prefs));
+// wot_tools.wdump("prefs: " + JSON.stringify(prefs));
return prefs;
},
@@ -276,15 +276,15 @@ var wot_rw = {
rw.wot_bg.wot.prefs.load_prefs(JSON.stringify(prefs));
} catch (e) {
- wdump("ERROR: wot_rw.push_preferences() raised an exception: " + e);
+ wot_tools.wdump("ERROR: wot_rw.push_preferences() raised an exception: " + e);
}
},
on_submit: function (data) {
-// wdump("RW: on_submit() " + JSON.stringify(data));
+// wot_tools.wdump("RW: on_submit() " + JSON.stringify(data));
if (!data || !data.params) {
- wdump("on_submit() received empty data to submit.");
+ wot_tools.wdump("on_submit() received empty data to submit.");
return;
}
@@ -325,7 +325,7 @@ var wot_rw = {
var details = event.detail;
if (!details) return false;
-// wdump("on_ratingwindow_event() " + JSON.stringify(details));
+// wot_tools.wdump("on_ratingwindow_event() " + JSON.stringify(details));
var message_id = details.message_id,
data = details.data;
@@ -389,14 +389,14 @@ var wot_rw = {
break;
case "log":
- wdump("LOG: " + JSON.stringify(data));
+ wot_tools.wdump("LOG: " + JSON.stringify(data));
break;
}
return true;
} catch (e) {
- wdump("ERROR: wot_rw.on_ratingwindow_event() raised an exception: " + e);
+ wot_tools.wdump("ERROR: wot_rw.on_ratingwindow_event() raised an exception: " + e);
}
},
@@ -412,7 +412,7 @@ var wot_rw = {
if (chan) {
chan.addEventListener(event_id, this.on_ratingwindow_event);
} else {
- wdump("Can't find 'wot-ratingwindow' element in RatingWindow DOM. Very bad!");
+ wot_tools.wdump("Can't find 'wot-ratingwindow' element in RatingWindow DOM. Very bad!");
}
return true;
@@ -427,7 +427,7 @@ var wot_rw = {
var prefs = this.get_preferences();
this.push_preferences(rw, prefs);
-// wdump(JSON.stringify(prefs));
+// wot_tools.wdump(JSON.stringify(prefs));
// setup categories data in the RW
rw_wot.categories = wot_categories.categories;
@@ -444,7 +444,7 @@ var wot_rw = {
this.is_inited = true;
} catch (e) {
- wdump("Failed with wot_rw.initialize()" + e);
+ wot_tools.wdump("Failed with wot_rw.initialize()" + e);
}
}
diff --git a/content/search.js b/content/search.js
index 380439a..9f357d8 100644
--- a/content/search.js
+++ b/content/search.js
@@ -422,7 +422,7 @@ var wot_search =
this.rules[name][attr] = this.getrule(pref, true);
}
} catch (e) {
- wdump("wot_search.loadrule: failed with " + e);
+ wot_tools.wdump("wot_search.loadrule: failed with " + e);
}
},
@@ -443,7 +443,7 @@ var wot_search =
this.loadrule(i);
}
} catch (e) {
- wdump("wot_search.sync: failed with " + e);
+ wot_tools.wdump("wot_search.sync: failed with " + e);
}
},
@@ -453,7 +453,7 @@ var wot_search =
{
try { // Workaround to resolve "TypeError: can't access dead object" at start of the browser
if (!event.originalTarget) {
- wdump("event.originalTarget is undefined");
+ wot_tools.wdump("event.originalTarget is undefined");
return;
}
} catch (e) {
@@ -463,7 +463,7 @@ var wot_search =
event.originalTarget.wot_domloaded = Date.now();
wot_search.watch(event.originalTarget);
} catch (e) {
- wdump("wot_search.domcontentloaded: failed with " + e);
+ wot_tools.wdump("wot_search.domcontentloaded: failed with " + e);
}
},
@@ -471,7 +471,7 @@ var wot_search =
{
try { // Workaround to resolve "TypeError: can't access dead object" at start of the browser
if (!event.originalTarget) {
- wdump("event.originalTarget is undefined");
+ wot_tools.wdump("event.originalTarget is undefined");
return;
}
} catch (e) {
@@ -513,7 +513,7 @@ var wot_search =
attributes: true, childList: true, subtree: true
});
} catch (e) {
- wdump("wot_search.watch: failed with " + e);
+ wot_tools.wdump("wot_search.watch: failed with " + e);
}
},
diff --git a/content/settings.js b/content/settings.js
index dd478e2..5b4858b 100644
--- a/content/settings.js
+++ b/content/settings.js
@@ -130,7 +130,7 @@ var wot_settings =
if ((type == "checkbox" || type == "radio") &&
preftype == "bool") {
if (!wot_prefs.setBool(id, inputs[i].checked)) {
- wdump("wot_settings.onsave: setBool failed for " + id);
+ wot_tools.wdump("wot_settings.onsave: setBool failed for " + id);
}
} else {
var value = inputs[i].getAttribute("value");
@@ -139,43 +139,43 @@ var wot_settings =
if (preftype == "string") {
value = "";
} else {
- wdump("wot_settings.onsave: no value for " + id);
+ wot_tools.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);
+ wot_tools.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);
+ wot_tools.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);
+ wot_tools.wdump("wot_settings.onsave: setChar failed for " + id);
}
}
}
} catch (e) {
- wdump("wot_settings.onsave(): failed for " + id + " with " + e);
+ wot_tools.wdump("wot_settings.onsave(): failed for " + id + " with " + e);
}
}
wot_prefs.flush();
wot_settings.addscript(content, "wotsettings_saved();");
return;
} catch (e) {
- wdump("wot_settings.onsave: failed with " + e);
+ wot_tools.wdump("wot_settings.onsave: failed with " + e);
}
try {
wot_settings.addscript(content, "wotsettings_failed();");
} catch (e) {
- wdump("wot_settings.onsave: failed with " + e);
+ wot_tools.wdump("wot_settings.onsave: failed with " + e);
}
},
-
+
addscript: function(content, js)
{
try {
@@ -219,7 +219,7 @@ var wot_settings =
} else if (preftype == "string") {
value = wot_prefs.getChar(id, null);
} else {
- wdump("wot_settings.loadinputs: invalid preftype " + preftype);
+ wot_tools.wdump("wot_settings.loadinputs: invalid preftype " + preftype);
continue;
}
@@ -266,7 +266,7 @@ var wot_settings =
if (item.display != rules[j]) {
continue;
}
-
+
var id = WOT_SEARCH + "." + item.rule + ".enabled";
search_rules.push({
@@ -278,15 +278,15 @@ var wot_settings =
}
}
-// wdump(JSON.stringify(search_rules));
+// wot_tools.wdump(JSON.stringify(search_rules));
wot_settings.addscript(content, "build_search_rules('"+JSON.stringify(search_rules)+"')");
return true;
} catch (e) {
- wdump("wot_settings.loadsearch: failed with " + e);
+ wot_tools.wdump("wot_settings.loadsearch: failed with " + e);
}
return false;
}
-
+
};
wot_modules.push({ name: "wot_settings", obj: wot_settings });
diff --git a/content/storage.js b/content/storage.js
index f705bfd..8cadbcb 100644
--- a/content/storage.js
+++ b/content/storage.js
@@ -53,7 +53,7 @@ var wot_storage =
}
} catch (e) {
- wdump("wot_storage.load: failed with " + e);
+ wot_tools.wdump("wot_storage.load: failed with " + e);
}
if(typeof(callback) == "function") callback(); // call the callback anyway, even if storage is failed to load in order to make the add-on work
@@ -102,7 +102,7 @@ var wot_storage =
var t = this.get_from_memory(name);
return t !== undefined ? t : default_value;
} catch (e) {
- wdump("wot_storage.get(" + name + "): failed with " + e);
+ wot_tools.wdump("wot_storage.get(" + name + "): failed with " + e);
return default_value;
}
},
@@ -115,7 +115,7 @@ var wot_storage =
}
return true;
} catch (e) {
- wdump("wot_storage.set(" + name + "): failed with " + e);
+ wot_tools.wdump("wot_storage.set(" + name + "): failed with " + e);
return false;
}
},
diff --git a/content/tools.js b/content/tools.js
new file mode 100644
index 0000000..663ac02
--- /dev/null
+++ b/content/tools.js
@@ -0,0 +1,28 @@
+/*
+ config.js
+ Copyright © 2014 - 2014 WOT Services Oy <info at mywot.com>
+
+ This file is part of WOT.
+
+ WOT is free software: you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ WOT is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
+ License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with WOT. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+
+var wot_modules = [];
+
+var wot_tools = {
+ wdump: function (str) {
+ dump(str + "\n");
+ }
+};
diff --git a/content/ui.js b/content/ui.js
index c303e95..8e03e75 100644
--- a/content/ui.js
+++ b/content/ui.js
@@ -61,7 +61,7 @@ var wot_status = {
if (wot_cache.isok(wot_core.hostname)) {
reputation = wot_cache.get(wot_core.hostname, "reputation_0");
}
-
+
if (reputation > WOT_MAX_REPUTATION) {
reputation = WOT_MAX_REPUTATION;
}
@@ -106,7 +106,7 @@ var wot_status = {
wot_rw.update();
} catch (e) {
- wdump("wot_status.update: failed with " + e);
+ wot_tools.wdump("wot_status.update: failed with " + e);
}
}
};
@@ -137,7 +137,7 @@ var wot_ui = {
}
}
} catch (e) {
- wdump("wot_ui.show_accessible: failed with " + e);
+ wot_tools.wdump("wot_ui.show_accessible: failed with " + e);
}
},
@@ -169,12 +169,12 @@ var wot_ui = {
if (target) {
target = target.nextSibling;
}
-
+
nbr.insertItem(id, target);
nbr.setAttribute("currentset", nbr.currentSet);
document.persist("nav-bar", "currentset");
} catch (e) {
- wdump("wot_ui.show_toolbar_button: failed with " + e);
+ wot_tools.wdump("wot_ui.show_toolbar_button: failed with " + e);
}
},
diff --git a/content/util.js b/content/util.js
index 5684612..eadb223 100644
--- a/content/util.js
+++ b/content/util.js
@@ -109,7 +109,7 @@ var wot_util =
obj[attr.name] = attr.value;
}
} else {
- wdump("wot_utils.copy_attrs() - empty node is provided");
+ wot_tools.wdump("wot_utils.copy_attrs() - empty node is provided");
}
return obj;
},
@@ -184,7 +184,7 @@ var wot_util =
return html;
} catch (e) {
- wdump("warning.processhtml: failed with " + e);
+ wot_tools.wdump("warning.processhtml: failed with " + e);
}
return "";
@@ -570,7 +570,7 @@ var wot_browser =
}
} catch (e) {
- wdump("ERROR: wot_util.wot_browser.open_wotsite() raised an exception. " + e);
+ wot_tools.wdump("ERROR: wot_util.wot_browser.open_wotsite() raised an exception. " + e);
}
},
@@ -980,7 +980,7 @@ var wot_crypto =
return (l == h);
} catch (e) {
- wdump("wot_crypto.islevel: failed with " + e);
+ wot_tools.wdump("wot_crypto.islevel: failed with " + e);
}
return false;
},
@@ -998,7 +998,7 @@ var wot_crypto =
}
}
} catch (e) {
- wdump("crypto.encrypt: failed with " + e);
+ wot_tools.wdump("crypto.encrypt: failed with " + e);
}
return null;
@@ -1024,7 +1024,7 @@ var wot_crypto =
}
}
} catch (e) {
- wdump("wot_crypto.decrypt(): failed with " + e);
+ wot_tools.wdump("wot_crypto.decrypt(): failed with " + e);
}
return null;
diff --git a/content/warning.js b/content/warning.js
index 46e009b..acc0205 100644
--- a/content/warning.js
+++ b/content/warning.js
@@ -167,7 +167,7 @@ var wot_warning =
this.warned = {};
} catch (e) {
- wdump("wot_warning.load: failed with " + e);
+ wot_tools.wdump("wot_warning.load: failed with " + e);
}
},
@@ -508,7 +508,7 @@ var wot_warning =
!body || !body.length) {
return true;
}
-
+
var style = content.createElement("style");
if (!style) {
@@ -636,7 +636,7 @@ var wot_warning =
if (!warning || warning.style.display == "none") {
return;
}
-
+
var wrapper = content.getElementById("wotwrapper");
if (!wrapper) {
--
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