-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Don't throw an error if access to the clipboard is denied. #6516
Conversation
} | ||
} | ||
if (permission.state === 'denied') { | ||
// most likely, the user intentionally denied the access | ||
this.messageService.error("Access to the clipboard is denied. Check your browser's permission."); | ||
throw new Error('Access to the clipboard is denied.'); | ||
this.messageService.warn("Access to the clipboard is denied. Check your browser's permission."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is not it confusing that we use the same warning message for read and write? Would not it better to have Read access
and Write access
instead of just Access
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But there're no separate read/write settings available to the user. It's just general access.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, I was concerned to know from where an error is coming, right now it is not clear whether extension tried to read or write. probably it is not important, let's wait with it.
@akosyakov I've addressed your comments. Thanks for reviewing! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good, please clean up the history (squash commits) and merge
Signed-off-by: Artem Zatsarynnyi <[email protected]>
b3d3014
to
8d266f6
Compare
Signed-off-by: Artem Zatsarynnyi [email protected]
What it does
When the user has denied access to the clipboard, it should not be treated as an error, by Theia.
The user just needs to be warned about it.
fixes eclipse-che/che#15093
How to test
1/ Run Theia with the test extension https://github.com/azatsarynnyy/test-clipboard-api/blob/master/clipboard-api-test-0.0.1.vsix
2/ Deny the browser accessing the clipboard from Theia page.
3/ Call
Clipboard: read from clipboard
command from the commands palette.w/o the patch
![image](https://user-images.githubusercontent.com/1636395/68476899-b2d3c780-0234-11ea-9de9-6b67d624626e.png)
w/ the patch
![image](https://user-images.githubusercontent.com/1636395/68477218-8a000200-0235-11ea-9e09-d1eaa1743cf0.png)
Review checklist
Reminder for reviewers