[wp-trac] [WordPress Trac] #57301: Emoji feature detection is incorrect
WordPress Trac
noreply at wordpress.org
Fri Feb 3 00:09:15 UTC 2023
#57301: Emoji feature detection is incorrect
---------------------------+--------------------------------------
Reporter: sergiomdgomes | Owner: dmsnell
Type: defect (bug) | Status: assigned
Priority: normal | Milestone: 6.2
Component: Emoji | Version: 5.3
Severity: normal | Resolution:
Keywords: | Focuses: javascript, performance
---------------------------+--------------------------------------
Comment (by dmsnell):
The easiest way to test this behavior will be to load a page in WordPress
and then inspect `_wpemojiSettings` in the browser dev tools. The
`supports` property will show whether the patch fixes the motivating bug.
1. Start with a blank WordPress site.
1. Set `define( SCRIPT_DEBUG, true )` in `wp-config` so that the source
JS file is served instead of the minified one. Remove the `wp-includes/js
/wp-emoji-loader.min.js` to ensure it won't be served.
1. Load the home page for that site.
1. Open the dev tools for your browser and inspect
`_wpemojiSettings.supports`
1. For modern browsers, `everything`, `flag`, and `emoji` should be
false, and `twemoji.js` and `wp-emoji.js` scripts should load to provide
support for the Emoji.
1. Apply
[https://core.trac.wordpress.org/attachment/ticket/57301/57301-3.diff
57301-3.diff] and reload the browser.
1. This time `everything`, `flag`, and `emoji` should be true, and
neither of the two emoji support scripts should load.
Looks like the attached pictures appeared inline so I won't copy them here
into the instructions, but I have provided screenshots of tests in Safari,
Firefox, and Chrome on macOS. Additionally I tested this on IE5 in Windows
98 but before and after both reported no support for the Emoji, which
isn't surprising because that support is missing. Still, the page did not
crash, which is the more important aspect of testing.
For mixed-support testing one needs to examine this on an OS that is old
enough to lack more recent Unicode updates, but I don't think that part of
the code has been under scrutiny or change, whereas the change is mostly
isolated to fixing two things:
- there was an outright bug in adding code points outside of the Basic
Multilingual Plane which `fromCharCode` cannot properly translate
- there was a change from storing these as numbers into storing these as
text to try and simplify the indirect way these strings are created
So all-in-all this is tested, confirmed, and safe. The only remaining
questions are additional enhancements beyond the scope of this ticket,
which are risks already present in WP that this patch does not also
ameliorate (that being, preventing someone from adding new Emoji detection
that breaks again).
--
Ticket URL: <https://core.trac.wordpress.org/ticket/57301#comment:28>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list