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

Implement cache or equality on _DOMWindowCrossFrame #20174

Closed
mkustermann opened this issue Jul 23, 2014 · 2 comments
Closed

Implement cache or equality on _DOMWindowCrossFrame #20174

mkustermann opened this issue Jul 23, 2014 · 2 comments
Labels
area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. closed-obsolete Closed as the reported issue is no longer relevant library-html type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)

Comments

@mkustermann
Copy link
Member

Windows/IFrames of different origin communicate with each other via the postMessage() mechanism. A script on a window can listen for incoming messages, but needs to know from where the message originated. This is possible by looking at [MessageEvent.source].

The following conceptual program works in dartium but not after compiling it with dart2js:

import 'dart:html';

main() {
  var iframe = new IFrameElement();
  iframe.src = "...";
  document.body.append(iframe);
  window.onMessage.listen((MessageEvent event) {
    if (event.source == iframe.contentWindow) {
      // This message is coming from [iframe].
      // => We get in here in dartium but not in dart2js.
    }
  });
}

The root cause is that the two _DOMWindowCrossFrame objects are not the same. There is a TODO in the following code to fix this:

dart/tools/dom/src/dart2js_DOMImplementation.dart:
 ...
 47 static WindowBase _createSafe(w) {
 48 if (identical(w, window)) {
 49 return w;
 50 } else {
 51 // TODO(vsm): Cache or implement equality.
 52 return new _DOMWindowCrossFrame(w);
 53 }
 54 }
  ...

@vsm/blois: Is there any chance someone could work on this? Would be highly appreciated.

@mkustermann
Copy link
Member Author

cc @floitschG.

@vsmenon
Copy link
Member

vsmenon commented Jul 28, 2014

In Dartium, this is cached on the C++ side. Ideally, we could cache in dart2js as well - an expando on the JS wrapper?


cc @rakudrama.
Set owner to @efortuna.
Added Area-Library label.

@mkustermann mkustermann added Type-Defect library-html area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. labels Jul 28, 2014
@kevmoo kevmoo added type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) and removed triaged labels Mar 1, 2016
@efortuna efortuna removed their assignment Nov 16, 2017
@matanlurey matanlurey added the closed-obsolete Closed as the reported issue is no longer relevant label Jun 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. closed-obsolete Closed as the reported issue is no longer relevant library-html type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)
Projects
None yet
Development

No branches or pull requests

5 participants