Skip to content
This repository was archived by the owner on Feb 26, 2024. It is now read-only.
This repository was archived by the owner on Feb 26, 2024. It is now read-only.

WebSocket patch on Android causes infinite recursion #233

Closed
@tlancina

Description

@tlancina

It looks like when canPatchViaPropertyDescriptor() is false, WebSocket's addEventListener is patched again: property-descriptor.ts#L29, websocket.ts#L6 after already being patched as part of browser.ts#L27.

Setting any of the WebSocket event handlers then causes infinite recursion as the "original" handler that gets called by the second patch is the already patched one from when the EventTarget handlers were patched: utils.ts#L86

You can reproduce minimally on desktop Chrome by breaking on property-descriptor.ts#L14 and having it return false: http://plnkr.co/edit/XF2mZMA6XBHuApVz6BJ4?p=preview (line 736 for me).

We had reports of this happening on Android 4.4 and 5.1, but I've only been able to reproduce on device with 4.4, though in theory it would happen for any devices where patching via property descriptors is unavailable.

Happy to submit a PR, but there is a lot going on between various different browsers and I'm not entirely sure what the best solution that wouldn't break other things is.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions