diff --git a/wp-includes/js/wp-emoji-loader.js b/wp-includes/js/wp-emoji-loader.js index fbf1e97aa4..3d2a161f1a 100644 --- a/wp-includes/js/wp-emoji-loader.js +++ b/wp-includes/js/wp-emoji-loader.js @@ -73,25 +73,20 @@ * @returns {?SupportTests} Support tests, or null if not set or older than 1 week. */ function getSessionSupportTests() { - if ( - typeof sessionStorage !== 'undefined' && - sessionStorageKey in sessionStorage - ) { - try { - /** @type {SessionSupportTests} */ - var item = JSON.parse( - sessionStorage.getItem( sessionStorageKey ) - ); - if ( - typeof item === 'object' && - typeof item.timestamp === 'number' && - new Date().valueOf() < item.timestamp + 604800 && // Note: Number is a week in seconds. - typeof item.supportTests === 'object' - ) { - return item.supportTests; - } - } catch ( e ) {} - } + try { + /** @type {SessionSupportTests} */ + var item = JSON.parse( + sessionStorage.getItem( sessionStorageKey ) + ); + if ( + typeof item === 'object' && + typeof item.timestamp === 'number' && + new Date().valueOf() < item.timestamp + 604800 && // Note: Number is a week in seconds. + typeof item.supportTests === 'object' + ) { + return item.supportTests; + } + } catch ( e ) {} return null; } @@ -105,20 +100,18 @@ * @param {SupportTests} supportTests Support tests. */ function setSessionSupportTests( supportTests ) { - if ( typeof sessionStorage !== 'undefined' ) { - try { - /** @type {SessionSupportTests} */ - var item = { - supportTests: supportTests, - timestamp: new Date().valueOf() - }; + try { + /** @type {SessionSupportTests} */ + var item = { + supportTests: supportTests, + timestamp: new Date().valueOf() + }; - sessionStorage.setItem( - sessionStorageKey, - JSON.stringify( item ) - ); - } catch ( e ) {} - } + sessionStorage.setItem( + sessionStorageKey, + JSON.stringify( item ) + ); + } catch ( e ) {} } /** diff --git a/wp-includes/js/wp-emoji-loader.min.js b/wp-includes/js/wp-emoji-loader.min.js index 13adf98896..e4d1b12b52 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 o,s,e;function c(e){if("undefined"!=typeof sessionStorage)try{var t={supportTests:e,timestamp:(new Date).valueOf()};sessionStorage.setItem(o,JSON.stringify(t))}catch(e){}}function p(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 f(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 u(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&&(o="wpEmojiSettingsSupports",s=["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&&o in sessionStorage)try{var e=JSON.parse(sessionStorage.getItem(o));if("object"==typeof e&&"number"==typeof e.timestamp&&(new Date).valueOf()