diff --git a/.travis.yml b/.travis.yml index 9d2f2e21..7147325b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,7 +7,7 @@ before_install: - git submodule update --init --recursive language: node_js node_js: - - "10.16.0" + - "14.3.0" script: - npm run build - npm test diff --git a/src/worker/workermain.ts b/src/worker/workermain.ts index 7ddd9ff4..d71e27e5 100644 --- a/src/worker/workermain.ts +++ b/src/worker/workermain.ts @@ -10,13 +10,11 @@ const emglobal : any = this['window'] || this['global'] || this; const ENVIRONMENT_IS_WEB = typeof window === 'object'; const ENVIRONMENT_IS_WORKER = typeof importScripts === 'function'; -//const self = emglobal.self; -//const __WORKER__ = function() { - // WebAssembly module cache // TODO: leaks memory even when disabled... var _WASM_module_cache = {}; -var CACHE_WASM_MODULES = true; +var CACHE_WASM_MODULES = true; // if false, use asm.js only + function getWASMModule(module_id:string) { var module = _WASM_module_cache[module_id]; if (!module) { diff --git a/test/cli/testworker.js b/test/cli/testworker.js index 36a9cfc8..6993d9b4 100644 --- a/test/cli/testworker.js +++ b/test/cli/testworker.js @@ -4,9 +4,6 @@ var fs = require('fs'); var wtu = require('./workertestutils.js'); //var heapdump = require('heapdump'); -// TODO: why memory leak? -CACHE_WASM_MODULES = false; - global.onmessage({data:{preload:'cc65', platform:'nes'}}); global.onmessage({data:{preload:'ca65', platform:'nes'}}); global.onmessage({data:{preload:'cc65', platform:'apple2'}}); diff --git a/test/cli/workertestutils.js b/test/cli/workertestutils.js index 251e8979..47814580 100644 --- a/test/cli/workertestutils.js +++ b/test/cli/workertestutils.js @@ -7,6 +7,13 @@ var worker = {}; global.window = global; global.exports = {}; +global.self = global; +global.location = {href:'.'}; +global.require = (modname) => { + console.log("REQUIRE",modname); + if (modname == 'path') + return require(modname); +}; global.btoa = require('btoa'); global.atob = require('atob');