Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Firefox/dom/svg/test/   (Browser von der Mozilla Stiftung Version 136.0.1©)  Datei vom 10.2.2025 mit Größe 2 kB image not shown  

Quelle  test_SVG_switch_language_spoof.html   Sprache: HTML

 
 products/Sources/formale Sprachen/C/Firefox/dom/svg/test/test_SVG_switch_language_spoof.html


<!DOCTYPE html>
<html>
  <!--
https://bugzilla.mozilla.org/show_bug.cgi?id=1924087
-->

  <head>
    <title>Test for Bug 1924087</title>
    <script src="/tests/SimpleTest/SimpleTest.js"></script>
    <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
    <script class="testbody" type="application/javascript">
      SimpleTest.waitForExplicitFinish();

      function clearAndAddSVG() {
        document.getElementById("display").innerHTML = "";
        const template = document.querySelector("template");
        const clone = document.importNode(template.content, true);
        document.getElementById("display").appendChild(clone);
      }

      function getShownTexts() {
        const swtch = document.getElementById("switch");
        return [...swtch.children].filter(
          child => child.getBoundingClientRect().width > 0
        );
      }

      async function runTests() {
        await SpecialPowers.pushPrefEnv({
          set: [["intl.accept_languages""tr"]],
        });
        await SpecialPowers.pushPrefEnv({
          set: [["privacy.spoof_english", 2]],
        });

        clearAndAddSVG();

        const spoofedShown = getShownTexts();
        is(spoofedShown.length, 1, "Only one child should be selected");
        is(
          spoofedShown[0].textContent,
          "Hello!",
          "The selected child should be the one with the 'en' language"
        );

        await SpecialPowers.popPrefEnv();

        clearAndAddSVG();

        const shown = getShownTexts();
        is(shown.length, 1, "Only one child should be selected");
        is(
          shown[0].textContent,
          "Merhaba!",
          "The selected child should be the one with the 'tr' language"
        );

        await SpecialPowers.popPrefEnv();

        SimpleTest.finish();
      }
    </script>
  </head>
  <body onload="runTests()">
    <a
      target="_blank"
      href="https://bugzilla.mozilla.org/show_bug.cgi?id=1924087"
      >Mozilla Bug 1924087</a
    >
    <template>
      <svg>
        <switch id="switch">
          <text systemLanguage="en">Hello!</text>
          <text systemLanguage="tr">Merhaba!</text>
        </switch>
      </svg>
    </template>
    <div id="display"></div>
  </body>
</html>

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

¤ Dauer der Verarbeitung: 0.21 Sekunden  (vorverarbeitet)  ¤

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