Skip to content

Commit 5d8cee3

Browse files
authored
Merge branch 'main' into cw-audio-memory64
2 parents 59acd50 + 9c9b3f7 commit 5d8cee3

File tree

8 files changed

+556
-651
lines changed

8 files changed

+556
-651
lines changed

emcc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -568,7 +568,7 @@ def run(args):
568568
if '--version' in args:
569569
print(version_string())
570570
print('''\
571-
Copyright (C) 2014 the Emscripten authors (see AUTHORS.txt)
571+
Copyright (C) 2025 the Emscripten authors (see AUTHORS.txt)
572572
This is free and open source software under the MIT license.
573573
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
574574
''')

src/lib/libcore.js

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1341,7 +1341,7 @@ addToLibrary({
13411341
// respective time origins.
13421342
emscripten_get_now: () => performance.timeOrigin + {{{ getPerformanceNow() }}}(),
13431343
#else
1344-
#if MIN_FIREFOX_VERSION <= 14 || MIN_CHROME_VERSION <= 23 || MIN_SAFARI_VERSION <= 80400 || AUDIO_WORKLET // https://caniuse.com/#feat=high-resolution-time
1344+
#if AUDIO_WORKLET // https://github.com/WebAudio/web-audio-api/issues/2413
13451345
emscripten_get_now: `;
13461346
// AudioWorkletGlobalScope does not have performance.now()
13471347
// (https://github.com/WebAudio/web-audio-api/issues/2527), so if building
@@ -1371,7 +1371,7 @@ addToLibrary({
13711371
return 1; // nanoseconds
13721372
}
13731373
#endif
1374-
#if MIN_FIREFOX_VERSION <= 14 || MIN_CHROME_VERSION <= 23 || MIN_SAFARI_VERSION <= 80400 // https://caniuse.com/#feat=high-resolution-time
1374+
#if AUDIO_WORKLET // https://github.com/WebAudio/web-audio-api/issues/2413
13751375
if (typeof performance == 'object' && performance && typeof performance['now'] == 'function') {
13761376
return 1000; // microseconds (1/1000 of a millisecond)
13771377
}
@@ -1385,13 +1385,8 @@ addToLibrary({
13851385
// Represents whether emscripten_get_now is guaranteed monotonic; the Date.now
13861386
// implementation is not :(
13871387
$nowIsMonotonic__internal: true,
1388-
#if MIN_FIREFOX_VERSION <= 14 || MIN_CHROME_VERSION <= 23 || MIN_SAFARI_VERSION <= 80400 // https://caniuse.com/#feat=high-resolution-time
1389-
$nowIsMonotonic: `
1390-
((typeof performance == 'object' && performance && typeof performance['now'] == 'function')
1391-
#if ENVIRONMENT_MAY_BE_NODE
1392-
|| ENVIRONMENT_IS_NODE
1393-
#endif
1394-
);`,
1388+
#if AUDIO_WORKLET // // https://github.com/WebAudio/web-audio-api/issues/2413
1389+
$nowIsMonotonic: `((typeof performance == 'object' && performance && typeof performance['now'] == 'function'));`,
13951390
#else
13961391
// Modern environment where performance.now() is supported
13971392
$nowIsMonotonic: 1,

src/lib/libembind.js

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -176,21 +176,7 @@ var LibraryEmbind = {
176176
return errorClass;
177177
},
178178

179-
$createNamedFunction: (name, body) => Object.defineProperty(body, 'name', {
180-
value: name
181-
}),
182-
// All browsers that support WebAssembly also support configurable function name,
183-
// but we might be building for very old browsers via WASM2JS.
184-
#if MIN_CHROME_VERSION < 43 || MIN_SAFARI_VERSION < 100101 || MIN_FIREFOX_VERSION < 38
185-
// In that case, check if configurable function name is supported at init time
186-
// and, if not, replace with a fallback that returns function as-is as those browsers
187-
// don't support other methods either.
188-
$createNamedFunction__postset: `
189-
if (!Object.getOwnPropertyDescriptor(Function.prototype, 'name').configurable) {
190-
createNamedFunction = (name, body) => body;
191-
}
192-
`,
193-
#endif
179+
$createNamedFunction: (name, func) => Object.defineProperty(func, 'name', { value: name }),
194180

195181
$embindRepr: (v) => {
196182
if (v === null) {

src/lib/libhtml5.js

Lines changed: 0 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,6 @@ var LibraryHTML5 = {
4040
// information about that element in the event message.
4141
previousFullscreenElement: null,
4242
43-
#if MIN_SAFARI_VERSION <= 80000 || MIN_CHROME_VERSION <= 21 // https://caniuse.com/#search=movementX
44-
// Remember the current mouse coordinates in case we need to emulate
45-
// movementXY generation for browsers that don't support it.
46-
// Some browsers (e.g. Safari 6.0.5) only give movementXY when Pointerlock is active.
47-
previousScreenX: null,
48-
previousScreenY: null,
49-
#endif
50-
5143
// When the C runtime exits via exit(), we unregister all event handlers
5244
// added by this library to be nice and clean.
5345
// Track in this field whether we have yet registered that onExit handler.
@@ -460,24 +452,12 @@ var LibraryHTML5 = {
460452
#if MIN_FIREFOX_VERSION <= 40
461453
// https://caniuse.com/#feat=mdn-api_mouseevent_movementx
462454
|| e["mozMovementX"]
463-
#endif
464-
#if MIN_CHROME_VERSION <= 36 // || MIN_ANDROID_BROWSER_VERSION <= 4.4.4
465-
|| e["webkitMovementX"]
466-
#endif
467-
#if MIN_SAFARI_VERSION <= 80000 || MIN_CHROME_VERSION <= 21 // https://caniuse.com/#search=movementX
468-
|| (e.screenX-JSEvents.previousScreenX)
469455
#endif
470456
;
471457

472458
HEAP32[idx + {{{ C_STRUCTS.EmscriptenMouseEvent.movementY / 4 }}}] = e["movementY"]
473459
#if MIN_FIREFOX_VERSION <= 40
474460
|| e["mozMovementY"]
475-
#endif
476-
#if MIN_CHROME_VERSION <= 36 // || MIN_ANDROID_BROWSER_VERSION <= 4.4.4
477-
|| e["webkitMovementY"]
478-
#endif
479-
#if MIN_SAFARI_VERSION <= 80000 || MIN_CHROME_VERSION <= 21 // https://caniuse.com/#search=movementX
480-
|| (e.screenY-JSEvents.previousScreenY)
481461
#endif
482462
;
483463

@@ -495,21 +475,6 @@ var LibraryHTML5 = {
495475
var rect = getBoundingClientRect(target);
496476
HEAP32[idx + {{{ C_STRUCTS.EmscriptenMouseEvent.targetX / 4 }}}] = e.clientX - (rect.left | 0);
497477
HEAP32[idx + {{{ C_STRUCTS.EmscriptenMouseEvent.targetY / 4 }}}] = e.clientY - (rect.top | 0);
498-
499-
#if MIN_SAFARI_VERSION <= 80000 || MIN_CHROME_VERSION <= 21 // https://caniuse.com/#search=movementX
500-
#if MIN_CHROME_VERSION <= 76
501-
// wheel and mousewheel events contain wrong screenX/screenY on chrome/opera <= 76,
502-
// so there we should not record previous screen coordinates on wheel events.
503-
// https://bugs.chromium.org/p/chromium/issues/detail?id=699956
504-
// https://github.com/emscripten-core/emscripten/pull/4997
505-
if (e.type !== 'wheel') {
506-
#endif
507-
JSEvents.previousScreenX = e.screenX;
508-
JSEvents.previousScreenY = e.screenY;
509-
#if MIN_CHROME_VERSION <= 76
510-
}
511-
#endif
512-
#endif
513478
},
514479

515480
$registerMouseEventCallback__deps: ['$JSEvents', '$fillMouseEventData', '$findEventTarget', 'malloc'],
@@ -628,22 +593,6 @@ var LibraryHTML5 = {
628593
#endif
629594
if ({{{ makeDynCall('iipp', 'callbackfunc') }}}(eventTypeId, wheelEvent, userData)) e.preventDefault();
630595
};
631-
#if MIN_SAFARI_VERSION < 60100 // Browsers that do not support https://caniuse.com/#feat=mdn-api_wheelevent
632-
// The 'mousewheel' event as implemented in Safari 6.0.5
633-
var mouseWheelHandlerFunc = (e = event) => {
634-
fillMouseEventData(JSEvents.wheelEvent, e, target);
635-
{{{ makeSetValue('JSEvents.wheelEvent', C_STRUCTS.EmscriptenWheelEvent.deltaX, 'e["wheelDeltaX"] || 0', 'double') }}};
636-
/* 1. Invert to unify direction with the DOM Level 3 wheel event. 2. MSIE does not provide wheelDeltaY, so wheelDelta is used as a fallback. */
637-
var wheelDeltaY = -(e["wheelDeltaY"] || e["wheelDelta"])
638-
{{{ makeSetValue('JSEvents.wheelEvent', C_STRUCTS.EmscriptenWheelEvent.deltaY, 'wheelDeltaY', 'double') }}};
639-
{{{ makeSetValue('JSEvents.wheelEvent', C_STRUCTS.EmscriptenWheelEvent.deltaZ, '0 /* Not available */', 'double') }}};
640-
{{{ makeSetValue('JSEvents.wheelEvent', C_STRUCTS.EmscriptenWheelEvent.deltaMode, '0 /* DOM_DELTA_PIXEL */', 'i32') }}};
641-
var shouldCancel = {{{ makeDynCall('iipp', 'callbackfunc') }}}( eventTypeId, JSEvents.wheelEvent, userData);
642-
if (shouldCancel) {
643-
e.preventDefault();
644-
}
645-
};
646-
#endif
647596

648597
var eventHandler = {
649598
target,
@@ -652,11 +601,7 @@ var LibraryHTML5 = {
652601
#endif
653602
eventTypeString,
654603
callbackfunc,
655-
#if MIN_SAFARI_VERSION < 60100 // Browsers that do not support https://caniuse.com/#feat=mdn-api_wheelevent
656-
handlerFunc: (eventTypeString == 'wheel') ? wheelHandlerFunc : mouseWheelHandlerFunc,
657-
#else
658604
handlerFunc: wheelHandlerFunc,
659-
#endif
660605
useCapture
661606
};
662607
return JSEvents.registerOrRemoveHandler(eventHandler);
@@ -669,10 +614,6 @@ var LibraryHTML5 = {
669614
if (!target) return {{{ cDefs.EMSCRIPTEN_RESULT_UNKNOWN_TARGET }}};
670615
if (typeof target.onwheel != 'undefined') {
671616
return registerWheelEventCallback(target, userData, useCapture, callbackfunc, {{{ cDefs.EMSCRIPTEN_EVENT_WHEEL }}}, "wheel", targetThread);
672-
#if MIN_SAFARI_VERSION < 60100 // Browsers that do not support https://caniuse.com/#feat=mdn-api_wheelevent
673-
} else if (typeof target.onmousewheel != 'undefined') {
674-
return registerWheelEventCallback(target, userData, useCapture, callbackfunc, {{{ cDefs.EMSCRIPTEN_EVENT_WHEEL }}}, "mousewheel", targetThread);
675-
#endif
676617
} else {
677618
return {{{ cDefs.EMSCRIPTEN_RESULT_NOT_SUPPORTED }}};
678619
}
@@ -1724,20 +1665,13 @@ var LibraryHTML5 = {
17241665
#if MIN_FIREFOX_VERSION <= 40 // https://caniuse.com/#feat=pointerlock
17251666
} else if (target.mozRequestPointerLock) {
17261667
target.mozRequestPointerLock();
1727-
#endif
1728-
#if MIN_CHROME_VERSION <= 36 // https://caniuse.com/#feat=pointerlock
1729-
} else if (target.webkitRequestPointerLock) {
1730-
target.webkitRequestPointerLock();
17311668
#endif
17321669
} else {
17331670
// document.body is known to accept pointer lock, so use that to differentiate if the user passed a bad element,
17341671
// or if the whole browser just doesn't support the feature.
17351672
if (document.body.requestPointerLock
17361673
#if MIN_FIREFOX_VERSION <= 40 // https://caniuse.com/#feat=pointerlock
17371674
|| document.body.mozRequestPointerLock
1738-
#endif
1739-
#if MIN_CHROME_VERSION <= 36 // https://caniuse.com/#feat=pointerlock
1740-
|| document.body.webkitRequestPointerLock
17411675
#endif
17421676
) {
17431677
return {{{ cDefs.EMSCRIPTEN_RESULT_INVALID_TARGET }}};
@@ -1758,9 +1692,6 @@ var LibraryHTML5 = {
17581692
if (!target.requestPointerLock
17591693
#if MIN_FIREFOX_VERSION <= 40 // https://caniuse.com/#feat=pointerlock
17601694
&& !target.mozRequestPointerLock
1761-
#endif
1762-
#if MIN_CHROME_VERSION <= 36 // https://caniuse.com/#feat=pointerlock
1763-
&& !target.webkitRequestPointerLock
17641695
#endif
17651696
) {
17661697
return {{{ cDefs.EMSCRIPTEN_RESULT_NOT_SUPPORTED }}};
@@ -1794,10 +1725,6 @@ var LibraryHTML5 = {
17941725
#if MIN_FIREFOX_VERSION <= 40 // https://caniuse.com/#feat=pointerlock
17951726
} else if (document.mozExitPointerLock) {
17961727
document.mozExitPointerLock();
1797-
#endif
1798-
#if MIN_CHROME_VERSION <= 36 // https://caniuse.com/#feat=pointerlock
1799-
} else if (document.webkitExitPointerLock) {
1800-
document.webkitExitPointerLock();
18011728
#endif
18021729
} else {
18031730
return {{{ cDefs.EMSCRIPTEN_RESULT_NOT_SUPPORTED }}};
@@ -2482,11 +2409,7 @@ var LibraryHTML5 = {
24822409
#if ENVIRONMENT_MAY_BE_NODE || ENVIRONMENT_MAY_BE_SHELL
24832410
return (typeof devicePixelRatio == 'number' && devicePixelRatio) || 1.0;
24842411
#else // otherwise, on the web and in workers, things are simpler
2485-
#if MIN_FIREFOX_VERSION < 18 || MIN_CHROME_VERSION < 4 || MIN_SAFARI_VERSION < 30100 // https://caniuse.com/#feat=devicepixelratio
2486-
return window.devicePixelRatio || 1.0;
2487-
#else
24882412
return devicePixelRatio;
2489-
#endif
24902413
#endif
24912414
}
24922415
};

src/lib/libwebgl.js

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -787,12 +787,7 @@ for (/**@suppress{duplicate}*/var i = 0; i <= {{{ GL_POOL_TEMP_BUFFERS_SIZE }}};
787787
#endif
788788
:
789789
#endif
790-
(canvas.getContext("webgl", webGLContextAttributes)
791-
// https://caniuse.com/#feat=webgl
792-
#if MIN_FIREFOX_VERSION <= 23 || MIN_CHROME_VERSION <= 32 || MIN_SAFARI_VERSION <= 70101
793-
|| canvas.getContext("experimental-webgl", webGLContextAttributes)
794-
#endif
795-
);
790+
canvas.getContext("webgl", webGLContextAttributes);
796791
#endif // MAX_WEBGL_VERSION >= 2
797792

798793
#if GL_PREINITIALIZED_CONTEXT

test/test_other.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
# noqa: E241
88

99
from functools import wraps
10+
from datetime import datetime
1011
import glob
1112
import gzip
1213
import importlib
@@ -484,8 +485,10 @@ def test_emcc_basics(self, compiler, suffix):
484485
# --version
485486
output = self.run_process([compiler, '--version'], stdout=PIPE, stderr=PIPE)
486487
output = output.stdout.replace('\r', '')
488+
# This test will require updating once per year. Sorry.
489+
this_year = datetime.now().year
487490
self.assertContained('emcc (Emscripten gcc/clang-like replacement', output)
488-
self.assertContained('''Copyright (C) 2014 the Emscripten authors (see AUTHORS.txt)
491+
self.assertContained(f'''Copyright (C) {this_year} the Emscripten authors (see AUTHORS.txt)
489492
This is free and open source software under the MIT license.
490493
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
491494
''', output)

0 commit comments

Comments
 (0)