ogre.rb 0.1-i686-linux → 0.2-i686-linux

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (368) hide show
  1. data/README +43 -5
  2. data/Rakefile +67 -165
  3. data/lib/application.rb +2 -1
  4. data/lib/application_frame_listener.rb +17 -17
  5. data/lib/ogre.so +0 -0
  6. data/lib/ruby_ois.so +0 -0
  7. data/ogre.rb +3 -0
  8. data/samples/Ogre.log +358 -257
  9. data/samples/cel_shading.rb +85 -0
  10. data/samples/grass.rb +1 -1
  11. data/samples/media/materials/programs/CelShading.cg +63 -0
  12. data/samples/media/materials/scripts/CelShading.material +68 -0
  13. data/samples/media/materials/textures/cel_shading_diffuse.png +0 -0
  14. data/samples/media/materials/textures/cel_shading_edge.png +0 -0
  15. data/samples/media/materials/textures/cel_shading_specular.png +0 -0
  16. data/samples/ogre.cfg +1 -2
  17. data/samples/plugins.cfg +3 -2
  18. data/test/ogre.cfg +10 -0
  19. data/{samples/navi → test}/plugins.cfg +2 -4
  20. data/test/test_helper.rb +67 -0
  21. data/test/unit/constants_test.rb +66 -0
  22. data/test/unit/frame_stats_proxy_test.rb +28 -0
  23. data/test/unit/math_test.rb +20 -0
  24. data/test/unit/mesh_test.rb +15 -0
  25. data/test/unit/methods_test.rb +98 -0
  26. data/test/unit/movable_object_test.rb +19 -0
  27. data/test/unit/name_value_pair_list_test.rb +12 -0
  28. data/test/unit/overlay_element_test.rb +20 -0
  29. data/test/unit/render_target_test.rb +11 -0
  30. data/test/unit/resource_test.rb +26 -0
  31. data/test/unit/scene_manager_test.rb +21 -0
  32. metadata +25 -356
  33. data/samples/navi/Media/NaviDemo.material +0 -60
  34. data/samples/navi/Media/OgreCore.zip +0 -0
  35. data/samples/navi/Media/cerulean.jpg +0 -0
  36. data/samples/navi/Media/clouds.jpg +0 -0
  37. data/samples/navi/Media/controlsNaviMask.png +0 -0
  38. data/samples/navi/Media/grass.jpg +0 -0
  39. data/samples/navi/Media/knot.mesh +0 -0
  40. data/samples/navi/Media/testNaviMask.png +0 -0
  41. data/samples/navi/NaviLocal/Navi.js +0 -136
  42. data/samples/navi/NaviLocal/buttonBg.jpg +0 -0
  43. data/samples/navi/NaviLocal/controls.html +0 -303
  44. data/samples/navi/NaviLocal/knobBg.jpg +0 -0
  45. data/samples/navi/NaviLocal/moo.dropdownmenu.js +0 -87
  46. data/samples/navi/NaviLocal/mootools.v1.1.js +0 -6964
  47. data/samples/navi/NaviLocal/naviLogo.html +0 -32
  48. data/samples/navi/NaviLocal/naviLogo.png +0 -0
  49. data/samples/navi/NaviLocal/pageBg.jpg +0 -0
  50. data/samples/navi/NaviLocal/sliderBg.jpg +0 -0
  51. data/samples/navi/NaviLocal/test.html +0 -5
  52. data/samples/navi/NaviLocal/welcome.html +0 -36
  53. data/samples/navi/NaviLocal/welcome.png +0 -0
  54. data/samples/navi/chrome/chromelist.txt +0 -597
  55. data/samples/navi/chrome/classic.jar +0 -0
  56. data/samples/navi/chrome/classic.manifest +0 -4
  57. data/samples/navi/chrome/comm.jar +0 -0
  58. data/samples/navi/chrome/comm.manifest +0 -2
  59. data/samples/navi/chrome/en-US.jar +0 -0
  60. data/samples/navi/chrome/en-US.manifest +0 -9
  61. data/samples/navi/chrome/toolkit.jar +0 -0
  62. data/samples/navi/chrome/toolkit.manifest +0 -6
  63. data/samples/navi/components/FeedProcessor.js +0 -1825
  64. data/samples/navi/components/alerts.xpt +0 -0
  65. data/samples/navi/components/appshell.xpt +0 -0
  66. data/samples/navi/components/appstartup.xpt +0 -0
  67. data/samples/navi/components/auth.dll +0 -0
  68. data/samples/navi/components/autocomplete.xpt +0 -0
  69. data/samples/navi/components/autoconfig.dll +0 -0
  70. data/samples/navi/components/autoconfig.xpt +0 -0
  71. data/samples/navi/components/caps.xpt +0 -0
  72. data/samples/navi/components/chardet.xpt +0 -0
  73. data/samples/navi/components/chrome.xpt +0 -0
  74. data/samples/navi/components/commandhandler.xpt +0 -0
  75. data/samples/navi/components/commandlines.xpt +0 -0
  76. data/samples/navi/components/composer.xpt +0 -0
  77. data/samples/navi/components/compreg.dat +0 -1474
  78. data/samples/navi/components/content_base.xpt +0 -0
  79. data/samples/navi/components/content_html.xpt +0 -0
  80. data/samples/navi/components/content_htmldoc.xpt +0 -0
  81. data/samples/navi/components/content_xmldoc.xpt +0 -0
  82. data/samples/navi/components/content_xslt.xpt +0 -0
  83. data/samples/navi/components/content_xtf.xpt +0 -0
  84. data/samples/navi/components/directory.xpt +0 -0
  85. data/samples/navi/components/docshell_base.xpt +0 -0
  86. data/samples/navi/components/dom.xpt +0 -0
  87. data/samples/navi/components/dom_base.xpt +0 -0
  88. data/samples/navi/components/dom_canvas.xpt +0 -0
  89. data/samples/navi/components/dom_core.xpt +0 -0
  90. data/samples/navi/components/dom_css.xpt +0 -0
  91. data/samples/navi/components/dom_events.xpt +0 -0
  92. data/samples/navi/components/dom_html.xpt +0 -0
  93. data/samples/navi/components/dom_loadsave.xpt +0 -0
  94. data/samples/navi/components/dom_range.xpt +0 -0
  95. data/samples/navi/components/dom_sidebar.xpt +0 -0
  96. data/samples/navi/components/dom_storage.xpt +0 -0
  97. data/samples/navi/components/dom_stylesheets.xpt +0 -0
  98. data/samples/navi/components/dom_svg.xpt +0 -0
  99. data/samples/navi/components/dom_traversal.xpt +0 -0
  100. data/samples/navi/components/dom_views.xpt +0 -0
  101. data/samples/navi/components/dom_xbl.xpt +0 -0
  102. data/samples/navi/components/dom_xpath.xpt +0 -0
  103. data/samples/navi/components/dom_xul.xpt +0 -0
  104. data/samples/navi/components/downloads.xpt +0 -0
  105. data/samples/navi/components/editor.xpt +0 -0
  106. data/samples/navi/components/embed_base.xpt +0 -0
  107. data/samples/navi/components/extensions.xpt +0 -0
  108. data/samples/navi/components/exthandler.xpt +0 -0
  109. data/samples/navi/components/fastfind.xpt +0 -0
  110. data/samples/navi/components/feeds.xpt +0 -0
  111. data/samples/navi/components/find.xpt +0 -0
  112. data/samples/navi/components/gfx.xpt +0 -0
  113. data/samples/navi/components/gksvgrenderer.xpt +0 -0
  114. data/samples/navi/components/history.xpt +0 -0
  115. data/samples/navi/components/htmlparser.xpt +0 -0
  116. data/samples/navi/components/imglib2.xpt +0 -0
  117. data/samples/navi/components/inspector.xpt +0 -0
  118. data/samples/navi/components/intl.xpt +0 -0
  119. data/samples/navi/components/intlcmpt.xpt +0 -0
  120. data/samples/navi/components/jar.xpt +0 -0
  121. data/samples/navi/components/jsconsole-clhandler.js +0 -170
  122. data/samples/navi/components/jsconsole.xpt +0 -0
  123. data/samples/navi/components/jsdservice.xpt +0 -0
  124. data/samples/navi/components/layout_base.xpt +0 -0
  125. data/samples/navi/components/layout_printing.xpt +0 -0
  126. data/samples/navi/components/layout_xul.xpt +0 -0
  127. data/samples/navi/components/layout_xul_tree.xpt +0 -0
  128. data/samples/navi/components/locale.xpt +0 -0
  129. data/samples/navi/components/lwbrk.xpt +0 -0
  130. data/samples/navi/components/mimetype.xpt +0 -0
  131. data/samples/navi/components/mozbrwsr.xpt +0 -0
  132. data/samples/navi/components/mozfind.xpt +0 -0
  133. data/samples/navi/components/necko.xpt +0 -0
  134. data/samples/navi/components/necko_about.xpt +0 -0
  135. data/samples/navi/components/necko_cache.xpt +0 -0
  136. data/samples/navi/components/necko_cookie.xpt +0 -0
  137. data/samples/navi/components/necko_data.xpt +0 -0
  138. data/samples/navi/components/necko_dns.xpt +0 -0
  139. data/samples/navi/components/necko_file.xpt +0 -0
  140. data/samples/navi/components/necko_ftp.xpt +0 -0
  141. data/samples/navi/components/necko_http.xpt +0 -0
  142. data/samples/navi/components/necko_res.xpt +0 -0
  143. data/samples/navi/components/necko_socket.xpt +0 -0
  144. data/samples/navi/components/necko_strconv.xpt +0 -0
  145. data/samples/navi/components/necko_viewsource.xpt +0 -0
  146. data/samples/navi/components/nsCloseAllWindows.js +0 -143
  147. data/samples/navi/components/nsDefaultCLH.js +0 -231
  148. data/samples/navi/components/nsDictionary.js +0 -148
  149. data/samples/navi/components/nsExtensionManager.js +0 -8497
  150. data/samples/navi/components/nsHelperAppDlg.js +0 -990
  151. data/samples/navi/components/nsInterfaceInfoToIDL.js +0 -590
  152. data/samples/navi/components/nsKillAll.js +0 -200
  153. data/samples/navi/components/nsPostUpdateWin.js +0 -711
  154. data/samples/navi/components/nsProgressDialog.js +0 -949
  155. data/samples/navi/components/nsProxyAutoConfig.js +0 -396
  156. data/samples/navi/components/nsResetPref.js +0 -175
  157. data/samples/navi/components/nsURLFormatter.js +0 -179
  158. data/samples/navi/components/nsUpdateService.js +0 -3074
  159. data/samples/navi/components/nsXULAppInstall.js +0 -301
  160. data/samples/navi/components/nsXmlRpcClient.js +0 -1038
  161. data/samples/navi/components/oji.xpt +0 -0
  162. data/samples/navi/components/passwordmgr.xpt +0 -0
  163. data/samples/navi/components/pipboot.xpt +0 -0
  164. data/samples/navi/components/pipnss.xpt +0 -0
  165. data/samples/navi/components/plugin.xpt +0 -0
  166. data/samples/navi/components/pref.xpt +0 -0
  167. data/samples/navi/components/prefetch.xpt +0 -0
  168. data/samples/navi/components/profile.xpt +0 -0
  169. data/samples/navi/components/progressDlg.xpt +0 -0
  170. data/samples/navi/components/proxyObject.xpt +0 -0
  171. data/samples/navi/components/rdf.xpt +0 -0
  172. data/samples/navi/components/satchel.xpt +0 -0
  173. data/samples/navi/components/saxparser.xpt +0 -0
  174. data/samples/navi/components/shistory.xpt +0 -0
  175. data/samples/navi/components/storage.xpt +0 -0
  176. data/samples/navi/components/toolkitprofile.xpt +0 -0
  177. data/samples/navi/components/transformiix.dll +0 -0
  178. data/samples/navi/components/txmgr.xpt +0 -0
  179. data/samples/navi/components/txtsvc.xpt +0 -0
  180. data/samples/navi/components/uconv.xpt +0 -0
  181. data/samples/navi/components/unicharutil.xpt +0 -0
  182. data/samples/navi/components/universalchardet.dll +0 -0
  183. data/samples/navi/components/update.xpt +0 -0
  184. data/samples/navi/components/uriloader.xpt +0 -0
  185. data/samples/navi/components/urlformatter.xpt +0 -0
  186. data/samples/navi/components/webBrowser_core.xpt +0 -0
  187. data/samples/navi/components/webbrowserpersist.xpt +0 -0
  188. data/samples/navi/components/webshell_idls.xpt +0 -0
  189. data/samples/navi/components/websrvcs.dll +0 -0
  190. data/samples/navi/components/websrvcs.xpt +0 -0
  191. data/samples/navi/components/widget.xpt +0 -0
  192. data/samples/navi/components/windowds.xpt +0 -0
  193. data/samples/navi/components/windowwatcher.xpt +0 -0
  194. data/samples/navi/components/xml-rpc.xpt +0 -0
  195. data/samples/navi/components/xmlextras.dll +0 -0
  196. data/samples/navi/components/xpcom_base.xpt +0 -0
  197. data/samples/navi/components/xpcom_components.xpt +0 -0
  198. data/samples/navi/components/xpcom_ds.xpt +0 -0
  199. data/samples/navi/components/xpcom_io.xpt +0 -0
  200. data/samples/navi/components/xpcom_obsolete.xpt +0 -0
  201. data/samples/navi/components/xpcom_thread.xpt +0 -0
  202. data/samples/navi/components/xpcom_xpti.xpt +0 -0
  203. data/samples/navi/components/xpconnect.xpt +0 -0
  204. data/samples/navi/components/xpinstall.xpt +0 -0
  205. data/samples/navi/components/xpti.dat +0 -1424
  206. data/samples/navi/components/xulapp.xpt +0 -0
  207. data/samples/navi/components/xulapp_setup.xpt +0 -0
  208. data/samples/navi/components/xuldoc.xpt +0 -0
  209. data/samples/navi/components/xulrunner.xpt +0 -0
  210. data/samples/navi/components/xultmpl.xpt +0 -0
  211. data/samples/navi/components/xulutil.dll +0 -0
  212. data/samples/navi/controlsNaviMask.png +0 -0
  213. data/samples/navi/greprefs/all.js +0 -1344
  214. data/samples/navi/greprefs/security-prefs.js +0 -69
  215. data/samples/navi/greprefs/xpinstall.js +0 -2
  216. data/samples/navi/navi_demo.rb +0 -207
  217. data/samples/navi/plugins/NPSWF32.dll +0 -0
  218. data/samples/navi/plugins/flashplayer.xpt +0 -0
  219. data/samples/navi/plugins/npnul32.dll +0 -0
  220. data/samples/navi/res/EditorOverride.css +0 -359
  221. data/samples/navi/res/Thumbs.db +0 -0
  222. data/samples/navi/res/arrow.gif +0 -0
  223. data/samples/navi/res/arrowd.gif +0 -0
  224. data/samples/navi/res/bloatcycle.html +0 -40
  225. data/samples/navi/res/broken-image.gif +0 -0
  226. data/samples/navi/res/charsetData.properties +0 -199
  227. data/samples/navi/res/charsetalias.properties +0 -517
  228. data/samples/navi/res/cmessage.txt +0 -1
  229. data/samples/navi/res/dtd/xhtml11.dtd +0 -300
  230. data/samples/navi/res/entityTables/html40Latin1.properties +0 -146
  231. data/samples/navi/res/entityTables/html40Special.properties +0 -69
  232. data/samples/navi/res/entityTables/html40Symbols.properties +0 -164
  233. data/samples/navi/res/entityTables/htmlEntityVersions.properties +0 -50
  234. data/samples/navi/res/entityTables/transliterate.properties +0 -2367
  235. data/samples/navi/res/fonts/fontEncoding.properties +0 -127
  236. data/samples/navi/res/fonts/fontNameMap.properties +0 -134
  237. data/samples/navi/res/forms.css +0 -531
  238. data/samples/navi/res/grabber.gif +0 -0
  239. data/samples/navi/res/hiddenWindow.html +0 -1
  240. data/samples/navi/res/html/Thumbs.db +0 -0
  241. data/samples/navi/res/html/gopher-audio.gif +0 -0
  242. data/samples/navi/res/html/gopher-binary.gif +0 -0
  243. data/samples/navi/res/html/gopher-find.gif +0 -0
  244. data/samples/navi/res/html/gopher-image.gif +0 -0
  245. data/samples/navi/res/html/gopher-menu.gif +0 -0
  246. data/samples/navi/res/html/gopher-movie.gif +0 -0
  247. data/samples/navi/res/html/gopher-sound.gif +0 -0
  248. data/samples/navi/res/html/gopher-telnet.gif +0 -0
  249. data/samples/navi/res/html/gopher-text.gif +0 -0
  250. data/samples/navi/res/html/gopher-unknown.gif +0 -0
  251. data/samples/navi/res/html.css +0 -478
  252. data/samples/navi/res/langGroups.properties +0 -236
  253. data/samples/navi/res/language.properties +0 -259
  254. data/samples/navi/res/loading-image.gif +0 -0
  255. data/samples/navi/res/quirk.css +0 -282
  256. data/samples/navi/res/samples/Anieyes.gif +0 -0
  257. data/samples/navi/res/samples/Thumbs.db +0 -0
  258. data/samples/navi/res/samples/aform.css +0 -69
  259. data/samples/navi/res/samples/beeptest.html +0 -18
  260. data/samples/navi/res/samples/bform.css +0 -45
  261. data/samples/navi/res/samples/bg.jpg +0 -0
  262. data/samples/navi/res/samples/cform.css +0 -40
  263. data/samples/navi/res/samples/checkboxTest.xul +0 -47
  264. data/samples/navi/res/samples/demoform.css +0 -97
  265. data/samples/navi/res/samples/find.html +0 -97
  266. data/samples/navi/res/samples/gear1.gif +0 -0
  267. data/samples/navi/res/samples/image_props.html +0 -58
  268. data/samples/navi/res/samples/mozform.css +0 -256
  269. data/samples/navi/res/samples/printsetup.html +0 -175
  270. data/samples/navi/res/samples/raptor.jpg +0 -0
  271. data/samples/navi/res/samples/rock_gra.gif +0 -0
  272. data/samples/navi/res/samples/scrollbarTest1.xul +0 -66
  273. data/samples/navi/res/samples/scrollbarTest2.xul +0 -19
  274. data/samples/navi/res/samples/sliderTest1.xul +0 -14
  275. data/samples/navi/res/samples/soundtest.html +0 -20
  276. data/samples/navi/res/samples/test.wav +0 -0
  277. data/samples/navi/res/samples/test0.html +0 -220
  278. data/samples/navi/res/samples/test1.html +0 -84
  279. data/samples/navi/res/samples/test10.html +0 -16
  280. data/samples/navi/res/samples/test11.html +0 -42
  281. data/samples/navi/res/samples/test12.html +0 -79
  282. data/samples/navi/res/samples/test13.html +0 -126
  283. data/samples/navi/res/samples/test14.html +0 -5
  284. data/samples/navi/res/samples/test15.html +0 -5
  285. data/samples/navi/res/samples/test16.html +0 -124
  286. data/samples/navi/res/samples/test2.html +0 -41
  287. data/samples/navi/res/samples/test3.html +0 -126
  288. data/samples/navi/res/samples/test4.html +0 -335
  289. data/samples/navi/res/samples/test5.html +0 -199
  290. data/samples/navi/res/samples/test6.html +0 -335
  291. data/samples/navi/res/samples/test7.html +0 -11
  292. data/samples/navi/res/samples/test8-1.html +0 -66
  293. data/samples/navi/res/samples/test8.html +0 -662
  294. data/samples/navi/res/samples/test8dom.html +0 -64
  295. data/samples/navi/res/samples/test8sca.html +0 -308
  296. data/samples/navi/res/samples/test8siz.html +0 -224
  297. data/samples/navi/res/samples/test8tab.html +0 -9
  298. data/samples/navi/res/samples/test9.html +0 -12
  299. data/samples/navi/res/samples/test9a.html +0 -39
  300. data/samples/navi/res/samples/test9b.html +0 -16
  301. data/samples/navi/res/samples/test_ed.html +0 -5
  302. data/samples/navi/res/samples/test_form.html +0 -34
  303. data/samples/navi/res/samples/test_gfx.html +0 -75
  304. data/samples/navi/res/samples/test_lbox.html +0 -100
  305. data/samples/navi/res/samples/test_pr.html +0 -87
  306. data/samples/navi/res/samples/test_weight.html +0 -45
  307. data/samples/navi/res/samples/toolbarTest1.xul +0 -51
  308. data/samples/navi/res/samples/treeTest1.css +0 -62
  309. data/samples/navi/res/samples/treeTest1.xul +0 -110
  310. data/samples/navi/res/samples/xulTest.css +0 -130
  311. data/samples/navi/res/svg.css +0 -64
  312. data/samples/navi/res/table-add-column-after-active.gif +0 -0
  313. data/samples/navi/res/table-add-column-after-hover.gif +0 -0
  314. data/samples/navi/res/table-add-column-after.gif +0 -0
  315. data/samples/navi/res/table-add-column-before-active.gif +0 -0
  316. data/samples/navi/res/table-add-column-before-hover.gif +0 -0
  317. data/samples/navi/res/table-add-column-before.gif +0 -0
  318. data/samples/navi/res/table-add-row-after-active.gif +0 -0
  319. data/samples/navi/res/table-add-row-after-hover.gif +0 -0
  320. data/samples/navi/res/table-add-row-after.gif +0 -0
  321. data/samples/navi/res/table-add-row-before-active.gif +0 -0
  322. data/samples/navi/res/table-add-row-before-hover.gif +0 -0
  323. data/samples/navi/res/table-add-row-before.gif +0 -0
  324. data/samples/navi/res/table-remove-column-active.gif +0 -0
  325. data/samples/navi/res/table-remove-column-hover.gif +0 -0
  326. data/samples/navi/res/table-remove-column.gif +0 -0
  327. data/samples/navi/res/table-remove-row-active.gif +0 -0
  328. data/samples/navi/res/table-remove-row-hover.gif +0 -0
  329. data/samples/navi/res/table-remove-row.gif +0 -0
  330. data/samples/navi/res/throbber/Thumbs.db +0 -0
  331. data/samples/navi/res/throbber/anim.gif +0 -0
  332. data/samples/navi/res/throbber/anims00.gif +0 -0
  333. data/samples/navi/res/throbber/anims01.gif +0 -0
  334. data/samples/navi/res/throbber/anims02.gif +0 -0
  335. data/samples/navi/res/throbber/anims03.gif +0 -0
  336. data/samples/navi/res/throbber/anims04.gif +0 -0
  337. data/samples/navi/res/throbber/anims05.gif +0 -0
  338. data/samples/navi/res/throbber/anims06.gif +0 -0
  339. data/samples/navi/res/throbber/anims07.gif +0 -0
  340. data/samples/navi/res/throbber/anims08.gif +0 -0
  341. data/samples/navi/res/throbber/anims09.gif +0 -0
  342. data/samples/navi/res/throbber/anims10.gif +0 -0
  343. data/samples/navi/res/throbber/anims11.gif +0 -0
  344. data/samples/navi/res/throbber/anims12.gif +0 -0
  345. data/samples/navi/res/throbber/anims13.gif +0 -0
  346. data/samples/navi/res/throbber/anims14.gif +0 -0
  347. data/samples/navi/res/throbber/anims15.gif +0 -0
  348. data/samples/navi/res/throbber/anims16.gif +0 -0
  349. data/samples/navi/res/throbber/anims17.gif +0 -0
  350. data/samples/navi/res/throbber/anims18.gif +0 -0
  351. data/samples/navi/res/throbber/anims19.gif +0 -0
  352. data/samples/navi/res/throbber/anims20.gif +0 -0
  353. data/samples/navi/res/throbber/anims21.gif +0 -0
  354. data/samples/navi/res/throbber/anims22.gif +0 -0
  355. data/samples/navi/res/throbber/anims23.gif +0 -0
  356. data/samples/navi/res/throbber/anims24.gif +0 -0
  357. data/samples/navi/res/throbber/anims25.gif +0 -0
  358. data/samples/navi/res/throbber/anims26.gif +0 -0
  359. data/samples/navi/res/throbber/anims27.gif +0 -0
  360. data/samples/navi/res/throbber/anims28.gif +0 -0
  361. data/samples/navi/res/throbber/anims29.gif +0 -0
  362. data/samples/navi/res/ua.css +0 -235
  363. data/samples/navi/res/viewer.properties +0 -1
  364. data/samples/navi/res/viewsource.css +0 -118
  365. data/samples/navi/res/wincharset.properties +0 -55
  366. data/samples/navi/resources.cfg +0 -14
  367. data/samples/navi/testNaviMask.png +0 -0
  368. data/samples/render_run_log.5796 +0 -891
@@ -1,1038 +0,0 @@
1
- /* ***** BEGIN LICENSE BLOCK *****
2
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
3
- *
4
- * The contents of this file are subject to the Mozilla Public License Version
5
- * 1.1 (the "License"); you may not use this file except in compliance with
6
- * the License. You may obtain a copy of the License at
7
- * http://www.mozilla.org/MPL/
8
- *
9
- * Software distributed under the License is distributed on an "AS IS" basis,
10
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
11
- * for the specific language governing rights and limitations under the
12
- * License.
13
- *
14
- * The Original Code is Mozilla XML-RPC Client component.
15
- *
16
- * The Initial Developer of the Original Code is
17
- * Digital Creations 2, Inc.
18
- * Portions created by the Initial Developer are Copyright (C) 2000
19
- * the Initial Developer. All Rights Reserved.
20
- *
21
- * Contributor(s):
22
- * Martijn Pieters <mj@digicool.com> (original author)
23
- * Samuel Sieb <samuel@sieb.net>
24
- *
25
- * Alternatively, the contents of this file may be used under the terms of
26
- * either the GNU General Public License Version 2 or later (the "GPL"), or
27
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
28
- * in which case the provisions of the GPL or the LGPL are applicable instead
29
- * of those above. If you wish to allow use of your version of this file only
30
- * under the terms of either the GPL or the LGPL, and not to allow others to
31
- * use your version of this file under the terms of the MPL, indicate your
32
- * decision by deleting the provisions above and replace them with the notice
33
- * and other provisions required by the GPL or the LGPL. If you do not delete
34
- * the provisions above, a recipient may use your version of this file under
35
- * the terms of any one of the MPL, the GPL or the LGPL.
36
- *
37
- * ***** END LICENSE BLOCK ***** */
38
-
39
- /*
40
- * nsXmlRpcClient XPCOM component
41
- * Version: $Revision: 1.34.28.3 $
42
- *
43
- * $Id: nsXmlRpcClient.js,v 1.34.28.3 2006/11/28 18:18:44 gijskruitbosch%gmail.com Exp $
44
- */
45
-
46
- /*
47
- * Constants
48
- */
49
- const XMLRPCCLIENT_CONTRACTID = '@mozilla.org/xml-rpc/client;1';
50
- const XMLRPCCLIENT_CID =
51
- Components.ID('{4d7d15c0-3747-4f7f-b6b3-792a5ea1a9aa}');
52
- const XMLRPCCLIENT_IID = Components.interfaces.nsIXmlRpcClient;
53
-
54
- const XMLRPCFAULT_CONTRACTID = '@mozilla.org/xml-rpc/fault;1';
55
- const XMLRPCFAULT_CID =
56
- Components.ID('{691cb864-0a7e-448c-98ee-4a7f359cf145}');
57
- const XMLRPCFAULT_IID = Components.interfaces.nsIXmlRpcFault;
58
-
59
- const XMLHTTPREQUEST_CONTRACTID = '@mozilla.org/xmlextras/xmlhttprequest;1';
60
-
61
- const NSICHANNEL = Components.interfaces.nsIChannel;
62
-
63
- const DEBUG = false;
64
- const DEBUGPARSE = false;
65
-
66
- const DOMNode = Components.interfaces.nsIDOMNode;
67
- /*
68
- * Class definitions
69
- */
70
-
71
- /* The nsXmlRpcFault class constructor. */
72
- function nsXmlRpcFault() {}
73
-
74
- /* the nsXmlRpcFault class def */
75
- nsXmlRpcFault.prototype = {
76
- faultCode: 0,
77
- faultString: '',
78
-
79
- init: function(faultCode, faultString) {
80
- this.faultCode = faultCode;
81
- this.faultString = faultString;
82
- },
83
-
84
- toString: function() {
85
- return '<XML-RPC Fault: (' + this.faultCode + ') ' +
86
- this.faultString + '>';
87
- },
88
-
89
- // nsISupports interface
90
- QueryInterface: function(iid) {
91
- if (!iid.equals(Components.interfaces.nsISupports) &&
92
- !iid.equals(XMLRPCFAULT_IID))
93
- throw Components.results.NS_ERROR_NO_INTERFACE;
94
- return this;
95
- }
96
- };
97
-
98
- /* The nsXmlRpcClient class constructor. */
99
- function nsXmlRpcClient() {}
100
-
101
- /* the nsXmlRpcClient class def */
102
- nsXmlRpcClient.prototype = {
103
- _serverUrl: null,
104
- _useAuth: false,
105
-
106
- init: function(serverURL) {
107
- this._serverUrl = serverURL;
108
- this._encoding = "UTF-8";
109
- },
110
-
111
- setAuthentication: function(username, password){
112
- if ((typeof username == "string") &&
113
- (typeof password == "string")){
114
- this._useAuth = true;
115
- this._username = username;
116
- this._password = password;
117
- }
118
- },
119
-
120
- clearAuthentication: function(){
121
- this._useAuth = false;
122
- },
123
-
124
- setEncoding: function(encoding){
125
- this._encoding = encoding;
126
- },
127
-
128
- get serverUrl() { return this._serverUrl; },
129
-
130
- // Internal copy of the status
131
- _status: null,
132
- _listener: null,
133
-
134
- asyncCall: function(listener, context, methodName, methodArgs, count) {
135
- debug('asyncCall');
136
- // Check for call in progress.
137
- if (this._inProgress)
138
- throw Components.Exception('Call in progress!');
139
-
140
- // Check for the server URL;
141
- if (!this._serverUrl)
142
- throw Components.Exception('Not initialized');
143
-
144
- this._inProgress = true;
145
-
146
- // Clear state.
147
- this._foundFault = false;
148
- this._passwordTried = false;
149
- this._result = null;
150
- this._fault = null;
151
- this._status = null;
152
- this._responseStatus = null;
153
- this._responseString = null;
154
- this._listener = listener;
155
- this._seenStart = false;
156
- this._context = context;
157
-
158
- debug('Arguments: ' + methodArgs);
159
-
160
- // Generate request body
161
- var xmlWriter = new XMLWriter(this._encoding);
162
- this._generateRequestBody(xmlWriter, methodName, methodArgs);
163
-
164
- var requestBody = xmlWriter.data;
165
-
166
- debug('Request: ' + requestBody);
167
-
168
- this.xmlhttp = Components.classes[XMLHTTPREQUEST_CONTRACTID]
169
- .createInstance(Components.interfaces.nsIXMLHttpRequest);
170
- if (this._useAuth) {
171
- this.xmlhttp.open('POST', this._serverUrl, true,
172
- this._username, this._password);
173
- } else {
174
- this.xmlhttp.open('POST', this._serverUrl);
175
- }
176
- this.xmlhttp.onload = this._onload;
177
- this.xmlhttp.onerror = this._onerror;
178
- this.xmlhttp.parent = this;
179
- this.xmlhttp.setRequestHeader('Content-Type','text/xml');
180
- this.xmlhttp.send(requestBody);
181
- var chan = this.xmlhttp.channel.QueryInterface(NSICHANNEL);
182
- chan.notificationCallbacks = this;
183
- },
184
-
185
- _onload: function(e) {
186
- var result;
187
- var parent = e.target.parent;
188
- parent._inProgress = false;
189
- parent._responseStatus = e.target.status;
190
- parent._responseString = e.target.statusText;
191
- if (!e.target.responseXML) {
192
- if (e.target.status) {
193
- try {
194
- parent._listener.onError(parent, parent._context,
195
- Components.results.NS_ERROR_FAILURE,
196
- 'Server returned status ' + e.target.status);
197
- } catch (ex) {
198
- debug('Exception in listener.onError: ' + ex);
199
- }
200
- } else {
201
- try {
202
- parent._listener.onError(parent, parent._context,
203
- Components.results.NS_ERROR_FAILURE,
204
- 'Unknown network error');
205
- } catch (ex) {
206
- debug('Exception in listener.onError: ' + ex);
207
- }
208
- }
209
- return;
210
- }
211
- try {
212
- e.target.responseXML.normalize();
213
- result = parent.parse(e.target.responseXML);
214
- } catch (ex) {
215
- try {
216
- parent._listener.onError(parent, parent._context,
217
- ex.result, ex.message);
218
- } catch (ex) {
219
- debug('Exception in listener.onError: ' + ex);
220
- }
221
- return;
222
- }
223
- if (parent._foundFault) {
224
- parent._fault = result;
225
- try {
226
- parent._listener.onFault(parent, parent._context, result);
227
- } catch(ex) {
228
- debug('Exception in listener.onFault: ' + ex);
229
- }
230
- } else {
231
- parent._result = result.value;
232
- try {
233
- parent._listener.onResult(parent, parent._context,
234
- result.value);
235
- } catch (ex) {
236
- debug('Exception in listener.onResult: ' + ex);
237
- }
238
- }
239
- },
240
-
241
- _onerror: function(e) {
242
- var parent = e.target.parent;
243
- parent._inProgress = false;
244
- try {
245
- parent._listener.onError(parent, parent._context,
246
- Components.results.NS_ERROR_FAILURE,
247
- 'Unknown network error');
248
- } catch (ex) {
249
- debug('Exception in listener.onError: ' + ex);
250
- }
251
- },
252
-
253
- _foundFault: false,
254
-
255
- _fault: null,
256
- _result: null,
257
- _responseStatus: null,
258
- _responseString: null,
259
-
260
- get fault() { return this._fault; },
261
- get result() { return this._result; },
262
- get responseStatus() { return this._responseStatus; },
263
- get responseString() { return this._responseString; },
264
-
265
- /* Convenience. Create an appropriate XPCOM object for a given type */
266
- INT: 1,
267
- BOOLEAN: 2,
268
- STRING: 3,
269
- DOUBLE: 4,
270
- DATETIME: 5,
271
- ARRAY: 6,
272
- STRUCT: 7,
273
- BASE64: 8, // Not part of nsIXmlRpcClient interface, internal use.
274
- createType: function(type, uuid) {
275
- const SUPPORTSID = '@mozilla.org/supports-';
276
- switch(type) {
277
- case this.INT:
278
- uuid.value = Components.interfaces.nsISupportsPRInt32
279
- return createInstance(SUPPORTSID + 'PRInt32;1',
280
- 'nsISupportsPRInt32');
281
-
282
- case this.BOOLEAN:
283
- uuid.value = Components.interfaces.nsISupportsPRBool
284
- return createInstance(SUPPORTSID + 'PRBool;1',
285
- 'nsISupportsPRBool');
286
-
287
- case this.STRING:
288
- uuid.value = Components.interfaces.nsISupportsCString
289
- return createInstance(SUPPORTSID + 'cstring;1',
290
- 'nsISupportsCString');
291
-
292
- case this.DOUBLE:
293
- uuid.value = Components.interfaces.nsISupportsDouble
294
- return createInstance(SUPPORTSID + 'double;1',
295
- 'nsISupportsDouble');
296
-
297
- case this.DATETIME:
298
- uuid.value = Components.interfaces.nsISupportsPRTime
299
- return createInstance(SUPPORTSID + 'PRTime;1',
300
- 'nsISupportsPRTime');
301
-
302
- case this.ARRAY:
303
- uuid.value = Components.interfaces.nsISupportsArray
304
- return createInstance(SUPPORTSID + 'array;1',
305
- 'nsISupportsArray');
306
-
307
- case this.STRUCT:
308
- uuid.value = Components.interfaces.nsIDictionary
309
- return createInstance('@mozilla.org/dictionary;1',
310
- 'nsIDictionary');
311
-
312
- default: throw Components.Exception('Unsupported type');
313
- }
314
- },
315
-
316
- // nsISupports interface
317
- QueryInterface: function(iid) {
318
- if (!iid.equals(Components.interfaces.nsISupports) &&
319
- !iid.equals(XMLRPCCLIENT_IID) &&
320
- !iid.equals(Components.interfaces.nsIInterfaceRequestor))
321
- throw Components.results.NS_ERROR_NO_INTERFACE;
322
- return this;
323
- },
324
-
325
- // nsIInterfaceRequester interface
326
- getInterface: function(iid, result){
327
- if (iid.equals(Components.interfaces.nsIAuthPrompt)){
328
- return this;
329
- }
330
- Components.returnCode = Components.results.NS_ERROR_NO_INTERFACE;
331
- return null;
332
- },
333
-
334
- // nsIAuthPrompt interface
335
- _passwordTried: false,
336
- promptUsernameAndPassword: function(dialogTitle, text, passwordRealm,
337
- savePassword, user, pwd){
338
-
339
- if (this._useAuth){
340
- if (this._passwordTried){
341
- return false;
342
- }
343
- user.value = this._username;
344
- pwd.value = this._password;
345
- this._passwordTried = true;
346
- return true;
347
- }
348
- return false;
349
- },
350
-
351
- /* Generate the XML-RPC request body */
352
- _generateRequestBody: function(writer, methodName, methodArgs) {
353
- writer.startElement('methodCall');
354
-
355
- writer.startElement('methodName');
356
- writer.write(methodName);
357
- writer.endElement('methodName');
358
-
359
- writer.startElement('params');
360
- for (var i = 0; i < methodArgs.length; i++) {
361
- writer.startElement('param');
362
- this._generateArgumentBody(writer, methodArgs[i]);
363
- writer.endElement('param');
364
- }
365
- writer.endElement('params');
366
-
367
- writer.endElement('methodCall');
368
- },
369
-
370
- /* Write out a XML-RPC parameter value */
371
- _generateArgumentBody: function(writer, obj) {
372
- writer.startElement('value');
373
- var sType = this._typeOf(obj);
374
- switch (sType) {
375
- case 'PRUint8':
376
- case 'PRUint16':
377
- case 'PRInt16':
378
- case 'PRInt32':
379
- obj=obj.QueryInterface(Components.interfaces['nsISupports' +
380
- sType]);
381
- writer.startElement('i4');
382
- writer.write(obj.toString());
383
- writer.endElement('i4');
384
- break;
385
-
386
- case 'PRBool':
387
- obj=obj.QueryInterface(Components.interfaces.nsISupportsPRBool);
388
- writer.startElement('boolean');
389
- writer.write(obj.data ? '1' : '0');
390
- writer.endElement('boolean');
391
- break;
392
-
393
- case 'Char':
394
- case 'CString':
395
- obj=obj.QueryInterface(Components.interfaces['nsISupports' +
396
- sType]);
397
- writer.startElement('string');
398
- writer.write(obj.toString());
399
- writer.endElement('string');
400
- break;
401
-
402
- case 'Float':
403
- case 'Double':
404
- obj=obj.QueryInterface(Components.interfaces['nsISupports' +
405
- sType]);
406
- writer.startElement('double');
407
- writer.write(obj.toString());
408
- writer.endElement('double');
409
- break;
410
-
411
- case 'PRTime':
412
- obj = obj.QueryInterface(
413
- Components.interfaces.nsISupportsPRTime);
414
- var date = new Date(obj.data)
415
- writer.startElement('dateTime.iso8601');
416
- writer.write(iso8601Format(date));
417
- writer.endElement('dateTime.iso8601');
418
- break;
419
-
420
- case 'InputStream':
421
- obj = obj.QueryInterface(Components.interfaces.nsIInputStream);
422
- obj = toScriptableStream(obj);
423
- writer.startElement('base64');
424
- streamToBase64(obj, writer);
425
- writer.endElement('base64');
426
- break;
427
-
428
- case 'Array':
429
- obj = obj.QueryInterface(
430
- Components.interfaces.nsISupportsArray);
431
- writer.startElement('array');
432
- writer.startElement('data');
433
- for (var i = 0; i < obj.Count(); i++)
434
- this._generateArgumentBody(writer, obj.GetElementAt(i));
435
- writer.endElement('data');
436
- writer.endElement('array');
437
- break;
438
-
439
- case 'Dictionary':
440
- obj = obj.QueryInterface(Components.interfaces.nsIDictionary);
441
- writer.startElement('struct');
442
- var keys = obj.getKeys({});
443
- for (var k = 0; k < keys.length; k++) {
444
- writer.startElement('member');
445
- writer.startElement('name');
446
- writer.write(keys[k]);
447
- writer.endElement('name');
448
- this._generateArgumentBody(writer, obj.getValue(keys[k]));
449
- writer.endElement('member');
450
- }
451
- writer.endElement('struct');
452
- break;
453
-
454
- default:
455
- throw Components.Exception('Unsupported argument', null, null,
456
- obj);
457
- }
458
-
459
- writer.endElement('value');
460
- },
461
-
462
- /* Determine type of a nsISupports primitive, array or dictionary. */
463
- _typeOf: function(obj) {
464
- // XPConnect alows JS to pass in anything, because we are a regular
465
- // JS object to it. So we have to test rigorously.
466
- if (typeof obj != 'object') return 'Unknown';
467
-
468
- // Anything else not nsISupports is not allowed.
469
- if (typeof obj.QueryInterface != 'function') return 'Unknown';
470
-
471
- // Now we will have to eliminate by trying all possebilities.
472
- try {
473
- obj.QueryInterface(Components.interfaces.nsISupportsPRUint8);
474
- return 'PRUint8';
475
- } catch(e) {}
476
-
477
- try {
478
- obj.QueryInterface(Components.interfaces.nsISupportsPRUint16);
479
- return 'PRUint16';
480
- } catch(e) {}
481
-
482
- try {
483
- obj.QueryInterface(Components.interfaces.nsISupportsPRInt16);
484
- return 'PRInt16';
485
- } catch(e) {}
486
-
487
- try {
488
- obj.QueryInterface(Components.interfaces.nsISupportsPRInt32);
489
- return 'PRInt32';
490
- } catch(e) {}
491
-
492
- try {
493
- obj.QueryInterface(Components.interfaces.nsISupportsPRBool);
494
- return 'PRBool';
495
- } catch(e) {}
496
-
497
- try {
498
- obj.QueryInterface(Components.interfaces.nsISupportsChar);
499
- return 'Char';
500
- } catch(e) {}
501
-
502
- try {
503
- obj.QueryInterface(Components.interfaces.nsISupportsCString);
504
- return 'CString';
505
- } catch(e) {}
506
-
507
- try {
508
- obj.QueryInterface(Components.interfaces.nsISupportsFloat);
509
- return 'Float';
510
- } catch(e) {}
511
-
512
- try {
513
- obj.QueryInterface(Components.interfaces.nsISupportsDouble);
514
- return 'Double';
515
- } catch(e) {}
516
-
517
- try {
518
- obj.QueryInterface(Components.interfaces.nsISupportsPRTime);
519
- return 'PRTime';
520
- } catch(e) {}
521
-
522
- try {
523
- obj.QueryInterface(Components.interfaces.nsIInputStream);
524
- return 'InputStream';
525
- } catch(e) {}
526
-
527
- try {
528
- obj.QueryInterface(Components.interfaces.nsISupportsArray);
529
- return 'Array';
530
- } catch(e) {}
531
-
532
- try {
533
- obj.QueryInterface(Components.interfaces.nsIDictionary);
534
- return 'Dictionary';
535
- } catch(e) {}
536
-
537
- // Not a supported type
538
- return 'Unknown';
539
- },
540
-
541
- // Response parsing state
542
- _valueStack: [],
543
- _currValue: null,
544
- _cdata: null,
545
-
546
- parse: function(doc) {
547
- var node = doc.firstChild;
548
- var result;
549
- if (node.nodeType == DOMNode.TEXT_NODE)
550
- node = node.nextSibling;
551
- if ((node.nodeType != DOMNode.ELEMENT_NODE) ||
552
- (node.nodeName != 'methodResponse')) {
553
- throw Components.Exception('Expecting a methodResponse', null, null,
554
- doc);
555
- }
556
- node = node.firstChild;
557
- if (node.nodeType == DOMNode.TEXT_NODE)
558
- node = node.nextSibling;
559
- if (node.nodeType != DOMNode.ELEMENT_NODE)
560
- throw Components.Exception('Expecting a params or fault', null,
561
- null, doc);
562
- if (node.nodeName == 'params') {
563
- node = node.firstChild;
564
- if (node.nodeType == DOMNode.TEXT_NODE)
565
- node = node.nextSibling;
566
- if ((node.nodeType != DOMNode.ELEMENT_NODE) ||
567
- (node.nodeName != 'param')) {
568
- throw Components.Exception('Expecting a param', null, null,
569
- doc);
570
- }
571
- result = this.parseValue(node.firstChild);
572
- } else if (node.nodeName == 'fault') {
573
- this._foundFault = true;
574
- result = this.parseFault(node.firstChild);
575
- } else {
576
- throw Components.Exception('Expecting a params or fault', null,
577
- null, doc);
578
- }
579
- debug('Parse finished');
580
- return result;
581
- },
582
-
583
- parseValue: function(node) {
584
- var cValue = new Value();
585
- if (node && (node.nodeType == DOMNode.TEXT_NODE))
586
- node = node.nextSibling;
587
- if (!node || (node.nodeType != DOMNode.ELEMENT_NODE) ||
588
- (node.nodeName != 'value')) {
589
- throw Components.Exception('Expecting a value', null, null, node);
590
- }
591
- node = node.firstChild;
592
- if (!node)
593
- return cValue;
594
- if (node.nodeType == DOMNode.TEXT_NODE){
595
- if (!node.nextSibling) {
596
- cValue.value = node.nodeValue;
597
- return cValue;
598
- } else {
599
- node = node.nextSibling;
600
- }
601
- }
602
- if (node.nodeType != DOMNode.ELEMENT_NODE)
603
- throw Components.Exception('Expecting a value type', null, null,
604
- node);
605
- switch (node.nodeName) {
606
- case 'string':
607
- cValue.value = this.parseString(node.firstChild);
608
- break;
609
- case 'i4':
610
- case 'int':
611
- cValue.type = this.INT;
612
- cValue.value = this.parseString(node.firstChild);
613
- break;
614
- case 'boolean':
615
- cValue.type = this.BOOLEAN;
616
- cValue.value = this.parseString(node.firstChild);
617
- break;
618
- case 'double':
619
- cValue.type = this.DOUBLE;
620
- cValue.value = this.parseString(node.firstChild);
621
- break;
622
- case 'dateTime.iso8601':
623
- cValue.type = this.DATETIME;
624
- cValue.value = this.parseString(node.firstChild);
625
- break;
626
- case 'base64':
627
- cValue.type = this.BASE64;
628
- cValue.value = this.parseString(node.firstChild);
629
- break;
630
- case 'struct':
631
- cValue.type = this.STRUCT;
632
- this.parseStruct(cValue, node.firstChild);
633
- break;
634
- case 'array':
635
- cValue.type = this.ARRAY;
636
- this.parseArray(cValue, node.firstChild);
637
- break;
638
- default:
639
- throw Components.Exception('Expecting a value type', null, null,
640
- node);
641
- }
642
- return cValue;
643
- },
644
-
645
- parseString: function(node) {
646
- value = '';
647
- while (node) {
648
- if (node.nodeType != DOMNode.TEXT_NODE)
649
- throw Components.Exception('Expecting a text node', null, null,
650
- node);
651
- value += node.nodeValue;
652
- node = node.nextSibling;
653
- }
654
- return value;
655
- },
656
-
657
- parseStruct: function(struct, node) {
658
- while (node) {
659
- if (node.nodeType == DOMNode.TEXT_NODE)
660
- node = node.nextSibling;
661
- if (!node)
662
- return;
663
- if ((node.nodeType != DOMNode.ELEMENT_NODE) ||
664
- (node.nodeName != 'member')) {
665
- throw Components.Exception('Expecting a member', null, null,
666
- node);
667
- }
668
- this.parseMember(struct, node.firstChild);
669
- node = node.nextSibling;
670
- }
671
- },
672
-
673
- parseMember: function(struct, node) {
674
- var cValue;
675
- if (node.nodeType == DOMNode.TEXT_NODE)
676
- node = node.nextSibling;
677
- if (!node || (node.nodeType != DOMNode.ELEMENT_NODE) ||
678
- (node.nodeName != 'name')) {
679
- throw Components.Exception('Expecting a name', null, null, node);
680
- }
681
- struct.name = this.parseString(node.firstChild);
682
- cValue = this.parseValue(node.nextSibling);
683
- struct.appendValue(cValue.value);
684
- },
685
-
686
- parseArray: function(array, node) {
687
- if (node.nodeType == DOMNode.TEXT_NODE)
688
- node = node.nextSibling;
689
- if (!node || (node.nodeType != DOMNode.ELEMENT_NODE) ||
690
- (node.nodeName != 'data')) {
691
- throw Components.Exception('Expecting array data', null, null, node);
692
- }
693
- for (node = node.firstChild; node; node = node.nextSibling) {
694
- if (node.nodeType == DOMNode.TEXT_NODE)
695
- continue;
696
- array.appendValue(this.parseValue(node).value);
697
- }
698
- },
699
-
700
- parseFault: function(node) {
701
- var fault = createInstance(XMLRPCFAULT_CONTRACTID, 'nsIXmlRpcFault');
702
- var cValue = this.parseValue(node);
703
- if ((cValue.type != this.STRUCT) ||
704
- (!cValue.value.hasKey('faultCode')) ||
705
- (!cValue.value.hasKey('faultString'))) {
706
- throw Components.Exception('Invalid fault', null, null, node);
707
- }
708
- fault.init(cValue.value.getValue('faultCode').data,
709
- cValue.value.getValue('faultString').data);
710
- return fault;
711
- }
712
- };
713
-
714
- /* The XMLWriter class constructor */
715
- function XMLWriter(encoding) {
716
- if (!encoding)
717
- encoding = "UTF-8";
718
- this.data = '<?xml version="1.0" encoding="' + encoding + '"?>';
719
- }
720
-
721
- /* The XMLWriter class def */
722
- XMLWriter.prototype = {
723
- data: '',
724
-
725
- startElement: function(element) {
726
- this.data += '<' + element + '>';
727
- },
728
-
729
- endElement: function(element) {
730
- this.data += '</' + element + '>';
731
- },
732
-
733
- write: function(text) {
734
- for (var i = 0; i < text.length; i++) {
735
- var c = text[i];
736
- switch (c) {
737
- case '<':
738
- this.data += '&lt;';
739
- break;
740
- case '&':
741
- this.data += '&amp;';
742
- break;
743
- default:
744
- this.data += c;
745
- }
746
- }
747
- },
748
-
749
- markup: function(text) { this.data += text }
750
- };
751
-
752
- /* The Value class contructor */
753
- function Value() { this.type = this.STRING; };
754
-
755
- /* The Value class def */
756
- Value.prototype = {
757
- INT: nsXmlRpcClient.prototype.INT,
758
- BOOLEAN: nsXmlRpcClient.prototype.BOOLEAN,
759
- STRING: nsXmlRpcClient.prototype.STRING,
760
- DOUBLE: nsXmlRpcClient.prototype.DOUBLE,
761
- DATETIME: nsXmlRpcClient.prototype.DATETIME,
762
- ARRAY: nsXmlRpcClient.prototype.ARRAY,
763
- STRUCT: nsXmlRpcClient.prototype.STRUCT,
764
- BASE64: nsXmlRpcClient.prototype.BASE64,
765
-
766
- _createType: nsXmlRpcClient.prototype.createType,
767
-
768
- name: null,
769
-
770
- _value: null,
771
- get value() { return this._value; },
772
- set value(val) {
773
- // accepts [0-9]+ or x[0-9a-fA-F]+ and returns the character.
774
- function entityTrans(substr, code) {
775
- return String.fromCharCode("0" + code);
776
- }
777
-
778
- switch (this.type) {
779
- case this.STRING:
780
- val = val.replace(/&#([0-9]+);/g, entityTrans);
781
- val = val.replace(/&#(x[0-9a-fA-F]+);/g, entityTrans);
782
- val = val.replace(/&lt;/g, '<');
783
- val = val.replace(/&gt;/g, '>');
784
- val = val.replace(/&amp;/g, '&');
785
- this._value.data = val;
786
- break;
787
-
788
- case this.BOOLEAN:
789
- this._value.data = (val == 1);
790
- break;
791
-
792
- case this.DATETIME:
793
- this._value.data = Date.UTC(val.slice(0, 4),
794
- val.slice(4, 6) - 1, val.slice(6, 8), val.slice(9, 11),
795
- val.slice(12, 14), val.slice(15));
796
- break;
797
-
798
- case this.BASE64:
799
- this._value.data = base64ToString(val);
800
- break;
801
-
802
- default:
803
- this._value.data = val;
804
- }
805
- },
806
-
807
- _type: null,
808
- get type() { return this._type; },
809
- set type(type) {
810
- this._type = type;
811
- if (type == this.BASE64)
812
- this._value = this._createType(this.STRING, {});
813
- else this._value = this._createType(type, {});
814
- },
815
-
816
- appendValue: function(val) {
817
- switch (this.type) {
818
- case this.ARRAY:
819
- this.value.AppendElement(val);
820
- break;
821
-
822
- case this.STRUCT:
823
- this.value.setValue(this.name, val);
824
- break;
825
- }
826
- }
827
- };
828
-
829
- /*
830
- * Objects
831
- */
832
-
833
- /* nsXmlRpcClient Module (for XPCOM registration) */
834
- var nsXmlRpcClientModule = {
835
- registerSelf: function(compMgr, fileSpec, location, type) {
836
- compMgr = compMgr.QueryInterface(Components.interfaces.nsIComponentRegistrar);
837
-
838
- compMgr.registerFactoryLocation(XMLRPCCLIENT_CID,
839
- 'XML-RPC Client JS component',
840
- XMLRPCCLIENT_CONTRACTID,
841
- fileSpec,
842
- location,
843
- type);
844
- compMgr.registerFactoryLocation(XMLRPCFAULT_CID,
845
- 'XML-RPC Fault JS component',
846
- XMLRPCFAULT_CONTRACTID,
847
- fileSpec,
848
- location,
849
- type);
850
- },
851
-
852
- getClassObject: function(compMgr, cid, iid) {
853
- if (!cid.equals(XMLRPCCLIENT_CID) && !cid.equals(XMLRPCFAULT_CID))
854
- throw Components.results.NS_ERROR_NO_INTERFACE;
855
-
856
- if (!iid.equals(Components.interfaces.nsIFactory))
857
- throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
858
-
859
- if (cid.equals(XMLRPCCLIENT_CID))
860
- return nsXmlRpcClientFactory
861
- else return nsXmlRpcFaultFactory;
862
- },
863
-
864
- canUnload: function(compMgr) { return true; }
865
- };
866
-
867
- /* nsXmlRpcClient Class Factory */
868
- var nsXmlRpcClientFactory = {
869
- createInstance: function(outer, iid) {
870
- if (outer != null)
871
- throw Components.results.NS_ERROR_NO_AGGREGATION;
872
-
873
- if (!iid.equals(XMLRPCCLIENT_IID) &&
874
- !iid.equals(Components.interfaces.nsISupports))
875
- throw Components.results.NS_ERROR_INVALID_ARG;
876
-
877
- return new nsXmlRpcClient();
878
- }
879
- }
880
-
881
- /* nsXmlRpcFault Class Factory */
882
- var nsXmlRpcFaultFactory = {
883
- createInstance: function(outer, iid) {
884
- if (outer != null)
885
- throw Components.results.NS_ERROR_NO_AGGREGATION;
886
-
887
- if (!iid.equals(XMLRPCFAULT_IID) &&
888
- !iid.equals(Components.interfaces.nsISupports))
889
- throw Components.results.NS_ERROR_INVALID_ARG;
890
-
891
- return new nsXmlRpcFault();
892
- }
893
- }
894
-
895
- /*
896
- * Functions
897
- */
898
-
899
- /* module initialisation */
900
- function NSGetModule(comMgr, fileSpec) { return nsXmlRpcClientModule; }
901
-
902
- /* Create an instance of the given ContractID, with given interface */
903
- function createInstance(contractId, intf) {
904
- return Components.classes[contractId]
905
- .createInstance(Components.interfaces[intf]);
906
- }
907
-
908
- /* Get a pointer to a service indicated by the ContractID, with given interface */
909
- function getService(contractId, intf) {
910
- return Components.classes[contractId]
911
- .getService(Components.interfaces[intf]);
912
- }
913
-
914
- /* Convert an inputstream to a scriptable inputstream */
915
- function toScriptableStream(input) {
916
- var SIStream = Components.Constructor(
917
- '@mozilla.org/scriptableinputstream;1',
918
- 'nsIScriptableInputStream', 'init');
919
- return new SIStream(input);
920
- }
921
-
922
- /* format a Date object into a iso8601 datetime string, UTC time */
923
- function iso8601Format(date) {
924
- var datetime = date.getUTCFullYear();
925
- var month = String(date.getUTCMonth() + 1);
926
- datetime += (month.length == 1 ? '0' + month : month);
927
- var day = date.getUTCDate();
928
- datetime += (day < 10 ? '0' + day : day);
929
-
930
- datetime += 'T';
931
-
932
- var hour = date.getUTCHours();
933
- datetime += (hour < 10 ? '0' + hour : hour) + ':';
934
- var minutes = date.getUTCMinutes();
935
- datetime += (minutes < 10 ? '0' + minutes : minutes) + ':';
936
- var seconds = date.getUTCSeconds();
937
- datetime += (seconds < 10 ? '0' + seconds : seconds);
938
-
939
- return datetime;
940
- }
941
-
942
- /* Convert a stream to Base64, writing it away to a string writer */
943
- const BASE64CHUNK = 255; // Has to be dividable by 3!!
944
- function streamToBase64(stream, writer) {
945
- while (stream.available()) {
946
- var data = [];
947
- while (data.length < BASE64CHUNK && stream.available()) {
948
- var d = stream.read(1).charCodeAt(0);
949
- // reading a 0 results in NaN, compensate.
950
- data = data.concat(isNaN(d) ? 0 : d);
951
- }
952
- writer.write(toBase64(data));
953
- }
954
- }
955
-
956
- /* Convert data (an array of integers) to a Base64 string. */
957
- const toBase64Table = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz' +
958
- '0123456789+/';
959
- const base64Pad = '=';
960
- function toBase64(data) {
961
- var result = '';
962
- var length = data.length;
963
- var i;
964
- // Convert every three bytes to 4 ascii characters.
965
- for (i = 0; i < (length - 2); i += 3) {
966
- result += toBase64Table[data[i] >> 2];
967
- result += toBase64Table[((data[i] & 0x03) << 4) + (data[i+1] >> 4)];
968
- result += toBase64Table[((data[i+1] & 0x0f) << 2) + (data[i+2] >> 6)];
969
- result += toBase64Table[data[i+2] & 0x3f];
970
- }
971
-
972
- // Convert the remaining 1 or 2 bytes, pad out to 4 characters.
973
- if (length%3) {
974
- i = length - (length%3);
975
- result += toBase64Table[data[i] >> 2];
976
- if ((length%3) == 2) {
977
- result += toBase64Table[((data[i] & 0x03) << 4) + (data[i+1] >> 4)];
978
- result += toBase64Table[(data[i+1] & 0x0f) << 2];
979
- result += base64Pad;
980
- } else {
981
- result += toBase64Table[(data[i] & 0x03) << 4];
982
- result += base64Pad + base64Pad;
983
- }
984
- }
985
-
986
- return result;
987
- }
988
-
989
- /* Convert Base64 data to a string */
990
- const toBinaryTable = [
991
- -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1,
992
- -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1,
993
- -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,62, -1,-1,-1,63,
994
- 52,53,54,55, 56,57,58,59, 60,61,-1,-1, -1, 0,-1,-1,
995
- -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10, 11,12,13,14,
996
- 15,16,17,18, 19,20,21,22, 23,24,25,-1, -1,-1,-1,-1,
997
- -1,26,27,28, 29,30,31,32, 33,34,35,36, 37,38,39,40,
998
- 41,42,43,44, 45,46,47,48, 49,50,51,-1, -1,-1,-1,-1
999
- ];
1000
- function base64ToString(data) {
1001
- var result = '';
1002
- var leftbits = 0; // number of bits decoded, but yet to be appended
1003
- var leftdata = 0; // bits decoded, but yet to be appended
1004
-
1005
- // Convert one by one.
1006
- for (var i = 0; i < data.length; i++) {
1007
- var c = toBinaryTable[data.charCodeAt(i) & 0x7f];
1008
- var padding = (data[i] == base64Pad);
1009
- // Skip illegal characters and whitespace
1010
- if (c == -1) continue;
1011
-
1012
- // Collect data into leftdata, update bitcount
1013
- leftdata = (leftdata << 6) | c;
1014
- leftbits += 6;
1015
-
1016
- // If we have 8 or more bits, append 8 bits to the result
1017
- if (leftbits >= 8) {
1018
- leftbits -= 8;
1019
- // Append if not padding.
1020
- if (!padding)
1021
- result += String.fromCharCode((leftdata >> leftbits) & 0xff);
1022
- leftdata &= (1 << leftbits) - 1;
1023
- }
1024
- }
1025
-
1026
- // If there are any bits left, the base64 string was corrupted
1027
- if (leftbits)
1028
- throw Components.Exception('Corrupted base64 string');
1029
-
1030
- return result;
1031
- }
1032
-
1033
- if (DEBUG) debug = function(msg) {
1034
- dump(' -- XML-RPC client -- : ' + msg + '\n');
1035
- };
1036
- else debug = function() {}
1037
-
1038
- // vim:sw=4:sr:sta:et:sts: