ramonlopes / jzebra

Automatically exported from code.google.com/p/jzebra
0 stars 0 forks source link

jzebraReady broken on Ubuntu #188

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Version 1.7.8 on Ubuntu doesn't properly call jzebraReady any more.  Instead it 
says "INFO: Successfully called JavaScript function "qzReady(...)", even when 
qzReady is not defined in JavaScript.

A work-around is to rename jzebraReady to qzReady, and it seems to load 
properly.

-Tres

Original issue reported on code.google.com by tres.fin...@gmail.com on 21 Nov 2013 at 5:21

GoogleCodeExporter commented 8 years ago
Fixed in 1.8.0 using a JavaScript "eval()" work-around.

String type = (String)window.eval("typeof(" + function + ")");

This will return "function" on all web browsers tested, and seems to fix the 
Ubuntu bug.

The Ubuntu bug stems from the fact that OpenJDK 7 u25 doesn't raise a 
JSException when an invalid JavaScript function name is called using 
LiveConnect.

The eval() seems to work very reliably and allows the applet to evaluate 
whether (i.e.) qzReady() is present before falling back on the older and 
deprecated jzebraReady() function.

This seems to fix some false-positives for readiness on Ubuntu as well, so it 
actually improves the readiness in general for deployments to Ubuntu (and 
likely other GNU/*nix/OpenJDK deployments).

-Tres

Original comment by tres.fin...@gmail.com on 5 Dec 2013 at 3:45