Eliminate/replace usage of mock4js |
|
Issue descriptionmock4js is a fairly old library for creating mock Javascript objects for testing purposes. In its own github page [1], it states: "This library has been made available on NPM for legacy code that still depends on mock4js. If you are looking for a mocking library for new code than you should look at either Sinon.jS or mochito." Besides just being old and having no OWNER in Chrome (see [2], the library is relying on "new Function()" constructor, which is basically eval(), which in turn causes several WebUI code to allow eval() in CSP just so that tests are passing, see more context at issue 525224. It is unclear if a replacement library is needed at all, or if existing WebUI testing infrastructure like TestBrowserProxy [3] is sufficient (needs to be investigated). [1] https://github.com/BladeRunnerJS/mock4js [2] https://cs.chromium.org/chromium/src/chrome/third_party/mock4js/ [3] https://cs.chromium.org/chromium/src/chrome/test/data/webui/test_browser_proxy.js
,
May 21 2018
So Mock4JS usage seems to be exposed by test_api.js via various helper methods, see [1]. Next step in the investigation would be to identify exactly where are those helper methods being used and see what can be done to replace such usages with something else. [1] https://cs.chromium.org/chromium/src/chrome/test/data/webui/test_api.js?l=1727 |
|
►
Sign in to add a comment |
|
Comment 1 by dpa...@chromium.org
, May 19 2018