Skip to content

Commit 4698834

Browse files
authored
[libbrowser.js] Remove non-standard Module exports (#24269)
Anyone who wants to use these functions on the Module object can export them using e.g. `-sEXPORTED_FUNCTIONS=getUserMedia`. As part of this I had to inject the export of `createContext` for SDL2 and SDL3 which were using `Module['createContext']` for some reason. I'm working on upstream patches to remove this usage.
1 parent 06748b0 commit 4698834

13 files changed

+46
-26
lines changed

ChangeLog.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,11 @@ See docs/process.md for more on how version tagging works.
2323
- libunwind was updated to LLVM 20.1.4. (#24251)
2424
- When using cmake the EMSCRIPTEN_FORCE_COMPILERS setting was reverted to
2525
being on by default due to issues that were found with disabling it. (#24223)
26-
- Embind symbols `InternalError`, `BindingError`, and `count_emval_handles` are
27-
no longer exported by default. They can be exported using
28-
`-sEXPORTED_RUNTIME_METHODS=InternalError,BindingError,count_emval_handles`
26+
- Several symbols from embind (`InternalError`, `BindingError`,
27+
`count_emval_handles`) and from `libbrowser.py` (`requestFullscreen`,
28+
`requestFullScreen`, `createContext`, `getUserMedia`, `setCanvasSize`) are no
29+
longer exported by default. They can be exported using
30+
`-sEXPORTED_RUNTIME_METHODS=requestFullscreen`, for example. (#24223, #24269)
2931

3032
4.0.8 - 04/30/25
3133
----------------

src/lib/libbrowser.js

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,6 @@ var LibraryBrowser = {
1717
#endif
1818
#endif
1919
],
20-
$Browser__postset: `
21-
// exports
22-
Module['requestFullscreen'] = Browser.requestFullscreen;
23-
#if ASSERTIONS
24-
Module['requestFullScreen'] = Browser.requestFullScreen;
25-
#endif
26-
Module['setCanvasSize'] = Browser.setCanvasSize;
27-
Module['getUserMedia'] = Browser.getUserMedia;
28-
Module['createContext'] = Browser.createContext;
29-
`,
3020

3121
$Browser: {
3222
useWebGL: false,
@@ -591,6 +581,14 @@ var LibraryBrowser = {
591581
},
592582
},
593583

584+
$requestFullscreen: 'Browser.requestFullscreen',
585+
#if ASSERTIONS
586+
$requestFullScreen: 'Browser.requestFullScreen',
587+
#endif
588+
$setCanvasSize: 'Browser.setCanvasSize',
589+
$getUserMedia: 'Browser.getUserMedia',
590+
$createContext: 'Browser.createContext',
591+
594592
emscripten_run_preload_plugins__deps: ['$PATH'],
595593
emscripten_run_preload_plugins__proxy: 'sync',
596594
emscripten_run_preload_plugins: (file, onload, onerror) => {

test/browser/test_sdl2_canvas_write.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ int main(void) {
6363
if (SDL_Init(SDL_INIT_VIDEO) != 0)
6464
sdlError("SDL_Init");
6565

66-
window = SDL_CreateWindow("SDL 2 test", 0, 0, 256, 256, SDL_WINDOW_SHOWN);
66+
window = SDL_CreateWindow("SDL2 test", 0, 0, 256, 256, SDL_WINDOW_SHOWN);
6767
if (window == NULL) {
6868
sdlError("SDL_CreateWindow");
6969
}

test/browser/test_sdl3_canvas_write.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ int main(void) {
6969
sdlError("SDL_Init");
7070
}
7171

72-
window = SDL_CreateWindow("SDL 2 test", 256, 256, 0);
72+
window = SDL_CreateWindow("SDL3 test", 256, 256, 0);
7373
if (window == NULL) {
7474
sdlError("SDL_CreateWindow");
7575
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
8292
1+
8312
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
22165
1+
22242
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
6595
1+
6617
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
17534
1+
17611
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
53603
1+
53705
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
51653
1+
51755

0 commit comments

Comments
 (0)