chromium-websocket-wrapper icon indicating copy to clipboard operation
chromium-websocket-wrapper copied to clipboard

https://github.com/gorhill/chromium-websocket-wrapper/issues/3

Open ameshkov opened this issue 9 years ago • 6 comments

Details of the issue: https://github.com/AdguardTeam/AdguardBrowserExtension/issues/307

Take a look at "Event" properties overriding. Pretty ugly, but I have not found a better way.

ameshkov avatar Jul 28 '16 20:07 ameshkov

Sorry, I haven't had time to look at the code yet -- I will try to do so soon.

FYI @kzar, you probably want to test that site also for https://issues.adblockplus.org/ticket/1727.

gorhill avatar Aug 10 '16 14:08 gorhill

@gorhill Thanks for the heads up, I just checked and luckily the implementation for #1727 doesn't have the same problem.

kzar avatar Aug 10 '16 15:08 kzar

@gorhill JFYI, here is @kzar implementation: https://codereview.adblockplus.org/29347034/diff/29349640/include.preload.js

The downside is that it does not prevent the actual WS connection. On the other hand it is very simple, no vodoo magic with events and such, and it works. Nice:)

ameshkov avatar Aug 10 '16 16:08 ameshkov

As of a few minutes ago it has landed in our repository too :+1: (FWIW it does prevent the WS connection, for me at least. I tested with WireShark to make sure no connections were leaked, not even the initial HTTP upgrade request. It's true, as discussed in the code review, that this could be a race condition or change with browser implementation however.)

kzar avatar Aug 10 '16 17:08 kzar

I guess for @gorhill's approach it won't be that good as he sends a web request to detect if WS connection should be blocked or not. But in our case with relying on Chrome messaging it is good enough indeed.

not even the initial HTTP upgrade request

Have you tested it with WS or WSS? I mean the difference is pretty huge, SSL handshake takes at least 20-30ms which is more than enough for checking and closing it before upgrade request is sent.

ameshkov avatar Aug 10 '16 17:08 ameshkov

IIRC HTTP because I couldn't get the test to work with HTTPS, but I can't remember for sure.

kzar avatar Aug 10 '16 17:08 kzar