aboutsummaryrefslogtreecommitdiff
path: root/tooling/talertest/selenium/testhost.html
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2017-04-20 03:09:25 +0200
committerFlorian Dold <florian.dold@gmail.com>2017-04-24 16:14:29 +0200
commit82f2b76e25a4a67e01ec67e5ebe39d14ad771ea8 (patch)
tree965f6eb89b84d65a62b49008fd972c004832ccd1 /tooling/talertest/selenium/testhost.html
parente6e0cbc387c2a77b48e4065c229daa65bf1aa0fa (diff)
Reorganize module loading.
We now use webpack instead of SystemJS, effectively bundling modules into one file (plus commons chunks) for every entry point. This results in a much smaller extension size (almost half). Furthermore we use yarn/npm even for extension run-time dependencies. This relieves us from manually vendoring and building dependencies. It's also easier to understand for new developers familiar with node.
Diffstat (limited to 'tooling/talertest/selenium/testhost.html')
-rw-r--r--tooling/talertest/selenium/testhost.html63
1 files changed, 63 insertions, 0 deletions
diff --git a/tooling/talertest/selenium/testhost.html b/tooling/talertest/selenium/testhost.html
new file mode 100644
index 000000000..01641547d
--- /dev/null
+++ b/tooling/talertest/selenium/testhost.html
@@ -0,0 +1,63 @@
+<!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>
+
+ <script src="/src/vendor/URI.js"></script>
+
+ <!-- for instrumentation to work, we have to use the non-csp version -->
+ <script src="/testlib/selenium/system.js"></script>
+
+ </head>
+ <body>
+ <script>
+ document.body.appendChild(document.createTextNode(`starting test`));
+ document.body.appendChild(document.createElement("br"));
+
+ var requestCoverage = false;
+
+ let parser = document.createElement('a');
+
+ let oldTranslate = System.translate.bind(System);
+ System.translate = (load) => {
+ let srcP = oldTranslate(load);
+ if (!requestCoverage) {
+ return srcP;
+ }
+
+ 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"));
+
+ return Promise.resolve(srcP).then((src) => {
+ return inst.instrumentSync(src, modName);
+ });
+ }
+
+ System.config({
+ baseURL: "/",
+ defaultJSExtensions: true,
+ meta: {
+ "src/emscripten/taler-emscripten-lib": {
+ format: "global",
+ exports: "Module",
+ },
+ },
+ });
+ </script>
+ </body>
+</html>