summaryrefslogtreecommitdiffstats
path: root/devtools/client/debugger/test/mochitest/examples/sourcemaps-reload-compressed/v1/same-url.sjs
blob: b7d7ea64cb8a57f746f068499590862e4933492a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */

"use strict";

/**
 * Serve a different content, each time it is loaded
 */
const contents = `console.log("Same url script #COUNTER");`;

function handleRequest(request, response) {
  response.setHeader("Cache-Control", "no-store");
  response.setHeader("Content-Type", "application/javascript");

  let counter = 1 + parseInt(getState("counter") || 0);
  setState("counter", "" + counter);

  response.write(contents.replace(/COUNTER/g, counter));
}