summaryrefslogtreecommitdiffstats
path: root/dom/security/test/csp/file_svg_inline_style_server.sjs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
commit26a029d407be480d791972afb5975cf62c9360a6 (patch)
treef435a8308119effd964b339f76abb83a57c29483 /dom/security/test/csp/file_svg_inline_style_server.sjs
parentInitial commit. (diff)
downloadfirefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz
firefox-26a029d407be480d791972afb5975cf62c9360a6.zip
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--dom/security/test/csp/file_svg_inline_style_server.sjs43
1 files changed, 43 insertions, 0 deletions
diff --git a/dom/security/test/csp/file_svg_inline_style_server.sjs b/dom/security/test/csp/file_svg_inline_style_server.sjs
new file mode 100644
index 0000000000..6073f36f62
--- /dev/null
+++ b/dom/security/test/csp/file_svg_inline_style_server.sjs
@@ -0,0 +1,43 @@
+"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");
+}