aboutsummaryrefslogtreecommitdiff
path: root/testlib/selenium/testhost.html
blob: b75c99e7e1105636b58bb6f39e2e46c5a96eda50 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<!doctype html>
<html>
  <head>
    <title>Browser Test Host</title>

    <script src="/testlib/selenium/esprima.js"></script>
    <script src="/testlib/selenium/escodegen.browser.js"></script>
    <script src="/testlib/selenium/instrumenter.js"></script>

    <!-- for instrumentation to work, we have to use the non-csp version -->
    <script src="/testlib/selenium/system.js"></script>

    <script>

    var requestCoverage = false;

    let parser = document.createElement('a');

    let oldTranslate = System.translate.bind(System);
    System.translate = (load) => {
      if (!requestCoverage) {
        return oldTranslate(load);
      }
      let inst = new Instrumenter();
      let srcP = oldTranslate(load);

      console.dir(load);

      return Promise.resolve(srcP).then((src) => {
        parser.href = load.name;
        let modName = parser.pathname.substring(1);
        return inst.instrumentSync(src, modName);
      });
    }

    System.config({
        baseURL: "/",
        defaultJSExtensions: true,
        meta: {
          "lib/emscripten/taler-emscripten-lib": {
            format: "global",
            exports: "Module",
          },
        },
    });
    </script>
  </head>
</html>