Skip to content

dart2js: compiled html apps are not forward compatible: new browsers can break deployed apps #13285

@jmesserly

Description

@jmesserly

dart2js compiled apps are not safe to be deployed long term. Browsers can break Dart apps in ways that would not break an application written purely in JavaScript.

dart2js+html's dynamic dispatch works roughly like:

  1. find the target object's JS type name (see getFunctionForTypeNameOf in native_helper.dart)
  2. map JS type name to corresponding Dart type
  3. apply Dart semantics for that method call

Some type names like "Node" and "HTMLElement" are specified and likely to be safe to use for the foreseeable future.

However, many other type names can and do get changed by browsers between major releases. For example, Firefox renamed the type that backs ".attributes" to MozNamedAttrMap, and this broke all use of HTML attributes.
(http://code.google.com/p/dart/issues/detail?id=11879). According to Pete this happened twice with IE11 as well. I think we have seen similar issues in Blink rolls.

How do we solve this for Dart 1.0? We must have a way to deploy apps that is not going to need recompilation whenever a browser vendor releases a new version...

Other scary facts about our current dispatch:

  • it relies on User Agent sniffing
  • both IE and Firefox have ad hoc rename tables (see typeNameInFirefox, typeNameInIE)
  • everything falls back to Object.prototype.toString. From the perspective of HTML/DOM standards, the behavior here is unspecified. Typical JavaScript programs don't depend on it except for debugging.

Metadata

Metadata

Assignees

Labels

P1A high priority bug; for example, a single project is unusable or has many test failureslibrary-htmltype-bugIncorrect behavior (everything from a crash to more subtle misbehavior)web-dart2js

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions