Skip to content

Instantly share code, notes, and snippets.

@TimothyGu
Created July 11, 2018 20:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TimothyGu/0081e871ef0999eee03b46a550a74625 to your computer and use it in GitHub Desktop.
Save TimothyGu/0081e871ef0999eee03b46a550a74625 to your computer and use it in GitHub Desktop.
Firefox #1475000
"use strict";
const http = require("http");
const server = http.createServer((req, res) => {
if (req.url.includes("slow.js")) {
setTimeout(() => {
res.setHeader("Content-Type", "text/javascript");
res.end("void 0;");
}, 5000);
} else {
res.statusCode = 404;
res.setHeader("Content-Type", "text/plain");
res.end("Not found");
}
});
server.listen(8888);
<p>This should get erased.</p>
<button onclick="document.open();">document.open()</button>
<script src="http://localhost:8888/slow.js"></script>
<script>
alert("You were too slow! Hit stop before this message.");
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment