test_ReadHeapSnapshot.js (758B)
1 /* Any copyright is dedicated to the Public Domain. 2 http://creativecommons.org/publicdomain/zero/1.0/ */ 3 4 // Test that we can read core dumps into HeapSnapshot instances. 5 /* eslint-disable strict */ 6 if (typeof Debugger != "function") { 7 const { addDebuggerToGlobal } = ChromeUtils.importESModule( 8 "resource://gre/modules/jsdebugger.sys.mjs" 9 ); 10 addDebuggerToGlobal(globalThis); 11 } 12 13 function run_test() { 14 const filePath = ChromeUtils.saveHeapSnapshot({ globals: [this] }); 15 ok(true, "Should be able to save a snapshot."); 16 17 const snapshot = ChromeUtils.readHeapSnapshot(filePath); 18 ok(snapshot, "Should be able to read a heap snapshot"); 19 ok(HeapSnapshot.isInstance(snapshot), "Should be an instanceof HeapSnapshot"); 20 21 do_test_finished(); 22 }