js-interop call in isolate compiled via dart2js throws Uncaught Instance of 'UnknownJavaScriptObject'
#14072
Labels
area-core-library
SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries.
closed-obsolete
Closed as the reported issue is no longer relevant
library-js
type-bug
Incorrect behavior (everything from a crash to more subtle misbehavior)
This issue was originally filed by ross.dart.la...@gmail.com
0.8.1_r28355
Windows 7x64
I am using
spawnFunction
fromdart:isolate
to attempt to offload some expensive work from my ui thread. This expensive work needs to make some js-interop calls, but it blows up on the first such call with:Uncaught Instance of 'UnknownJavaScriptObject'
ReferenceError: window is not defined
at ReceivePortSync.receive$1 (...)
at _ProxiedObjectTable._ProxiedObjectTable$0 (...)
at Object._ProxiedObjectTable.static._ProxiedObjectTable$ (...)
at Isolate.prototype.(anonymous function) (...)
at Object._enterScopeIfNeeded (...)
The offending code looks like:
ReceivePortSync: {"": "Object;_portId@-,_callback@-,_portSubscription@-",
_callback$1: function(arg0) {
return this._callback.call$1(arg0);
},
_callback$0: function() {
return this._callback.call$0();
},
get$_listenerName: function() {
var t1, t2;
t1 = W.ReceivePortSync__isolateId();
t2 = this._portId;
return "dart-port-" + H.S(t1) + "-" + H.S(t2);
"18";
},
"+_listenerName": 1,
receive$1: function(callback) {
var t1, t2, t3;
this._callback = callback;
if (this._portSubscription == null) {
t1 = window; // THIS IS THE PROBLEM
t2 = W.ReceivePortSync__isolateId();
...
I spent some time trying to figure out precisely where this is coming from but did not succeed. Can I use
dart:js
instead ofjs-interop
to avoid this, or is it somewhere deeper?thanks,
The text was updated successfully, but these errors were encountered: