test_memory_allocations_06.html (1214B)
1 <!DOCTYPE HTML> 2 <html> 3 <!-- 4 Bug 1132764 - Test controlling the maximum allocations log length over the RDP. 5 --> 6 <head> 7 <meta charset="utf-8"> 8 <title>Memory monitoring actor 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 src="memory-helpers.js" type="application/javascript"></script> 15 <script> 16 "use strict"; 17 18 window.onload = function() { 19 SimpleTest.waitForExplicitFinish(); 20 21 (async function() { 22 const { memory, target } = await startServerAndGetSelectedTabMemory(); 23 await memory.attach(); 24 25 const allocs = []; 26 function allocator() { 27 allocs.push({}); 28 } 29 30 await memory.startRecordingAllocations({ 31 maxLogLength: 1, 32 }); 33 34 allocator(); 35 allocator(); 36 allocator(); 37 38 const response = await memory.getAllocations(); 39 await memory.stopRecordingAllocations(); 40 41 is(response.allocations.length, 1, 42 "There should only be one entry in the allocations log."); 43 44 await memory.detach(); 45 destroyServerAndFinish(target); 46 })(); 47 }; 48 </script> 49 </pre> 50 </body> 51 </html>