test_memory_attach_02.html (1045B)
1 <!DOCTYPE HTML> 2 <html> 3 <!-- 4 Bug 960671 - Test attaching and detaching while in the wrong state. 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 24 let e = null; 25 try { 26 await memory.detach(); 27 } catch (ee) { 28 e = ee; 29 } 30 ok(e, "Should have hit the wrongState error"); 31 32 await memory.attach(); 33 34 await memory.attach(); 35 ok(true, "We can call attach many times, the duplicates will be ignored"); 36 37 await memory.detach(); 38 destroyServerAndFinish(target); 39 })(); 40 }; 41 </script> 42 </pre> 43 </body> 44 </html>