From 6bf0a5cb5034a7e684dcc3500e841785237ce2dd Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 19:32:43 +0200 Subject: Adding upstream version 1:115.7.0. Signed-off-by: Daniel Baumann --- .../inspector/test/sjs_slow-loading-image.sjs | 33 ++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 devtools/client/inspector/test/sjs_slow-loading-image.sjs (limited to 'devtools/client/inspector/test/sjs_slow-loading-image.sjs') diff --git a/devtools/client/inspector/test/sjs_slow-loading-image.sjs b/devtools/client/inspector/test/sjs_slow-loading-image.sjs new file mode 100644 index 0000000000..c4b12d7c60 --- /dev/null +++ b/devtools/client/inspector/test/sjs_slow-loading-image.sjs @@ -0,0 +1,33 @@ +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ +"use strict"; + +function handleRequest(request, response) { + response.processAsync(); + + const params = new Map( + request.queryString + .replace("?", "") + .split("&") + .map(s => s.split("=")) + ); + const delay = params.has("delay") ? params.get("delay") : 2000; + + let timer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer); + timer.initWithCallback( + () => { + // to avoid garbage collection + timer = null; + response.setStatusLine(request.httpVersion, 200, "OK"); + response.setHeader("Content-Type", "image/svg+xml", false); + // This is the mozilla logo + response.write(` + + + `); + response.finish(); + }, + delay, + Ci.nsITimer.TYPE_ONE_SHOT + ); +} -- cgit v1.2.3