From d87c35b008ef0c423f7fba159fa456007ee9e270 Mon Sep 17 00:00:00 2001 From: Weston Ruter Date: Fri, 30 Jun 2023 20:51:28 +0000 Subject: [PATCH] Emoji: Give name to web worker in emoji loader and terminate when finished. See #58472. Follow-up to [56074], [56095]. Props westonruter, joemcgill. Fixes #58691. Built from https://develop.svn.wordpress.org/trunk@56119 git-svn-id: http://core.svn.wordpress.org/trunk@55631 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/js/wp-emoji-loader.js | 3 ++- wp-includes/js/wp-emoji-loader.min.js | 2 +- wp-includes/version.php | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/wp-includes/js/wp-emoji-loader.js b/wp-includes/js/wp-emoji-loader.js index 2dce4e2637..fbf1e97aa4 100644 --- a/wp-includes/js/wp-emoji-loader.js +++ b/wp-includes/js/wp-emoji-loader.js @@ -366,10 +366,11 @@ var blob = new Blob( [ workerScript ], { type: 'text/javascript' } ); - var worker = new Worker( URL.createObjectURL( blob ) ); + var worker = new Worker( URL.createObjectURL( blob ), { name: 'wpTestEmojiSupports' } ); worker.onmessage = function ( event ) { supportTests = event.data; setSessionSupportTests( supportTests ); + worker.terminate(); resolve( supportTests ); }; return; diff --git a/wp-includes/js/wp-emoji-loader.min.js b/wp-includes/js/wp-emoji-loader.min.js index 38f33b869f..13adf98896 100644 --- a/wp-includes/js/wp-emoji-loader.min.js +++ b/wp-includes/js/wp-emoji-loader.min.js @@ -1,2 +1,2 @@ /*! This file is auto-generated */ -!function(i,n){var a,o,e;function s(e){if("undefined"!=typeof sessionStorage)try{var t={supportTests:e,timestamp:(new Date).valueOf()};sessionStorage.setItem(a,JSON.stringify(t))}catch(e){}}function c(e,t,n){e.clearRect(0,0,e.canvas.width,e.canvas.height),e.fillText(t,0,0);var t=new Uint32Array(e.getImageData(0,0,e.canvas.width,e.canvas.height).data),r=(e.clearRect(0,0,e.canvas.width,e.canvas.height),e.fillText(n,0,0),new Uint32Array(e.getImageData(0,0,e.canvas.width,e.canvas.height).data));return t.every(function(e,t){return e===r[t]})}function p(e,t,n){switch(t){case"flag":return n(e,"\ud83c\udff3\ufe0f\u200d\u26a7\ufe0f","\ud83c\udff3\ufe0f\u200b\u26a7\ufe0f")?!1:!n(e,"\ud83c\uddfa\ud83c\uddf3","\ud83c\uddfa\u200b\ud83c\uddf3")&&!n(e,"\ud83c\udff4\udb40\udc67\udb40\udc62\udb40\udc65\udb40\udc6e\udb40\udc67\udb40\udc7f","\ud83c\udff4\u200b\udb40\udc67\u200b\udb40\udc62\u200b\udb40\udc65\u200b\udb40\udc6e\u200b\udb40\udc67\u200b\udb40\udc7f");case"emoji":return!n(e,"\ud83e\udef1\ud83c\udffb\u200d\ud83e\udef2\ud83c\udfff","\ud83e\udef1\ud83c\udffb\u200b\ud83e\udef2\ud83c\udfff")}return!1}function f(e,t,n){var r="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope?new OffscreenCanvas(300,150):i.createElement("canvas"),a=r.getContext("2d",{willReadFrequently:!0}),o=(a.textBaseline="top",a.font="600 32px Arial",{});return e.forEach(function(e){o[e]=t(a,e,n)}),o}function t(e){var t=i.createElement("script");t.src=e,t.defer=!0,i.head.appendChild(t)}"undefined"!=typeof Promise&&(a="wpEmojiSettingsSupports",o=["flag","emoji"],n.supports={everything:!0,everythingExceptFlag:!0},e=new Promise(function(e){i.addEventListener("DOMContentLoaded",e,{once:!0})}),new Promise(function(t){var n=function(){if("undefined"!=typeof sessionStorage&&a in sessionStorage)try{var e=JSON.parse(sessionStorage.getItem(a));if("object"==typeof e&&"number"==typeof e.timestamp&&(new Date).valueOf()