2016-11-03 00:47:22 +01:00
|
|
|
<!doctype html>
|
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
<title>Browser Test Host</title>
|
2016-11-13 18:44:50 +01:00
|
|
|
|
|
|
|
<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>
|
|
|
|
|
2016-11-13 19:39:30 +01:00
|
|
|
</head>
|
|
|
|
<body>
|
2016-11-03 00:47:22 +01:00
|
|
|
<script>
|
2016-11-13 19:39:30 +01:00
|
|
|
document.body.appendChild(document.createTextNode(`starting test`));
|
|
|
|
document.body.appendChild(document.createElement("br"));
|
2016-11-13 18:44:50 +01:00
|
|
|
|
|
|
|
var requestCoverage = false;
|
|
|
|
|
|
|
|
let parser = document.createElement('a');
|
|
|
|
|
|
|
|
let oldTranslate = System.translate.bind(System);
|
|
|
|
System.translate = (load) => {
|
2016-11-13 19:39:30 +01:00
|
|
|
let srcP = oldTranslate(load);
|
2016-11-13 18:44:50 +01:00
|
|
|
if (!requestCoverage) {
|
2016-11-13 19:39:30 +01:00
|
|
|
return srcP;
|
2016-11-13 18:44:50 +01:00
|
|
|
}
|
|
|
|
|
2016-11-13 19:39:30 +01:00
|
|
|
parser.href = load.name;
|
|
|
|
let modName = parser.pathname.substring(1);
|
|
|
|
|
|
|
|
if (/.*\/?taler-emscripten-lib.js/.test(load.name)) {
|
|
|
|
// don't instrument emscripten
|
|
|
|
document.body.appendChild(document.createTextNode(`not instrumenting ${modName}`));
|
|
|
|
document.body.appendChild(document.createElement("br"));
|
|
|
|
return srcP;
|
|
|
|
}
|
|
|
|
|
|
|
|
let inst = new Instrumenter();
|
|
|
|
document.body.appendChild(document.createTextNode(`instrumenting ${modName}`));
|
|
|
|
document.body.appendChild(document.createElement("br"));
|
2016-11-13 18:44:50 +01:00
|
|
|
|
|
|
|
return Promise.resolve(srcP).then((src) => {
|
|
|
|
return inst.instrumentSync(src, modName);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2016-11-03 00:47:22 +01:00
|
|
|
System.config({
|
2016-11-08 16:52:03 +01:00
|
|
|
baseURL: "/",
|
2016-11-03 00:47:22 +01:00
|
|
|
defaultJSExtensions: true,
|
|
|
|
meta: {
|
|
|
|
"lib/emscripten/taler-emscripten-lib": {
|
|
|
|
format: "global",
|
|
|
|
exports: "Module",
|
2016-11-13 17:25:36 +01:00
|
|
|
},
|
2016-11-03 00:47:22 +01:00
|
|
|
},
|
|
|
|
});
|
|
|
|
</script>
|
2016-11-13 19:39:30 +01:00
|
|
|
</body>
|
2016-11-03 00:47:22 +01:00
|
|
|
</html>
|