Skip to content

Commit

Permalink
Feedback on emscripten-core#21775
Browse files Browse the repository at this point in the history
- Add changelog entry
- Fix typo in error message
- Improve error message
  • Loading branch information
sbc100 committed Apr 17, 2024
1 parent c75ca97 commit 555aad5
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
4 changes: 4 additions & 0 deletions ChangeLog.md
Expand Up @@ -20,6 +20,10 @@ See docs/process.md for more on how version tagging works.

3.1.58 (in development)
-----------------------
- In `-sMODULARIZE` mode, the argument passed into the module constructor is
no longer mutated in place. The expectation is that the module instance will
be available via the constructor return value. Attempting to access methods
on the object passed *into* the constructor will now abort. (#21775)
- Enable use of `::` to escape port option separator (#21710)
- In multi-threaded builds `--extern-pre-js` and `--extern-post-js` code is
now only run on the main thread, and not on each of the workers. (#21750)
Expand Down
6 changes: 1 addition & 5 deletions src/postamble_modularize.js
Expand Up @@ -29,11 +29,7 @@ for (const prop of Object.keys(Module)) {
Object.defineProperty(moduleArg, prop, {
configurable: true,
get() {
#if WASM_ASYNC_COMPILATION
abort(`Access to module property ('${prop}') is no longer possible via the incoming module contructor argument; Instead, use the result of the module promise.`)
#else
abort(`Access to module property ('${prop}') is no longer possible via the module input argument; Instead, use the module constructor return value.`)
#endif
abort(`Access to module property ('${prop}') is no longer possible via the module constructor argument; Instead, use the result of the module constructor.`)
}
});
}
Expand Down
6 changes: 3 additions & 3 deletions test/test_other.py
Expand Up @@ -6446,7 +6446,7 @@ def test_modularize_argument_misuse(self):
var promise = Module(arg);
arg._foo();''')

expected = "Aborted(Access to module property ('_foo') is no longer possible via the incoming module contructor argument; Instead, use the result of the module promise"
expected = "Aborted(Access to module property ('_foo') is no longer possible via the module constructor argument; Instead, use the result of the module constructor"
self.do_runf('test.c', expected, assert_returncode=NON_ZERO, emcc_args=['--no-entry', '-sMODULARIZE', '--extern-post-js=post.js'])

def test_export_all_3142(self):
Expand Down Expand Up @@ -6983,7 +6983,7 @@ def test_dlopen_bad_flags(self):
out = self.run_js('a.out.js')
self.assertContained('invalid mode for dlopen(): Either RTLD_LAZY or RTLD_NOW is required', out)

def test_dlopen_contructors(self):
def test_dlopen_constructors(self):
create_file('side.c', r'''
#include <stdio.h>
#include <assert.h>
Expand All @@ -6998,7 +6998,7 @@ def test_dlopen_contructors(self):
__attribute__((constructor)) void ctor(void) {
printf("foo address: %p\n", ptr);
// Check that relocations have already been applied by the time
// contructor functions run.
// constructor functions run.
check_relocations();
printf("done ctor\n");
}
Expand Down

0 comments on commit 555aad5

Please sign in to comment.