-
Notifications
You must be signed in to change notification settings - Fork 48.6k
Disable unsupported context menu options for Firefox #17668
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
Disable unsupported context menu options for Firefox #17668
Conversation
…ns for Firefox addon
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit f8f2440:
|
Tagging a few random reviewers who (I think) aren't yet on PTO 😄 |
|
@digitarald |
@bvaughn that's disappointing, but maybe it shouldn't be too surprising as I did not test it. My hope was that console commands, would just work in the extension. CC @nchevobbe @rpl |
@jasonLaster No worries! Here's a pointer to the code: react/packages/react-devtools-extensions/src/main.js Lines 154 to 171 in 1b9328c
The way this works currently is the frontend sends a The extension is involved because JavaScript running in the document itself can't call |
In firefox the interaction with the clipboard from an extension requires additional permissions ("clipboardRead" and/or "clipboardWrite"), some details about that are available in the following MDN doc page: In particular this section may be helpful: https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Interact_with_the_clipboard#Browser-specific_considerations (and in case it may be also helpful, here are the related test cases from mozilla-central: https://searchfox.org/mozilla-central/source/toolkit/components/extensions/test/mochitest/test_ext_clipboard.html) I just gave a quick look and (at least if I'm reading it correctly) currently About the issue with
And so I'm wondering what is set on the @jasonLaster @bvaughn would you mind to give me some steps to be able to reproduce this issue locally? |
I mentioned this in the Firefox Slack but I guess I forgot to add it to this PR- I already tried adding the I pushed this test to a branch (
The reason In general, DevTools avoids sending data across the
Neither |
I'm going to merge this for now so the feature doesn't block an extension release to the browser stores. I'll be happy to follow up and re-add support for Firefox in a future PR if we figure out a path forward that satisfies the above constraints. |
I filed #17681 as a follow up. |
Unfortunately the "copy to clipboard" and "go to definition" context menu options do not work for the Firefox add-on. I'm not sure why "go to definition" doesn't work. (Seems like it should but it just fails silently.) The clipboard option seems more obviously broken though.
We currently use

document.execCommand("copy")
which works for Chrome but fails for Firefox with the following error:Unfortunately, using the newer Clipboard API fails for both browsers:

So for now it seems the best we can do is stick with the old
execCommand
API and disable the menu option for Firefox.Chrome demo
Firefox demo