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

Quelle  file_svg_inline_style_server.sjs   Sprache: unbekannt

 
Spracherkennung für: .sjs vermutete Sprache: Unknown {[0] [0] [0]} [Methode: Schwerpunktbildung, einfache Gewichte, sechs Dimensionen]

"use strict";

const SVG_IMG = `<svg width="200" height="200" viewBox="0 0 150 150" xmlns="http://www.w3.org/2000/svg">
   <style>
     circle {
       fill: orange;
       stroke: black;
       stroke-width: 10px;
     }
   </style>
   <circle cx="50" cy="50" r="40" />
   </svg>`;

const SVG_IMG_NO_INLINE_STYLE = `<svg width="200" height="200" viewBox="0 0 150 150" xmlns="http://www.w3.org/2000/svg">
   <circle cx="50" cy="50" r="40" />
   </svg>`;

function handleRequest(request, response) {
  const query = request.queryString;

  response.setHeader("Cache-Control", "no-cache", false);
  response.setHeader("Content-Type", "image/svg+xml", false);

  if (query.includes("svg_inline_style_csp")) {
    response.setHeader("Content-Security-Policy", "default-src 'none'", false);
    response.write(SVG_IMG);
    return;
  }

  if (query.includes("svg_inline_style_nocsp")) {
    response.write(SVG_IMG);
    return;
  }

  if (query.includes("svg_no_inline_style")) {
    response.write(SVG_IMG_NO_INLINE_STYLE);
    return;
  }

  // we should never get here, but just in case
  // return something unexpected
  response.write("do'h");
}

[ Dauer der Verarbeitung: 0.31 Sekunden  ]