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

Dart2js Symbol and/or mirrors issue #11833

Closed
DartBot opened this issue Jul 15, 2013 · 13 comments
Closed

Dart2js Symbol and/or mirrors issue #11833

DartBot opened this issue Jul 15, 2013 · 13 comments

Comments

@DartBot
Copy link

DartBot commented Jul 15, 2013

This issue was originally filed by fra...@igindo.com


What steps will reproduce the problem?

  1. Create a base class in lib A and let it have one property
  2. Extends this class in lib B, or the main file, and add another property
  3. The property of the super class will be defined in the likes of Symbol("_liblib10$_name=")
  4. The property of the extending class however, looks normal, like Symbol("_id=")
  5. Now when I set properties via reflection, in the likes of extendedClassInstanceMirror.setField(symbol, value);
    Then JS crashes saying: Caught NoSuchMethodError : method not found: '_liblib10$_name='

Works fine in DartVM, crashes Dart2JS

Note, at no point did I create the Symbol via code, I did reflection on the extended class type, and the super class, and joined the 2 result lists to group both the super classes properties and subclasses properties in one List. Then loop the list to set properties at runtime to all properties of the extended class instance.

@DartBot
Copy link
Author

DartBot commented Jul 15, 2013

This comment was originally written by fra...@igindo.com


Actually, come to think of it, the above example allows me to access library private members via mirrors in the DartVM, not sure if this is as designed?

All properties I'm trying to set via instanceMirrors.setField are in fact private (underscored)

@DartBot
Copy link
Author

DartBot commented Jul 15, 2013

This comment was originally written by fra...@igindo.com


Update, I made the properties public, and then I get no crash in Dart2JS,
so it seems it is actually DartVM that has a scope security leak.

@iposva-google
Copy link
Contributor

Added Area-Dart2JS, Triaged labels.

@peter-ahe-google
Copy link
Contributor

There is no security leak in the Dart VM. Privacy in Dart is not a security mechanism.

You're supposed to be able to access private members using reflection, however, private symbols is a bit messed up at this time. Both in dart2js and in the VM.

@peter-ahe-google
Copy link
Contributor

Set owner to @peter-ahe-google.
Added Library-Mirrors, Accepted labels.

@peter-ahe-google
Copy link
Contributor

Marked this as blocking #6490.

@kasperl
Copy link

kasperl commented Sep 18, 2013

Added this to the M7 milestone.

@kasperl
Copy link

kasperl commented Sep 30, 2013

Removed Priority-Unassigned label.
Added Priority-Medium label.

@kasperl
Copy link

kasperl commented Oct 2, 2013

Removed this from the M7 milestone.
Added this to the M8 milestone.

@kasperl
Copy link

kasperl commented Jun 4, 2014

Removed this from the M8 milestone.
Added this to the 1.6 milestone.

@kasperl
Copy link

kasperl commented Jul 10, 2014

Removed this from the 1.6 milestone.
Added Oldschool-Milestone-1.6 label.

@kasperl
Copy link

kasperl commented Aug 4, 2014

Removed Oldschool-Milestone-1.6 label.

@sigmundch
Copy link
Member

closing this issue as a duplicate, since the main thing is to support privates in dart:mirrors, we also have #13597 to track that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants