Skip to content

Commit 555aad5

Browse files
committed
- Add changelog entry - Fix typo in error message - Improve error message
1 parent c75ca97 commit 555aad5

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

ChangeLog.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ See docs/process.md for more on how version tagging works.
2020

2121
3.1.58 (in development)
2222
-----------------------
23+
- In `-sMODULARIZE` mode, the argument passed into the module constructor is
24+
no longer mutated in place. The expectation is that the module instance will
25+
be available via the constructor return value. Attempting to access methods
26+
on the object passed *into* the constructor will now abort. (#21775)
2327
- Enable use of `::` to escape port option separator (#21710)
2428
- In multi-threaded builds `--extern-pre-js` and `--extern-post-js` code is
2529
now only run on the main thread, and not on each of the workers. (#21750)

src/postamble_modularize.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,7 @@ for (const prop of Object.keys(Module)) {
2929
Object.defineProperty(moduleArg, prop, {
3030
configurable: true,
3131
get() {
32-
#if WASM_ASYNC_COMPILATION
33-
abort(`Access to module property ('${prop}') is no longer possible via the incoming module contructor argument; Instead, use the result of the module promise.`)
34-
#else
35-
abort(`Access to module property ('${prop}') is no longer possible via the module input argument; Instead, use the module constructor return value.`)
36-
#endif
32+
abort(`Access to module property ('${prop}') is no longer possible via the module constructor argument; Instead, use the result of the module constructor.`)
3733
}
3834
});
3935
}

test/test_other.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6446,7 +6446,7 @@ def test_modularize_argument_misuse(self):
64466446
var promise = Module(arg);
64476447
arg._foo();''')
64486448

6449-
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"
6449+
expected = "Aborted(Access to module property ('_foo') is no longer possible via the module constructor argument; Instead, use the result of the module constructor"
64506450
self.do_runf('test.c', expected, assert_returncode=NON_ZERO, emcc_args=['--no-entry', '-sMODULARIZE', '--extern-post-js=post.js'])
64516451

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

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

0 commit comments

Comments
 (0)