Eine aufbereitete Darstellung der Quelle

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

Benutzer

Quelle  browser_status_code.js

  Sprache: JAVA
 

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


"use strict";

const TEST_PATH = getRootDirectory(gTestPath).replace(
  "chrome://mochitests/content",
  // eslint-disable-next-line @microsoft/sdl/no-insecure-url
  "http://example.com"
);

async function runTest(code, hasBody) {
  const url = `${TEST_PATH}file_status_code.sjs?code=${code}&body=${hasBody ? "1" : "0"}`;
  const desc = `${code} ${hasBody ? "with" : "without"} body`;

  const tab = await BrowserTestUtils.openNewForegroundTab(
    gBrowser,
    "about:blank"
  );
  const browser = tab.linkedBrowser;

  const loaded = Promise.race([
    BrowserTestUtils.waitForErrorPage(browser),
    BrowserTestUtils.browserLoaded(browser),
  ]);
  BrowserTestUtils.startLoadingURIString(browser, url);
  await loaded;

  is(browser.currentURI.scheme, "https", `Should remain on HTTPS for ${desc}`);

  await SpecialPowers.spawn(
    browser,
    [code, hasBody],
    async function (statusCode, withBody) {
      const innerHTML = content.document.body.innerHTML;
      ok(
        !innerHTML.includes("about-httpsonly-title-alert"),
        `Should not show HTTPS-Only error page for ${statusCode}`
      );
      if (withBody) {
        ok(
          innerHTML.includes(`status=${statusCode}`),
          `Should show response body for ${statusCode}`
        );
      }
    }
  );

  BrowserTestUtils.removeTab(tab);
}

add_task(async function test_status_code() {
  await SpecialPowers.pushPrefEnv({
    set: [["dom.security.https_only_mode"true]],
  });

  for (const code of [200400404500503]) {
    await runTest(code, true);
    await runTest(code, false);
  }
});

Messung V0.5 in Prozent
C=94 H=100 G=96

¤ Dauer der Verarbeitung: 0.28 Sekunden  (vorverarbeitet am  2026-08-27) ¤

*© 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=476070
#Domains=661743