diff options
Diffstat (limited to 'testlib/selenium/testhost.html')
-rw-r--r-- | testlib/selenium/testhost.html | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/testlib/selenium/testhost.html b/testlib/selenium/testhost.html index 2fb9cb533..b75c99e7e 100644 --- a/testlib/selenium/testhost.html +++ b/testlib/selenium/testhost.html @@ -2,8 +2,37 @@ <html> <head> <title>Browser Test Host</title> - <script src="/lib/vendor/system-csp-production.src.js"></script> + + <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, |