Skip to content

Instantly share code, notes, and snippets.

@bwhite
bwhite / glass.html
Created February 9, 2014 20:53
[wearscript] Tests the java/javascript bridge for character violations. A string can be sent to java and back as long as it has no null characters in it. For callbacks there are more restrictions (as such all data should be b64d).
<html style="width:100%; height:100%; overflow:hidden">
<body style="width:100%; height:100%; overflow:hidden; margin:0">
<script>
function server() {
var a=[]; for (var i = 0; i < 256; i++) a.push(String.fromCharCode(i));b256=a.join('');
a=[]; for (var i = 1; i < 256; i++) a.push(String.fromCharCode(i));b255=a.join('');
WS.log('echolen(b256): ' + WS.echolen(b256));
WS.log('echolen(b255): ' + WS.echolen(b255));
WS.log('echo(b256).length: ' + WS.echo(b256).length);
WS.log('echo(b255).length: ' + WS.echo(b255).length);