-
Notifications
You must be signed in to change notification settings - Fork 1.7k
JS interop corrupt DOM element if is used as argument in dart 1.14 and above (cross frame access issue) #25871
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
Comments
Not sure if this is an HTML lib issue at the root - or if this is something that needs fixing in our JS interop story. Please re-label accordingly. |
Is this in Dartium or dart2js? Cross-frame access is difficult, because the objects have different prototypes. I'll guess this is Dartium, and what's happening is that the conversion is not recognizing the other frame's document as needing to be converted to Document. But @jacob314 is the expert. |
This problem is only in Dartium. If I look deeper: part but problem may be in function wrap_jso And I mean it depend on modification in file 1.14 - condition is true and function return bad value wrapper::class is JsObjectImpl |
Some good news and some bad news. Bad news: the fact that this worked in Dartium 1.13 is a bug not a feature. The design was you should not be able to get access DOM objects from a different frame. You found a clever way to work around the restrictions we had in place to stop cross frame access by from JS switching what document an element was part of. |
Sounds good for us. Thank you for your response. |
There isn't a need for disableDart method. Creating and destroying iframe objects that have enableDart called on them will not leak memory. Think of it like enabling a JS polyfill on the iframe. |
Please re-open if this is still the case with the latest |
For our application we need to work with DOM elements inside iFrame.
Because DART does not allow cross-frame access even if window use same origin I must make little hack:
In DART:
In JS function do something like this:
In DART 1.13 and before
After I call _replaceElementInIframe I can take from div his ownerDocument without error and work with it as I want. For example insert other nodes to it, listen events ...
In DART 1.14 and above (1.15.0-dev.4.0 (ref 43e12db))
When I try to read ownerDocument from div, DART throws exception:
type 'JsObjectImpl' is not a subtype of type 'Document' of 'function result'.
(Same error is thrown if I try to read div.parentNode)
I try to use package:js and dart:js with same result. (with dart:js is little different code)
This is very limiting for us, because we cannot upgrade from DART 1.13 where are some other bugs which may be repaired in 1.14
The text was updated successfully, but these errors were encountered: