Opened on 08/15/2016 at 01:31:04 PM
Closed on 08/16/2016 at 08:23:12 AM
Last modified on 08/22/2016 at 11:54:47 AM
#4332 closed defect (fixed)
Objects produced by the wrapped WebSocket aren't considered WebSocket instances
Reported by: | trev | Assignee: | kzar |
---|---|---|---|
Priority: | P1 | Milestone: | Adblock-Plus-1.12.2-for-Chrome-Opera-Safari |
Module: | Platform | Keywords: | |
Cc: | sebastian, kzar, Ross, scheer | Blocked By: | |
Blocking: | #1727 | Platform: | Unknown / Cross platform |
Ready: | yes | Confidential: | no |
Tester: | Scheer | Verified working: | yes |
Review URL(s): |
Description
Environment
Adblock Plus 1.12.1.1640 on Chrome 52.
How to reproduce
- Go to https://google.com/
- Press Ctrl-Shift-J/Cmd-Option-J to open JavaScript console.
- Type new WebSocket("wss://google.com/") instanceof WebSocket and press Enter.
Observed behaviour
You see false printed to console.
Expected behaviour
It should be true, as you get for the new tab page where WebSocket isn't wrapped.
Background
It seems that we need to set .prototype property on the original WebSocket function as well, not merely the bound function. As http://www.ecma-international.org/ecma-262/5.1/#sec-15.3.5.3 explains, bound functions will redirect to their target function for subclass tests, so this one has to be associated with the right prototype.
Attachments (0)
Change History (5)
comment:1 Changed on 08/15/2016 at 07:30:17 PM by kzar
- Owner set to kzar
- Priority changed from Unknown to P1
- Review URL(s) modified (diff)
comment:2 Changed on 08/15/2016 at 07:30:34 PM by kzar
- Status changed from new to reviewing
comment:3 Changed on 08/16/2016 at 08:23:12 AM by kzar
- Cc Ross scheer added
- Milestone set to Adblock-Plus-1.12.2-for-Chrome-Opera-Safari
- Resolution set to fixed
- Status changed from reviewing to closed
comment:4 Changed on 08/22/2016 at 07:57:55 AM by scheer
- Tester changed from Unknown to Scheer
- Verified working set
- When entering the above I now receive:
-new WebSocket("wss://google.com/") instanceof WebSocket -true -WebSocket connection to 'wss://google.com/' failed: Error during WebSocket handshake: Unexpected response code: 400
Chrome 52
ABP 1.12.1.1644
comment:5 Changed on 08/22/2016 at 11:54:47 AM by rraceanu
Same results on Safari 9 and Opera 39.0.2256.48- ABP 1.21.1.1644
-true
-WebSocket connection to 'wss://google.com/' failed: Error during WebSocket handshake: Unexpected response code: 400
A commit referencing this issue has landed:
Fixes 4331, 4332 - WebSocket.length and instanceof WebSocket