Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/MariaDB/mysql-test/suite/json/t/     Datei vom 1.9.2026 mit Größe 834 B image not shown  

SSL test_reporting_api_disabled.html  Interaktion und
PortierbarkeitHTML


 products/Sources/formale Sprachen/C/Firefox/dom/security/test/csp/test_reporting_api_disabled.html


<!DOCTYPE HTML>
<html>
<head>
  <title>Bug 1922967 - Check `report-uri` is used when Reporting API is enabled regardless the existence of `report-to`</title>
  <!-- Including SimpleTest.js so we can use waitForExplicitFinish !-->
  <script src="/tests/SimpleTest/SimpleTest.js"></script>
  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>

<iframe style="width:200px;height:200px;" id='cspframe'></iframe>
<script class="testbody" type="text/javascript">

SimpleTest.waitForExplicitFinish();

/* Description of the test:
 * This test reuses the setup from test_blocked_uri_in_reports.html.
 * The only differences is we provide `report-to` directive while Reporting API
 * is disabled.
 * We want to test `report-uri` still works if Reporting API is disabled.
 */

const reportURI = "http://mochi.test:8888/foo.sjs";
// Note that both `report-to` and `reprot-uri` are provided.
const policy = "report-to csp-group; script-src http://example.com; report-uri " + reportURI;
const testfile = "tests/dom/security/test/csp/file_path_matching_redirect.html";

var chromeScriptUrl = SimpleTest.getTestFileURL("file_report_chromescript.js");
var script = SpecialPowers.loadChromeScript(chromeScriptUrl);

script.addMessageListener('opening-request-completed', function ml(msg) {
  if (msg.error) {
    ok(false, "Could not query report (exception: " + msg.error + ")");
  } else {
    try {
      var reportObj = JSON.parse(msg.report);
    } catch (e) {
      ok(false, "Could not parse JSON (exception: " + e + ")");
    }
    try {
      var cspReport = reportObj["csp-report"];
      // blocked-uri should only be the asciiHost instead of:
      // http://test1.example.com/tests/dom/security/test/csp/file_path_matching.js
      // eslint-disable-next-line @microsoft/sdl/no-insecure-url
      is(cspReport["blocked-uri"], "http://example.com/tests/dom/security/test/csp/file_path_matching_redirect_server.sjs", "Incorrect blocked-uri");
    } catch (e) {
      ok(false, "Could not query report (exception: " + e + ")");
    }
  }

  script.removeMessageListener('opening-request-completed', ml);
  script.sendAsyncMessage("finish");
  SimpleTest.finish();
});

SimpleTest.waitForExplicitFinish();

function runTest() {
  var src = "file_testserver.sjs";
  // append the file that should be served
  src += "?file=" + escape(testfile);
  // append the CSP that should be used to serve the file
  src += "&csp=" + escape(policy);

  document.getElementById("cspframe").src = src;
}

SpecialPowers.pushPrefEnv({
  set: [
    ["dom.reporting.enabled", false],
  ],
}, runTest);

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

Messung
CHZG
899910096

¤ Diese beiden folgenden Angebotsgruppen bietet das Unternehmen0.84Angebot  ¤

*Eine klare Vorstellung vom Zielzustand