QA/Telemetry/BrowserConsoleCommands: Difference between revisions

From MozillaWiki
< QA‎ | Telemetry
Jump to navigation Jump to search
Line 42: Line 42:


* '''Run Maintenance Task'''
* '''Run Maintenance Task'''
** force firefox to run the maintenance task
** force Firefox to run the maintenance task


  Cu.import("resource://gre/modules/CrashManager.jsm");
  Cu.import("resource://gre/modules/CrashManager.jsm");
Line 48: Line 48:


* '''Crash Firefox'''
* '''Crash Firefox'''
** force firefox to crash through the browser console
** force Firefox to crash through the browser console


  Cu.import("resource://gre/modules/ctypes.jsm");
  Cu.import("resource://gre/modules/ctypes.jsm");
Line 54: Line 54:
  let badptr = ctypes.cast(zero, ctypes.PointerType(ctypes.int32_t));
  let badptr = ctypes.cast(zero, ctypes.PointerType(ctypes.int32_t));
  badptr.contents;
  badptr.contents;
* '''Run Maintenance Task'''
** run the maintenance task on the crash manager
Cu.import("resource://gre/modules/CrashManager.jsm");
CrashManager.Singleton.runMaintenanceTasks();

Revision as of 14:32, 20 August 2014

Quick Summary

The following document will list several commands and pieces of code that you can insert into the browser console to extract more information from the experiment system. With this information, you'll be able to take a deeper look at the data and debug/test more reliably.

Enabling Logging

Please visit and review the following document:

Browser Console Commands

  • Refresh Experiment Manifest Manually
    • automatically update/refresh the current experiment manifest
Cu.import("resource:///modules/experiments/Experiments.jsm");
Experiments.instance().updateManifest();
  • Retrieve Telemetry Logs
    • retrieves the current telemetry log entries and displays them in the browser console
Cu.import("resource://gre/modules/TelemetryLog.jsm");
TelemetryLog.entries().toSource();

Once retrieved, you should see something similar in the Browser Console:

["EXPERIMENT_ACTIVATION", 52487, "ACTIVATED", "tile-switcher@experiments.mozilla.org"]
["EXPERIMENT_TERMINATION", 389463, "ADDON_UNINSTALLED", "tile-switcher@experiments.mozilla.org"]
["EXPERIMENT_ACTIVATION", 400009, "ACTIVATED", "tile-switcher@experiments.mozilla.org #2"]
["EXPERIMENT_TERMINATION", 692040, "ADDON_UNINSTALLED", "tile-switcher@experiments.mozilla.org #2"]
["EXPERIMENT_ACTIVATION", 731416, "ACTIVATED", "tile-switcher@experiments.mozilla.org #3"]
  • Extracting Telemetry Payload
    • extract the current telemetry payload and add it into the clipboard (paste into a text editor)
(function() {
 function copyStringToClipboard(s) {
   var ch = Cc["@mozilla.org/widget/clipboardhelper;1"].getService(Ci.nsIClipboardHelper);
   ch.copyString(s);
 }
 Cu.import("resource://gre/modules/TelemetryPing.jsm");
 copyStringToClipboard(JSON.stringify(TelemetryPing.getPayload(), null, " "));
})(); 
  • Run Maintenance Task
    • force Firefox to run the maintenance task
Cu.import("resource://gre/modules/CrashManager.jsm");
CrashManager.Singleton.runMaintenanceTasks();
  • Crash Firefox
    • force Firefox to crash through the browser console
Cu.import("resource://gre/modules/ctypes.jsm");
let zero = new ctypes.intptr_t(8);
let badptr = ctypes.cast(zero, ctypes.PointerType(ctypes.int32_t));
badptr.contents;