Quellcodebibliothek Statistik Leitseite products/sources/formale Sprachen/C/Firefox/dom/security/test/https-only/   (Browser von der Mozilla Stiftung Version 136.0.1©)  Datei vom 10.2.2025 mit Größe 1 kB image not shown  

Quelle  browser_user_gesture.js   Sprache: JAVA

 
// Bug 1725026 - HTTPS Only Mode - Test if a load triggered by a user gesture
// https://bugzilla.mozilla.org/show_bug.cgi?id=1725026
// Test if a load triggered by a user gesture can be upgraded to HTTPS
// successfully.

"use strict";

const testPathUpgradeable = getRootDirectory(gTestPath).replace(
  "chrome://mochitests/content",
  "http://example.com"
);

const kTestURI = testPathUpgradeable + "file_user_gesture.html";

add_task(async function () {
  // Enable HTTPS-Only Mode and register console-listener
  await SpecialPowers.pushPrefEnv({
    set: [["dom.security.https_only_mode"true]],
  });

  await BrowserTestUtils.withNewTab("about:blank", async function (browser) {
    const loaded = BrowserTestUtils.browserLoaded(browser, falsenulltrue);
    // 1. Upgrade a page to https://>
    BrowserTestUtils.startLoadingURIString(browser, kTestURI);
    await loaded;
    await ContentTask.spawn(browser, {}, async () => {
      ok(
        content.document.location.href.startsWith("
https://"),

        "Should be https"
      );

      // 2. Trigger a load by clicking button.
      // The scheme of the link url is `http` and the load should be able to
      // upgraded to `https` because of HTTPS-only mode.
      let button = content.document.getElementById("httpLinkButton");
      await EventUtils.synthesizeMouseAtCenter(
        button,
        { type: "mousedown" },
        content
      );
      await EventUtils.synthesizeMouseAtCenter(
        button,
        { type: "mouseup" },
        content
      );
      await ContentTaskUtils.waitForCondition(() => {
        return content.document.location.href.startsWith("https://");
      });
      ok(
        content.document.location.href.startsWith("https://"),
        "Should be https"
      );
    });
  });
});

Messung V0.5
C=91 H=94 G=92

¤ Dauer der Verarbeitung: 0.2 Sekunden  ¤

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