Changeset 56095
- Timestamp:
- 06/28/2023 05:24:36 PM (16 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/js/_enqueues/lib/emoji-loader.js
r56074 r56095 180 180 * @param {CanvasRenderingContext2D} context 2D Context. 181 181 * @param {string} type Whether to test for support of "flag" or "emoji". 182 * @param {Function} emojiSetsRenderIdentically Reference to emojiSetsRenderIdentically function, needed due to minification. 182 183 * 183 184 * @return {boolean} True if the browser can render emoji, false if it cannot. 184 185 */ 185 function browserSupportsEmoji( context, type ) {186 function browserSupportsEmoji( context, type, emojiSetsRenderIdentically ) { 186 187 var isIdentical; 187 188 … … 279 280 * 280 281 * @param {string[]} tests Tests. 282 * @param {Function} browserSupportsEmoji Reference to browserSupportsEmoji function, needed due to minification. 283 * @param {Function} emojiSetsRenderIdentically Reference to emojiSetsRenderIdentically function, needed due to minification. 281 284 * 282 285 * @return {SupportTests} Support tests. 283 286 */ 284 function testEmojiSupports( tests ) {287 function testEmojiSupports( tests, browserSupportsEmoji, emojiSetsRenderIdentically ) { 285 288 var canvas; 286 289 if ( … … 305 308 var supports = {}; 306 309 tests.forEach( function ( test ) { 307 supports[ test ] = browserSupportsEmoji( context, test );310 supports[ test ] = browserSupportsEmoji( context, test, emojiSetsRenderIdentically ); 308 311 } ); 309 312 return supports; … … 350 353 if ( supportsWorkerOffloading() ) { 351 354 try { 352 /* 353 * Note that this string contains the real source code for the 354 * copied functions, _not_ a string representation of them. This 355 * is because it's not possible to transfer a Function across 356 * threads. The lack of quotes is intentional. The function names 357 * are copied to variable names since minification will munge the 358 * function names, thus breaking the ability for the functions to 359 * refer to each other. 360 */ 355 // Note that the functions are being passed as arguments due to minification. 361 356 var workerScript = 362 'var emojiSetsRenderIdentically = ' + emojiSetsRenderIdentically + ';' + 363 'var browserSupportsEmoji = ' + browserSupportsEmoji + ';' + 364 'var testEmojiSupports = ' + testEmojiSupports + ';' + 365 'postMessage(testEmojiSupports(' + JSON.stringify(tests) + '));'; 357 'postMessage(' + 358 testEmojiSupports.toString() + 359 '(' + 360 [ 361 JSON.stringify( tests ), 362 browserSupportsEmoji.toString(), 363 emojiSetsRenderIdentically.toString() 364 ].join( ',' ) + 365 '));'; 366 366 var blob = new Blob( [ workerScript ], { 367 367 type: 'text/javascript' … … 377 377 } 378 378 379 supportTests = testEmojiSupports( tests );379 supportTests = testEmojiSupports( tests, browserSupportsEmoji, emojiSetsRenderIdentically ); 380 380 setSessionSupportTests( supportTests ); 381 381 resolve( supportTests );
Note: See TracChangeset
for help on using the changeset viewer.