Quellcodebibliothek Statistik Leitseite products/sources/formale Sprachen/C/Firefox/devtools/client/framework/test/   (Browser von der Mozilla Stiftung Version 136.0.1©)  Datei vom 10.2.2025 mit Größe 1 kB image not shown  

Quelle  browser_toolbox_raise.js   Sprache: JAVA

 
/* Any copyright is dedicated to the Public Domain.
 * http://creativecommons.org/publicdomain/zero/1.0/ */


const TEST_URL = "data:text/html,test for opening toolbox in different hosts";

var { Toolbox } = require("resource://devtools/client/framework/toolbox.js");

add_task(async function () {
  const tab1 = await addTab(TEST_URL);
  const tab2 = BrowserTestUtils.addTab(gBrowser);

  const toolbox = await gDevTools.showToolboxForTab(tab1);
  await testBottomHost(toolbox, tab1, tab2);

  await testWindowHost(toolbox);

  Services.prefs.setCharPref("devtools.toolbox.host", Toolbox.HostType.BOTTOM);

  await toolbox.destroy();
  gBrowser.removeCurrentTab();
  gBrowser.removeCurrentTab();
});

async function testBottomHost(toolbox, tab1, tab2) {
  // switch to another tab and test toolbox.raise()
  gBrowser.selectedTab = tab2;
  await new Promise(executeSoon);
  is(
    gBrowser.selectedTab,
    tab2,
    "Correct tab is selected before calling raise"
  );

  await toolbox.raise();
  is(
    gBrowser.selectedTab,
    tab1,
    "Correct tab was selected after calling raise"
  );
}

async function testWindowHost(toolbox) {
  await toolbox.switchHost(Toolbox.HostType.WINDOW);

  info("Wait for the toolbox to be focused when switching to window host");
  // We can't wait for the "focus" event on toolbox.win.parent as this document is created while calling switchHost.
  await waitFor(() => {
    return Services.focus.activeWindow == toolbox.topWindow;
  });

  const onBrowserWindowFocused = new Promise(resolve =>
    window.addEventListener("focus", resolve, { once: true, capture: true })
  );

  info("Focusing the browser window");
  window.focus();

  info("Wait for the browser window to be focused");
  await onBrowserWindowFocused;

  // Now raise toolbox.
  await toolbox.raise();
  is(
    Services.focus.activeWindow,
    toolbox.topWindow,
    "the toolbox window is immediately focused after raise resolution"
  );
}

96%


¤ Dauer der Verarbeitung: 0.5 Sekunden  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung ist noch experimentell.