Eine aufbereitete Darstellung der Quelle

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

Benutzer

Quelle  browser_bug1236512.js

  Sprache: JAVA
 

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


"use strict";

add_setup(async function () {
  await SpecialPowers.pushPrefEnv({
    set: [["test.wait300msAfterTabSwitch"true]],
  });
});

const testPageURL =
  "http://mochi.test:8888/browser/dom/tests/browser/dummy.html";

async function testContentVisibilityState(aIsHidden, aBrowser) {
  await SpecialPowers.spawn(
    aBrowser.selectedBrowser,
    [aIsHidden],
    aExpectedResult => {
      is(content.document.hidden, aExpectedResult, "document.hidden");
      is(
        content.document.visibilityState,
        aExpectedResult ? "hidden" : "visible",
        "document.visibilityState"
      );
    }
  );
}

async function waitContentVisibilityChange(aIsHidden, aBrowser) {
  await SpecialPowers.spawn(
    aBrowser.selectedBrowser,
    [aIsHidden],
    async function (aExpectedResult) {
      let visibilityState = aExpectedResult ? "hidden" : "visible";
      if (
        content.document.hidden === aExpectedResult &&
        content.document.visibilityState === visibilityState
      ) {
        ok(true"already changed to expected visibility state");
        return;
      }

      info("wait visibilitychange event");
      await ContentTaskUtils.waitForEvent(
        content.document,
        "visibilitychange",
        true /* capture */,
        () => {
          info(
            `visibilitychange: ${content.document.hidden} ${content.document.visibilityState}`
          );
          return (
            content.document.hidden === aExpectedResult &&
            content.document.visibilityState === visibilityState
          );
        }
      );
    }
  );
}

/**
 * This test is to test the visibility state will change to "hidden" when browser
 * window is fully covered by another non-translucent application. Note that we
 * only support this on Mac for now, other platforms don't support reporting
 * occlusion state.
 */

add_task(async function () {
  info("creating test window");
  let winTest = await BrowserTestUtils.openNewBrowserWindow();
  // Specify the width, height, left and top, so that the new window can be
  // fully covered by "window".
  let resizePromise = BrowserTestUtils.waitForEvent(
    winTest,
    "resize",
    false,
    () => {
      return winTest.innerHeight <= 500 && winTest.innerWidth <= 500;
    }
  );
  winTest.moveTo(200200);
  winTest.resizeTo(500500);
  await resizePromise;

  let browserTest = winTest.gBrowser;

  info(`loading test page: ${testPageURL}`);
  BrowserTestUtils.startLoadingURIString(
    browserTest.selectedBrowser,
    testPageURL
  );
  await BrowserTestUtils.browserLoaded(browserTest.selectedBrowser);

  info("test init visibility state");
  await testContentVisibilityState(false /* isHidden */, browserTest);

  info(
    "test window should report 'hidden' if it is fully covered by another " +
      "window"
  );
  await new Promise(resolve => waitForFocus(resolve, window));
  await waitContentVisibilityChange(true /* isHidden */, browserTest);

  info(
    "test window should still report 'hidden' since it is still fully covered " +
      "by another window"
  );
  let tab = BrowserTestUtils.addTab(browserTest);
  await BrowserTestUtils.switchTab(browserTest, tab);
  BrowserTestUtils.removeTab(browserTest.selectedTab);
  await testContentVisibilityState(true /* isHidden */, browserTest);

  info(
    "test window should report 'visible' if it is not fully covered by " +
      "another window"
  );
  await new Promise(resolve => waitForFocus(resolve, winTest));
  await waitContentVisibilityChange(false /* isHidden */, browserTest);

  info("closing test window");
  await BrowserTestUtils.closeWindow(winTest);
});

Messung V0.5 in Prozent
C=84 H=93 G=88

¤ Dauer der Verarbeitung: 0.11 Sekunden  (vorverarbeitet am  2026-08-26) ¤

*© 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=277311
#Domains=752002