Permalink
Browse files

Bug 881672 - Enabling a DUMP function for all Gaia apps, r=kaze

  • Loading branch information...
1 parent f937207 commit 5d6fbaa19afc6e15aa8449d6ba5e4a3cb680b0ec Fernando Rodriguez Sela committed Jun 19, 2013
Showing with 43 additions and 0 deletions.
  1. +7 −0 apps/settings/index.html
  2. +1 −0 build/settings.py
  3. +35 −0 shared/js/dump.js
View
@@ -2054,6 +2054,13 @@ <h2 data-l10n-id="debug">Debug</h2>
</li>
<li>
<label>
+ <input type="checkbox" name="debug.gaia.enabled"/>
+ <span></span>
+ </label>
+ <a data-l10n-id="debug-gaia-enabled">Gaia debug traces</a>
+ </li>
+ <li>
+ <label>
<button id="ftuLauncher" data-l10n-id="launch-ftu">Launch FTU</button>
</label>
</li>
View
@@ -36,6 +36,7 @@
"debug.log-animations.enabled": False,
"debug.paint-flashing.enabled": False,
"debug.peformancedata.shared": False,
+ "debug.gaia.enabled": False,
"deviceinfo.firmware_revision": "",
"deviceinfo.hardware": "",
"deviceinfo.mac": "",
View
@@ -0,0 +1,35 @@
+/* -*- Mode: js; js-indent-level: 2; indent-tabs-mode: nil -*- */
+/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
+
+
+(function() {
+ 'use strict';
+
+ function dump_off(msg, optionalObject) {};
+ function dump_on(msg, optionalObject) {
+ var output = msg;
+ if (optionalObject) {
+ output += JSON.stringify(optionalObject);
+ }
+ if (dump) {
+ var appName = document.location.hostname.replace(/\..*$/, '');
+ dump('[' + appName + '] ' + output + '\n');
+ } else {
+ console.log(output);
+ }
+ }
+
+ window.DUMP = dump_off; // no traces by default
+
+ // enable/disable DUMP according to the related setting
+ var settings = window.navigator.mozSettings;
+ var reqGaiaDebug = settings.createLock().get('debug.gaia.enabled');
+ reqGaiaDebug.onsuccess = function gaiaDebug() {
+ window.DUMP =
+ reqGaiaDebug.result['debug.gaia.enabled'] ? dump_on : dump_off;
+ };
+ settings.addObserver('debug.gaia.enabled', function(event) {
+ window.DUMP = event.settingValue ? dump_on : dump_off;
+ dump_on(event.settingValue ? 'Enabling DUMP' : 'Disabling DUMP');
+ });
+}());

0 comments on commit 5d6fbaa

Please sign in to comment.