summaryrefslogtreecommitdiffstats
path: root/layout/generic/test/file_SlowPage.sjs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 14:29:10 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 14:29:10 +0000
commit2aa4a82499d4becd2284cdb482213d541b8804dd (patch)
treeb80bf8bf13c3766139fbacc530efd0dd9d54394c /layout/generic/test/file_SlowPage.sjs
parentInitial commit. (diff)
downloadfirefox-2aa4a82499d4becd2284cdb482213d541b8804dd.tar.xz
firefox-2aa4a82499d4becd2284cdb482213d541b8804dd.zip
Adding upstream version 86.0.1.upstream/86.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--layout/generic/test/file_SlowPage.sjs38
1 files changed, 38 insertions, 0 deletions
diff --git a/layout/generic/test/file_SlowPage.sjs b/layout/generic/test/file_SlowPage.sjs
new file mode 100644
index 0000000000..8b1a7cd574
--- /dev/null
+++ b/layout/generic/test/file_SlowPage.sjs
@@ -0,0 +1,38 @@
+"use strict";
+
+let timer;
+
+const DELAY_MS = 5000;
+
+function handleRequest(request, response) {
+ response.processAsync();
+
+ response.setHeader("Content-Type", "text/html", false);
+
+ // Include paint_listener.js so that we can call waitForAllPaintsFlushed
+ // on the window in which this is opened.
+ response.write("<script type=\"text/javascript\" src=\"/tests/SimpleTest/paint_listener.js\"></script>");
+
+ // Allow the opening window to react to loading being complete.
+ response.write("<body onload=\"window.opener.fullyLoaded()\">");
+
+ // Send half of the content.
+ for (var i = 0; i < 100; ++i) {
+ response.write("<p>Some text.</p>");
+ }
+
+ // Allow the opening window to react to being partially loaded.
+ response.write("<script>window.opener.partiallyLoaded();</script>");
+
+ // Wait for 5 seconds, then send the rest of the content.
+ timer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
+ timer.init(() => {
+
+ for (var i = 0; i < 100; ++i) {
+ response.write("<p>Some text.</p>");
+ }
+ response.write("</body>");
+
+ response.finish();
+ }, DELAY_MS, Ci.nsITimer.TYPE_ONE_SHOT);
+}