New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"People and body" section doesn't work inside Firefox addon content script #356
Comments
@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 |
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. |
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 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. |
My theory is that what's happening here is
Just a theory, though. |
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 |
That fixed it! and no |
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. |
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 |
Apparently it's because of Twemoji use, so it's unrelated. |
When ran in Firefox addon's content script, opening "People and body" section doesnt work, it doesn't render emojis inside even though it switches the active section.
Error:
Error: Not allowed to define cross-origin object as property on [Object] or [Array] XrayWrapper
insidecleanEmoji
function, specificallyemoji.skins = Array(len);
, seems that assigning toemoji
causes this error but I wasn't able to figure out what's exactly wrong. Something about Firefox's sandboxRelated issue: dimdenGD/OldTwitter#77
The text was updated successfully, but these errors were encountered: