Index: client/dart.js |
=================================================================== |
--- client/dart.js (revision 9437) |
+++ client/dart.js (working copy) |
@@ -53,6 +53,12 @@ |
typeof(message) == 'number' || |
typeof(message) == 'boolean') { |
return message; |
+ } else if (message instanceof Array) { |
+ var values = new Array(message.length); |
+ for (var i = 0; i < message.length; i++) { |
+ values[i] = serialize(message[i]); |
+ } |
+ return [ 'list', message.length, values ]; |
} else if (message instanceof LocalSendPortSync) { |
return [ 'sendport', 'nativejs', message.receivePort.id ]; |
} else if (message instanceof DartSendPortSync) { |
@@ -63,7 +69,7 @@ |
var keys = Object.getOwnPropertyNames(message); |
var values = new Array(keys.length); |
for (var i = 0; i < keys.length; i++) { |
- values[i] = message[keys[i]]; |
+ values[i] = serialize(message[keys[i]]); |
} |
return [ 'map', id, keys, values ]; |
} |
@@ -83,6 +89,7 @@ |
switch (x[0]) { |
case 'map': return deserializeMap(x); |
case 'sendport': return deserializeSendPort(x); |
+ case 'list': return deserializeList(x); |
default: throw 'unimplemented'; |
} |
} |
@@ -105,7 +112,7 @@ |
switch (tag) { |
case 'nativejs': |
var id = x[2]; |
- return new LocalSendPortSync(id); |
+ return new LocalSendPortSync(ReceivePortSync.map[id]); |
sammccall
2012/07/06 16:01:41
I think this was just an oversight before?
|
case 'dart': |
var isolateId = x[2]; |
var portId = x[3]; |
@@ -115,6 +122,16 @@ |
} |
} |
+ function deserializeList(x) { |
+ var length = x[1]; |
+ var values = x[2]; |
+ var result = new Array(length); |
+ for (var i = 0; i < length; i++) { |
+ result[i] = values[i]; |
+ } |
+ return result; |
+ } |
+ |
window.registerPort = function(name, port) { |
var stringified = JSON.stringify(serialize(port)); |
window.localStorage['dart-port:' + name] = stringified; |