browser_dbg-remember-expanded-scopes.js (1325B)
1 /* This Source Code Form is subject to the terms of the Mozilla Public 2 * License, v. 2.0. If a copy of the MPL was not distributed with this 3 * file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */ 4 5 "use strict"; 6 7 // Ignore strange errors when shutting down. 8 PromiseTestUtils.allowMatchingRejectionsGlobally(/No such actor/); 9 PromiseTestUtils.allowMatchingRejectionsGlobally(/connection just closed/); 10 11 const MAXIMUM_ITEMS = 10; 12 13 // Test that expanded scopes stay expanded after resuming and pausing again. 14 add_task(async function () { 15 const dbg = await initDebugger("doc-remember-expanded-scopes.html"); 16 invokeInTab("main", "doc-remember-expanded-scopes.html"); 17 await waitForPaused(dbg); 18 19 await toggleNode(dbg, "object"); 20 await toggleNode(dbg, "innerObject"); 21 await stepOver(dbg); 22 await waitForPaused(dbg); 23 24 await waitUntil(() => findNode(dbg, "innerData")); 25 ok(true, "Inner object data automatically expanded after stepping"); 26 }); 27 28 function findNode(dbg, text) { 29 for (let index = 0; index < MAXIMUM_ITEMS; index++) { 30 const elem = findElement(dbg, "scopeNode", index); 31 if (elem?.innerText == text) { 32 return elem; 33 } 34 } 35 return null; 36 } 37 38 async function toggleNode(dbg, text) { 39 const node = await waitFor(() => findNode(dbg, text)); 40 return toggleObjectInspectorNode(node); 41 }