Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Firefox/dom/base/test/   (Firefox Browser Version 153.0.1©)  Datei vom 27.6.2026 mit Größe 3 kB image not shown  

Quelle  test_bug1639328.html

  Sprache: HTML
 

 products/Sources/formale Sprachen/C/Firefox/dom/base/test/test_bug1639328.html


<!DOCTYPE HTML>
<meta charset="utf-8">
<title>Test for bug 1639328</title>
<script src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" href="/tests/SimpleTest/test.css">
<style>
  /* To ensure that they're all in the viewport when displayed */
  iframe {
    width: 10px;
    height: 10px;
  }
  iframe[id^=zero-size] {
    border: none;
    width: 0;
    height: 0;
  }
</style>
<!-- TODO(emilio): The iframes with id ending in "http" are intended to use the http:// protocol, but that causes issues with http2/http3 tests, see bug 1917297 -->
<iframe id="http" src="https://example.com/tests/dom/base/test/file_bug1639328.html"></iframe>
<iframe id="https" src="https://example.com/tests/dom/base/test/file_bug1639328.html"></iframe>
<iframe id="same-origin" src="file_bug1639328.html"></iframe>
<br>
<iframe id="zero-size-http" src="https://example.com/tests/dom/base/test/file_bug1639328.html"></iframe>
<iframe id="zero-size-https" src="https://example.com/tests/dom/base/test/file_bug1639328.html"></iframe>
<iframe id="zero-size-same-origin" src="file_bug1639328.html"></iframe>
<br>
<iframe id="display-none-http" style="display: none" src="https://example.com/tests/dom/base/test/file_bug1639328.html"></iframe>
<iframe id="display-none-https" style="display: none" src="https://example.com/tests/dom/base/test/file_bug1639328.html"></iframe>
<iframe id="display-none-same-origin" style="display: none" src="file_bug1639328.html"></iframe>
<br>
<iframe id="vis-hidden-http" style="visibility: hidden" src="https://example.com/tests/dom/base/test/file_bug1639328.html"></iframe>
<iframe id="vis-hidden-https" style="visibility: hidden" src="https://example.com/tests/dom/base/test/file_bug1639328.html"></iframe>
<iframe id="vis-hidden-same-origin" style="visibility: hidden" src="file_bug1639328.html"></iframe>
<script>
SimpleTest.waitForExplicitFinish();

function getOneMessage(frame) {
  info(`querying ${frame.src} (${frame.id})`);
  let resolve;
  let promise = new Promise(r => { resolve = r; });
  window.addEventListener("message", function(e) {
    info("got " + JSON.stringify(e.data));
    resolve(e.data);
  }, { once: true });
  frame.contentWindow.postMessage("ping""*");
  return promise;
}

async function ticks(n) {
  for (let i = 0i < n; ++i) {
    await new Promise(resolve => requestAnimationFrame(resolve));
  }
}

async function checkFrame(frame, shouldThrottle) {
  let message = null;
  do {
    if (message) {
      await ticks(2);
    }
    message = await getOneMessage(frame);
  } while (message.throttledFrameRequests != shouldThrottle);
  is(message.throttledFrameRequests, shouldThrottle, frame.id);
}

function shouldThrottle(frame) {
  return frame.style.display == "none" || frame.style.visibility == "hidden";
}

onload = async function() {
  await SimpleTest.promiseFocus(window);
  await ticks(2);
  is(SpecialPowers.DOMWindowUtils.effectivelyThrottlesFrameRequests, false, "Should not be throttling main page");
  for (let frame of document.querySelectorAll("iframe")) {
    let originalShouldThrottle = shouldThrottle(frame);
    await checkFrame(frame, originalShouldThrottle);
    for (let prop of ["display""visibility"]) {
      info(`Switching ${prop} of ${frame.id}`);
      let orig = frame.style[prop];
      let throttledValue = prop == "display" ? "none" : "hidden";
      frame.style[prop] = orig == throttledValue ? "" : throttledValue;
      if (orig != throttledValue) {
        is(shouldThrottle(frame), true, `Should throttle for ${prop}: ${throttledValue}`);
      }
      await checkFrame(frame, shouldThrottle(frame));
      info(`Switching ${prop} back for ${frame.id}`);
      frame.style[prop] = orig;
      await checkFrame(frame, originalShouldThrottle);
    }
  }

  SimpleTest.finish();
};
</script>

Messung V0.5 in Prozent
C=99 H=100 G=99

¤ Dauer der Verarbeitung: 0.3 Sekunden  ¤

*© 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.