summaryrefslogtreecommitdiffstats
path: root/devtools/client/memory/test/browser/browser_memory_transferHeapSnapshot_e10s_01.js
blob: 8ebb7622afc3723fb5567073ee2a0014d0bde153 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/* Any copyright is dedicated to the Public Domain.
   http://creativecommons.org/publicdomain/zero/1.0/ */

// Test that we can save a heap snapshot and transfer it over the RDP in e10s
// where the child process is sandboxed and so we have to use
// HeapSnapshotFileActor to get the heap snapshot file.

"use strict";

const TEST_URL = "data:text/html,<html><body></body></html>";

this.test = makeMemoryTest(TEST_URL, function* ({ tab, panel }) {
  const memoryFront = panel.panelWin.gFront;
  ok(memoryFront, "Should get the MemoryFront");

  const snapshotFilePath = yield memoryFront.saveHeapSnapshot({
    // Force a copy so that we go through the HeapSnapshotFileActor's
    // transferHeapSnapshot request and exercise this code path on e10s.
    forceCopy: true
  });

  ok(!!(yield OS.File.stat(snapshotFilePath)),
     "Should have the heap snapshot file");

  const snapshot = ChromeUtils.readHeapSnapshot(snapshotFilePath);
  ok(snapshot instanceof HeapSnapshot,
     "And we should be able to read a HeapSnapshot instance from the file");
});