Skip to content
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

fix(websocket): Fix PermissionDenied error being caught in constructor #8402

Merged
merged 11 commits into from
Nov 25, 2020

Conversation

crowlKats
Copy link
Member

Fixes #8394

Copy link
Member

@bartlomieju bartlomieju left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a unit test that assures PermissionDenied is thrown

@ry
Copy link
Member

ry commented Nov 20, 2020

I made a little test, @crowlKats is this sufficient to demo the problem?

@crowlKats
Copy link
Member Author

@ry thanks! yes it would. there shouldnt even really be any need for the eventhandler

@bartlomieju bartlomieju added this to the 1.6.0 milestone Nov 23, 2020
# Conflicts:
#	cli/tests/integration_tests.rs
@@ -0,0 +1 @@
warning: network access to "ws:https://localhost/", run again with the --allow-net flag
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a bit surprising, is there a reason why we can't catch this error? What happens if there's onerror handler attached to the WebSocket? It'd be great to test that scenario as well

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The error will be passed to the error event as well

cli/ops/websocket.rs Outdated Show resolved Hide resolved
Copy link
Member

@bartlomieju bartlomieju left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is preferable solution to the problem instead of logging a warning to the console

@bartlomieju bartlomieju changed the title fix(cli/websocket): Fix permissionDenied being caught in constructor fix(websocket): Fix PermissionDenied error being caught in constructor Nov 25, 2020
Copy link
Member

@bartlomieju bartlomieju left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks @crowlKats

@bartlomieju bartlomieju merged commit d40b071 into denoland:master Nov 25, 2020
@crowlKats crowlKats deleted the websocket_permission_error branch November 25, 2020 14:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

WebSocket silently exits if --allow-net is not enabled
3 participants