tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

browser_dbg-preview-switch.js (1567B)


      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 // Check that switching between different previews doesn't release the underlying object actors
      6 // Bug 1944408 - Can not expand info about variable
      7 
      8 "use strict";
      9 
     10 add_task(async function () {
     11  const dbg = await initDebugger("doc-preview.html", "preview.js");
     12 
     13  info(
     14    "Check that switching between different previews doesn't release the underlying object actors"
     15  );
     16  invokeInTab("classPreview");
     17  await waitForPaused(dbg);
     18 
     19  const fooTokenEl = await getTokenFromPosition(dbg, { line: 50, column: 44 });
     20  const privateStaticTokenEl = await getTokenFromPosition(dbg, {
     21    line: 50,
     22    column: 48,
     23  });
     24 
     25  hoverToken(fooTokenEl);
     26  await waitForPreviewWithResult(dbg, "class Foo");
     27 
     28  // We want the ObjectInspector component to be updated with new roots rather than destroyed and recreated.
     29  // This is hard to trigger reliably so we switch between different previews multiple times with different delays.
     30  info("Switch between different previews multiple times");
     31  for (let i = 0; i < 5; i++) {
     32    await waitForTime(i * 5);
     33    hoverToken(privateStaticTokenEl);
     34    await waitForPreviewWithResult(dbg, "Object");
     35 
     36    hoverToken(fooTokenEl);
     37    await waitForPreviewWithResult(dbg, "class Foo");
     38  }
     39 
     40  info("Try to expand a property");
     41  await toggleExpanded(dbg, 3);
     42  await waitForTime(1000);
     43  ok(true, "The property was expanded");
     44 });