Skip to content

Pushing window messages into an event bus causes an infinite loop #712

@EdBailey

Description

@EdBailey

Version

4.1.4

Browser and OS info

Chrome 68 / xubuntu 16.04

Steps to reproduce

Using the following code:

let bus = new Vue()
window.addEventListener('message', function (e) {
  bus.$emit('message', e.data)
}

What is expected?

Message events are pushed through my event bus and don't crash the app.

What is actually happening?

Any message posted to the window now gets looped by vue devtools, as it is trying to track the events fired on the event bus and appears to be using messages to do this.


I am using this to allow communication between an iframe and my main vue application.

I am willing to work around this by checking for something specific in the message data which my app will always use but it's a bit of a pain and restricts how I can use it.

Is there a better way I can blacklist devtools messages, rather than whitelisting specific messages?

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