test_ReadHeapSnapshot.js 699 B

123456789101112131415161718192021
  1. /* Any copyright is dedicated to the Public Domain.
  2. http://creativecommons.org/publicdomain/zero/1.0/ */
  3. // Test that we can read core dumps into HeapSnapshot instances.
  4. if (typeof Debugger != "function") {
  5. const { addDebuggerToGlobal } = Cu.import("resource://gre/modules/jsdebugger.jsm", {});
  6. addDebuggerToGlobal(this);
  7. }
  8. function run_test() {
  9. const filePath = ChromeUtils.saveHeapSnapshot({ globals: [this] });
  10. ok(true, "Should be able to save a snapshot.");
  11. const snapshot = ChromeUtils.readHeapSnapshot(filePath);
  12. ok(snapshot, "Should be able to read a heap snapshot");
  13. ok(snapshot instanceof HeapSnapshot, "Should be an instanceof HeapSnapshot");
  14. do_test_finished();
  15. }