From a9dbfcd48b31ebcda972bf5571d0726d92c9be28 Mon Sep 17 00:00:00 2001 From: Oliver Smith Date: Thu, 6 Apr 2023 16:54:07 +0000 Subject: [PATCH] autoconfig: add log_obj debug function As the API isn't well documented, add this helper function to log object properties. --- src/mobile-config-autoconfig.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/mobile-config-autoconfig.js b/src/mobile-config-autoconfig.js index 8585e12..5fa49be 100644 --- a/src/mobile-config-autoconfig.js +++ b/src/mobile-config-autoconfig.js @@ -29,6 +29,21 @@ function log(line) { logFileStream.write(line, line.length); } +// Debug function for logging object attributes +function log_obj(obj) { + var prop; + var value; + + for (var prop in obj) { + try { + value = obj[prop]; + } catch(e) { + value = e; + } + log(" - " + prop + ": " + value); + } +} + function trigger_firefox_restart() { log("Triggering Firefox restart"); var appStartup = Cc["@mozilla.org/toolkit/app-startup;1"].getService(Ci.nsIAppStartup);