[Pkg-mozext-commits] [tabmixplus] 07/56: Refactor log.obj to prevents TypeError: can't convert undefined\null to object and for the case the function was called with non-object argument
David Prévot
taffit at moszumanska.debian.org
Mon Jun 6 00:02:32 UTC 2016
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository tabmixplus.
commit 55c31ae980efb74a93ba8583819ad9a242a41f47
Author: onemen <tabmix.onemen at gmail.com>
Date: Wed Apr 27 07:11:26 2016 +0300
Refactor log.obj to prevents TypeError: can't convert undefined\null to object and for the case the function was called with non-object argument
---
modules/log.jsm | 17 ++++++++++++++---
1 file changed, 14 insertions(+), 3 deletions(-)
diff --git a/modules/log.jsm b/modules/log.jsm
index 3c81f6c..2af4f2e 100644
--- a/modules/log.jsm
+++ b/modules/log.jsm
@@ -191,10 +191,21 @@ options = {
}
*/
obj: function TMP_console_obj(aObj, aMessage, aDisallowLog, level) {
- var offset = typeof level == "string" ? " " : "";
+ if (!aObj || typeof aObj != "object") {
+ let msg = "log.obj was called with non-object argument\n";
+ if (aMessage) {
+ msg += aMessage + "\n";
+ }
+ let type = aObj === null ? "null" : typeof aObj;
+ msg += "typeof aObj is '" + type + "'\n'" + aObj + "'";
+ if (!aDisallowLog) {
+ this.log(msg, true, false, this.caller);
+ }
+ return msg;
+ }
+ let offset = typeof level == "string" ? " " : "";
aMessage = aMessage ? offset + aMessage + "\n" : "";
- var objS = aObj ? offset + aObj.toString() : offset + "aObj is " + typeof (aObj);
- objS += ":\n";
+ let objS = offset + aObj.toString() + ":\n";
for (let prop of Object.keys(aObj)) {
try {
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/tabmixplus.git
More information about the Pkg-mozext-commits
mailing list