Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modify type of MessageEvent.source because its type could be not an EventTarget #16814

Closed
efortuna opened this issue Feb 13, 2014 · 2 comments
Closed
Labels
type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)

Comments

@efortuna
Copy link
Contributor

In an effort to remove warnings for 1.2 Release I added some "unimplemented errors" since _DOMWindowCrossFrame implements WindowBase, which supposedly implements EventTarget. The real solution is to remove the "implements EventTarget" from WindowBase, but this causes a curious timeout on the Window.PostMessage layout test.

@efortuna
Copy link
Contributor Author

Did some more debugging on this one. The problem occurs in dartium/src/third_party/WebKit/LayouTests/dart/resources/pong.html :

return event.source.postMessage('echo: ${event.data}', ...)

which throws the error:

CONSOLE ERROR: Exception: type '_DOMWindowCrossFrame' is not a subtype of type 'EventTarget' of 'function result'.

basically event.source is listed as being only an EventTarget (https://api.dartlang.org/apidocs/channels/be/#dart-dom-html.MessageEvent@id_source)

and so this fails in checked mode because we were trying to remove the "implements EventTarget" from WindowBase, which _DOMWindowCrossFrame implements.

So in summary, MessageEvent.source can be an EventTarget, but ALSO a WindowCrossFrame. We need to change our return type to deal with this so we don't fail in checked mode!


Removed the owner.
Changed the title to: "Modify type of MessageEvent.source because its type could be not an EventTarget".

@kevmoo
Copy link
Member

kevmoo commented Feb 15, 2014

What are the docs for the source property?

The w3C docs say source should be Window: http://www.w3.org/TR/2008/WD-html5-20080610/comms.html

whatwg claims it can be a WindowProxy or MessagePort: http://www.whatwg.org/specs/web-apps/current-work/multipage/comms.html#messageevent

@kevmoo kevmoo added type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) and removed priority-unassigned labels Feb 29, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)
Projects
None yet
Development

No branches or pull requests

3 participants