summaryrefslogtreecommitdiffstats
path: root/dom/tests/mochitest/whatwg/file_structuredCloneAndExposed.sjs
blob: e352078e2a5dff6e523ae8b1f73bcd32dacf8b86 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
"use strict";

function handleRequest(request, response) {
  let query = new URLSearchParams(request.queryString);

  response.setHeader("Content-Type", "application/javascript");

  let content = `function installListeners(input, target) {
    input.addEventListener("message", () => {
      target.postMessage(true, { targetOrigin: "*" });
    });
    input.addEventListener("messageerror", () => {
      target.postMessage(false, { targetOrigin: "*" });
    });
    target.postMessage("Inited", { targetOrigin: "*" });
  }

  ${query.get("additionalScript")}
  `;

  response.write(content);
}