Comments (10)
That fixed it! and no window.wrappedJSObject
needed to work too
from emoji-picker-element.
@dimdenGD Thanks for filing! Do you have a test to reproduce? Have you filed a bug on Firefox?
I've only glanced at this issue, but it seems unlikely that it can be fixed on the emoji-picker-element
side of things... It appears to be a Firefox issue.
from emoji-picker-element.
There seems to be almost identical bug filed: https://bugzilla.mozilla.org/show_bug.cgi?id=1475950 which was closed already. I don't think this a Firefox bug, just a specific security measure on Firefox that needs to be addressed properly when detected to be used inside Firefox sandboxed window. The only (easy) way to reproduce right now is to use my extension Old Twitter Layout on Firefox and open emoji picker in it.
from emoji-picker-element.
This definitely appears to be a bug in Firefox. I believe the error is caused by the line:
Based on the bug, it looks like Firefox is doing some kind of sandboxing of globals; I assume the global Array
is confusing it here.
I don't know the first thing about Firefox extension development, so I can repro but I don't know how to test a fix. In your use of the emoji picker, could you try:
- emoji.skins = Array(len);
+ emoji.skins = [];
for (let i = 0; i < len; i++) {
- emoji.skins[i] = {
+ emoji.skins.push({
tone: emoji.skinTones[i],
unicode: emoji.skinUnicodes[i],
version: emoji.skinVersions[i]
- };
+ });
}
If that fixes the issue (and there are no other bugs!) then you have a repro you can file on Mozilla for sure.
from emoji-picker-element.
My theory is that what's happening here is
- The object comes back from IndexedDB
- We try to set
Array()
on it - Firefox is confused about the origin of the IndexedDB object versus the
Array
global - Boom
Just a theory, though.
from emoji-picker-element.
Originally I thought it's caused by assigning anything into emoji
but I tested and assigning a number works fine, before opening this issue I also tried basically same code as you just showed and it didn't work, so neither Array
nor []
works for this.
Using window.wrappedJSObject.Array()
seems to work for first line, but then it errors on version
with same error for whatever reason:
from emoji-picker-element.
Could you try this:
function cleanEmoji (emoji) {
if (!emoji) {
return emoji
}
+ emoji = structuredClone(emoji);
delete emoji.tokens;
Maybe cloning it will cause Firefox to stop complaining? If structuredClone
doesn't work, you can also try JSON.parse(JSON.stringify(emoji))
.
from emoji-picker-element.
Thanks! FWIW I noticed that the skintone picker also appeared to be not working in your extension. (Open the dropdown, select a skintone, it never updates.) Not sure if that's related.
from emoji-picker-element.
Just checked, it seems to update the emojis, but only after going to other category and then back to People and body. Not sure if it's supposed to update hand skin color itself. This happens on both Chrome and Firefox and doesn't throw any error. I'll check this out
from emoji-picker-element.
Apparently it's because of Twemoji use, so it's unrelated.
from emoji-picker-element.
Related Issues (20)
- Emoji v15.0
- Skintone dropdown is not dismissed when using Shift+Tab
- "Salute" emoji is visually truncated on MacOS/iOS HOT 1
- Only use custom emojis HOT 4
- How do I use emoji-picker-element in a simple HTML page (no modules)? HOT 3
- Underscores in when hovering over emoji in the picker HOT 3
- Install procedure with a SvelteKit app HOT 9
- Alternative emoji support level check? HOT 1
- Default favorites have the "heart suit" emoji, not the "red heart" emoji
- Not working when used on browser extension HOT 1
- Changing `customEmoji` incorrectly decrements current active nav button
- Favorites bar updates randomly
- Unify language codes in the i18n file names. HOT 4
- `--emoji-font-family` CSS property not working correctly on Windows HOT 2
- Add possibility to disable sending "HEAD" request when it is needed. HOT 1
- TypeError: shadowRootNode.getElementById is not a function. HOT 11
- Use TrustedTypes when setting `innerHTML`
- Programmatically select initial category
- IDB InvalidStateError due to timing issues with lazy-updates in database HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from emoji-picker-element.