Eine aufbereitete Darstellung der Quelle

 
     
 
 
Anforderungen  |   Konzepte  |   Entwurf  |   Entwicklung  |   Qualitätssicherung  |   Lebenszyklus  |   Steuerung
 
 
 
 

Benutzer

Quelle  browser_bug1703472.js

  Sprache: JAVA
 

/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */


const BASE_URL = "http://mochi.test:8888/browser/dom/base/test/";

add_task(async function bug1703472() {
  await SpecialPowers.pushPrefEnv({
    set: [
      ["test.wait300msAfterTabSwitch"true],
      // Enable the popup blocker
      ["dom.disable_open_during_load"true],
    ],
  });

  await BrowserTestUtils.withNewTab(
    BASE_URL + "file_bug1703472.html",
    async function (browser) {
      info("Opening about:blank popup");
      let win = await newFocusedWindow(function () {
        return BrowserTestUtils.synthesizeMouseAtCenter(
          "#openWindow",
          {},
          browser
        );
      }, true);
      is(Services.focus.focusedWindow, win, "New window should be focused");

      info("re-focusing the original window");
      {
        let focusBack = BrowserTestUtils.waitForEvent(window, "focus"true);
        window.focus();
        await focusBack;
        is(Services.focus.focusedWindow, window, "should focus back");
      }

      // The click to do window.open() should've consumed the user interaction,
      // and an artificial .click() shouldn't count as a user interaction, so the
      // page shouldn't be allowed to focus it again without user interaction.
      info("Trying to steal focus without interaction");
      await SpecialPowers.spawn(browser, [], function () {
        content.document.querySelector("#focusWindow").click();
      });

      // We need to wait for something _not_ happening, so we need to use an arbitrary setTimeout.
      await new Promise(resolve => {
        // eslint-disable-next-line mozilla/no-arbitrary-setTimeout
        setTimeout(resolve, 500);
      });

      is(Services.focus.focusedWindow, window, "should still be focused");

      info("Trying to move focus with user interaction");
      {
        let focus = BrowserTestUtils.waitForEvent(win, "focus"true);
        await BrowserTestUtils.synthesizeMouseAtCenter(
          "#focusWindow",
          {},
          browser
        );
        await focus;
        is(Services.focus.focusedWindow, win, "should focus back");
      }

      win.close();
    }
  );
});

Messung V0.5 in Prozent
C=96 H=100 G=97

¤ Dauer der Verarbeitung: 0.24 Sekunden  (vorverarbeitet am  2026-08-27) ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

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 und die Messung sind noch experimentell.






                                                                                                                                                                                                                                                                                                                                                                                                     


Neuigkeiten

     Aktuelles
     Motto des Tages

Open Source Software

     Quellcodebibliothek
     Eigene Quellcodes
     Fremde Quellcodes
     Suchen

Jenseits des Üblichen ....

Besucherstatistik

Besucherstatistik

Statistik
#Sources=476070
#Domains=661743