Skip to content

Commit

Permalink
perf: hoist global check (#358)
Browse files Browse the repository at this point in the history
  • Loading branch information
nolanlawson committed Jun 30, 2023
1 parent b829d4c commit 60eeb8e
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/database/utils/cleanEmoji.js
@@ -1,12 +1,15 @@
const isFirefoxContentScript = typeof wrappedJSObject !== 'undefined'

// remove some internal implementation details, i.e. the "tokens" array on the emoji object
// essentially, convert the emoji from the version stored in IDB to the version used in-memory
export function cleanEmoji (emoji) {
if (!emoji) {
return emoji
}
// if inside a Firefox content script, need to clone the emoji object to prevent Firefox from complaining about cross-origin object
// if inside a Firefox content script, need to clone the emoji object to prevent Firefox from complaining about
// cross-origin object. See: https://github.com/nolanlawson/emoji-picker-element/issues/356
/* istanbul ignore if */
if (typeof wrappedJSObject !== 'undefined') {
if (isFirefoxContentScript) {
emoji = structuredClone(emoji)
}
delete emoji.tokens
Expand Down

0 comments on commit 60eeb8e

Please sign in to comment.