-
Notifications
You must be signed in to change notification settings - Fork 321
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
copy is not successful NotAllowedError: The Clipboard API has been blocked #5775
Comments
We're an iframe inside an iframe here. VS Code iframes the Dart-Code extensions webview, and the webview then has to iframe DevTools (we can't set a raw URL for the first iframe, we can only set its html contents). I suspect we just need to put the same I've opened Dart-Code/Dart-Code#4540 about this. |
I've been digging into this, but been unable to fix. I added some notes about this to Dart-Code/Dart-Code#4540. It seems like passing clipboard access cross-origin in iframes isn't working (this might be the cause of our other issue - microsoft/vscode#129178). Some people are falling back to older clipboard APIs that don'thave the same permissions requirements, but since this is handled by Flutter I don't know if that's a simple option. One possibility could be to pass the text up to the parent iframe via postMessage where we can write to the clipboard, but it feels a bit weird to be doing that in DevTools. Thoughts? |
Since this same setup seems to work outside of VS Code (nested iframes crossing origins with |
![](https://media.giphy.com/media/4URfklUToxk6A/giphy.gif) Adds a fallback behaviour for copying which will allow copy buttons to actually work in VSCode. NOTE: success toasts will no longer show in VSCode though. I've also added some logging just in case a user is looking at their console when a copy fails. Hopefully this provides enough information that the unhide-able error doesn't look suspicious. ![Screenshot 2023-10-26 at 10 53 39 AM](https://github.com/flutter/devtools/assets/1386322/b4ebd139-f3f5-4dd6-8c62-794f7d6df80d) Related to Dart-Code/Dart-Code#4814 Fixes #5775
![](https://media.giphy.com/media/4URfklUToxk6A/giphy.gif) Adds a fallback behaviour for copying which will allow copy buttons to actually work in VSCode. NOTE: success toasts will no longer show in VSCode though. I've also added some logging just in case a user is looking at their console when a copy fails. Hopefully this provides enough information that the unhide-able error doesn't look suspicious. ![Screenshot 2023-10-26 at 10 53 39 AM](https://github.com/flutter/devtools/assets/1386322/b4ebd139-f3f5-4dd6-8c62-794f7d6df80d) Related to Dart-Code/Dart-Code#4814 Fixes #5775
![](https://media.giphy.com/media/4URfklUToxk6A/giphy.gif) Adds a fallback behaviour for copying which will allow copy buttons to actually work in VSCode. NOTE: success toasts will no longer show in VSCode though. I've also added some logging just in case a user is looking at their console when a copy fails. Hopefully this provides enough information that the unhide-able error doesn't look suspicious. ![Screenshot 2023-10-26 at 10 53 39 AM](https://github.com/flutter/devtools/assets/1386322/b4ebd139-f3f5-4dd6-8c62-794f7d6df80d) Related to Dart-Code/Dart-Code#4814 Fixes #5775 Mirror package:web version from Flutter SDK
While testing log copying behaviour in VSCode, I noticed that the copy button is no longer working, when using it in the context of VSCode.
Alternatively, I have run Dart Devtools from the command line using
flutter run -d chrome
. When running devtools like this, the copy functionality seems to work just fine.The following is the log message that is output in the vscode developer console when the copy fails.
DevTools version: 2.23.1
Connected Device:
CPU / OS: x64 (64 bit) macos
Dart Version: 3.1.0-63.1.beta
Flutter Version: 3.11.0-1.0.pre.1 / beta
Framework / Engine: 74e4b092e5 / 992cdb6cd4
Connected app type: Flutter native (debug build)
The text was updated successfully, but these errors were encountered: