File tree Expand file tree Collapse file tree 2 files changed +12
-9
lines changed
Expand file tree Collapse file tree 2 files changed +12
-9
lines changed Original file line number Diff line number Diff line change @@ -3117,13 +3117,16 @@ var LibrarySDL = {
31173117 try {
31183118 var offscreenCanvas = new OffscreenCanvas ( 0 , 0 ) ;
31193119 SDL . ttfContext = offscreenCanvas . getContext ( '2d' ) ;
3120- // Firefox support for OffscreenCanvas is still experimental, and it seems
3121- // like CI might be creating a context here but one that is not entirely
3122- // valid. Check that explicitly and fall back to a plain Canvas if we need
3123- // to. See https://github.com/emscripten-core/emscripten/issues/16242
3124- if ( typeof SDL . ttfContext . measureText != 'function' ) {
3125- abort ( 'bad context' ) ;
3120+ #if MIN_FIREFOX_VERSION < 128 // Conservative, not exact
3121+ // According to https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvasRenderingContext2D
3122+ // OffscreenCanvasRenderingContext2D.measureText() appeared in
3123+ // Chrome 69, Firefox 105 and Safari 16.4. Fall back to using regular
3124+ // Canvas2D if OffscreenCanvas2D exists, but does not look workable.
3125+ // https://github.com/emscripten-core/emscripten/issues/16242
3126+ if ( ! SDL . ttfContext . measureText ) {
3127+ throw 1 ; // no OffscreenCanvasRenderingContext2D.measureText
31263128 }
3129+ #endif
31273130 } catch ( ex ) {
31283131 var canvas = /** @type {HTMLCanvasElement } */ ( document . createElement ( 'canvas' ) ) ;
31293132 SDL . ttfContext = canvas . getContext ( '2d' ) ;
Original file line number Diff line number Diff line change 11{
2- "a.out.js" : 246028 ,
3- "a.out.nodebug.wasm" : 597755 ,
4- "total" : 843783 ,
2+ "a.out.js" : 246004 ,
3+ "a.out.nodebug.wasm" : 597763 ,
4+ "total" : 843759 ,
55 "sent" : [
66 " IMG_Init" ,
77 " IMG_Load" ,
You can’t perform that action at this time.
0 commit comments