diff --git a/test/test_core.py b/test/test_core.py index 8fb5f9e8fd50d..c1929141f43ac 100644 --- a/test/test_core.py +++ b/test/test_core.py @@ -7637,6 +7637,7 @@ def test_embind_no_rtti_followed_by_rtti(self): def test_webidl(self, mode, allow_memory_growth): self.uses_es6 = True self.set_setting('WASM_ASYNC_COMPILATION', 0) + self.set_setting('STRICT') if self.maybe_closure(): # avoid closure minified names competing with our test code in the global name space self.set_setting('MODULARIZE') @@ -7670,7 +7671,7 @@ def test_webidl(self, mode, allow_memory_growth): # Export things on "TheModule". This matches the typical use pattern of the bound library # being used as Box2D.* or Ammo.*, and we cannot rely on "Module" being always present (closure may remove it). - self.emcc_args += ['--post-js=glue.js', '--extern-post-js=extern-post.js'] + self.emcc_args += ['--no-entry', '--post-js=glue.js', '--extern-post-js=extern-post.js'] if mode == 'ALL': self.emcc_args += ['-sASSERTIONS'] if allow_memory_growth: diff --git a/test/webidl/post.js b/test/webidl/post.js index cb76024ad3d7a..18f0b3bb01a0d 100644 --- a/test/webidl/post.js +++ b/test/webidl/post.js @@ -239,7 +239,7 @@ try { } catch (e) {} try { - s = new TheModule.StringUser('abc', 1); + var s = new TheModule.StringUser('abc', 1); s.Print(123, null); // Expects a string or a wrapped pointer } catch (e) {} diff --git a/tools/webidl_binder.py b/tools/webidl_binder.py index 186544582f89c..0e5eb5dabdb31 100644 --- a/tools/webidl_binder.py +++ b/tools/webidl_binder.py @@ -133,6 +133,15 @@ def build_constructor(name): mid_js += build_constructor('WrapperObject') mid_js += [''' +/* + * For now, the webidl-generated code unconditionally depends on the `assert` function, + * but there are certain build modes where emscripten does not define this. + * TODO(sbc): Make the usage of assert conditional. + */ +if (typeof assert == "undefined") { + assert = (cond) => {} +} + /** @suppress {duplicate} (TODO: avoid emitting this multiple times, it is redundant) @param {*=} __class__ */ function getCache(__class__) {