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

Quelle  test_http_auth_cache.html   Sprache: HTML

 

 products/Sources/formale Sprachen/C/Firefox/netwerk/test/mochitests/test_http_auth_cache.html


<!DOCTYPE HTML>
<!-- Any copyright is dedicated to the Public Domain.
   - http://creativecommons.org/publicdomain/zero/1.0/ -->

<html>
  <head>
    <script src="/tests/SimpleTest/SimpleTest.js"></script>
    <script type="text/javascript" src="../../../toolkit/components/prompts/test/prompt_common.js"></script>
  </head>
<body>
  <script type="application/javascript">

  async function populateHttpAuthCache() {
    await fetch("authenticate.sjs");
  }

  async function clearHttpAuthCacheTest() {
    let script = SpecialPowers.loadChromeScript(function () {
      const {addMessageListener, sendAsyncMessage} = this;
      addMessageListener("start", function () {
        try {
          let httpAuthCache = Cc["@mozilla.org/network/http-auth-cache;1"]
            .getService(Ci.nsIHttpAuthCache);

          let entries = httpAuthCache.getEntries();
          sendAsyncMessage("before", entries.length);

          for (let entry of entries) {
            console.log(entry.realm);
            httpAuthCache.clearEntry(entry);
          }

          let afterEntries = httpAuthCache.getEntries();
          sendAsyncMessage("after", afterEntries.length);
        } catch (e) {
          console.error("Failed to get or clear the HTTP auth cache", e);
          sendAsyncMessage("before", -1);
          sendAsyncMessage("after", -1);
        }
      });
    });

    script.sendAsyncMessage("start");
    await script.promiseOneMessage("before").then(val => {
      ok(val > 0, `got ${val}, cache size before clearing should be above 0`);
    });
    await script.promiseOneMessage("after").then(val => {
      is(val, 0, "cache should be empty after clearing");
    });
  }

add_task(async function () {
  const state = {
    msg: "This site is asking you to sign in.",
    title: "Authentication Required",
    textValue: "",
    passValue: "",
    iconClass: "authentication-icon question-icon",
    titleHidden: true,
    textHidden: false,
    passHidden: false,
    checkHidden: true,
    checkMsg: "",
    checked: false,
    focused: "textField",
    defButton: "button0",
  };
  const action = {
    buttonClick: "ok",
    textField: "user",
    passField: "pass",
  };
  let promptDone = handlePrompt(state, action);

  await populateHttpAuthCache();
  await promptDone;
  await clearHttpAuthCacheTest();
});

</script>
</body>
</html>

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

¤ Dauer der Verarbeitung: 0.16 Sekunden  (vorverarbeitet am  2026-10-01) ¤

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