Thursday, November 05, 2009

A bug in Shindig code (for revision 832845)

Recently, I tried to deploy cyberaide filetransfer gadget (http://lily01.rit.edu/cyberaideFiletransfer.xml) and jobman gadget (http://lily01.rit.edu/cyberaideJobman.xml). They did NOT work in shindig server built from revision 832845. Those two gadgets use ‘tab’ feature which is not implemented well in shindig code.

Problem description
See source code of tab feature at http://svn.apache.org/repos/asf/incubator/shindig/trunk/features/src/main/javascript/features/tabs/tabs.js?p=832845.
In this file, function ‘html_sanitize’ is used. It is a function from caja javascript library.
Shindig website does not provide much useful information about integration of caja. http://incubator.apache.org/shindig/developers/java/build.html#Running_with_Caja
I found a useful wiki page in caja project: http://code.google.com/p/google-caja/wiki/GettingStarted.
Basically the user needs to add following text to ModulePrefs element of the gadget xml file
    <Require feature="caja"/>
After I changed the gadget xml file, it still didn’t work. It seems that after caja library sanitizes the rendered html/javascript code, some useful code is removed.

My solution
To make it simple, I disabled caja. I just removed invocations of functions belonging to caja library. Concretely, I removed invocations of function ‘html_sanitize’ in file ‘tab.js

Also, feature ‘minimessage’ also uses caja functions to sanitize html/javascript. If your gadgets use that feature, corresponding changes must be made as well.

No comments: