test_DominatorTree_01.html (999B)
1 <!DOCTYPE HTML> 2 <html> 3 <!-- 4 Sanity test that we can compute dominator trees from a heap snapshot in a web window. 5 --> 6 <head> 7 <meta charset="utf-8"> 8 <title>ChromeUtils.saveHeapSnapshot test</title> 9 <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script> 10 <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"> 11 </head> 12 <body> 13 <pre id="test"> 14 <script> 15 "use strict"; 16 /* global window, ChromeUtils, DominatorTree */ 17 18 SimpleTest.waitForExplicitFinish(); 19 window.onload = function() { 20 const path = ChromeUtils.saveHeapSnapshot({ runtime: true }); 21 const snapshot = ChromeUtils.readHeapSnapshot(path); 22 23 const dominatorTree = snapshot.computeDominatorTree(); 24 ok(dominatorTree); 25 ok(DominatorTree.isInstance(dominatorTree)); 26 27 let threw = false; 28 try { 29 new DominatorTree(); 30 } catch (e) { 31 threw = true; 32 } 33 ok(threw, "Constructor shouldn't be usable"); 34 35 SimpleTest.finish(); 36 }; 37 </script> 38 </pre> 39 </body> 40 </html>