tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

test_MemoryActor_saveHeapSnapshot_01.js (710B)


      1 /* Any copyright is dedicated to the Public Domain.
      2   http://creativecommons.org/publicdomain/zero/1.0/ */
      3 
      4 "use strict";
      5 
      6 // Test that we can tell the memory actor to take a heap snapshot over the RDP
      7 // and then create a HeapSnapshot instance from the resulting file.
      8 
      9 add_task(async () => {
     10  const { memoryFront } = await createTabMemoryFront();
     11 
     12  const snapshotFilePath = await memoryFront.saveHeapSnapshot();
     13  ok(
     14    !!(await IOUtils.stat(snapshotFilePath)),
     15    "Should have the heap snapshot file"
     16  );
     17  const snapshot = ChromeUtils.readHeapSnapshot(snapshotFilePath);
     18  ok(
     19    HeapSnapshot.isInstance(snapshot),
     20    "And we should be able to read a HeapSnapshot instance from the file"
     21  );
     22 });