My dart2js compiled Chrome Packaged App crashes with Uncaught Error: Instance of 'UnknownJavaScriptObject'
and ReferenceError: DartObject is not defined
.
The full stack trace follows
Uncaught Error: Instance of 'UnknownJavaScriptObject' echo_mco.dart.js:7913
Stack Trace:
ReferenceError: DartObject is not defined
at dart._convertToDart (chrome-extension://paadaccdfibbhkkhjaolagidoopakdik/echo_mco.dart.js:7422:34)
at JsObject.$index (chrome-extension://paadaccdfibbhkkhjaolagidoopakdik/echo_mco.dart.js:7449:16)
at dart.J.$index$asx (chrome-extension://paadaccdfibbhkkhjaolagidoopakdik/echo_mco.dart.js:8496:41)
at chrome-extension://paadaccdfibbhkkhjaolagidoopakdik/echo_mco.dart.js:8874:12
at Isolate.prototype.(anonymous function) (chrome-extension://paadaccdfibbhkkhjaolagidoopakdik/echo_mco.dart.js:9412:37)
at chrome-extension://paadaccdfibbhkkhjaolagidoopakdik/echo_mco.dart.js:8871:25
at Isolate.prototype.(anonymous function) (chrome-extension://paadaccdfibbhkkhjaolagidoopakdik/echo_mco.dart.js:9412:37)
at RawDatagramSocket_bind_closure.call$0 (chrome-extension://paadaccdfibbhkkhjaolagidoopakdik/echo_mco.dart.js:3079:14)
at dart.Future_Future$sync (chrome-extension://paadaccdfibbhkkhjaolagidoopakdik/echo_mco.dart.js:3381:28)
at dart.RawDatagramSocket.static.RawDatagramSocket_bind (chrome-extension://paadaccdfibbhkkhjaolagidoopakdik/echo_mco.dart.js:3070:18)
This is caused by the interop.js
script not being included properly. It must be included as
<script src="packages/browser/interop.js"></script>
and it must precede all other Dart related JavaScript includes. So the includes may for example look like this
<script src="packages/browser/interop.js"></script>
<script type="application/dart">export 'package:polymer/init.dart';</script>
<script src="packages/browser/dart.js"></script>
In a Chrome Packaged App that uses the chrome package the includes may look like this
<script src="packages/browser/interop.js"></script>
<script src="packages/chrome/bootstrap.js" defer></script>
<script src="echo_mco.dart" type="application/dart"></script>
The problem was being discussed and solved at https://code.google.com/p/dart/issues/detail?id=15065
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With