const nsTimer = Components.Constructor( "@mozilla.org/timer;1", "nsITimer", "initWithCallback" ); const PDF = ` Content-Type: application/pdf %PDF-2.0 1 0 obj <> endobj 2 0 obj <> endobj 3 0 obj<> endobj 4 0 obj<>>> endobj 5 0 obj<> endobj 6 0 obj <> stream BT /F1 24 Tf 175 720 Td (Hello World!)Tj ET endstream endobj xref 0 7 0000000000 65535 f 0000000009 00000 n 0000000056 00000 n 0000000111 00000 n 0000000212 00000 n 0000000250 00000 n 0000000317 00000 n trailer <> startxref 406 %%EOF `; const HTML = ` Content-Type: text/html
Test
`; const BOUNDARY = "--boundary"; function handleRequest(request, response) { response.processAsync(); response.setHeader( "Content-Type", "multipart/x-mixed-replace;boundary=boundary", false ); response.setHeader("Cache-Control", "no-cache", false); response.setStatusLine(request.httpVersion, "200", "Found"); response.write(BOUNDARY); response.write(PDF); response.write(BOUNDARY); new nsTimer( () => { response.write(HTML); response.write(`${BOUNDARY}--`); response.finish(); }, 1000, Ci.nsITimer.TYPE_ONE_SHOT ); }