diff --git a/test/test_browser.py b/test/test_browser.py index 3d6f309d6a121..8a616831ad76d 100644 --- a/test/test_browser.py +++ b/test/test_browser.py @@ -609,10 +609,16 @@ def test_preload_caching(self, extra_size): self.skipTest('chrome bug') create_file('somefile.txt', '''load me right before running the code please''' + ('_' * extra_size)) print('size:', os.path.getsize('somefile.txt')) - self.compile_btest('main.c', ['--use-preload-cache', '--js-library', 'test.js', '--preload-file', 'somefile.txt', '-o', 'page.html', '-sALLOW_MEMORY_GROWTH'], reporting=Reporting.JS_ONLY) + args = ['--use-preload-cache', '--js-library', 'test.js', '--preload-file', 'somefile.txt', '-o', 'page.html', '-sALLOW_MEMORY_GROWTH'] + self.compile_btest('main.c', args, reporting=Reporting.JS_ONLY) self.run_browser('page.html', '/report_result?exit:0') self.run_browser('page.html', '/report_result?exit:1') + # test with ENVIRONMENT=web, to check for problems with node.js support + # (see #23059) + self.compile_btest('main.c', args + ['-sENVIRONMENT=web'], reporting=Reporting.JS_ONLY) + self.run_browser('page.html', '/report_result?exit:0') + def test_preload_caching_indexeddb_name(self): self.set_setting('EXIT_RUNTIME') create_file('somefile.txt', '''load me right before running the code please''') diff --git a/tools/file_packager.py b/tools/file_packager.py index 5c48543588d16..d76e245b8eb7c 100755 --- a/tools/file_packager.py +++ b/tools/file_packager.py @@ -787,10 +787,13 @@ def generate_js(data_target, data_files, metadata): var DB_VERSION = 1; var METADATA_STORE_NAME = 'METADATA'; var PACKAGE_STORE_NAME = 'PACKAGES'; - function openDatabase(callback, errback) { - if (isNode) { - return errback(); - } + function openDatabase(callback, errback) {''' + if options.support_node: + code += ''' + if (isNode) { + return errback(); + }''' + code += ''' var indexedDB; if (typeof window === 'object') { indexedDB = window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB;