Skip to content

MessageEvent throws an exception when trying to access data field and it's an object #1183

Closed
@DartBot

Description

@DartBot

This issue was originally filed by [email protected]


I send a message via postMessage to the window from javascript code and to receive it from the dart code. If I send a string message, dart code can access data field from MessageEvent without any problems. But If I send an object with postMessage, any access to data field causes exception.

JS code:
window.addEventListener('message', function(ev) {
    if (ev.data == 'init') {
        console.log(arguments);
        window.postMessage({some: 'message from js'}, '*');
    };
});

Dart code:
    window.on.message.add((ev) {
      if (ev.data != 'init') {
        window.console.log(ev.data);
        window.console.log(ev.data.some);
      }
    });
    window.postMessage('init', '*');

Console output:
MessageEvent
Uncaught TypeError: Object #<Object> has no method 'ptr$htmlimpl0a8e4b$$getter'

Metadata

Metadata

Assignees

No one assigned

    Labels

    closed-duplicateClosed in favor of an existing reportweb-librariesIssues impacting dart:html, etc., libraries

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions