dart-archive / polymer-dart

Polymer support for Dart
https://pub.dartlang.org/packages/polymer
BSD 3-Clause "New" or "Revised" License
181 stars 33 forks source link

"Requesting mirror on un-marked class, superclass of 'JsProxy'" in Firefox #648

Closed zoechi closed 7 years ago

zoechi commented 8 years ago
  @property List columnCheckboxes = [];

  ...
  void _handleHeaderContextMenu(HeaderContextMenu e) {
    for (int i = 0; i < _columns.length; i++) {
      CbData cb = new CbData(_columns[i].id);

      cb.checked = _grid.getColumnIndex(_columns[i].id) != null;
      cb.text = _columns[i].name;
      add('columnCheckboxes', cb); // <= fails
    }
  }

I wasn't able to get a Dart stack trace from Firefox (using source maps) Hope this helps a bit:

image

zoechi commented 8 years ago

See also https://github.com/bwu-dart/bwu_datagrid/blob/issue648/lib/components/bwu_column_picker/bwu_column_picker.dart#L119

zoechi commented 8 years ago

If you want to try it yourself, the code is called when example_/web/checkbox_row_select.html is opened and the a column title is right-clicked. The _example directory is a sub-project with it's own pubspec.yaml

jakemac53 commented 8 years ago

Definitely a really strange issue to get in only FF.... I did check it out briefly and wasn't able to reproduce it, although I saw a couple other FF errors in the console.

eernstg commented 8 years ago

In transformed code, reflectable will throw this exception in the situation where a superclass invocation from the class named 'JsProxy' finds the "no such thing" index (which is -1, known as NO_CAPABILITY_INDEX in the source code) for its superclass.

If you wish to check it out, you should be able to find the class mirror for 'JsProxy' for the relevant reflector in the output from the reflectable transformer (that is, some file matching 'build/*/.dart'); the value -1 would be the 9th argument to a NonGenericClassMirrorImpl or a GenericClassMirrorImpl). This will confirm the scenario, but it is not particularly informative, because the crucial point is the generation of that value.

The core problem is that something makes that superclass unavailable, such that we generate -1 as the superclassIndex.

Is it possible that the superclass of JsProxy differs on different platforms, and that it is a private class on FF and a public class on other platforms? Of course, if that's really the case then it should be reproducible, which does not seem to be the case. Or maybe it depends on the exact version of FF?

On Mon, Nov 23, 2015 at 10:35 PM, Jacob MacDonald notifications@github.com wrote:

Definitely a really strange issue to get in only FF.... I did check it out briefly and wasn't able to reproduce it, although I saw a couple other FF errors in the console.

— Reply to this email directly or view it on GitHub https://github.com/dart-lang/polymer-dart/issues/648#issuecomment-159073014 .

Erik Ernst - Google Danmark ApS Skt Petri Passage 5, 2 sal, 1165 København K, Denmark CVR no. 28866984

zoechi commented 8 years ago

I just tried again. Currenty I get the error "element is not subclass of TemplateElement" in Firefox. Is this also what you were seeing @jakemac53 ?

jakemac53 commented 8 years ago

Yes, that was the error I saw.

eernstg commented 8 years ago

That looks like an entirely different issue; it is a failing checked-mode check, right? Could it be that you've been running in checked mode one time and production mode the other time, such that "element is not subclass of TemplateElement" was ignored in the first run? Some time later we could then get the failing attempt to look up the superclass of 'JsProxy', which may or may not be caused by an incorrectly typed entity in that context.

On Tue, Nov 24, 2015 at 3:47 PM, Jacob MacDonald notifications@github.com wrote:

Yes, that was the error I saw.

— Reply to this email directly or view it on GitHub https://github.com/dart-lang/polymer-dart/issues/648#issuecomment-159290297 .

Erik Ernst - Google Danmark ApS Skt Petri Passage 5, 2 sal, 1165 København K, Denmark CVR no. 28866984

zoechi commented 8 years ago

That's possible. I'll try it in unchecked and report back.

zoechi commented 8 years ago

@eernstg When I run it in Dartium checked-mode is used (at least it's enabled in WebStorm to run Dartium in checked mode). I assume pub serve also creates checked-mode JS output by default. But it's working fine in Dartium but fails in Firefox ('pub serve' generated JS).

eernstg commented 8 years ago

Maybe you could learn something by checking out the Reflectable.annotatedClasses, which would give you the classes that are supported by the given configuration. If you could find the superclass of JsProxy some other way then you might get some input on why that class might not be covered. The situation that comes to mind again is that this might be a private class on FF.

zoechi commented 8 years ago

I just found out that pub serve always uses production mode if checke-mode isn't specified in the pubspec.yaml dart2js transformer config. Have to investigate again.

zoechi commented 7 years ago

I don't know if this is still an issue. I'm not using Polymer anymore and therefore didn't run into it since then. Feel free to close.