Skip to content

dart2js: default toString method crashes on Firefox #3389

Closed
@rakudrama

Description

@rakudrama

This code is trying to say "Instance of 'foo'"
Not all objects have a constructor with a name, so name$ is 'undefined'.
This causes an error in $.charCodeAt.

$.objectToString = function(object) {
  var name$ = (object.constructor.name);
  if ($.charCodeAt(name$, 0) === 36) {
    name$ = $.substring$1(name$, 1);
  }
  return 'Instance of '' + $.stringToString(name$) + ''';
};

Several tests print objects and fail because of this problem.

I suggest taking the name out of the string returned by Object.prototype.toString.call(receiver)

Metadata

Metadata

Assignees

Labels

P1A high priority bug; for example, a single project is unusable or has many test failuresweb-dart2js

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions