closure 1.1.692

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 (1494) hide show
  1. data/.gitignore +6 -0
  2. data/.yardopts +3 -0
  3. data/LICENSE +202 -0
  4. data/README.md +26 -0
  5. data/beanshell/LICENSE +12 -0
  6. data/beanshell/bsh-core-2.0b4.jar +0 -0
  7. data/closure-compiler/COPYING +202 -0
  8. data/closure-compiler/README +278 -0
  9. data/closure-compiler/compiler.jar +0 -0
  10. data/closure-library/AUTHORS +12 -0
  11. data/closure-library/LICENSE +176 -0
  12. data/closure-library/README +6 -0
  13. data/closure-library/all_tests.html +113 -0
  14. data/closure-library/alltests.js +16 -0
  15. data/closure-library/closure/bin/build/closurebuilder.py +257 -0
  16. data/closure-library/closure/bin/build/depstree.py +186 -0
  17. data/closure-library/closure/bin/build/depstree_test.py +127 -0
  18. data/closure-library/closure/bin/build/depswriter.py +197 -0
  19. data/closure-library/closure/bin/build/jscompiler.py +69 -0
  20. data/closure-library/closure/bin/build/source.py +86 -0
  21. data/closure-library/closure/bin/build/source_test.py +57 -0
  22. data/closure-library/closure/bin/build/treescan.py +78 -0
  23. data/closure-library/closure/bin/calcdeps.py +570 -0
  24. data/closure-library/closure/bin/scopify.py +211 -0
  25. data/closure-library/closure/css/inlay/g-base.css +82 -0
  26. data/closure-library/closure/css/inlay/g-fixed.css +158 -0
  27. data/closure-library/closure/css/inlay/g-ratio.css +253 -0
  28. data/closure-library/closure/goog/array/array.js +1300 -0
  29. data/closure-library/closure/goog/array/array_test.html +1524 -0
  30. data/closure-library/closure/goog/asserts/asserts.js +277 -0
  31. data/closure-library/closure/goog/asserts/asserts_test.html +163 -0
  32. data/closure-library/closure/goog/async/conditionaldelay.js +238 -0
  33. data/closure-library/closure/goog/async/conditionaldelay_test.html +227 -0
  34. data/closure-library/closure/goog/async/delay.js +174 -0
  35. data/closure-library/closure/goog/async/delay_test.html +148 -0
  36. data/closure-library/closure/goog/async/throttle.js +189 -0
  37. data/closure-library/closure/goog/async/throttle_test.html +102 -0
  38. data/closure-library/closure/goog/base.js +1471 -0
  39. data/closure-library/closure/goog/base_test.html +1166 -0
  40. data/closure-library/closure/goog/bootstrap/webworkers.js +37 -0
  41. data/closure-library/closure/goog/color/alpha.js +436 -0
  42. data/closure-library/closure/goog/color/alpha_test.html +234 -0
  43. data/closure-library/closure/goog/color/color.js +757 -0
  44. data/closure-library/closure/goog/color/color_test.html +645 -0
  45. data/closure-library/closure/goog/color/names.js +176 -0
  46. data/closure-library/closure/goog/crypt/arc4.js +141 -0
  47. data/closure-library/closure/goog/crypt/arc4_test.html +42 -0
  48. data/closure-library/closure/goog/crypt/base64.js +267 -0
  49. data/closure-library/closure/goog/crypt/base64_test.html +106 -0
  50. data/closure-library/closure/goog/crypt/basen.js +242 -0
  51. data/closure-library/closure/goog/crypt/basen_test.html +167 -0
  52. data/closure-library/closure/goog/crypt/crypt.js +103 -0
  53. data/closure-library/closure/goog/crypt/crypt_test.html +68 -0
  54. data/closure-library/closure/goog/crypt/hash32.js +184 -0
  55. data/closure-library/closure/goog/crypt/hash32_test.html +287 -0
  56. data/closure-library/closure/goog/crypt/sha1.js +238 -0
  57. data/closure-library/closure/goog/crypt/sha1_test.html +47 -0
  58. data/closure-library/closure/goog/css/autocomplete.css +43 -0
  59. data/closure-library/closure/goog/css/bubble.css +84 -0
  60. data/closure-library/closure/goog/css/button.css +38 -0
  61. data/closure-library/closure/goog/css/charpicker.css +201 -0
  62. data/closure-library/closure/goog/css/checkbox.css +38 -0
  63. data/closure-library/closure/goog/css/colormenubutton.css +25 -0
  64. data/closure-library/closure/goog/css/colorpalette.css +54 -0
  65. data/closure-library/closure/goog/css/colorpicker-simplegrid.css +50 -0
  66. data/closure-library/closure/goog/css/combobox.css +57 -0
  67. data/closure-library/closure/goog/css/common.css +41 -0
  68. data/closure-library/closure/goog/css/css3button.css +77 -0
  69. data/closure-library/closure/goog/css/css3menubutton.css +23 -0
  70. data/closure-library/closure/goog/css/custombutton.css +164 -0
  71. data/closure-library/closure/goog/css/datepicker.css +148 -0
  72. data/closure-library/closure/goog/css/dialog.css +72 -0
  73. data/closure-library/closure/goog/css/dimensionpicker.css +47 -0
  74. data/closure-library/closure/goog/css/dragdropdetector.css +48 -0
  75. data/closure-library/closure/goog/css/editor/bubble.css +73 -0
  76. data/closure-library/closure/goog/css/editor/dialog.css +66 -0
  77. data/closure-library/closure/goog/css/editor/linkdialog.css +36 -0
  78. data/closure-library/closure/goog/css/editortoolbar.css +225 -0
  79. data/closure-library/closure/goog/css/filteredmenu.css +30 -0
  80. data/closure-library/closure/goog/css/filterobservingmenuitem.css +25 -0
  81. data/closure-library/closure/goog/css/flatbutton.css +65 -0
  82. data/closure-library/closure/goog/css/flatmenubutton.css +63 -0
  83. data/closure-library/closure/goog/css/hovercard.css +51 -0
  84. data/closure-library/closure/goog/css/hsvapalette.css +231 -0
  85. data/closure-library/closure/goog/css/hsvpalette.css +179 -0
  86. data/closure-library/closure/goog/css/imagelessbutton.css +160 -0
  87. data/closure-library/closure/goog/css/imagelessmenubutton.css +23 -0
  88. data/closure-library/closure/goog/css/inputdatepicker.css +12 -0
  89. data/closure-library/closure/goog/css/linkbutton.css +26 -0
  90. data/closure-library/closure/goog/css/menu.css +27 -0
  91. data/closure-library/closure/goog/css/menubutton.css +169 -0
  92. data/closure-library/closure/goog/css/menuitem.css +96 -0
  93. data/closure-library/closure/goog/css/menuseparator.css +19 -0
  94. data/closure-library/closure/goog/css/multitestrunner.css +121 -0
  95. data/closure-library/closure/goog/css/offline.css +147 -0
  96. data/closure-library/closure/goog/css/palette.css +36 -0
  97. data/closure-library/closure/goog/css/popupdatepicker.css +17 -0
  98. data/closure-library/closure/goog/css/roundedpanel.css +29 -0
  99. data/closure-library/closure/goog/css/roundedtab.css +158 -0
  100. data/closure-library/closure/goog/css/submenu.css +28 -0
  101. data/closure-library/closure/goog/css/tab.css +91 -0
  102. data/closure-library/closure/goog/css/tabbar.css +52 -0
  103. data/closure-library/closure/goog/css/tablesorter.css +14 -0
  104. data/closure-library/closure/goog/css/toolbar.css +400 -0
  105. data/closure-library/closure/goog/css/tooltip.css +14 -0
  106. data/closure-library/closure/goog/css/tree.css +147 -0
  107. data/closure-library/closure/goog/css/tristatemenuitem.css +43 -0
  108. data/closure-library/closure/goog/cssom/cssom.js +447 -0
  109. data/closure-library/closure/goog/cssom/cssom_test.html +343 -0
  110. data/closure-library/closure/goog/cssom/cssom_test_import_1.css +11 -0
  111. data/closure-library/closure/goog/cssom/cssom_test_import_2.css +10 -0
  112. data/closure-library/closure/goog/cssom/cssom_test_link_1.css +10 -0
  113. data/closure-library/closure/goog/cssom/iframe/style.js +1020 -0
  114. data/closure-library/closure/goog/cssom/iframe/style_test.html +391 -0
  115. data/closure-library/closure/goog/cssom/iframe/style_test_import.css +10 -0
  116. data/closure-library/closure/goog/datasource/datamanager.js +566 -0
  117. data/closure-library/closure/goog/datasource/datasource.js +646 -0
  118. data/closure-library/closure/goog/datasource/datasource_test.html +265 -0
  119. data/closure-library/closure/goog/datasource/expr.js +544 -0
  120. data/closure-library/closure/goog/datasource/expr_test.html +97 -0
  121. data/closure-library/closure/goog/datasource/fastdatanode.js +792 -0
  122. data/closure-library/closure/goog/datasource/fastdatanode_test.html +254 -0
  123. data/closure-library/closure/goog/datasource/jsdatasource.js +460 -0
  124. data/closure-library/closure/goog/datasource/jsondatasource.js +146 -0
  125. data/closure-library/closure/goog/datasource/jsxmlhttpdatasource.js +191 -0
  126. data/closure-library/closure/goog/datasource/jsxmlhttpdatasource_test.html +94 -0
  127. data/closure-library/closure/goog/datasource/xmldatasource.js +407 -0
  128. data/closure-library/closure/goog/date/date.js +1642 -0
  129. data/closure-library/closure/goog/date/date_test.html +1293 -0
  130. data/closure-library/closure/goog/date/datelike.js +27 -0
  131. data/closure-library/closure/goog/date/daterange.js +398 -0
  132. data/closure-library/closure/goog/date/daterange_test.html +213 -0
  133. data/closure-library/closure/goog/date/relative.js +425 -0
  134. data/closure-library/closure/goog/date/relative_test.html +124 -0
  135. data/closure-library/closure/goog/date/utcdatetime.js +178 -0
  136. data/closure-library/closure/goog/date/utcdatetime_test.html +119 -0
  137. data/closure-library/closure/goog/debug/console.js +138 -0
  138. data/closure-library/closure/goog/debug/debug.js +452 -0
  139. data/closure-library/closure/goog/debug/debug_test.html +32 -0
  140. data/closure-library/closure/goog/debug/debugwindow.js +582 -0
  141. data/closure-library/closure/goog/debug/devcss/devcss.js +435 -0
  142. data/closure-library/closure/goog/debug/devcss/devcss_test.html +365 -0
  143. data/closure-library/closure/goog/debug/devcss/devcssrunner.js +26 -0
  144. data/closure-library/closure/goog/debug/divconsole.js +141 -0
  145. data/closure-library/closure/goog/debug/enhanceerror_test.html +138 -0
  146. data/closure-library/closure/goog/debug/entrypointregistry.js +111 -0
  147. data/closure-library/closure/goog/debug/entrypointregistry_test.html +63 -0
  148. data/closure-library/closure/goog/debug/error.js +47 -0
  149. data/closure-library/closure/goog/debug/error_test.html +85 -0
  150. data/closure-library/closure/goog/debug/errorhandler.js +234 -0
  151. data/closure-library/closure/goog/debug/errorhandler_async_test.html +112 -0
  152. data/closure-library/closure/goog/debug/errorhandler_test.html +186 -0
  153. data/closure-library/closure/goog/debug/errorhandlerweakdep.js +38 -0
  154. data/closure-library/closure/goog/debug/errorreporter.js +324 -0
  155. data/closure-library/closure/goog/debug/errorreporter_test.html +289 -0
  156. data/closure-library/closure/goog/debug/fancywindow.js +265 -0
  157. data/closure-library/closure/goog/debug/formatter.js +314 -0
  158. data/closure-library/closure/goog/debug/gcdiagnostics.js +143 -0
  159. data/closure-library/closure/goog/debug/logbuffer.js +147 -0
  160. data/closure-library/closure/goog/debug/logbuffer_test.html +105 -0
  161. data/closure-library/closure/goog/debug/logger.js +809 -0
  162. data/closure-library/closure/goog/debug/logger_test.html +208 -0
  163. data/closure-library/closure/goog/debug/logrecord.js +271 -0
  164. data/closure-library/closure/goog/debug/reflect.js +159 -0
  165. data/closure-library/closure/goog/debug/reflect_test.html +81 -0
  166. data/closure-library/closure/goog/debug/relativetimeprovider.js +83 -0
  167. data/closure-library/closure/goog/debug/tracer.js +750 -0
  168. data/closure-library/closure/goog/debug/tracer_test.html +57 -0
  169. data/closure-library/closure/goog/demos/advancedtooltip.html +78 -0
  170. data/closure-library/closure/goog/demos/animationqueue.html +149 -0
  171. data/closure-library/closure/goog/demos/autocomplete-basic.html +56 -0
  172. data/closure-library/closure/goog/demos/autocompleteremote.html +40 -0
  173. data/closure-library/closure/goog/demos/autocompleteremotedata.js +18 -0
  174. data/closure-library/closure/goog/demos/autocompleterichremote.html +137 -0
  175. data/closure-library/closure/goog/demos/autocompleterichremotedata.js +33 -0
  176. data/closure-library/closure/goog/demos/bidiinput.html +72 -0
  177. data/closure-library/closure/goog/demos/bubble.html +250 -0
  178. data/closure-library/closure/goog/demos/button.html +395 -0
  179. data/closure-library/closure/goog/demos/charcounter.html +57 -0
  180. data/closure-library/closure/goog/demos/charpicker.html +64 -0
  181. data/closure-library/closure/goog/demos/checkbox.html +122 -0
  182. data/closure-library/closure/goog/demos/color-contrast.html +60 -0
  183. data/closure-library/closure/goog/demos/colormenubutton.html +213 -0
  184. data/closure-library/closure/goog/demos/colorpicker.html +43 -0
  185. data/closure-library/closure/goog/demos/combobox.html +125 -0
  186. data/closure-library/closure/goog/demos/container.html +670 -0
  187. data/closure-library/closure/goog/demos/control.html +477 -0
  188. data/closure-library/closure/goog/demos/css/demo.css +75 -0
  189. data/closure-library/closure/goog/demos/css/emojipicker.css +36 -0
  190. data/closure-library/closure/goog/demos/css/emojisprite.css +92 -0
  191. data/closure-library/closure/goog/demos/css3button.html +166 -0
  192. data/closure-library/closure/goog/demos/css3menubutton.html +285 -0
  193. data/closure-library/closure/goog/demos/cssspriteanimation.html +80 -0
  194. data/closure-library/closure/goog/demos/datepicker.html +183 -0
  195. data/closure-library/closure/goog/demos/debug.html +119 -0
  196. data/closure-library/closure/goog/demos/depsgraph.html +221 -0
  197. data/closure-library/closure/goog/demos/dialog.html +156 -0
  198. data/closure-library/closure/goog/demos/dimensionpicker.html +108 -0
  199. data/closure-library/closure/goog/demos/dimensionpicker_rtl.html +123 -0
  200. data/closure-library/closure/goog/demos/dom_selection.html +88 -0
  201. data/closure-library/closure/goog/demos/drag.html +191 -0
  202. data/closure-library/closure/goog/demos/dragdrop.html +263 -0
  203. data/closure-library/closure/goog/demos/dragdropdetector.html +46 -0
  204. data/closure-library/closure/goog/demos/dragdropdetector_target.html +17 -0
  205. data/closure-library/closure/goog/demos/dragger.html +83 -0
  206. data/closure-library/closure/goog/demos/draglistgroup.html +261 -0
  207. data/closure-library/closure/goog/demos/drilldownrow.html +78 -0
  208. data/closure-library/closure/goog/demos/editor/deps.js +20 -0
  209. data/closure-library/closure/goog/demos/editor/editor.html +139 -0
  210. data/closure-library/closure/goog/demos/editor/field_basic.html +74 -0
  211. data/closure-library/closure/goog/demos/editor/helloworld.html +91 -0
  212. data/closure-library/closure/goog/demos/editor/helloworld.js +81 -0
  213. data/closure-library/closure/goog/demos/editor/helloworld_test.html +75 -0
  214. data/closure-library/closure/goog/demos/editor/helloworlddialog.js +163 -0
  215. data/closure-library/closure/goog/demos/editor/helloworlddialog_test.html +100 -0
  216. data/closure-library/closure/goog/demos/editor/helloworlddialogplugin.js +110 -0
  217. data/closure-library/closure/goog/demos/editor/helloworlddialogplugin_test.html +198 -0
  218. data/closure-library/closure/goog/demos/editor/seamlessfield.html +106 -0
  219. data/closure-library/closure/goog/demos/effects.html +142 -0
  220. data/closure-library/closure/goog/demos/emoji/200.gif +0 -0
  221. data/closure-library/closure/goog/demos/emoji/201.gif +0 -0
  222. data/closure-library/closure/goog/demos/emoji/202.gif +0 -0
  223. data/closure-library/closure/goog/demos/emoji/203.gif +0 -0
  224. data/closure-library/closure/goog/demos/emoji/204.gif +0 -0
  225. data/closure-library/closure/goog/demos/emoji/205.gif +0 -0
  226. data/closure-library/closure/goog/demos/emoji/206.gif +0 -0
  227. data/closure-library/closure/goog/demos/emoji/2BC.gif +0 -0
  228. data/closure-library/closure/goog/demos/emoji/2BD.gif +0 -0
  229. data/closure-library/closure/goog/demos/emoji/2BE.gif +0 -0
  230. data/closure-library/closure/goog/demos/emoji/2BF.gif +0 -0
  231. data/closure-library/closure/goog/demos/emoji/2C0.gif +0 -0
  232. data/closure-library/closure/goog/demos/emoji/2C1.gif +0 -0
  233. data/closure-library/closure/goog/demos/emoji/2C2.gif +0 -0
  234. data/closure-library/closure/goog/demos/emoji/2C3.gif +0 -0
  235. data/closure-library/closure/goog/demos/emoji/2C4.gif +0 -0
  236. data/closure-library/closure/goog/demos/emoji/2C5.gif +0 -0
  237. data/closure-library/closure/goog/demos/emoji/2C6.gif +0 -0
  238. data/closure-library/closure/goog/demos/emoji/2C7.gif +0 -0
  239. data/closure-library/closure/goog/demos/emoji/2C8.gif +0 -0
  240. data/closure-library/closure/goog/demos/emoji/2C9.gif +0 -0
  241. data/closure-library/closure/goog/demos/emoji/2CA.gif +0 -0
  242. data/closure-library/closure/goog/demos/emoji/2CB.gif +0 -0
  243. data/closure-library/closure/goog/demos/emoji/2CC.gif +0 -0
  244. data/closure-library/closure/goog/demos/emoji/2CD.gif +0 -0
  245. data/closure-library/closure/goog/demos/emoji/2CE.gif +0 -0
  246. data/closure-library/closure/goog/demos/emoji/2CF.gif +0 -0
  247. data/closure-library/closure/goog/demos/emoji/2D0.gif +0 -0
  248. data/closure-library/closure/goog/demos/emoji/2D1.gif +0 -0
  249. data/closure-library/closure/goog/demos/emoji/2D2.gif +0 -0
  250. data/closure-library/closure/goog/demos/emoji/2D3.gif +0 -0
  251. data/closure-library/closure/goog/demos/emoji/2D4.gif +0 -0
  252. data/closure-library/closure/goog/demos/emoji/2D5.gif +0 -0
  253. data/closure-library/closure/goog/demos/emoji/2D6.gif +0 -0
  254. data/closure-library/closure/goog/demos/emoji/2D7.gif +0 -0
  255. data/closure-library/closure/goog/demos/emoji/2D8.gif +0 -0
  256. data/closure-library/closure/goog/demos/emoji/2D9.gif +0 -0
  257. data/closure-library/closure/goog/demos/emoji/2DA.gif +0 -0
  258. data/closure-library/closure/goog/demos/emoji/2DB.gif +0 -0
  259. data/closure-library/closure/goog/demos/emoji/2DC.gif +0 -0
  260. data/closure-library/closure/goog/demos/emoji/2DD.gif +0 -0
  261. data/closure-library/closure/goog/demos/emoji/2DE.gif +0 -0
  262. data/closure-library/closure/goog/demos/emoji/2DF.gif +0 -0
  263. data/closure-library/closure/goog/demos/emoji/2E0.gif +0 -0
  264. data/closure-library/closure/goog/demos/emoji/2E1.gif +0 -0
  265. data/closure-library/closure/goog/demos/emoji/2E2.gif +0 -0
  266. data/closure-library/closure/goog/demos/emoji/2E3.gif +0 -0
  267. data/closure-library/closure/goog/demos/emoji/2E4.gif +0 -0
  268. data/closure-library/closure/goog/demos/emoji/2E5.gif +0 -0
  269. data/closure-library/closure/goog/demos/emoji/2E6.gif +0 -0
  270. data/closure-library/closure/goog/demos/emoji/2E7.gif +0 -0
  271. data/closure-library/closure/goog/demos/emoji/2E8.gif +0 -0
  272. data/closure-library/closure/goog/demos/emoji/2E9.gif +0 -0
  273. data/closure-library/closure/goog/demos/emoji/2EA.gif +0 -0
  274. data/closure-library/closure/goog/demos/emoji/2EB.gif +0 -0
  275. data/closure-library/closure/goog/demos/emoji/2EC.gif +0 -0
  276. data/closure-library/closure/goog/demos/emoji/2ED.gif +0 -0
  277. data/closure-library/closure/goog/demos/emoji/2EE.gif +0 -0
  278. data/closure-library/closure/goog/demos/emoji/2EF.gif +0 -0
  279. data/closure-library/closure/goog/demos/emoji/2F0.gif +0 -0
  280. data/closure-library/closure/goog/demos/emoji/2F1.gif +0 -0
  281. data/closure-library/closure/goog/demos/emoji/2F2.gif +0 -0
  282. data/closure-library/closure/goog/demos/emoji/2F3.gif +0 -0
  283. data/closure-library/closure/goog/demos/emoji/2F4.gif +0 -0
  284. data/closure-library/closure/goog/demos/emoji/2F5.gif +0 -0
  285. data/closure-library/closure/goog/demos/emoji/2F6.gif +0 -0
  286. data/closure-library/closure/goog/demos/emoji/2F7.gif +0 -0
  287. data/closure-library/closure/goog/demos/emoji/2F8.gif +0 -0
  288. data/closure-library/closure/goog/demos/emoji/2F9.gif +0 -0
  289. data/closure-library/closure/goog/demos/emoji/2FA.gif +0 -0
  290. data/closure-library/closure/goog/demos/emoji/2FB.gif +0 -0
  291. data/closure-library/closure/goog/demos/emoji/2FC.gif +0 -0
  292. data/closure-library/closure/goog/demos/emoji/2FD.gif +0 -0
  293. data/closure-library/closure/goog/demos/emoji/2FE.gif +0 -0
  294. data/closure-library/closure/goog/demos/emoji/2FF.gif +0 -0
  295. data/closure-library/closure/goog/demos/emoji/none.gif +0 -0
  296. data/closure-library/closure/goog/demos/emoji/sprite.png +0 -0
  297. data/closure-library/closure/goog/demos/emoji/sprite2.png +0 -0
  298. data/closure-library/closure/goog/demos/emoji/unknown.gif +0 -0
  299. data/closure-library/closure/goog/demos/event-propagation.html +192 -0
  300. data/closure-library/closure/goog/demos/events.html +99 -0
  301. data/closure-library/closure/goog/demos/eventtarget.html +70 -0
  302. data/closure-library/closure/goog/demos/filedrophandler.html +63 -0
  303. data/closure-library/closure/goog/demos/filteredmenu.html +118 -0
  304. data/closure-library/closure/goog/demos/focushandler.html +58 -0
  305. data/closure-library/closure/goog/demos/gauge.html +158 -0
  306. data/closure-library/closure/goog/demos/graphics/advancedcoordinates.html +141 -0
  307. data/closure-library/closure/goog/demos/graphics/advancedcoordinates2.html +130 -0
  308. data/closure-library/closure/goog/demos/graphics/basicelements.html +264 -0
  309. data/closure-library/closure/goog/demos/graphics/events.html +113 -0
  310. data/closure-library/closure/goog/demos/graphics/modifyelements.html +195 -0
  311. data/closure-library/closure/goog/demos/graphics/subpixel.html +80 -0
  312. data/closure-library/closure/goog/demos/graphics/tiger.html +105 -0
  313. data/closure-library/closure/goog/demos/graphics/tigerdata.js +2840 -0
  314. data/closure-library/closure/goog/demos/history1.html +132 -0
  315. data/closure-library/closure/goog/demos/history2.html +100 -0
  316. data/closure-library/closure/goog/demos/history3.html +106 -0
  317. data/closure-library/closure/goog/demos/history3js.html +36 -0
  318. data/closure-library/closure/goog/demos/history_blank.html +25 -0
  319. data/closure-library/closure/goog/demos/hovercard.html +177 -0
  320. data/closure-library/closure/goog/demos/hsvapalette.html +55 -0
  321. data/closure-library/closure/goog/demos/hsvpalette.html +56 -0
  322. data/closure-library/closure/goog/demos/html5history.html +87 -0
  323. data/closure-library/closure/goog/demos/imagelessbutton.html +221 -0
  324. data/closure-library/closure/goog/demos/imagelessmenubutton.html +285 -0
  325. data/closure-library/closure/goog/demos/imagelessroundedcorner.html +231 -0
  326. data/closure-library/closure/goog/demos/index.html +19 -0
  327. data/closure-library/closure/goog/demos/index_nav.html +253 -0
  328. data/closure-library/closure/goog/demos/index_splash.html +22 -0
  329. data/closure-library/closure/goog/demos/inline_block_quirks.html +125 -0
  330. data/closure-library/closure/goog/demos/inline_block_standards.html +126 -0
  331. data/closure-library/closure/goog/demos/inputdatepicker.html +60 -0
  332. data/closure-library/closure/goog/demos/inputhandler.html +72 -0
  333. data/closure-library/closure/goog/demos/jsonprettyprinter.html +80 -0
  334. data/closure-library/closure/goog/demos/keyboardshortcuts.html +112 -0
  335. data/closure-library/closure/goog/demos/keyhandler.html +127 -0
  336. data/closure-library/closure/goog/demos/labelinput.html +42 -0
  337. data/closure-library/closure/goog/demos/menu.html +220 -0
  338. data/closure-library/closure/goog/demos/menubutton.html +318 -0
  339. data/closure-library/closure/goog/demos/mousewheelhandler.html +109 -0
  340. data/closure-library/closure/goog/demos/offline.html +268 -0
  341. data/closure-library/closure/goog/demos/onlinehandler.html +77 -0
  342. data/closure-library/closure/goog/demos/palette.html +302 -0
  343. data/closure-library/closure/goog/demos/pastehandler.html +54 -0
  344. data/closure-library/closure/goog/demos/plaintextspellchecker.html +106 -0
  345. data/closure-library/closure/goog/demos/popup.html +200 -0
  346. data/closure-library/closure/goog/demos/popupcolorpicker.html +49 -0
  347. data/closure-library/closure/goog/demos/popupdatepicker.html +53 -0
  348. data/closure-library/closure/goog/demos/popupemojipicker.html +407 -0
  349. data/closure-library/closure/goog/demos/popupmenu.html +89 -0
  350. data/closure-library/closure/goog/demos/progressbar.html +97 -0
  351. data/closure-library/closure/goog/demos/prompt.html +92 -0
  352. data/closure-library/closure/goog/demos/quadtree.html +107 -0
  353. data/closure-library/closure/goog/demos/ratings.html +120 -0
  354. data/closure-library/closure/goog/demos/richtextspellchecker.html +92 -0
  355. data/closure-library/closure/goog/demos/roundedpanel.html +139 -0
  356. data/closure-library/closure/goog/demos/samplecomponent.html +75 -0
  357. data/closure-library/closure/goog/demos/samplecomponent.js +206 -0
  358. data/closure-library/closure/goog/demos/scrollfloater.html +117 -0
  359. data/closure-library/closure/goog/demos/select.html +324 -0
  360. data/closure-library/closure/goog/demos/selectionmenubutton.html +186 -0
  361. data/closure-library/closure/goog/demos/serverchart.html +122 -0
  362. data/closure-library/closure/goog/demos/silverlightclipboardbutton.html +71 -0
  363. data/closure-library/closure/goog/demos/slider.html +110 -0
  364. data/closure-library/closure/goog/demos/splitbehavior.html +164 -0
  365. data/closure-library/closure/goog/demos/splitpane.html +243 -0
  366. data/closure-library/closure/goog/demos/stopevent.html +171 -0
  367. data/closure-library/closure/goog/demos/submenus.html +130 -0
  368. data/closure-library/closure/goog/demos/submenus2.html +150 -0
  369. data/closure-library/closure/goog/demos/tabbar.html +289 -0
  370. data/closure-library/closure/goog/demos/tablesorter.html +116 -0
  371. data/closure-library/closure/goog/demos/tabpane.html +302 -0
  372. data/closure-library/closure/goog/demos/textarea.html +128 -0
  373. data/closure-library/closure/goog/demos/timers.html +291 -0
  374. data/closure-library/closure/goog/demos/toolbar.html +703 -0
  375. data/closure-library/closure/goog/demos/tooltip.html +91 -0
  376. data/closure-library/closure/goog/demos/tracer.html +92 -0
  377. data/closure-library/closure/goog/demos/tree/demo.html +126 -0
  378. data/closure-library/closure/goog/demos/tree/testdata.js +260 -0
  379. data/closure-library/closure/goog/demos/tweakui.html +121 -0
  380. data/closure-library/closure/goog/demos/twothumbslider.html +121 -0
  381. data/closure-library/closure/goog/demos/useragent.html +173 -0
  382. data/closure-library/closure/goog/demos/viewportsizemonitor.html +71 -0
  383. data/closure-library/closure/goog/demos/xpc/blank.html +7 -0
  384. data/closure-library/closure/goog/demos/xpc/index.html +89 -0
  385. data/closure-library/closure/goog/demos/xpc/inner.html +58 -0
  386. data/closure-library/closure/goog/demos/xpc/minimal/blank.html +7 -0
  387. data/closure-library/closure/goog/demos/xpc/minimal/index.html +105 -0
  388. data/closure-library/closure/goog/demos/xpc/minimal/inner.html +75 -0
  389. data/closure-library/closure/goog/demos/xpc/minimal/relay.html +7 -0
  390. data/closure-library/closure/goog/demos/xpc/relay.html +7 -0
  391. data/closure-library/closure/goog/demos/xpc/xpcdemo.js +304 -0
  392. data/closure-library/closure/goog/demos/zippy.html +127 -0
  393. data/closure-library/closure/goog/deps.js +672 -0
  394. data/closure-library/closure/goog/disposable/disposable.js +167 -0
  395. data/closure-library/closure/goog/disposable/disposable_test.html +202 -0
  396. data/closure-library/closure/goog/dom/a11y.js +438 -0
  397. data/closure-library/closure/goog/dom/a11y_test.html +86 -0
  398. data/closure-library/closure/goog/dom/abstractmultirange.js +77 -0
  399. data/closure-library/closure/goog/dom/abstractrange.js +514 -0
  400. data/closure-library/closure/goog/dom/abstractrange_test.html +73 -0
  401. data/closure-library/closure/goog/dom/annotate.js +352 -0
  402. data/closure-library/closure/goog/dom/annotate_test.html +187 -0
  403. data/closure-library/closure/goog/dom/browserfeature.js +50 -0
  404. data/closure-library/closure/goog/dom/browserrange/abstractrange.js +316 -0
  405. data/closure-library/closure/goog/dom/browserrange/browserrange.js +149 -0
  406. data/closure-library/closure/goog/dom/browserrange/browserrange_test.html +562 -0
  407. data/closure-library/closure/goog/dom/browserrange/geckorange.js +82 -0
  408. data/closure-library/closure/goog/dom/browserrange/ierange.js +970 -0
  409. data/closure-library/closure/goog/dom/browserrange/operarange.js +83 -0
  410. data/closure-library/closure/goog/dom/browserrange/w3crange.js +364 -0
  411. data/closure-library/closure/goog/dom/browserrange/webkitrange.js +112 -0
  412. data/closure-library/closure/goog/dom/classes.js +233 -0
  413. data/closure-library/closure/goog/dom/classes_test.html +228 -0
  414. data/closure-library/closure/goog/dom/controlrange.js +511 -0
  415. data/closure-library/closure/goog/dom/controlrange_test.html +246 -0
  416. data/closure-library/closure/goog/dom/dataset.js +90 -0
  417. data/closure-library/closure/goog/dom/dataset_test.html +104 -0
  418. data/closure-library/closure/goog/dom/dom.js +2424 -0
  419. data/closure-library/closure/goog/dom/dom_quirks_test.html +104 -0
  420. data/closure-library/closure/goog/dom/dom_test.html +103 -0
  421. data/closure-library/closure/goog/dom/dom_test.js +1129 -0
  422. data/closure-library/closure/goog/dom/fontsizemonitor.js +159 -0
  423. data/closure-library/closure/goog/dom/fontsizemonitor_test.html +283 -0
  424. data/closure-library/closure/goog/dom/forms.js +403 -0
  425. data/closure-library/closure/goog/dom/forms_test.html +483 -0
  426. data/closure-library/closure/goog/dom/iframe.js +128 -0
  427. data/closure-library/closure/goog/dom/iframe_test.html +87 -0
  428. data/closure-library/closure/goog/dom/iter.js +127 -0
  429. data/closure-library/closure/goog/dom/iter_test.html +97 -0
  430. data/closure-library/closure/goog/dom/multirange.js +519 -0
  431. data/closure-library/closure/goog/dom/multirange_test.html +67 -0
  432. data/closure-library/closure/goog/dom/nodeiterator.js +85 -0
  433. data/closure-library/closure/goog/dom/nodeiterator_test.html +49 -0
  434. data/closure-library/closure/goog/dom/nodeoffset.js +111 -0
  435. data/closure-library/closure/goog/dom/nodeoffset_test.html +88 -0
  436. data/closure-library/closure/goog/dom/pattern/abstractpattern.js +60 -0
  437. data/closure-library/closure/goog/dom/pattern/allchildren.js +73 -0
  438. data/closure-library/closure/goog/dom/pattern/callback/callback.js +82 -0
  439. data/closure-library/closure/goog/dom/pattern/callback/counter.js +72 -0
  440. data/closure-library/closure/goog/dom/pattern/callback/test.js +77 -0
  441. data/closure-library/closure/goog/dom/pattern/childmatches.js +152 -0
  442. data/closure-library/closure/goog/dom/pattern/endtag.js +53 -0
  443. data/closure-library/closure/goog/dom/pattern/fulltag.js +92 -0
  444. data/closure-library/closure/goog/dom/pattern/matcher.js +150 -0
  445. data/closure-library/closure/goog/dom/pattern/matcher_test.html +204 -0
  446. data/closure-library/closure/goog/dom/pattern/nodetype.js +57 -0
  447. data/closure-library/closure/goog/dom/pattern/pattern.js +93 -0
  448. data/closure-library/closure/goog/dom/pattern/pattern_test.html +614 -0
  449. data/closure-library/closure/goog/dom/pattern/repeat.js +188 -0
  450. data/closure-library/closure/goog/dom/pattern/sequence.js +139 -0
  451. data/closure-library/closure/goog/dom/pattern/starttag.js +53 -0
  452. data/closure-library/closure/goog/dom/pattern/tag.js +149 -0
  453. data/closure-library/closure/goog/dom/pattern/text.js +69 -0
  454. data/closure-library/closure/goog/dom/range.js +220 -0
  455. data/closure-library/closure/goog/dom/range_test.html +702 -0
  456. data/closure-library/closure/goog/dom/rangeendpoint.js +32 -0
  457. data/closure-library/closure/goog/dom/savedcaretrange.js +203 -0
  458. data/closure-library/closure/goog/dom/savedcaretrange_test.html +235 -0
  459. data/closure-library/closure/goog/dom/savedrange.js +74 -0
  460. data/closure-library/closure/goog/dom/savedrange_test.html +61 -0
  461. data/closure-library/closure/goog/dom/selection.js +470 -0
  462. data/closure-library/closure/goog/dom/selection_test.html +329 -0
  463. data/closure-library/closure/goog/dom/tagiterator.js +365 -0
  464. data/closure-library/closure/goog/dom/tagiterator_test.html +589 -0
  465. data/closure-library/closure/goog/dom/tagname.js +121 -0
  466. data/closure-library/closure/goog/dom/tagname_test.html +37 -0
  467. data/closure-library/closure/goog/dom/textrange.js +611 -0
  468. data/closure-library/closure/goog/dom/textrange_test.html +127 -0
  469. data/closure-library/closure/goog/dom/textrangeiterator.js +246 -0
  470. data/closure-library/closure/goog/dom/textrangeiterator_test.html +142 -0
  471. data/closure-library/closure/goog/dom/viewportsizemonitor.js +220 -0
  472. data/closure-library/closure/goog/dom/viewportsizemonitor_test.html +166 -0
  473. data/closure-library/closure/goog/dom/xml.js +187 -0
  474. data/closure-library/closure/goog/dom/xml_test.html +77 -0
  475. data/closure-library/closure/goog/editor/browserfeature.js +251 -0
  476. data/closure-library/closure/goog/editor/browserfeature_test.html +124 -0
  477. data/closure-library/closure/goog/editor/clicktoeditwrapper.js +438 -0
  478. data/closure-library/closure/goog/editor/clicktoeditwrapper_test.html +137 -0
  479. data/closure-library/closure/goog/editor/command.js +74 -0
  480. data/closure-library/closure/goog/editor/defines.js +34 -0
  481. data/closure-library/closure/goog/editor/field.js +2594 -0
  482. data/closure-library/closure/goog/editor/field_test.html +1000 -0
  483. data/closure-library/closure/goog/editor/focus.js +32 -0
  484. data/closure-library/closure/goog/editor/focus_test.html +66 -0
  485. data/closure-library/closure/goog/editor/icontent.js +296 -0
  486. data/closure-library/closure/goog/editor/icontent_test.html +209 -0
  487. data/closure-library/closure/goog/editor/link.js +279 -0
  488. data/closure-library/closure/goog/editor/link_test.html +234 -0
  489. data/closure-library/closure/goog/editor/node.js +435 -0
  490. data/closure-library/closure/goog/editor/node_test.html +590 -0
  491. data/closure-library/closure/goog/editor/plugin.js +444 -0
  492. data/closure-library/closure/goog/editor/plugin_test.html +187 -0
  493. data/closure-library/closure/goog/editor/plugins/abstractbubbleplugin.js +535 -0
  494. data/closure-library/closure/goog/editor/plugins/abstractbubbleplugin_test.html +227 -0
  495. data/closure-library/closure/goog/editor/plugins/abstractdialogplugin.js +336 -0
  496. data/closure-library/closure/goog/editor/plugins/abstractdialogplugin_test.html +399 -0
  497. data/closure-library/closure/goog/editor/plugins/abstracttabhandler.js +78 -0
  498. data/closure-library/closure/goog/editor/plugins/abstracttabhandler_test.html +91 -0
  499. data/closure-library/closure/goog/editor/plugins/basictextformatter.js +1740 -0
  500. data/closure-library/closure/goog/editor/plugins/basictextformatter_test.html +1171 -0
  501. data/closure-library/closure/goog/editor/plugins/blockquote.js +422 -0
  502. data/closure-library/closure/goog/editor/plugins/blockquote_test.html +149 -0
  503. data/closure-library/closure/goog/editor/plugins/emoticons.js +83 -0
  504. data/closure-library/closure/goog/editor/plugins/emoticons_test.html +67 -0
  505. data/closure-library/closure/goog/editor/plugins/enterhandler.js +730 -0
  506. data/closure-library/closure/goog/editor/plugins/enterhandler_test.html +739 -0
  507. data/closure-library/closure/goog/editor/plugins/headerformatter.js +95 -0
  508. data/closure-library/closure/goog/editor/plugins/headerformatter_test.html +100 -0
  509. data/closure-library/closure/goog/editor/plugins/linkbubble.js +458 -0
  510. data/closure-library/closure/goog/editor/plugins/linkbubble_test.html +309 -0
  511. data/closure-library/closure/goog/editor/plugins/linkdialogplugin.js +222 -0
  512. data/closure-library/closure/goog/editor/plugins/linkdialogplugin_test.html +370 -0
  513. data/closure-library/closure/goog/editor/plugins/listtabhandler.js +66 -0
  514. data/closure-library/closure/goog/editor/plugins/listtabhandler_test.html +177 -0
  515. data/closure-library/closure/goog/editor/plugins/loremipsum.js +186 -0
  516. data/closure-library/closure/goog/editor/plugins/loremipsum_test.html +169 -0
  517. data/closure-library/closure/goog/editor/plugins/removeformatting.js +772 -0
  518. data/closure-library/closure/goog/editor/plugins/removeformatting_test.html +920 -0
  519. data/closure-library/closure/goog/editor/plugins/spacestabhandler.js +93 -0
  520. data/closure-library/closure/goog/editor/plugins/spacestabhandler_test.html +186 -0
  521. data/closure-library/closure/goog/editor/plugins/tableeditor.js +496 -0
  522. data/closure-library/closure/goog/editor/plugins/tableeditor_test.html +299 -0
  523. data/closure-library/closure/goog/editor/plugins/tagonenterhandler.js +741 -0
  524. data/closure-library/closure/goog/editor/plugins/tagonenterhandler_test.html +481 -0
  525. data/closure-library/closure/goog/editor/plugins/undoredo.js +1014 -0
  526. data/closure-library/closure/goog/editor/plugins/undoredo_test.html +525 -0
  527. data/closure-library/closure/goog/editor/plugins/undoredomanager.js +337 -0
  528. data/closure-library/closure/goog/editor/plugins/undoredomanager_test.html +394 -0
  529. data/closure-library/closure/goog/editor/plugins/undoredostate.js +84 -0
  530. data/closure-library/closure/goog/editor/plugins/undoredostate_test.html +44 -0
  531. data/closure-library/closure/goog/editor/range.js +602 -0
  532. data/closure-library/closure/goog/editor/range_test.html +880 -0
  533. data/closure-library/closure/goog/editor/seamlessfield.js +720 -0
  534. data/closure-library/closure/goog/editor/seamlessfield_quirks_test.html +30 -0
  535. data/closure-library/closure/goog/editor/seamlessfield_test.html +33 -0
  536. data/closure-library/closure/goog/editor/seamlessfield_test.js +392 -0
  537. data/closure-library/closure/goog/editor/style.js +222 -0
  538. data/closure-library/closure/goog/editor/style_test.html +177 -0
  539. data/closure-library/closure/goog/editor/table.js +566 -0
  540. data/closure-library/closure/goog/editor/table_test.html +522 -0
  541. data/closure-library/closure/goog/events/actioneventwrapper.js +131 -0
  542. data/closure-library/closure/goog/events/actioneventwrapper_test.html +176 -0
  543. data/closure-library/closure/goog/events/actionhandler.js +189 -0
  544. data/closure-library/closure/goog/events/actionhandler_test.html +82 -0
  545. data/closure-library/closure/goog/events/browserevent.js +412 -0
  546. data/closure-library/closure/goog/events/browserevent_test.html +145 -0
  547. data/closure-library/closure/goog/events/browserfeature.js +43 -0
  548. data/closure-library/closure/goog/events/event.js +123 -0
  549. data/closure-library/closure/goog/events/event_test.html +70 -0
  550. data/closure-library/closure/goog/events/eventhandler.js +348 -0
  551. data/closure-library/closure/goog/events/eventhandler_test.html +230 -0
  552. data/closure-library/closure/goog/events/events.js +1101 -0
  553. data/closure-library/closure/goog/events/events_test.html +362 -0
  554. data/closure-library/closure/goog/events/eventtarget.js +197 -0
  555. data/closure-library/closure/goog/events/eventtarget_test.html +423 -0
  556. data/closure-library/closure/goog/events/eventtype.js +107 -0
  557. data/closure-library/closure/goog/events/eventwrapper.js +67 -0
  558. data/closure-library/closure/goog/events/filedrophandler.js +224 -0
  559. data/closure-library/closure/goog/events/filedrophandler_test.html +258 -0
  560. data/closure-library/closure/goog/events/focushandler.js +111 -0
  561. data/closure-library/closure/goog/events/imehandler.js +365 -0
  562. data/closure-library/closure/goog/events/imehandler_test.html +271 -0
  563. data/closure-library/closure/goog/events/inputhandler.js +218 -0
  564. data/closure-library/closure/goog/events/keycodes.js +314 -0
  565. data/closure-library/closure/goog/events/keycodes_test.html +72 -0
  566. data/closure-library/closure/goog/events/keyhandler.js +522 -0
  567. data/closure-library/closure/goog/events/keyhandler_test.html +621 -0
  568. data/closure-library/closure/goog/events/keynames.js +124 -0
  569. data/closure-library/closure/goog/events/listener.js +160 -0
  570. data/closure-library/closure/goog/events/mousewheelhandler.js +280 -0
  571. data/closure-library/closure/goog/events/mousewheelhandler_test.html +331 -0
  572. data/closure-library/closure/goog/events/onlinehandler.js +176 -0
  573. data/closure-library/closure/goog/events/onlinelistener_test.html +214 -0
  574. data/closure-library/closure/goog/events/pastehandler.js +444 -0
  575. data/closure-library/closure/goog/events/pastehandler_test.html +354 -0
  576. data/closure-library/closure/goog/events/pools.js +342 -0
  577. data/closure-library/closure/goog/format/emailaddress.js +329 -0
  578. data/closure-library/closure/goog/format/emailaddress_test.html +179 -0
  579. data/closure-library/closure/goog/format/format.js +451 -0
  580. data/closure-library/closure/goog/format/format_test.html +257 -0
  581. data/closure-library/closure/goog/format/htmlprettyprinter.js +406 -0
  582. data/closure-library/closure/goog/format/htmlprettyprinter_test.html +205 -0
  583. data/closure-library/closure/goog/format/jsonprettyprinter.js +405 -0
  584. data/closure-library/closure/goog/format/jsonprettyprinter_test.html +111 -0
  585. data/closure-library/closure/goog/fs/entry.js +406 -0
  586. data/closure-library/closure/goog/fs/error.js +103 -0
  587. data/closure-library/closure/goog/fs/filesaver.js +214 -0
  588. data/closure-library/closure/goog/fs/filesystem.js +59 -0
  589. data/closure-library/closure/goog/fs/filewriter.js +106 -0
  590. data/closure-library/closure/goog/fs/fs.js +183 -0
  591. data/closure-library/closure/goog/fs/fs_test.html +270 -0
  592. data/closure-library/closure/goog/functions/functions.js +219 -0
  593. data/closure-library/closure/goog/functions/functions_test.html +198 -0
  594. data/closure-library/closure/goog/fx/abstractdragdrop.js +1451 -0
  595. data/closure-library/closure/goog/fx/abstractdragdrop_test.html +430 -0
  596. data/closure-library/closure/goog/fx/animation.js +621 -0
  597. data/closure-library/closure/goog/fx/animationqueue.js +348 -0
  598. data/closure-library/closure/goog/fx/cssspriteanimation.js +112 -0
  599. data/closure-library/closure/goog/fx/cssspriteanimation_test.html +125 -0
  600. data/closure-library/closure/goog/fx/dom.js +610 -0
  601. data/closure-library/closure/goog/fx/dragdrop.js +49 -0
  602. data/closure-library/closure/goog/fx/dragdropgroup.js +107 -0
  603. data/closure-library/closure/goog/fx/dragdropgroup_test.html +234 -0
  604. data/closure-library/closure/goog/fx/dragger.js +731 -0
  605. data/closure-library/closure/goog/fx/dragger_test.html +415 -0
  606. data/closure-library/closure/goog/fx/draglistgroup.js +1159 -0
  607. data/closure-library/closure/goog/fx/draglistgroup_test.html +231 -0
  608. data/closure-library/closure/goog/fx/dragscrollsupport.js +274 -0
  609. data/closure-library/closure/goog/fx/dragscrollsupport_test.html +253 -0
  610. data/closure-library/closure/goog/fx/easing.js +50 -0
  611. data/closure-library/closure/goog/fx/fx.js +30 -0
  612. data/closure-library/closure/goog/fx/fx_test.html +157 -0
  613. data/closure-library/closure/goog/gears/basestore.js +523 -0
  614. data/closure-library/closure/goog/gears/basestore_test.html +247 -0
  615. data/closure-library/closure/goog/gears/database.js +935 -0
  616. data/closure-library/closure/goog/gears/database_test.html +699 -0
  617. data/closure-library/closure/goog/gears/fakeworkerpool.js +252 -0
  618. data/closure-library/closure/goog/gears/fakeworkerpool_test.html +188 -0
  619. data/closure-library/closure/goog/gears/gears.js +228 -0
  620. data/closure-library/closure/goog/gears/gears_test.html +78 -0
  621. data/closure-library/closure/goog/gears/httprequest.js +77 -0
  622. data/closure-library/closure/goog/gears/loggerclient.js +131 -0
  623. data/closure-library/closure/goog/gears/loggerclient_test.html +171 -0
  624. data/closure-library/closure/goog/gears/loggerserver.js +158 -0
  625. data/closure-library/closure/goog/gears/loggerserver_test.html +118 -0
  626. data/closure-library/closure/goog/gears/logstore.js +479 -0
  627. data/closure-library/closure/goog/gears/logstore_test.html +600 -0
  628. data/closure-library/closure/goog/gears/managedresourcestore.js +553 -0
  629. data/closure-library/closure/goog/gears/managedresourcestore_test.html +453 -0
  630. data/closure-library/closure/goog/gears/multipartformdata.js +203 -0
  631. data/closure-library/closure/goog/gears/multipartformdata_test.html +220 -0
  632. data/closure-library/closure/goog/gears/statustype.js +37 -0
  633. data/closure-library/closure/goog/gears/urlcapture.js +370 -0
  634. data/closure-library/closure/goog/gears/urlcapture_test.html +392 -0
  635. data/closure-library/closure/goog/gears/worker.js +201 -0
  636. data/closure-library/closure/goog/gears/workerchannel.js +205 -0
  637. data/closure-library/closure/goog/gears/workerchannel_test.html +207 -0
  638. data/closure-library/closure/goog/gears/workerpool.js +241 -0
  639. data/closure-library/closure/goog/gears/workerpool_test.html +203 -0
  640. data/closure-library/closure/goog/graphics/abstractgraphics.js +439 -0
  641. data/closure-library/closure/goog/graphics/affinetransform.js +497 -0
  642. data/closure-library/closure/goog/graphics/affinetransform_test.html +316 -0
  643. data/closure-library/closure/goog/graphics/canvaselement.js +776 -0
  644. data/closure-library/closure/goog/graphics/canvasgraphics.js +632 -0
  645. data/closure-library/closure/goog/graphics/element.js +145 -0
  646. data/closure-library/closure/goog/graphics/ellipseelement.js +59 -0
  647. data/closure-library/closure/goog/graphics/ext/coordinates.js +158 -0
  648. data/closure-library/closure/goog/graphics/ext/coordinates_test.html +74 -0
  649. data/closure-library/closure/goog/graphics/ext/element.js +970 -0
  650. data/closure-library/closure/goog/graphics/ext/element_test.html +144 -0
  651. data/closure-library/closure/goog/graphics/ext/ellipse.js +58 -0
  652. data/closure-library/closure/goog/graphics/ext/ext.js +29 -0
  653. data/closure-library/closure/goog/graphics/ext/graphics.js +209 -0
  654. data/closure-library/closure/goog/graphics/ext/group.js +213 -0
  655. data/closure-library/closure/goog/graphics/ext/image.js +62 -0
  656. data/closure-library/closure/goog/graphics/ext/path.js +140 -0
  657. data/closure-library/closure/goog/graphics/ext/path_test.html +46 -0
  658. data/closure-library/closure/goog/graphics/ext/rectangle.js +53 -0
  659. data/closure-library/closure/goog/graphics/ext/shape.js +144 -0
  660. data/closure-library/closure/goog/graphics/ext/strokeandfillelement.js +69 -0
  661. data/closure-library/closure/goog/graphics/fill.js +29 -0
  662. data/closure-library/closure/goog/graphics/font.js +59 -0
  663. data/closure-library/closure/goog/graphics/graphics.js +124 -0
  664. data/closure-library/closure/goog/graphics/groupelement.js +54 -0
  665. data/closure-library/closure/goog/graphics/imageelement.js +67 -0
  666. data/closure-library/closure/goog/graphics/lineargradient.js +131 -0
  667. data/closure-library/closure/goog/graphics/path.js +508 -0
  668. data/closure-library/closure/goog/graphics/path_test.html +359 -0
  669. data/closure-library/closure/goog/graphics/pathelement.js +50 -0
  670. data/closure-library/closure/goog/graphics/paths.js +86 -0
  671. data/closure-library/closure/goog/graphics/paths_test.html +97 -0
  672. data/closure-library/closure/goog/graphics/rectelement.js +59 -0
  673. data/closure-library/closure/goog/graphics/solidfill.js +70 -0
  674. data/closure-library/closure/goog/graphics/stroke.js +63 -0
  675. data/closure-library/closure/goog/graphics/strokeandfillelement.js +110 -0
  676. data/closure-library/closure/goog/graphics/svgelement.js +262 -0
  677. data/closure-library/closure/goog/graphics/svggraphics.js +813 -0
  678. data/closure-library/closure/goog/graphics/textelement.js +51 -0
  679. data/closure-library/closure/goog/graphics/vmlelement.js +380 -0
  680. data/closure-library/closure/goog/graphics/vmlgraphics.js +863 -0
  681. data/closure-library/closure/goog/history/event.js +54 -0
  682. data/closure-library/closure/goog/history/eventtype.js +30 -0
  683. data/closure-library/closure/goog/history/history.js +979 -0
  684. data/closure-library/closure/goog/history/html5history.js +303 -0
  685. data/closure-library/closure/goog/history/html5history_test.html +163 -0
  686. data/closure-library/closure/goog/i18n/bidi.js +772 -0
  687. data/closure-library/closure/goog/i18n/bidi_test.html +414 -0
  688. data/closure-library/closure/goog/i18n/bidiformatter.js +488 -0
  689. data/closure-library/closure/goog/i18n/bidiformatter_test.html +343 -0
  690. data/closure-library/closure/goog/i18n/charlistdecompressor.js +157 -0
  691. data/closure-library/closure/goog/i18n/charlistdecompressor_test.html +65 -0
  692. data/closure-library/closure/goog/i18n/charpickerdata.js +3185 -0
  693. data/closure-library/closure/goog/i18n/currency.js +385 -0
  694. data/closure-library/closure/goog/i18n/currency_test.html +202 -0
  695. data/closure-library/closure/goog/i18n/currencycodemap.js +210 -0
  696. data/closure-library/closure/goog/i18n/datetimeformat.js +636 -0
  697. data/closure-library/closure/goog/i18n/datetimeformat_test.html +436 -0
  698. data/closure-library/closure/goog/i18n/datetimeparse.js +1111 -0
  699. data/closure-library/closure/goog/i18n/datetimeparse_test.html +796 -0
  700. data/closure-library/closure/goog/i18n/datetimepatterns.js +1586 -0
  701. data/closure-library/closure/goog/i18n/datetimepatternsext.js +7386 -0
  702. data/closure-library/closure/goog/i18n/datetimesymbols.js +3350 -0
  703. data/closure-library/closure/goog/i18n/datetimesymbolsext.js +12938 -0
  704. data/closure-library/closure/goog/i18n/graphemebreak.js +181 -0
  705. data/closure-library/closure/goog/i18n/graphemebreak_test.html +72 -0
  706. data/closure-library/closure/goog/i18n/messageformat.js +553 -0
  707. data/closure-library/closure/goog/i18n/messageformat_test.html +323 -0
  708. data/closure-library/closure/goog/i18n/mime.js +100 -0
  709. data/closure-library/closure/goog/i18n/mime_test.html +51 -0
  710. data/closure-library/closure/goog/i18n/numberformat.js +763 -0
  711. data/closure-library/closure/goog/i18n/numberformat_test.html +605 -0
  712. data/closure-library/closure/goog/i18n/numberformatsymbols.js +10358 -0
  713. data/closure-library/closure/goog/i18n/pluralrules.js +695 -0
  714. data/closure-library/closure/goog/i18n/timezone.js +341 -0
  715. data/closure-library/closure/goog/i18n/timezone_test.html +163 -0
  716. data/closure-library/closure/goog/i18n/uchar.js +1160 -0
  717. data/closure-library/closure/goog/i18n/uchar_test.html +72 -0
  718. data/closure-library/closure/goog/images/blank.gif +0 -0
  719. data/closure-library/closure/goog/images/bubble_close.jpg +0 -0
  720. data/closure-library/closure/goog/images/bubble_left.gif +0 -0
  721. data/closure-library/closure/goog/images/bubble_right.gif +0 -0
  722. data/closure-library/closure/goog/images/button-bg.gif +0 -0
  723. data/closure-library/closure/goog/images/check-outline.gif +0 -0
  724. data/closure-library/closure/goog/images/check-sprite.gif +0 -0
  725. data/closure-library/closure/goog/images/check.gif +0 -0
  726. data/closure-library/closure/goog/images/close_box.gif +0 -0
  727. data/closure-library/closure/goog/images/color-swatch-tick.gif +0 -0
  728. data/closure-library/closure/goog/images/dialog_close_box.gif +0 -0
  729. data/closure-library/closure/goog/images/dimension-highlighted.png +0 -0
  730. data/closure-library/closure/goog/images/dimension-unhighlighted.png +0 -0
  731. data/closure-library/closure/goog/images/dropdn.gif +0 -0
  732. data/closure-library/closure/goog/images/dropdn_disabled.gif +0 -0
  733. data/closure-library/closure/goog/images/dropdown.gif +0 -0
  734. data/closure-library/closure/goog/images/gears_bluedot.gif +0 -0
  735. data/closure-library/closure/goog/images/gears_offline.gif +0 -0
  736. data/closure-library/closure/goog/images/gears_online.gif +0 -0
  737. data/closure-library/closure/goog/images/gears_paused.gif +0 -0
  738. data/closure-library/closure/goog/images/gears_syncing.gif +0 -0
  739. data/closure-library/closure/goog/images/hsv-sprite-sm.gif +0 -0
  740. data/closure-library/closure/goog/images/hsv-sprite-sm.png +0 -0
  741. data/closure-library/closure/goog/images/hsv-sprite.gif +0 -0
  742. data/closure-library/closure/goog/images/hsv-sprite.png +0 -0
  743. data/closure-library/closure/goog/images/hsva-sprite-sm.gif +0 -0
  744. data/closure-library/closure/goog/images/hsva-sprite-sm.png +0 -0
  745. data/closure-library/closure/goog/images/hsva-sprite.gif +0 -0
  746. data/closure-library/closure/goog/images/hsva-sprite.png +0 -0
  747. data/closure-library/closure/goog/images/left_anchor_bubble_bot.gif +0 -0
  748. data/closure-library/closure/goog/images/left_anchor_bubble_top.gif +0 -0
  749. data/closure-library/closure/goog/images/menu-arrows.gif +0 -0
  750. data/closure-library/closure/goog/images/minus.png +0 -0
  751. data/closure-library/closure/goog/images/no_anchor_bubble_bot.gif +0 -0
  752. data/closure-library/closure/goog/images/no_anchor_bubble_top.gif +0 -0
  753. data/closure-library/closure/goog/images/offlineicons.png +0 -0
  754. data/closure-library/closure/goog/images/plus.png +0 -0
  755. data/closure-library/closure/goog/images/ratingstars.gif +0 -0
  756. data/closure-library/closure/goog/images/right_anchor_bubble_bot.gif +0 -0
  757. data/closure-library/closure/goog/images/right_anchor_bubble_top.gif +0 -0
  758. data/closure-library/closure/goog/images/toolbar-bg.png +0 -0
  759. data/closure-library/closure/goog/images/toolbar-separator.gif +0 -0
  760. data/closure-library/closure/goog/images/toolbar_icons.gif +0 -0
  761. data/closure-library/closure/goog/images/tree/I.png +0 -0
  762. data/closure-library/closure/goog/images/tree/cleardot.gif +0 -0
  763. data/closure-library/closure/goog/images/tree/tree.gif +0 -0
  764. data/closure-library/closure/goog/images/tree/tree.png +0 -0
  765. data/closure-library/closure/goog/images/ui_controls.jpg +0 -0
  766. data/closure-library/closure/goog/iter/iter.js +627 -0
  767. data/closure-library/closure/goog/iter/iter_test.html +443 -0
  768. data/closure-library/closure/goog/json/json.js +302 -0
  769. data/closure-library/closure/goog/json/json_test.html +501 -0
  770. data/closure-library/closure/goog/locale/countries.js +288 -0
  771. data/closure-library/closure/goog/locale/countrylanguagenames_test.html +233 -0
  772. data/closure-library/closure/goog/locale/defaultlocalenameconstants.js +847 -0
  773. data/closure-library/closure/goog/locale/genericfontnames.js +73 -0
  774. data/closure-library/closure/goog/locale/genericfontnames_test.html +97 -0
  775. data/closure-library/closure/goog/locale/genericfontnamesdata.js +328 -0
  776. data/closure-library/closure/goog/locale/locale.js +397 -0
  777. data/closure-library/closure/goog/locale/nativenameconstants.js +1354 -0
  778. data/closure-library/closure/goog/locale/scriptToLanguages.js +482 -0
  779. data/closure-library/closure/goog/locale/timezonedetection.js +117 -0
  780. data/closure-library/closure/goog/locale/timezonedetection_test.html +130 -0
  781. data/closure-library/closure/goog/locale/timezonefingerprint.js +250 -0
  782. data/closure-library/closure/goog/locale/timezonelist.js +129 -0
  783. data/closure-library/closure/goog/locale/timezonelist_test.html +165 -0
  784. data/closure-library/closure/goog/math/bezier.js +244 -0
  785. data/closure-library/closure/goog/math/bezier_test.html +70 -0
  786. data/closure-library/closure/goog/math/box.js +236 -0
  787. data/closure-library/closure/goog/math/box_test.html +139 -0
  788. data/closure-library/closure/goog/math/coordinate.js +136 -0
  789. data/closure-library/closure/goog/math/coordinate3.js +168 -0
  790. data/closure-library/closure/goog/math/coordinate3_test.html +208 -0
  791. data/closure-library/closure/goog/math/coordinate_test.html +92 -0
  792. data/closure-library/closure/goog/math/integer.js +736 -0
  793. data/closure-library/closure/goog/math/integer_test.html +1653 -0
  794. data/closure-library/closure/goog/math/line.js +177 -0
  795. data/closure-library/closure/goog/math/line_test.html +62 -0
  796. data/closure-library/closure/goog/math/long.js +801 -0
  797. data/closure-library/closure/goog/math/long_test.html +1571 -0
  798. data/closure-library/closure/goog/math/math.js +355 -0
  799. data/closure-library/closure/goog/math/math_test.html +254 -0
  800. data/closure-library/closure/goog/math/matrix.js +669 -0
  801. data/closure-library/closure/goog/math/matrix_test.html +427 -0
  802. data/closure-library/closure/goog/math/range.js +146 -0
  803. data/closure-library/closure/goog/math/range_test.html +103 -0
  804. data/closure-library/closure/goog/math/rangeset.js +368 -0
  805. data/closure-library/closure/goog/math/rangeset_test.html +619 -0
  806. data/closure-library/closure/goog/math/rect.js +340 -0
  807. data/closure-library/closure/goog/math/rect_test.html +315 -0
  808. data/closure-library/closure/goog/math/size.js +201 -0
  809. data/closure-library/closure/goog/math/size_test.html +174 -0
  810. data/closure-library/closure/goog/math/vec2.js +255 -0
  811. data/closure-library/closure/goog/math/vec2_test.html +203 -0
  812. data/closure-library/closure/goog/math/vec3.js +327 -0
  813. data/closure-library/closure/goog/math/vec3_test.html +231 -0
  814. data/closure-library/closure/goog/memoize/memoize.js +98 -0
  815. data/closure-library/closure/goog/memoize/memoize_test.html +157 -0
  816. data/closure-library/closure/goog/messaging/abstractchannel.js +209 -0
  817. data/closure-library/closure/goog/messaging/abstractchannel_test.html +90 -0
  818. data/closure-library/closure/goog/messaging/bufferedchannel.js +277 -0
  819. data/closure-library/closure/goog/messaging/bufferedchannel_test.html +205 -0
  820. data/closure-library/closure/goog/messaging/deferredchannel.js +79 -0
  821. data/closure-library/closure/goog/messaging/deferredchannel_test.html +107 -0
  822. data/closure-library/closure/goog/messaging/loggerclient.js +131 -0
  823. data/closure-library/closure/goog/messaging/loggerclient_test.html +102 -0
  824. data/closure-library/closure/goog/messaging/loggerserver.js +94 -0
  825. data/closure-library/closure/goog/messaging/loggerserver_test.html +101 -0
  826. data/closure-library/closure/goog/messaging/messagechannel.js +115 -0
  827. data/closure-library/closure/goog/messaging/messaging.js +34 -0
  828. data/closure-library/closure/goog/messaging/messaging_test.html +42 -0
  829. data/closure-library/closure/goog/messaging/multichannel.js +303 -0
  830. data/closure-library/closure/goog/messaging/multichannel_test.html +122 -0
  831. data/closure-library/closure/goog/messaging/portchannel.js +341 -0
  832. data/closure-library/closure/goog/messaging/portchannel_test.html +359 -0
  833. data/closure-library/closure/goog/messaging/testdata/portchannel_worker.js +37 -0
  834. data/closure-library/closure/goog/module/abstractmoduleloader.js +46 -0
  835. data/closure-library/closure/goog/module/basemodule.js +45 -0
  836. data/closure-library/closure/goog/module/basemoduleloader.js +210 -0
  837. data/closure-library/closure/goog/module/loader.js +269 -0
  838. data/closure-library/closure/goog/module/module.js +166 -0
  839. data/closure-library/closure/goog/module/moduleinfo.js +336 -0
  840. data/closure-library/closure/goog/module/moduleinfo_test.html +109 -0
  841. data/closure-library/closure/goog/module/moduleloadcallback.js +84 -0
  842. data/closure-library/closure/goog/module/moduleloadcallback_test.html +57 -0
  843. data/closure-library/closure/goog/module/moduleloader.js +250 -0
  844. data/closure-library/closure/goog/module/moduleloader_test.html +244 -0
  845. data/closure-library/closure/goog/module/modulemanager.js +1008 -0
  846. data/closure-library/closure/goog/module/modulemanager_test.html +1240 -0
  847. data/closure-library/closure/goog/module/testdata/modA_1.js +22 -0
  848. data/closure-library/closure/goog/module/testdata/modA_2.js +24 -0
  849. data/closure-library/closure/goog/module/testdata/modB_1.js +24 -0
  850. data/closure-library/closure/goog/net/browserchannel.js +2441 -0
  851. data/closure-library/closure/goog/net/browserchannel_test.html +1176 -0
  852. data/closure-library/closure/goog/net/browsertestchannel.js +552 -0
  853. data/closure-library/closure/goog/net/bulkloader.js +174 -0
  854. data/closure-library/closure/goog/net/bulkloader_test.html +232 -0
  855. data/closure-library/closure/goog/net/bulkloaderhelper.js +129 -0
  856. data/closure-library/closure/goog/net/channeldebug.js +288 -0
  857. data/closure-library/closure/goog/net/channelrequest.js +1125 -0
  858. data/closure-library/closure/goog/net/channelrequest_test.html +158 -0
  859. data/closure-library/closure/goog/net/cookies.js +401 -0
  860. data/closure-library/closure/goog/net/cookies_test.html +255 -0
  861. data/closure-library/closure/goog/net/crossdomainrpc.js +848 -0
  862. data/closure-library/closure/goog/net/crossdomainrpc_test.gif +0 -0
  863. data/closure-library/closure/goog/net/crossdomainrpc_test.html +120 -0
  864. data/closure-library/closure/goog/net/crossdomainrpc_test_response.html +59 -0
  865. data/closure-library/closure/goog/net/errorcode.js +130 -0
  866. data/closure-library/closure/goog/net/eventtype.js +37 -0
  867. data/closure-library/closure/goog/net/iframe_xhr_test.html +142 -0
  868. data/closure-library/closure/goog/net/iframe_xhr_test_response.html +17 -0
  869. data/closure-library/closure/goog/net/iframeio.js +1342 -0
  870. data/closure-library/closure/goog/net/iframeio_different_base_test.data +2 -0
  871. data/closure-library/closure/goog/net/iframeio_different_base_test.html +42 -0
  872. data/closure-library/closure/goog/net/iframeio_test.html +368 -0
  873. data/closure-library/closure/goog/net/iframeloadmonitor.js +199 -0
  874. data/closure-library/closure/goog/net/iframeloadmonitor_test.html +113 -0
  875. data/closure-library/closure/goog/net/iframeloadmonitor_test_frame.html +12 -0
  876. data/closure-library/closure/goog/net/iframeloadmonitor_test_frame2.html +12 -0
  877. data/closure-library/closure/goog/net/iframeloadmonitor_test_frame3.html +12 -0
  878. data/closure-library/closure/goog/net/imageloader.js +237 -0
  879. data/closure-library/closure/goog/net/imageloader_test.html +200 -0
  880. data/closure-library/closure/goog/net/imageloader_testimg1.gif +0 -0
  881. data/closure-library/closure/goog/net/imageloader_testimg2.gif +0 -0
  882. data/closure-library/closure/goog/net/imageloader_testimg3.gif +0 -0
  883. data/closure-library/closure/goog/net/jsonp.js +379 -0
  884. data/closure-library/closure/goog/net/jsonp_test.html +328 -0
  885. data/closure-library/closure/goog/net/mockiframeio.js +318 -0
  886. data/closure-library/closure/goog/net/mockxhrlite.js +34 -0
  887. data/closure-library/closure/goog/net/mockxhrlite_test.html +109 -0
  888. data/closure-library/closure/goog/net/multiiframeloadmonitor.js +116 -0
  889. data/closure-library/closure/goog/net/multiiframeloadmonitor_test.html +172 -0
  890. data/closure-library/closure/goog/net/networktester.js +383 -0
  891. data/closure-library/closure/goog/net/networktester_test.html +227 -0
  892. data/closure-library/closure/goog/net/tmpnetwork.js +168 -0
  893. data/closure-library/closure/goog/net/wrapperxmlhttpfactory.js +68 -0
  894. data/closure-library/closure/goog/net/xhrio.js +1093 -0
  895. data/closure-library/closure/goog/net/xhrio_test.html +603 -0
  896. data/closure-library/closure/goog/net/xhriopool.js +87 -0
  897. data/closure-library/closure/goog/net/xhrlite.js +119 -0
  898. data/closure-library/closure/goog/net/xhrlite_test.html +156 -0
  899. data/closure-library/closure/goog/net/xhrlitepool.js +37 -0
  900. data/closure-library/closure/goog/net/xhrmanager.js +763 -0
  901. data/closure-library/closure/goog/net/xhrmonitor.js +254 -0
  902. data/closure-library/closure/goog/net/xhrmonitor_test.html +199 -0
  903. data/closure-library/closure/goog/net/xmlhttp.js +215 -0
  904. data/closure-library/closure/goog/net/xmlhttpfactory.js +64 -0
  905. data/closure-library/closure/goog/net/xpc/crosspagechannel.js +624 -0
  906. data/closure-library/closure/goog/net/xpc/crosspagechannel_test.html +422 -0
  907. data/closure-library/closure/goog/net/xpc/frameelementmethodtransport.js +251 -0
  908. data/closure-library/closure/goog/net/xpc/iframepollingtransport.js +822 -0
  909. data/closure-library/closure/goog/net/xpc/iframerelaytransport.js +288 -0
  910. data/closure-library/closure/goog/net/xpc/nativemessagingtransport.js +280 -0
  911. data/closure-library/closure/goog/net/xpc/nativemessagingtransport_test.html +164 -0
  912. data/closure-library/closure/goog/net/xpc/nixtransport.js +454 -0
  913. data/closure-library/closure/goog/net/xpc/relay.js +72 -0
  914. data/closure-library/closure/goog/net/xpc/testdata/inner_peer.html +106 -0
  915. data/closure-library/closure/goog/net/xpc/transport.js +104 -0
  916. data/closure-library/closure/goog/net/xpc/xpc.js +238 -0
  917. data/closure-library/closure/goog/object/object.js +553 -0
  918. data/closure-library/closure/goog/object/object_test.html +376 -0
  919. data/closure-library/closure/goog/positioning/absoluteposition.js +73 -0
  920. data/closure-library/closure/goog/positioning/abstractposition.js +47 -0
  921. data/closure-library/closure/goog/positioning/anchoredposition.js +78 -0
  922. data/closure-library/closure/goog/positioning/anchoredviewportposition.js +126 -0
  923. data/closure-library/closure/goog/positioning/anchoredviewportposition_test.html +117 -0
  924. data/closure-library/closure/goog/positioning/anchoredviewportposition_test_iframe.html +35 -0
  925. data/closure-library/closure/goog/positioning/clientposition.js +75 -0
  926. data/closure-library/closure/goog/positioning/menuanchoredposition.js +97 -0
  927. data/closure-library/closure/goog/positioning/positioning.js +476 -0
  928. data/closure-library/closure/goog/positioning/positioning_test.html +877 -0
  929. data/closure-library/closure/goog/positioning/positioning_test_iframe1.html +16 -0
  930. data/closure-library/closure/goog/positioning/positioning_test_iframe2.html +13 -0
  931. data/closure-library/closure/goog/positioning/positioning_test_quirk.html +9 -0
  932. data/closure-library/closure/goog/positioning/positioning_test_standard.html +13 -0
  933. data/closure-library/closure/goog/positioning/viewportclientposition.js +102 -0
  934. data/closure-library/closure/goog/positioning/viewportclientposition_test.html +172 -0
  935. data/closure-library/closure/goog/positioning/viewportposition.js +63 -0
  936. data/closure-library/closure/goog/proto/proto.js +43 -0
  937. data/closure-library/closure/goog/proto/serializer.js +68 -0
  938. data/closure-library/closure/goog/proto/serializer_test.html +43 -0
  939. data/closure-library/closure/goog/proto2/descriptor.js +198 -0
  940. data/closure-library/closure/goog/proto2/descriptor_test.html +60 -0
  941. data/closure-library/closure/goog/proto2/fielddescriptor.js +288 -0
  942. data/closure-library/closure/goog/proto2/fielddescriptor_test.html +124 -0
  943. data/closure-library/closure/goog/proto2/lazydeserializer.js +69 -0
  944. data/closure-library/closure/goog/proto2/message.js +726 -0
  945. data/closure-library/closure/goog/proto2/message_test.html +356 -0
  946. data/closure-library/closure/goog/proto2/objectserializer.js +159 -0
  947. data/closure-library/closure/goog/proto2/objectserializer_test.html +423 -0
  948. data/closure-library/closure/goog/proto2/package_test.pb.js +164 -0
  949. data/closure-library/closure/goog/proto2/pbliteserializer.js +150 -0
  950. data/closure-library/closure/goog/proto2/pbliteserializer_test.html +267 -0
  951. data/closure-library/closure/goog/proto2/proto_test.html +693 -0
  952. data/closure-library/closure/goog/proto2/serializer.js +148 -0
  953. data/closure-library/closure/goog/proto2/test.pb.js +2820 -0
  954. data/closure-library/closure/goog/proto2/util.js +54 -0
  955. data/closure-library/closure/goog/pubsub/pubsub.js +326 -0
  956. data/closure-library/closure/goog/pubsub/pubsub_test.html +635 -0
  957. data/closure-library/closure/goog/reflect/reflect.js +50 -0
  958. data/closure-library/closure/goog/spell/spellcheck.js +474 -0
  959. data/closure-library/closure/goog/spell/spellcheck_test.html +112 -0
  960. data/closure-library/closure/goog/string/path.js +100 -0
  961. data/closure-library/closure/goog/string/path_test.html +59 -0
  962. data/closure-library/closure/goog/string/string.js +1207 -0
  963. data/closure-library/closure/goog/string/string_test.html +877 -0
  964. data/closure-library/closure/goog/string/stringbuffer.js +167 -0
  965. data/closure-library/closure/goog/string/stringbuffer_test.html +101 -0
  966. data/closure-library/closure/goog/string/stringformat.js +247 -0
  967. data/closure-library/closure/goog/string/stringformat_test.html +211 -0
  968. data/closure-library/closure/goog/structs/avltree.js +769 -0
  969. data/closure-library/closure/goog/structs/avltree_test.html +241 -0
  970. data/closure-library/closure/goog/structs/circularbuffer.js +219 -0
  971. data/closure-library/closure/goog/structs/circularbuffer_test.html +105 -0
  972. data/closure-library/closure/goog/structs/heap.js +332 -0
  973. data/closure-library/closure/goog/structs/heap_test.html +220 -0
  974. data/closure-library/closure/goog/structs/inversionmap.js +159 -0
  975. data/closure-library/closure/goog/structs/inversionmap_test.html +157 -0
  976. data/closure-library/closure/goog/structs/linkedmap.js +472 -0
  977. data/closure-library/closure/goog/structs/linkedmap_test.html +300 -0
  978. data/closure-library/closure/goog/structs/map.js +446 -0
  979. data/closure-library/closure/goog/structs/map_test.html +430 -0
  980. data/closure-library/closure/goog/structs/node.js +74 -0
  981. data/closure-library/closure/goog/structs/pool.js +344 -0
  982. data/closure-library/closure/goog/structs/pool_test.html +265 -0
  983. data/closure-library/closure/goog/structs/prioritypool.js +147 -0
  984. data/closure-library/closure/goog/structs/prioritypool_test.html +478 -0
  985. data/closure-library/closure/goog/structs/priorityqueue.js +64 -0
  986. data/closure-library/closure/goog/structs/priorityqueue_test.html +179 -0
  987. data/closure-library/closure/goog/structs/quadtree.js +571 -0
  988. data/closure-library/closure/goog/structs/quadtree_test.html +179 -0
  989. data/closure-library/closure/goog/structs/queue.js +157 -0
  990. data/closure-library/closure/goog/structs/queue_test.html +140 -0
  991. data/closure-library/closure/goog/structs/set.js +251 -0
  992. data/closure-library/closure/goog/structs/set_test.html +551 -0
  993. data/closure-library/closure/goog/structs/simplepool.js +203 -0
  994. data/closure-library/closure/goog/structs/stringset.js +404 -0
  995. data/closure-library/closure/goog/structs/stringset_test.html +251 -0
  996. data/closure-library/closure/goog/structs/structs.js +341 -0
  997. data/closure-library/closure/goog/structs/structs_test.html +1050 -0
  998. data/closure-library/closure/goog/structs/treenode.js +312 -0
  999. data/closure-library/closure/goog/structs/treenode_test.html +285 -0
  1000. data/closure-library/closure/goog/structs/trie.js +368 -0
  1001. data/closure-library/closure/goog/structs/trie_test.html +378 -0
  1002. data/closure-library/closure/goog/style/cursor.js +125 -0
  1003. data/closure-library/closure/goog/style/cursor_test.html +131 -0
  1004. data/closure-library/closure/goog/style/style.js +1804 -0
  1005. data/closure-library/closure/goog/style/style_quirks_test.html +1928 -0
  1006. data/closure-library/closure/goog/style/style_test.html +2073 -0
  1007. data/closure-library/closure/goog/style/style_test_iframe_quirk.html +29 -0
  1008. data/closure-library/closure/goog/style/style_test_iframe_standard.html +30 -0
  1009. data/closure-library/closure/goog/style/style_test_quirk.html +9 -0
  1010. data/closure-library/closure/goog/style/style_test_standard.html +11 -0
  1011. data/closure-library/closure/goog/testing/asserts.js +970 -0
  1012. data/closure-library/closure/goog/testing/asserts_test.html +966 -0
  1013. data/closure-library/closure/goog/testing/async/mockcontrol.js +174 -0
  1014. data/closure-library/closure/goog/testing/async/mockcontrol_test.html +224 -0
  1015. data/closure-library/closure/goog/testing/asynctestcase.js +812 -0
  1016. data/closure-library/closure/goog/testing/asynctestcase_async_test.html +102 -0
  1017. data/closure-library/closure/goog/testing/asynctestcase_noasync_test.html +98 -0
  1018. data/closure-library/closure/goog/testing/benchmark.js +87 -0
  1019. data/closure-library/closure/goog/testing/benchmarks/jsbinarysizebutton.js +64 -0
  1020. data/closure-library/closure/goog/testing/benchmarks/jsbinarysizebutton_test.html +58 -0
  1021. data/closure-library/closure/goog/testing/benchmarks/jsbinarysizetoolbar.js +66 -0
  1022. data/closure-library/closure/goog/testing/benchmarks/jsbinarysizetoolbar_test.html +49 -0
  1023. data/closure-library/closure/goog/testing/continuationtestcase.js +682 -0
  1024. data/closure-library/closure/goog/testing/continuationtestcase_test.html +349 -0
  1025. data/closure-library/closure/goog/testing/deferredtestcase.js +157 -0
  1026. data/closure-library/closure/goog/testing/deferredtestcase_test.html +152 -0
  1027. data/closure-library/closure/goog/testing/dom.js +596 -0
  1028. data/closure-library/closure/goog/testing/dom_test.html +438 -0
  1029. data/closure-library/closure/goog/testing/editor/dom.js +293 -0
  1030. data/closure-library/closure/goog/testing/editor/dom_test.html +295 -0
  1031. data/closure-library/closure/goog/testing/editor/fieldmock.js +90 -0
  1032. data/closure-library/closure/goog/testing/editor/testhelper.js +168 -0
  1033. data/closure-library/closure/goog/testing/editor/testhelper_test.html +176 -0
  1034. data/closure-library/closure/goog/testing/events/eventobserver.js +85 -0
  1035. data/closure-library/closure/goog/testing/events/eventobserver_test.html +70 -0
  1036. data/closure-library/closure/goog/testing/events/events.js +540 -0
  1037. data/closure-library/closure/goog/testing/events/events_test.html +434 -0
  1038. data/closure-library/closure/goog/testing/events/matchers.js +41 -0
  1039. data/closure-library/closure/goog/testing/events/matchers_test.html +40 -0
  1040. data/closure-library/closure/goog/testing/expectedfailures.js +236 -0
  1041. data/closure-library/closure/goog/testing/expectedfailures_test.html +122 -0
  1042. data/closure-library/closure/goog/testing/fs/blob.js +74 -0
  1043. data/closure-library/closure/goog/testing/fs/blob_test.html +53 -0
  1044. data/closure-library/closure/goog/testing/fs/directoryentry_test.html +185 -0
  1045. data/closure-library/closure/goog/testing/fs/entry.js +511 -0
  1046. data/closure-library/closure/goog/testing/fs/entry_test.html +153 -0
  1047. data/closure-library/closure/goog/testing/fs/file.js +51 -0
  1048. data/closure-library/closure/goog/testing/fs/fileentry_test.html +54 -0
  1049. data/closure-library/closure/goog/testing/fs/filesystem.js +64 -0
  1050. data/closure-library/closure/goog/testing/fs/filewriter.js +314 -0
  1051. data/closure-library/closure/goog/testing/fs/filewriter_test.html +248 -0
  1052. data/closure-library/closure/goog/testing/fs/fs.js +146 -0
  1053. data/closure-library/closure/goog/testing/fs/fs_test.html +54 -0
  1054. data/closure-library/closure/goog/testing/fs/integration_test.html +219 -0
  1055. data/closure-library/closure/goog/testing/functionmock.js +157 -0
  1056. data/closure-library/closure/goog/testing/functionmock_test.html +357 -0
  1057. data/closure-library/closure/goog/testing/graphics.js +64 -0
  1058. data/closure-library/closure/goog/testing/jsunit.js +144 -0
  1059. data/closure-library/closure/goog/testing/loosemock.js +240 -0
  1060. data/closure-library/closure/goog/testing/loosemock_test.html +343 -0
  1061. data/closure-library/closure/goog/testing/messaging/mockmessagechannel.js +77 -0
  1062. data/closure-library/closure/goog/testing/messaging/mockmessageevent.js +100 -0
  1063. data/closure-library/closure/goog/testing/mock.js +556 -0
  1064. data/closure-library/closure/goog/testing/mock_test.html +208 -0
  1065. data/closure-library/closure/goog/testing/mockclassfactory.js +580 -0
  1066. data/closure-library/closure/goog/testing/mockclassfactory_test.html +241 -0
  1067. data/closure-library/closure/goog/testing/mockclock.js +395 -0
  1068. data/closure-library/closure/goog/testing/mockclock_test.html +413 -0
  1069. data/closure-library/closure/goog/testing/mockcontrol.js +210 -0
  1070. data/closure-library/closure/goog/testing/mockcontrol_test.html +127 -0
  1071. data/closure-library/closure/goog/testing/mockinterface.js +45 -0
  1072. data/closure-library/closure/goog/testing/mockmatchers.js +395 -0
  1073. data/closure-library/closure/goog/testing/mockmatchers_test.html +388 -0
  1074. data/closure-library/closure/goog/testing/mockrandom.js +128 -0
  1075. data/closure-library/closure/goog/testing/mockrandom_test.html +56 -0
  1076. data/closure-library/closure/goog/testing/mockrange.js +65 -0
  1077. data/closure-library/closure/goog/testing/mockrange_test.html +41 -0
  1078. data/closure-library/closure/goog/testing/mockuseragent.js +143 -0
  1079. data/closure-library/closure/goog/testing/mockuseragent_test.html +59 -0
  1080. data/closure-library/closure/goog/testing/multitestrunner.js +1442 -0
  1081. data/closure-library/closure/goog/testing/net/xhrio.js +595 -0
  1082. data/closure-library/closure/goog/testing/net/xhrio_test.html +321 -0
  1083. data/closure-library/closure/goog/testing/objectpropertystring.js +67 -0
  1084. data/closure-library/closure/goog/testing/performancetable.css +46 -0
  1085. data/closure-library/closure/goog/testing/performancetable.js +162 -0
  1086. data/closure-library/closure/goog/testing/performancetimer.js +166 -0
  1087. data/closure-library/closure/goog/testing/performancetimer_test.html +107 -0
  1088. data/closure-library/closure/goog/testing/propertyreplacer.js +243 -0
  1089. data/closure-library/closure/goog/testing/propertyreplacer_test.html +368 -0
  1090. data/closure-library/closure/goog/testing/pseudorandom.js +162 -0
  1091. data/closure-library/closure/goog/testing/pseudorandom_test.html +98 -0
  1092. data/closure-library/closure/goog/testing/recordfunction.js +194 -0
  1093. data/closure-library/closure/goog/testing/recordfunction_test.html +147 -0
  1094. data/closure-library/closure/goog/testing/singleton.js +82 -0
  1095. data/closure-library/closure/goog/testing/singleton_test.html +39 -0
  1096. data/closure-library/closure/goog/testing/stacktrace.js +470 -0
  1097. data/closure-library/closure/goog/testing/stacktrace_test.html +229 -0
  1098. data/closure-library/closure/goog/testing/strictmock.js +124 -0
  1099. data/closure-library/closure/goog/testing/strictmock_test.html +368 -0
  1100. data/closure-library/closure/goog/testing/style/layoutasserts.js +368 -0
  1101. data/closure-library/closure/goog/testing/style/layoutasserts_test.html +269 -0
  1102. data/closure-library/closure/goog/testing/testcase.js +1053 -0
  1103. data/closure-library/closure/goog/testing/testqueue.js +66 -0
  1104. data/closure-library/closure/goog/testing/testrunner.js +391 -0
  1105. data/closure-library/closure/goog/testing/ui/rendererasserts.js +50 -0
  1106. data/closure-library/closure/goog/testing/ui/rendererasserts_test.html +51 -0
  1107. data/closure-library/closure/goog/testing/ui/rendererharness.js +175 -0
  1108. data/closure-library/closure/goog/testing/ui/style.js +137 -0
  1109. data/closure-library/closure/goog/testing/ui/style_reference.html +27 -0
  1110. data/closure-library/closure/goog/testing/ui/style_test.html +130 -0
  1111. data/closure-library/closure/goog/timer/timer.js +285 -0
  1112. data/closure-library/closure/goog/timer/timer_test.html +118 -0
  1113. data/closure-library/closure/goog/tweak/entries.js +990 -0
  1114. data/closure-library/closure/goog/tweak/entries_test.html +94 -0
  1115. data/closure-library/closure/goog/tweak/registry.js +310 -0
  1116. data/closure-library/closure/goog/tweak/registry_test.html +144 -0
  1117. data/closure-library/closure/goog/tweak/testhelpers.js +111 -0
  1118. data/closure-library/closure/goog/tweak/tweak.js +318 -0
  1119. data/closure-library/closure/goog/tweak/tweakui.js +817 -0
  1120. data/closure-library/closure/goog/tweak/tweakui_test.html +280 -0
  1121. data/closure-library/closure/goog/ui/abstractspellchecker.js +1069 -0
  1122. data/closure-library/closure/goog/ui/activitymonitor.js +286 -0
  1123. data/closure-library/closure/goog/ui/activitymonitor_test.html +44 -0
  1124. data/closure-library/closure/goog/ui/advancedtooltip.js +369 -0
  1125. data/closure-library/closure/goog/ui/advancedtooltip_test.html +274 -0
  1126. data/closure-library/closure/goog/ui/animatedzippy.js +190 -0
  1127. data/closure-library/closure/goog/ui/attachablemenu.js +464 -0
  1128. data/closure-library/closure/goog/ui/autocomplete/arraymatcher.js +156 -0
  1129. data/closure-library/closure/goog/ui/autocomplete/arraymatcher_test.html +130 -0
  1130. data/closure-library/closure/goog/ui/autocomplete/autocomplete.js +627 -0
  1131. data/closure-library/closure/goog/ui/autocomplete/autocomplete_test.html +537 -0
  1132. data/closure-library/closure/goog/ui/autocomplete/basic.js +53 -0
  1133. data/closure-library/closure/goog/ui/autocomplete/basic_test.html +204 -0
  1134. data/closure-library/closure/goog/ui/autocomplete/inputhandler.js +1209 -0
  1135. data/closure-library/closure/goog/ui/autocomplete/inputhandler_test.html +555 -0
  1136. data/closure-library/closure/goog/ui/autocomplete/remote.js +117 -0
  1137. data/closure-library/closure/goog/ui/autocomplete/remotearraymatcher.js +273 -0
  1138. data/closure-library/closure/goog/ui/autocomplete/remotearraymatcher_test.html +73 -0
  1139. data/closure-library/closure/goog/ui/autocomplete/renderer.js +852 -0
  1140. data/closure-library/closure/goog/ui/autocomplete/renderer_test.html +386 -0
  1141. data/closure-library/closure/goog/ui/autocomplete/richinputhandler.js +59 -0
  1142. data/closure-library/closure/goog/ui/autocomplete/richremote.js +108 -0
  1143. data/closure-library/closure/goog/ui/autocomplete/richremotearraymatcher.js +126 -0
  1144. data/closure-library/closure/goog/ui/basicmenu.js +930 -0
  1145. data/closure-library/closure/goog/ui/bidiinput.js +164 -0
  1146. data/closure-library/closure/goog/ui/bubble.js +475 -0
  1147. data/closure-library/closure/goog/ui/button.js +208 -0
  1148. data/closure-library/closure/goog/ui/button_test.html +257 -0
  1149. data/closure-library/closure/goog/ui/buttonrenderer.js +205 -0
  1150. data/closure-library/closure/goog/ui/buttonrenderer_test.html +190 -0
  1151. data/closure-library/closure/goog/ui/buttonside.js +40 -0
  1152. data/closure-library/closure/goog/ui/cccbutton.js +281 -0
  1153. data/closure-library/closure/goog/ui/charcounter.js +200 -0
  1154. data/closure-library/closure/goog/ui/charpicker.js +807 -0
  1155. data/closure-library/closure/goog/ui/checkbox.js +303 -0
  1156. data/closure-library/closure/goog/ui/checkbox_test.html +224 -0
  1157. data/closure-library/closure/goog/ui/checkboxmenuitem.js +53 -0
  1158. data/closure-library/closure/goog/ui/colorbutton.js +58 -0
  1159. data/closure-library/closure/goog/ui/colorbutton_test.html +70 -0
  1160. data/closure-library/closure/goog/ui/colorbuttonrenderer.js +72 -0
  1161. data/closure-library/closure/goog/ui/colormenubutton.js +213 -0
  1162. data/closure-library/closure/goog/ui/colormenubuttonrenderer.js +144 -0
  1163. data/closure-library/closure/goog/ui/colormenubuttonrenderer_test.html +88 -0
  1164. data/closure-library/closure/goog/ui/colorpalette.js +162 -0
  1165. data/closure-library/closure/goog/ui/colorpalette_test.html +169 -0
  1166. data/closure-library/closure/goog/ui/colorpicker.js +344 -0
  1167. data/closure-library/closure/goog/ui/colorsplitbehavior.js +61 -0
  1168. data/closure-library/closure/goog/ui/combobox.js +894 -0
  1169. data/closure-library/closure/goog/ui/combobox_test.html +208 -0
  1170. data/closure-library/closure/goog/ui/component.js +1187 -0
  1171. data/closure-library/closure/goog/ui/component_test.html +723 -0
  1172. data/closure-library/closure/goog/ui/container.js +1296 -0
  1173. data/closure-library/closure/goog/ui/container_test.html +450 -0
  1174. data/closure-library/closure/goog/ui/containerrenderer.js +370 -0
  1175. data/closure-library/closure/goog/ui/containerrenderer_test.html +227 -0
  1176. data/closure-library/closure/goog/ui/containerscroller.js +221 -0
  1177. data/closure-library/closure/goog/ui/containerscroller_test.html +213 -0
  1178. data/closure-library/closure/goog/ui/control.js +1348 -0
  1179. data/closure-library/closure/goog/ui/control_test.html +2128 -0
  1180. data/closure-library/closure/goog/ui/controlcontent.js +28 -0
  1181. data/closure-library/closure/goog/ui/controlrenderer.js +808 -0
  1182. data/closure-library/closure/goog/ui/controlrenderer_test.html +840 -0
  1183. data/closure-library/closure/goog/ui/cookieeditor.js +182 -0
  1184. data/closure-library/closure/goog/ui/cookieeditor_test.html +102 -0
  1185. data/closure-library/closure/goog/ui/css3buttonrenderer.js +147 -0
  1186. data/closure-library/closure/goog/ui/css3menubuttonrenderer.js +144 -0
  1187. data/closure-library/closure/goog/ui/cssnames.js +28 -0
  1188. data/closure-library/closure/goog/ui/custombutton.js +58 -0
  1189. data/closure-library/closure/goog/ui/custombuttonrenderer.js +254 -0
  1190. data/closure-library/closure/goog/ui/customcolorpalette.js +137 -0
  1191. data/closure-library/closure/goog/ui/customcolorpalette_test.html +60 -0
  1192. data/closure-library/closure/goog/ui/datepicker.js +1339 -0
  1193. data/closure-library/closure/goog/ui/datepicker_test.html +190 -0
  1194. data/closure-library/closure/goog/ui/decorate.js +37 -0
  1195. data/closure-library/closure/goog/ui/decorate_test.html +113 -0
  1196. data/closure-library/closure/goog/ui/deprecatedbutton.js +381 -0
  1197. data/closure-library/closure/goog/ui/dialog.js +1776 -0
  1198. data/closure-library/closure/goog/ui/dialog_test.html +493 -0
  1199. data/closure-library/closure/goog/ui/dimensionpicker.js +289 -0
  1200. data/closure-library/closure/goog/ui/dimensionpicker_test.html +128 -0
  1201. data/closure-library/closure/goog/ui/dimensionpickerrenderer.js +387 -0
  1202. data/closure-library/closure/goog/ui/dragdropdetector.js +642 -0
  1203. data/closure-library/closure/goog/ui/drilldownrow.js +494 -0
  1204. data/closure-library/closure/goog/ui/editor/abstractdialog.js +443 -0
  1205. data/closure-library/closure/goog/ui/editor/abstractdialog_test.html +467 -0
  1206. data/closure-library/closure/goog/ui/editor/bubble.js +520 -0
  1207. data/closure-library/closure/goog/ui/editor/bubble_test.html +264 -0
  1208. data/closure-library/closure/goog/ui/editor/defaulttoolbar.js +1062 -0
  1209. data/closure-library/closure/goog/ui/editor/linkdialog.js +833 -0
  1210. data/closure-library/closure/goog/ui/editor/linkdialog_test.html +449 -0
  1211. data/closure-library/closure/goog/ui/editor/messages.js +115 -0
  1212. data/closure-library/closure/goog/ui/editor/tabpane.js +183 -0
  1213. data/closure-library/closure/goog/ui/editor/toolbarcontroller.js +293 -0
  1214. data/closure-library/closure/goog/ui/editor/toolbarfactory.js +437 -0
  1215. data/closure-library/closure/goog/ui/editor/toolbarfactory_test.html +73 -0
  1216. data/closure-library/closure/goog/ui/emoji/emoji.js +72 -0
  1217. data/closure-library/closure/goog/ui/emoji/emojipalette.js +298 -0
  1218. data/closure-library/closure/goog/ui/emoji/emojipaletterenderer.js +206 -0
  1219. data/closure-library/closure/goog/ui/emoji/emojipicker.js +797 -0
  1220. data/closure-library/closure/goog/ui/emoji/emojipicker_test.html +840 -0
  1221. data/closure-library/closure/goog/ui/emoji/fast_nonprogressive_emojipicker_test.html +256 -0
  1222. data/closure-library/closure/goog/ui/emoji/fast_progressive_emojipicker_test.html +256 -0
  1223. data/closure-library/closure/goog/ui/emoji/popupemojipicker.js +410 -0
  1224. data/closure-library/closure/goog/ui/emoji/popupemojipicker_test.html +80 -0
  1225. data/closure-library/closure/goog/ui/emoji/progressiveemojipaletterenderer.js +97 -0
  1226. data/closure-library/closure/goog/ui/emoji/spriteinfo.js +212 -0
  1227. data/closure-library/closure/goog/ui/emoji/spriteinfo_test.html +51 -0
  1228. data/closure-library/closure/goog/ui/filteredmenu.js +562 -0
  1229. data/closure-library/closure/goog/ui/filteredmenu_test.html +299 -0
  1230. data/closure-library/closure/goog/ui/filterobservingmenuitem.js +97 -0
  1231. data/closure-library/closure/goog/ui/filterobservingmenuitemrenderer.js +60 -0
  1232. data/closure-library/closure/goog/ui/flatbuttonrenderer.js +138 -0
  1233. data/closure-library/closure/goog/ui/flatmenubuttonrenderer.js +199 -0
  1234. data/closure-library/closure/goog/ui/formpost.js +109 -0
  1235. data/closure-library/closure/goog/ui/formpost_test.html +109 -0
  1236. data/closure-library/closure/goog/ui/gauge.js +999 -0
  1237. data/closure-library/closure/goog/ui/gaugetheme.js +169 -0
  1238. data/closure-library/closure/goog/ui/hovercard.js +447 -0
  1239. data/closure-library/closure/goog/ui/hovercard_test.html +343 -0
  1240. data/closure-library/closure/goog/ui/hsvapalette.js +311 -0
  1241. data/closure-library/closure/goog/ui/hsvapalette_test.html +152 -0
  1242. data/closure-library/closure/goog/ui/hsvpalette.js +470 -0
  1243. data/closure-library/closure/goog/ui/hsvpalette_test.html +202 -0
  1244. data/closure-library/closure/goog/ui/idgenerator.js +57 -0
  1245. data/closure-library/closure/goog/ui/idletimer.js +299 -0
  1246. data/closure-library/closure/goog/ui/idletimer_test.html +100 -0
  1247. data/closure-library/closure/goog/ui/iframemask.js +256 -0
  1248. data/closure-library/closure/goog/ui/iframemask_test.html +230 -0
  1249. data/closure-library/closure/goog/ui/imagelessbuttonrenderer.js +204 -0
  1250. data/closure-library/closure/goog/ui/imagelessmenubuttonrenderer.js +202 -0
  1251. data/closure-library/closure/goog/ui/imagelessroundedcorner.js +971 -0
  1252. data/closure-library/closure/goog/ui/inputdatepicker.js +306 -0
  1253. data/closure-library/closure/goog/ui/inputdatepicker_test.html +109 -0
  1254. data/closure-library/closure/goog/ui/itemevent.js +50 -0
  1255. data/closure-library/closure/goog/ui/keyboardshortcuthandler.js +981 -0
  1256. data/closure-library/closure/goog/ui/keyboardshortcuthandler_test.html +671 -0
  1257. data/closure-library/closure/goog/ui/labelinput.js +439 -0
  1258. data/closure-library/closure/goog/ui/linkbuttonrenderer.js +67 -0
  1259. data/closure-library/closure/goog/ui/media/flashobject.js +629 -0
  1260. data/closure-library/closure/goog/ui/media/flashobject_test.html +236 -0
  1261. data/closure-library/closure/goog/ui/media/flickr.js +309 -0
  1262. data/closure-library/closure/goog/ui/media/flickr_test.html +90 -0
  1263. data/closure-library/closure/goog/ui/media/media.js +284 -0
  1264. data/closure-library/closure/goog/ui/media/media_test.html +161 -0
  1265. data/closure-library/closure/goog/ui/media/mediamodel.js +840 -0
  1266. data/closure-library/closure/goog/ui/media/mp3.js +225 -0
  1267. data/closure-library/closure/goog/ui/media/mp3_test.html +78 -0
  1268. data/closure-library/closure/goog/ui/media/photo.js +139 -0
  1269. data/closure-library/closure/goog/ui/media/photo_test.html +62 -0
  1270. data/closure-library/closure/goog/ui/media/picasa.js +317 -0
  1271. data/closure-library/closure/goog/ui/media/picasa_test.html +131 -0
  1272. data/closure-library/closure/goog/ui/media/vimeo.js +264 -0
  1273. data/closure-library/closure/goog/ui/media/vimeo_test.html +79 -0
  1274. data/closure-library/closure/goog/ui/media/youtube.js +328 -0
  1275. data/closure-library/closure/goog/ui/media/youtube_test.html +185 -0
  1276. data/closure-library/closure/goog/ui/menu.js +435 -0
  1277. data/closure-library/closure/goog/ui/menu_test.html +129 -0
  1278. data/closure-library/closure/goog/ui/menubase.js +191 -0
  1279. data/closure-library/closure/goog/ui/menubutton.js +809 -0
  1280. data/closure-library/closure/goog/ui/menubutton_test.html +440 -0
  1281. data/closure-library/closure/goog/ui/menubutton_test_frame.html +41 -0
  1282. data/closure-library/closure/goog/ui/menubuttonrenderer.js +226 -0
  1283. data/closure-library/closure/goog/ui/menubuttonrenderer_test.html +161 -0
  1284. data/closure-library/closure/goog/ui/menuheader.js +62 -0
  1285. data/closure-library/closure/goog/ui/menuheaderrenderer.js +55 -0
  1286. data/closure-library/closure/goog/ui/menuitem.js +154 -0
  1287. data/closure-library/closure/goog/ui/menuitem_test.html +506 -0
  1288. data/closure-library/closure/goog/ui/menuitemrenderer.js +353 -0
  1289. data/closure-library/closure/goog/ui/menuitemrenderer_test.html +190 -0
  1290. data/closure-library/closure/goog/ui/menurenderer.js +118 -0
  1291. data/closure-library/closure/goog/ui/menuseparator.js +51 -0
  1292. data/closure-library/closure/goog/ui/menuseparatorrenderer.js +102 -0
  1293. data/closure-library/closure/goog/ui/mockactivitymonitor.js +54 -0
  1294. data/closure-library/closure/goog/ui/nativebuttonrenderer.js +205 -0
  1295. data/closure-library/closure/goog/ui/nativebuttonrenderer_test.html +213 -0
  1296. data/closure-library/closure/goog/ui/offlineinstalldialog.js +1086 -0
  1297. data/closure-library/closure/goog/ui/offlinestatuscard.js +580 -0
  1298. data/closure-library/closure/goog/ui/offlinestatuscomponent.js +545 -0
  1299. data/closure-library/closure/goog/ui/option.js +67 -0
  1300. data/closure-library/closure/goog/ui/palette.js +528 -0
  1301. data/closure-library/closure/goog/ui/paletterenderer.js +318 -0
  1302. data/closure-library/closure/goog/ui/plaintextspellchecker.js +668 -0
  1303. data/closure-library/closure/goog/ui/plaintextspellchecker_test.html +240 -0
  1304. data/closure-library/closure/goog/ui/popup.js +410 -0
  1305. data/closure-library/closure/goog/ui/popup_test.html +137 -0
  1306. data/closure-library/closure/goog/ui/popupbase.js +721 -0
  1307. data/closure-library/closure/goog/ui/popupbase_test.html +186 -0
  1308. data/closure-library/closure/goog/ui/popupcolorpicker.js +441 -0
  1309. data/closure-library/closure/goog/ui/popupcolorpicker_test.html +71 -0
  1310. data/closure-library/closure/goog/ui/popupdatepicker.js +273 -0
  1311. data/closure-library/closure/goog/ui/popupmenu.js +539 -0
  1312. data/closure-library/closure/goog/ui/popupmenu_test.html +197 -0
  1313. data/closure-library/closure/goog/ui/progressbar.js +390 -0
  1314. data/closure-library/closure/goog/ui/prompt.js +307 -0
  1315. data/closure-library/closure/goog/ui/prompt_test.html +65 -0
  1316. data/closure-library/closure/goog/ui/rangemodel.js +301 -0
  1317. data/closure-library/closure/goog/ui/rangemodel_test.html +270 -0
  1318. data/closure-library/closure/goog/ui/ratings.js +441 -0
  1319. data/closure-library/closure/goog/ui/registry.js +166 -0
  1320. data/closure-library/closure/goog/ui/registry_test.html +236 -0
  1321. data/closure-library/closure/goog/ui/richtextspellchecker.js +600 -0
  1322. data/closure-library/closure/goog/ui/richtextspellchecker_test.html +224 -0
  1323. data/closure-library/closure/goog/ui/roundedcorners.js +694 -0
  1324. data/closure-library/closure/goog/ui/roundedpanel.js +609 -0
  1325. data/closure-library/closure/goog/ui/roundedpanel_test.html +57 -0
  1326. data/closure-library/closure/goog/ui/roundedtabrenderer.js +196 -0
  1327. data/closure-library/closure/goog/ui/scrollfloater.js +394 -0
  1328. data/closure-library/closure/goog/ui/scrollfloater_test.html +46 -0
  1329. data/closure-library/closure/goog/ui/select.js +397 -0
  1330. data/closure-library/closure/goog/ui/select_test.html +152 -0
  1331. data/closure-library/closure/goog/ui/selectionmenubutton.js +277 -0
  1332. data/closure-library/closure/goog/ui/selectionmenubutton_test.html +237 -0
  1333. data/closure-library/closure/goog/ui/selectionmodel.js +291 -0
  1334. data/closure-library/closure/goog/ui/separator.js +74 -0
  1335. data/closure-library/closure/goog/ui/serverchart.js +1791 -0
  1336. data/closure-library/closure/goog/ui/serverchart_test.html +598 -0
  1337. data/closure-library/closure/goog/ui/slider.js +125 -0
  1338. data/closure-library/closure/goog/ui/sliderbase.js +1087 -0
  1339. data/closure-library/closure/goog/ui/sliderbase_test.html +198 -0
  1340. data/closure-library/closure/goog/ui/splitbehavior.js +348 -0
  1341. data/closure-library/closure/goog/ui/splitbehavior_test.html +161 -0
  1342. data/closure-library/closure/goog/ui/splitpane.js +844 -0
  1343. data/closure-library/closure/goog/ui/splitpane_test.html +143 -0
  1344. data/closure-library/closure/goog/ui/style/app/buttonrenderer.js +204 -0
  1345. data/closure-library/closure/goog/ui/style/app/buttonrenderer_test.html +155 -0
  1346. data/closure-library/closure/goog/ui/style/app/menubuttonrenderer.js +227 -0
  1347. data/closure-library/closure/goog/ui/style/app/menubuttonrenderer_test.html +167 -0
  1348. data/closure-library/closure/goog/ui/style/app/primaryactionbuttonrenderer.js +88 -0
  1349. data/closure-library/closure/goog/ui/style/app/primaryactionbuttonrenderer_test.html +76 -0
  1350. data/closure-library/closure/goog/ui/submenu.js +660 -0
  1351. data/closure-library/closure/goog/ui/submenu_test.html +446 -0
  1352. data/closure-library/closure/goog/ui/submenurenderer.js +188 -0
  1353. data/closure-library/closure/goog/ui/tab.js +102 -0
  1354. data/closure-library/closure/goog/ui/tab_test.html +61 -0
  1355. data/closure-library/closure/goog/ui/tabbar.js +393 -0
  1356. data/closure-library/closure/goog/ui/tabbar_test.html +611 -0
  1357. data/closure-library/closure/goog/ui/tabbarrenderer.js +173 -0
  1358. data/closure-library/closure/goog/ui/tabbarrenderer_test.html +137 -0
  1359. data/closure-library/closure/goog/ui/tablesorter.js +304 -0
  1360. data/closure-library/closure/goog/ui/tablesorter_test.html +127 -0
  1361. data/closure-library/closure/goog/ui/tabpane.js +674 -0
  1362. data/closure-library/closure/goog/ui/tabpane_test.html +107 -0
  1363. data/closure-library/closure/goog/ui/tabrenderer.js +152 -0
  1364. data/closure-library/closure/goog/ui/tabrenderer_test.html +132 -0
  1365. data/closure-library/closure/goog/ui/textarea.js +573 -0
  1366. data/closure-library/closure/goog/ui/textarea_test.html +305 -0
  1367. data/closure-library/closure/goog/ui/textarearenderer.js +167 -0
  1368. data/closure-library/closure/goog/ui/togglebutton.js +58 -0
  1369. data/closure-library/closure/goog/ui/toolbar.js +45 -0
  1370. data/closure-library/closure/goog/ui/toolbarbutton.js +54 -0
  1371. data/closure-library/closure/goog/ui/toolbarbuttonrenderer.js +55 -0
  1372. data/closure-library/closure/goog/ui/toolbarcolormenubutton.js +57 -0
  1373. data/closure-library/closure/goog/ui/toolbarcolormenubuttonrenderer.js +95 -0
  1374. data/closure-library/closure/goog/ui/toolbarcolormenubuttonrenderer_test.html +66 -0
  1375. data/closure-library/closure/goog/ui/toolbarmenubutton.js +56 -0
  1376. data/closure-library/closure/goog/ui/toolbarmenubuttonrenderer.js +55 -0
  1377. data/closure-library/closure/goog/ui/toolbarrenderer.js +95 -0
  1378. data/closure-library/closure/goog/ui/toolbarselect.js +55 -0
  1379. data/closure-library/closure/goog/ui/toolbarseparator.js +51 -0
  1380. data/closure-library/closure/goog/ui/toolbarseparatorrenderer.js +87 -0
  1381. data/closure-library/closure/goog/ui/toolbartogglebutton.js +53 -0
  1382. data/closure-library/closure/goog/ui/tooltip.js +975 -0
  1383. data/closure-library/closure/goog/ui/tooltip_test.html +351 -0
  1384. data/closure-library/closure/goog/ui/tree/basenode.js +1457 -0
  1385. data/closure-library/closure/goog/ui/tree/basenode_test.html +218 -0
  1386. data/closure-library/closure/goog/ui/tree/treecontrol.js +656 -0
  1387. data/closure-library/closure/goog/ui/tree/treecontrol_test.html +113 -0
  1388. data/closure-library/closure/goog/ui/tree/treenode.js +102 -0
  1389. data/closure-library/closure/goog/ui/tree/typeahead.js +332 -0
  1390. data/closure-library/closure/goog/ui/tree/typeahead_test.html +133 -0
  1391. data/closure-library/closure/goog/ui/tristatemenuitem.js +185 -0
  1392. data/closure-library/closure/goog/ui/tristatemenuitemrenderer.js +86 -0
  1393. data/closure-library/closure/goog/ui/twothumbslider.js +134 -0
  1394. data/closure-library/closure/goog/ui/zippy.js +277 -0
  1395. data/closure-library/closure/goog/ui/zippy_test.html +223 -0
  1396. data/closure-library/closure/goog/uri/uri.js +1595 -0
  1397. data/closure-library/closure/goog/uri/uri_test.html +837 -0
  1398. data/closure-library/closure/goog/uri/utils.js +972 -0
  1399. data/closure-library/closure/goog/uri/utils_test.html +521 -0
  1400. data/closure-library/closure/goog/useragent/adobereader.js +90 -0
  1401. data/closure-library/closure/goog/useragent/adobereader_test.html +34 -0
  1402. data/closure-library/closure/goog/useragent/flash.js +113 -0
  1403. data/closure-library/closure/goog/useragent/flash_test.html +34 -0
  1404. data/closure-library/closure/goog/useragent/iphoto.js +86 -0
  1405. data/closure-library/closure/goog/useragent/jscript.js +94 -0
  1406. data/closure-library/closure/goog/useragent/jscript_test.html +65 -0
  1407. data/closure-library/closure/goog/useragent/picasa.js +111 -0
  1408. data/closure-library/closure/goog/useragent/platform.js +70 -0
  1409. data/closure-library/closure/goog/useragent/platform_test.html +108 -0
  1410. data/closure-library/closure/goog/useragent/product.js +253 -0
  1411. data/closure-library/closure/goog/useragent/product_isversion.js +99 -0
  1412. data/closure-library/closure/goog/useragent/product_test.html +322 -0
  1413. data/closure-library/closure/goog/useragent/useragent.js +464 -0
  1414. data/closure-library/closure/goog/useragent/useragent_test.html +290 -0
  1415. data/closure-library/closure/goog/window/window.js +206 -0
  1416. data/closure-library/closure/goog/window/window_test.html +185 -0
  1417. data/closure-library/third_party/closure/goog/base.js +2 -0
  1418. data/closure-library/third_party/closure/goog/caja/string/html/htmlparser.js +611 -0
  1419. data/closure-library/third_party/closure/goog/caja/string/html/htmlsanitizer.js +605 -0
  1420. data/closure-library/third_party/closure/goog/deps.js +26 -0
  1421. data/closure-library/third_party/closure/goog/dojo/dom/query.js +1532 -0
  1422. data/closure-library/third_party/closure/goog/dojo/dom/query_test.html +63 -0
  1423. data/closure-library/third_party/closure/goog/dojo/dom/query_test.js +160 -0
  1424. data/closure-library/third_party/closure/goog/jpeg_encoder/jpeg_encoder_basic.js +751 -0
  1425. data/closure-library/third_party/closure/goog/loremipsum/text/loremipsum.js +712 -0
  1426. data/closure-library/third_party/closure/goog/loremipsum/text/loremipsum_test.html +61 -0
  1427. data/closure-library/third_party/closure/goog/mochikit/async/deferred.js +530 -0
  1428. data/closure-library/third_party/closure/goog/mochikit/async/deferred_test.html +627 -0
  1429. data/closure-library/third_party/closure/goog/mochikit/async/deferredlist.js +199 -0
  1430. data/closure-library/third_party/closure/goog/mochikit/async/deferredlist_test.html +426 -0
  1431. data/closure-library/third_party/closure/goog/osapi/osapi.js +91 -0
  1432. data/closure-library/third_party/closure/goog/silverlight/AppManifest.xml +6 -0
  1433. data/closure-library/third_party/closure/goog/silverlight/AssemblyInfo.cs +35 -0
  1434. data/closure-library/third_party/closure/goog/silverlight/ClipboardButton.xaml +9 -0
  1435. data/closure-library/third_party/closure/goog/silverlight/ClipboardButton.xaml.cs +74 -0
  1436. data/closure-library/third_party/closure/goog/silverlight/ClipboardButtonApp.xaml +8 -0
  1437. data/closure-library/third_party/closure/goog/silverlight/ClipboardButtonApp.xaml.cs +75 -0
  1438. data/closure-library/third_party/closure/goog/silverlight/ClosureClipboardButton.csproj +108 -0
  1439. data/closure-library/third_party/closure/goog/silverlight/ClosureClipboardButton.csproj.user +29 -0
  1440. data/closure-library/third_party/closure/goog/silverlight/clipboardbutton.js +279 -0
  1441. data/closure-library/third_party/closure/goog/silverlight/silverlight.js +758 -0
  1442. data/closure-library/third_party/closure/goog/silverlight/supporteduseragent.js +138 -0
  1443. data/closure-library/third_party/closure/goog/silverlight/xap_files +0 -0
  1444. data/closure-templates/COPYING +202 -0
  1445. data/closure-templates/README +47 -0
  1446. data/closure-templates/SoyToJsSrcCompiler.jar +0 -0
  1447. data/closure-templates/soyutils.js +880 -0
  1448. data/closure-templates/soyutils_usegoog.js +308 -0
  1449. data/closure.gemspec +20 -0
  1450. data/config.ru +40 -0
  1451. data/java_src/ClosureScript.java +89 -0
  1452. data/java_src/make.rb +19 -0
  1453. data/lib/closure/beanshell.rb +80 -0
  1454. data/lib/closure/compiler.rb +184 -0
  1455. data/lib/closure/file_response.rb +90 -0
  1456. data/lib/closure/goog.rb +143 -0
  1457. data/lib/closure/middleware.rb +43 -0
  1458. data/lib/closure/sass.rb +56 -0
  1459. data/lib/closure/script.rb +139 -0
  1460. data/lib/closure/server.rb +83 -0
  1461. data/lib/closure/sources.rb +310 -0
  1462. data/lib/closure/templates.rb +156 -0
  1463. data/lib/closure/version.rb +20 -0
  1464. data/lib/closure.jar +0 -0
  1465. data/lib/closure.rb +134 -0
  1466. data/scripts/demos/compile.js.erb +8 -0
  1467. data/scripts/demos/compile.out +1 -0
  1468. data/scripts/demos/compiler.haml +17 -0
  1469. data/scripts/demos/compiler.js +12 -0
  1470. data/scripts/demos/deps.js.erb +1 -0
  1471. data/scripts/demos/externs.haml +16 -0
  1472. data/scripts/demos/externs.js.erb +8 -0
  1473. data/scripts/demos/externs.out +1 -0
  1474. data/scripts/demos/externs_jquery.externs +849 -0
  1475. data/scripts/demos/externs_jquery.js +167 -0
  1476. data/scripts/demos/externs_jquerytest.js +11 -0
  1477. data/scripts/demos/helloworld.haml +15 -0
  1478. data/scripts/demos/helloworld.js +58 -0
  1479. data/scripts/demos/helloworld.soy +45 -0
  1480. data/scripts/demos/index.haml +21 -0
  1481. data/scripts/demos/rails_ujs.haml +24 -0
  1482. data/scripts/examples/rails/ujs.js +136 -0
  1483. data/scripts/favicon.ico +0 -0
  1484. data/scripts/fixtures/_partial.haml +2 -0
  1485. data/scripts/fixtures/erb.html.erb +8 -0
  1486. data/scripts/fixtures/haml.haml +6 -0
  1487. data/scripts/fixtures/html.html +9 -0
  1488. data/scripts/fixtures/route_js.js.erb +1 -0
  1489. data/scripts/index.haml +14 -0
  1490. data/test/beanshell_test.rb +22 -0
  1491. data/test/server_test.rb +67 -0
  1492. data/test/sources_test.rb +41 -0
  1493. data/test/test_helper.rb +12 -0
  1494. metadata +1577 -0
@@ -0,0 +1,2441 @@
1
+ // Copyright 2006 The Closure Library Authors. All Rights Reserved.
2
+ //
3
+ // Licensed under the Apache License, Version 2.0 (the "License");
4
+ // you may not use this file except in compliance with the License.
5
+ // You may obtain a copy of the License at
6
+ //
7
+ // http://www.apache.org/licenses/LICENSE-2.0
8
+ //
9
+ // Unless required by applicable law or agreed to in writing, software
10
+ // distributed under the License is distributed on an "AS-IS" BASIS,
11
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ // See the License for the specific language governing permissions and
13
+ // limitations under the License.
14
+
15
+ /**
16
+ * @fileoverview Definition of the BrowserChannel class. A BrowserChannel
17
+ * simulates a bidirectional socket over HTTP. It is the basis of the
18
+ * Gmail Chat IM connections to the server.
19
+ *
20
+ * See http://wiki/Main/BrowserChannel
21
+ * This doesn't yet completely comform to the design document as we've done
22
+ * some renaming and cleanup in the design document that hasn't yet been
23
+ * implemented in the protocol.
24
+ *
25
+ * Typical usage will look like
26
+ * var handler = [handler object];
27
+ * var channel = new BrowserChannel(clientVersion);
28
+ * channel.setHandler(handler);
29
+ * channel.connect('channel/test', 'channel/bind');
30
+ *
31
+ * See goog.net.BrowserChannel.Handler for the handler interface.
32
+ *
33
+ */
34
+
35
+
36
+ goog.provide('goog.net.BrowserChannel');
37
+ goog.provide('goog.net.BrowserChannel.Error');
38
+ goog.provide('goog.net.BrowserChannel.Handler');
39
+ goog.provide('goog.net.BrowserChannel.LogSaver');
40
+ goog.provide('goog.net.BrowserChannel.QueuedMap');
41
+ goog.provide('goog.net.BrowserChannel.StatEvent');
42
+ goog.provide('goog.net.BrowserChannel.TimingEvent');
43
+
44
+ goog.require('goog.Uri');
45
+ goog.require('goog.array');
46
+ goog.require('goog.debug.TextFormatter');
47
+ goog.require('goog.events.Event');
48
+ goog.require('goog.events.EventTarget');
49
+ goog.require('goog.json');
50
+ goog.require('goog.net.BrowserTestChannel');
51
+ goog.require('goog.net.ChannelDebug');
52
+ goog.require('goog.net.ChannelRequest');
53
+ goog.require('goog.net.XhrIo');
54
+ goog.require('goog.string');
55
+ goog.require('goog.structs.CircularBuffer');
56
+ goog.require('goog.userAgent');
57
+
58
+
59
+
60
+ /**
61
+ * Encapsulates the logic for a single BrowserChannel.
62
+ *
63
+ * @param {string} clientVersion An application-specific version number that
64
+ * is sent to the server when connected.
65
+ * @constructor
66
+ */
67
+ goog.net.BrowserChannel = function(clientVersion) {
68
+ /**
69
+ * The application specific version that is passed to the server.
70
+ * @type {string}
71
+ * @private
72
+ */
73
+ this.clientVersion_ = clientVersion;
74
+
75
+ /**
76
+ * The current state of the BrowserChannel. It should be one of the
77
+ * goog.net.BrowserChannel.State constants.
78
+ * @type {goog.net.BrowserChannel.State}
79
+ * @private
80
+ */
81
+ this.state_ = goog.net.BrowserChannel.State.INIT;
82
+
83
+ /**
84
+ * An array of queued maps that need to be sent to the server.
85
+ * @type {Array.<goog.net.BrowserChannel.QueuedMap>}
86
+ * @private
87
+ */
88
+ this.outgoingMaps_ = [];
89
+
90
+ /**
91
+ * An array of dequeued maps that we have either received a non-successful
92
+ * response for, or no response at all, and which therefore may or may not
93
+ * have been received by the server.
94
+ * @type {Array.<goog.net.BrowserChannel.QueuedMap>}
95
+ * @private
96
+ */
97
+ this.pendingMaps_ = [];
98
+
99
+ /**
100
+ * The channel debug used for browserchannel logging
101
+ * @type {goog.net.ChannelDebug}
102
+ * @private
103
+ */
104
+ this.channelDebug_ = new goog.net.ChannelDebug();
105
+ };
106
+
107
+
108
+
109
+ /**
110
+ * Simple container class for a (mapId, map) pair.
111
+ * @param {number} mapId The id for this map.
112
+ * @param {Object|goog.structs.Map} map The map itself.
113
+ * @constructor
114
+ */
115
+ goog.net.BrowserChannel.QueuedMap = function(mapId, map) {
116
+ /**
117
+ * The id for this map.
118
+ * @type {number}
119
+ */
120
+ this.mapId = mapId;
121
+
122
+ /**
123
+ * The map itself.
124
+ * @type {Object|goog.structs.Map}
125
+ */
126
+ this.map = map;
127
+ };
128
+
129
+
130
+ /**
131
+ * Extra HTTP headers to add to all the requests sent to the server.
132
+ * @type {Object}
133
+ * @private
134
+ */
135
+ goog.net.BrowserChannel.prototype.extraHeaders_ = null;
136
+
137
+
138
+ /**
139
+ * Extra parameters to add to all the requests sent to the server.
140
+ * @type {Object}
141
+ * @private
142
+ */
143
+ goog.net.BrowserChannel.prototype.extraParams_ = null;
144
+
145
+
146
+ /**
147
+ * The current ChannelRequest object for the forwardchannel.
148
+ * @type {goog.net.ChannelRequest?}
149
+ * @private
150
+ */
151
+ goog.net.BrowserChannel.prototype.forwardChannelRequest_ = null;
152
+
153
+
154
+ /**
155
+ * The ChannelRequest object for the backchannel.
156
+ * @type {goog.net.ChannelRequest?}
157
+ * @private
158
+ */
159
+ goog.net.BrowserChannel.prototype.backChannelRequest_ = null;
160
+
161
+
162
+ /**
163
+ * The relative path (in the context of the the page hosting the browser
164
+ * channel) for making requests to the server.
165
+ * @type {?string}
166
+ * @private
167
+ */
168
+ goog.net.BrowserChannel.prototype.path_ = null;
169
+
170
+
171
+ /**
172
+ * The absolute URI for the forwardchannel request.
173
+ * @type {goog.Uri}
174
+ * @private
175
+ */
176
+ goog.net.BrowserChannel.prototype.forwardChannelUri_ = null;
177
+
178
+
179
+ /**
180
+ * The absolute URI for the backchannel request.
181
+ * @type {goog.Uri}
182
+ * @private
183
+ */
184
+ goog.net.BrowserChannel.prototype.backChannelUri_ = null;
185
+
186
+
187
+ /**
188
+ * A subdomain prefix for using a subdomain in IE for the backchannel
189
+ * requests.
190
+ * @type {?string}
191
+ * @private
192
+ */
193
+ goog.net.BrowserChannel.prototype.hostPrefix_ = null;
194
+
195
+
196
+ /**
197
+ * Whether we allow the use of a subdomain in IE for the backchannel requests.
198
+ * @private
199
+ */
200
+ goog.net.BrowserChannel.prototype.allowHostPrefix_ = true;
201
+
202
+
203
+ /**
204
+ * The next id to use for the RID (request identifier) parameter. This
205
+ * identifier uniquely identifies the forward channel request.
206
+ * @type {number}
207
+ * @private
208
+ */
209
+ goog.net.BrowserChannel.prototype.nextRid_ = 0;
210
+
211
+
212
+ /**
213
+ * The id to use for the next outgoing map. This identifier uniquely
214
+ * identifies a sent map.
215
+ * @type {number}
216
+ * @private
217
+ */
218
+ goog.net.BrowserChannel.prototype.nextMapId_ = 0;
219
+
220
+
221
+ /**
222
+ * Whether to fail forward-channel requests after one try, or after a few tries.
223
+ * @type {boolean}
224
+ * @private
225
+ */
226
+ goog.net.BrowserChannel.prototype.failFast_ = false;
227
+
228
+
229
+ /**
230
+ * The handler that receive callbacks for state changes and data.
231
+ * @type {goog.net.BrowserChannel.Handler}
232
+ * @private
233
+ */
234
+ goog.net.BrowserChannel.prototype.handler_ = null;
235
+
236
+
237
+ /**
238
+ * Timer identifier for asynchronously making a forward channel request.
239
+ * @type {?number}
240
+ * @private
241
+ */
242
+ goog.net.BrowserChannel.prototype.forwardChannelTimerId_ = null;
243
+
244
+
245
+ /**
246
+ * Timer identifier for asynchronously making a back channel request.
247
+ * @type {?number}
248
+ * @private
249
+ */
250
+ goog.net.BrowserChannel.prototype.backChannelTimerId_ = null;
251
+
252
+
253
+ /**
254
+ * Timer identifier for the timer that waits for us to retry the backchannel in
255
+ * the case where it is dead and no longer receiving data.
256
+ * @type {?number}
257
+ * @private
258
+ */
259
+ goog.net.BrowserChannel.prototype.deadBackChannelTimerId_ = null;
260
+
261
+
262
+ /**
263
+ * The BrowserTestChannel object which encapsulates the logic for determining
264
+ * interesting network conditions about the client.
265
+ * @type {goog.net.BrowserTestChannel?}
266
+ * @private
267
+ */
268
+ goog.net.BrowserChannel.prototype.connectionTest_ = null;
269
+
270
+
271
+ /**
272
+ * Whether the client's network conditions can support chunked responses.
273
+ * @type {?boolean}
274
+ * @private
275
+ */
276
+ goog.net.BrowserChannel.prototype.useChunked_ = null;
277
+
278
+
279
+ /**
280
+ * Whether chunked mode is allowed. In certain debugging situations, it's
281
+ * useful to disable this.
282
+ * @private
283
+ */
284
+ goog.net.BrowserChannel.prototype.allowChunkedMode_ = true;
285
+
286
+
287
+ /**
288
+ * The array identifier of the last array received from the server for the
289
+ * backchannel request.
290
+ * @type {number}
291
+ * @private
292
+ */
293
+ goog.net.BrowserChannel.prototype.lastArrayId_ = -1;
294
+
295
+
296
+ /**
297
+ * The array identifier of the last array sent by the server that we know about.
298
+ * @type {number}
299
+ * @private
300
+ */
301
+ goog.net.BrowserChannel.prototype.lastPostResponseArrayId_ = -1;
302
+
303
+
304
+ /**
305
+ * The last status code received.
306
+ * @type {number}
307
+ * @private
308
+ */
309
+ goog.net.BrowserChannel.prototype.lastStatusCode_ = -1;
310
+
311
+
312
+ /**
313
+ * Number of times we have retried the current forward channel request.
314
+ * @type {number}
315
+ * @private
316
+ */
317
+ goog.net.BrowserChannel.prototype.forwardChannelRetryCount_ = 0;
318
+
319
+
320
+ /**
321
+ * Number of times it a row that we have retried the current back channel
322
+ * request and received no data.
323
+ * @type {number}
324
+ * @private
325
+ */
326
+ goog.net.BrowserChannel.prototype.backChannelRetryCount_ = 0;
327
+
328
+
329
+ /**
330
+ * The attempt id for the current back channel request. Starts at 1 and
331
+ * increments for each reconnect. The server uses this to log if our connection
332
+ * is flaky or not.
333
+ * @type {number}
334
+ * @private
335
+ */
336
+ goog.net.BrowserChannel.prototype.backChannelAttemptId_;
337
+
338
+
339
+ /**
340
+ * The latest protocol version that this class supports. We request this version
341
+ * from the server when opening the connection. Should match
342
+ * com.google.net.browserchannel.BrowserChannel.LATEST_CHANNEL_VERSION.
343
+ * @type {number}
344
+ */
345
+ goog.net.BrowserChannel.LATEST_CHANNEL_VERSION = 8;
346
+
347
+
348
+ /**
349
+ * The channel version that we negotiated with the server for this session.
350
+ * Starts out as the version we request, and then is changed to the negotiated
351
+ * version after the initial open.
352
+ * @type {number}
353
+ * @private
354
+ */
355
+ goog.net.BrowserChannel.prototype.channelVersion_ =
356
+ goog.net.BrowserChannel.LATEST_CHANNEL_VERSION;
357
+
358
+
359
+ /**
360
+ * Enum type for the browser channel state machine.
361
+ * @enum {number}
362
+ */
363
+ goog.net.BrowserChannel.State = {
364
+ /** The channel is closed. */
365
+ CLOSED: 0,
366
+
367
+ /** The channel has been initialized but hasn't yet initiated a connection. */
368
+ INIT: 1,
369
+
370
+ /** The channel is in the process of opening a connection to the server. */
371
+ OPENING: 2,
372
+
373
+ /** The channel is open. */
374
+ OPENED: 3
375
+ };
376
+
377
+
378
+ /**
379
+ * Maximum number of attempts to connect to the server for forward channel
380
+ * requests.
381
+ * @type {number}
382
+ */
383
+ goog.net.BrowserChannel.FORWARD_CHANNEL_MAX_RETRIES = 2;
384
+
385
+
386
+ /**
387
+ * The timeout in milliseconds for a forward channel request.
388
+ * @type {number}
389
+ */
390
+ goog.net.BrowserChannel.FORWARD_CHANNEL_RETRY_TIMEOUT = 20 * 1000;
391
+
392
+
393
+ /**
394
+ * Maximum number of attempts to connect to the server for back channel
395
+ * requests.
396
+ * @type {number}
397
+ */
398
+ goog.net.BrowserChannel.BACK_CHANNEL_MAX_RETRIES = 3;
399
+
400
+
401
+ /**
402
+ * Default timeout in MS before the initial retry. Subsequent retries will be
403
+ * slower.
404
+ * @type {number}
405
+ */
406
+ goog.net.BrowserChannel.RETRY_DELAY_MS = 5 * 1000;
407
+
408
+
409
+ /**
410
+ * We will add a random time between 0 and this number of MS to retries to
411
+ * the retry time for this request.
412
+ * @type {number}
413
+ */
414
+ goog.net.BrowserChannel.RETRY_DELAY_SEED = 10 * 1000;
415
+
416
+
417
+ /**
418
+ * A number in MS of how long we guess the maxmium amount of time a round trip
419
+ * to the server should take. In the future this could be substituted with a
420
+ * real measurement of the RTT.
421
+ * @type {number}
422
+ */
423
+ goog.net.BrowserChannel.RTT_ESTIMATE = 3 * 1000;
424
+
425
+
426
+ /**
427
+ * When retrying for an inactive channel, we will multiply the total delay by
428
+ * this number.
429
+ * @type {number}
430
+ */
431
+ goog.net.BrowserChannel.INACTIVE_CHANNEL_RETRY_FACTOR = 2;
432
+
433
+
434
+ /**
435
+ * Enum type for identifying a BrowserChannel error.
436
+ * @enum {number}
437
+ */
438
+ goog.net.BrowserChannel.Error = {
439
+ /** Value that indicates no error has occurred. */
440
+ OK: 0,
441
+
442
+ /** An error due to a request failing. */
443
+ REQUEST_FAILED: 2,
444
+
445
+ /** An error due to the user being logged out. */
446
+ LOGGED_OUT: 4,
447
+
448
+ /** An error due to server response which contains no data. */
449
+ NO_DATA: 5,
450
+
451
+ /** An error due to a server response indicating an unknown session id */
452
+ UNKNOWN_SESSION_ID: 6,
453
+
454
+ /** An error due to a server response requesting to stop the channel. */
455
+ STOP: 7,
456
+
457
+ /** A general network error. */
458
+ NETWORK: 8,
459
+
460
+ /** An error due to the channel being blocked by a network administrator. */
461
+ BLOCKED: 9,
462
+
463
+ /** An error due to bad data being returned from the server. */
464
+ BAD_DATA: 10,
465
+
466
+ /** An error due to a response that doesn't start with the magic cookie. */
467
+ BAD_RESPONSE: 11
468
+ };
469
+
470
+
471
+ /**
472
+ * Internal enum type for the two browser channel channel types.
473
+ * @enum {number}
474
+ * @private
475
+ */
476
+ goog.net.BrowserChannel.ChannelType_ = {
477
+ FORWARD_CHANNEL: 1,
478
+
479
+ BACK_CHANNEL: 2
480
+ };
481
+
482
+
483
+ /**
484
+ * The maximum number of maps that can be sent in one POST. Should match
485
+ * com.google.net.browserchannel.BrowserChannel.MAX_MAPS_PER_REQUEST.
486
+ * @type {number}
487
+ * @private
488
+ */
489
+ goog.net.BrowserChannel.MAX_MAPS_PER_REQUEST_ = 1000;
490
+
491
+
492
+ /**
493
+ * Singleton event target for firing stat events
494
+ * @type {goog.events.EventTarget}
495
+ * @private
496
+ */
497
+ goog.net.BrowserChannel.statEventTarget_ = new goog.events.EventTarget();
498
+
499
+
500
+ /**
501
+ * Events fired by BrowserChannel and associated objects
502
+ * @type {Object}
503
+ */
504
+ goog.net.BrowserChannel.Event = {};
505
+
506
+
507
+ /**
508
+ * Stat Event that fires when things of interest happen that may be useful for
509
+ * applications to know about for stats or debugging purposes. This event fires
510
+ * on the EventTarget returned by getStatEventTarget.
511
+ */
512
+ goog.net.BrowserChannel.Event.STAT_EVENT = 'statevent';
513
+
514
+
515
+
516
+ /**
517
+ * Event class for goog.net.BrowserChannel.Event.STAT_EVENT
518
+ *
519
+ * @param {goog.events.EventTarget} eventTarget The stat event target for
520
+ the browser channel.
521
+ * @param {goog.net.BrowserChannel.Stat} stat The stat.
522
+ * @constructor
523
+ * @extends {goog.events.Event}
524
+ */
525
+ goog.net.BrowserChannel.StatEvent = function(eventTarget, stat) {
526
+ goog.events.Event.call(this, goog.net.BrowserChannel.Event.STAT_EVENT,
527
+ eventTarget);
528
+
529
+ /**
530
+ * The stat
531
+ * @type {goog.net.BrowserChannel.Stat}
532
+ */
533
+ this.stat = stat;
534
+
535
+ };
536
+ goog.inherits(goog.net.BrowserChannel.StatEvent, goog.events.Event);
537
+
538
+
539
+ /**
540
+ * An event that fires when POST requests complete successfully, indicating
541
+ * the size of the POST and the round trip time.
542
+ * This event fires on the EventTarget returned by getStatEventTarget.
543
+ */
544
+ goog.net.BrowserChannel.Event.TIMING_EVENT = 'timingevent';
545
+
546
+
547
+
548
+ /**
549
+ * Event class for goog.net.BrowserChannel.Event.TIMING_EVENT
550
+ *
551
+ * @param {goog.events.EventTarget} target The stat event target for
552
+ the browser channel.
553
+ * @param {number} size The number of characters in the POST data.
554
+ * @param {number} rtt The total round trip time from POST to response in MS.
555
+ * @param {number} retries The number of times the POST had to be retried.
556
+ * @constructor
557
+ * @extends {goog.events.Event}
558
+ */
559
+ goog.net.BrowserChannel.TimingEvent = function(target, size, rtt, retries) {
560
+ goog.events.Event.call(this, goog.net.BrowserChannel.Event.TIMING_EVENT,
561
+ target);
562
+
563
+ /**
564
+ * @type {number}
565
+ */
566
+ this.size = size;
567
+
568
+ /**
569
+ * @type {number}
570
+ */
571
+ this.rtt = rtt;
572
+
573
+ /**
574
+ * @type {number}
575
+ */
576
+ this.retries = retries;
577
+
578
+ };
579
+ goog.inherits(goog.net.BrowserChannel.TimingEvent, goog.events.Event);
580
+
581
+
582
+ /**
583
+ * Enum that identifies events for statistics that are interesting to track.
584
+ * TODO(user) - Change name not to use Event or use EventTarget
585
+ * @enum {number}
586
+ */
587
+ goog.net.BrowserChannel.Stat = {
588
+ /** Event indicating a new connection attempt. */
589
+ CONNECT_ATTEMPT: 0,
590
+
591
+ /** Event indicating a connection error due to a general network problem. */
592
+ ERROR_NETWORK: 1,
593
+
594
+ /**
595
+ * Event indicating a connection error that isn't due to a general network
596
+ * problem.
597
+ */
598
+ ERROR_OTHER: 2,
599
+
600
+ /** Event indicating the start of test stage one. */
601
+ TEST_STAGE_ONE_START: 3,
602
+
603
+
604
+ /** Event indicating the channel is blocked by a network administrator. */
605
+ CHANNEL_BLOCKED: 4,
606
+
607
+ /** Event indicating the start of test stage two. */
608
+ TEST_STAGE_TWO_START: 5,
609
+
610
+ /** Event indicating the first piece of test data was received. */
611
+ TEST_STAGE_TWO_DATA_ONE: 6,
612
+
613
+ /**
614
+ * Event indicating that the second piece of test data was received and it was
615
+ * recieved separately from the first.
616
+ */
617
+ TEST_STAGE_TWO_DATA_TWO: 7,
618
+
619
+ /** Event indicating both pieces of test data were received simultaneously. */
620
+ TEST_STAGE_TWO_DATA_BOTH: 8,
621
+
622
+ /** Event indicating stage one of the test request failed. */
623
+ TEST_STAGE_ONE_FAILED: 9,
624
+
625
+ /** Event indicating stage two of the test request failed. */
626
+ TEST_STAGE_TWO_FAILED: 10,
627
+
628
+ /**
629
+ * Event indicating that a buffering proxy is likely between the client and
630
+ * the server.
631
+ */
632
+ PROXY: 11,
633
+
634
+ /**
635
+ * Event indicating that no buffering proxy is likely between the client and
636
+ * the server.
637
+ */
638
+ NOPROXY: 12,
639
+
640
+ /** Event indicating an unknown SID error. */
641
+ REQUEST_UNKNOWN_SESSION_ID: 13,
642
+
643
+ /** Event indicating a bad status code was received. */
644
+ REQUEST_BAD_STATUS: 14,
645
+
646
+ /** Event indicating incomplete data was received */
647
+ REQUEST_INCOMPLETE_DATA: 15,
648
+
649
+ /** Event indicating bad data was received */
650
+ REQUEST_BAD_DATA: 16,
651
+
652
+ /** Event indicating no data was received when data was expected. */
653
+ REQUEST_NO_DATA: 17,
654
+
655
+ /** Event indicating a request timeout. */
656
+ REQUEST_TIMEOUT: 18,
657
+
658
+ /**
659
+ * Event indicating that the server never received our hanging GET and so it
660
+ * is being retried.
661
+ */
662
+ BACKCHANNEL_MISSING: 19,
663
+
664
+ /**
665
+ * Event indicating that we have determined that our hanging GET is not
666
+ * receiving data when it should be. Thus it is dead dead and will be retried.
667
+ */
668
+ BACKCHANNEL_DEAD: 20
669
+ };
670
+
671
+
672
+ /**
673
+ * The normal response for forward channel requests.
674
+ * Used only before version 8 of the protocol.
675
+ * @type {string}
676
+ */
677
+ goog.net.BrowserChannel.MAGIC_RESPONSE_COOKIE = 'y2f%';
678
+
679
+
680
+ /**
681
+ * A guess at a cutoff at which to no longer assume the backchannel is dead
682
+ * when we are slow to receive data. Number in bytes.
683
+ *
684
+ * Assumption: The worst bandwidth we work on is 50 kilobits/sec
685
+ * 50kbits/sec * (1 byte / 8 bits) * 6 sec dead backchannel timeout
686
+ * @type {number}
687
+ */
688
+ goog.net.BrowserChannel.OUTSTANDING_DATA_BACKCHANNEL_RETRY_CUTOFF = 37500;
689
+
690
+
691
+ /**
692
+ * Returns the browserchannel logger.
693
+ *
694
+ * @return {goog.net.ChannelDebug} The channel debug object.
695
+ */
696
+ goog.net.BrowserChannel.prototype.getChannelDebug = function() {
697
+ return this.channelDebug_;
698
+ };
699
+
700
+
701
+ /**
702
+ * Set the browserchannel logger.
703
+ * TODO(user): Add interface for channel loggers or remove this function.
704
+ *
705
+ * @param {goog.net.ChannelDebug} channelDebug The channel debug object.
706
+ */
707
+ goog.net.BrowserChannel.prototype.setChannelDebug = function(
708
+ channelDebug) {
709
+ this.channelDebug_ = channelDebug;
710
+ };
711
+
712
+
713
+ /**
714
+ * Allows the application to set an execution hooks for when BrowserChannel
715
+ * starts processing requests. This is useful to track timing or logging
716
+ * special information. The function takes no parameters and return void.
717
+ * @param {Function} startHook The function for the start hook.
718
+ */
719
+ goog.net.BrowserChannel.setStartThreadExecutionHook = function(startHook) {
720
+ goog.net.BrowserChannel.startExecutionHook_ = startHook;
721
+ };
722
+
723
+
724
+ /**
725
+ * Allows the application to set an execution hooks for when BrowserChannel
726
+ * stops processing requests. This is useful to track timing or logging
727
+ * special information. The function takes no parameters and return void.
728
+ * @param {Function} endHook The function for the end hook.
729
+ */
730
+ goog.net.BrowserChannel.setEndThreadExecutionHook = function(endHook) {
731
+ goog.net.BrowserChannel.endExecutionHook_ = endHook;
732
+ };
733
+
734
+
735
+ /**
736
+ * Application provided execution hook for the start hook.
737
+ *
738
+ * @type {Function}
739
+ * @private
740
+ */
741
+ goog.net.BrowserChannel.startExecutionHook_ = function() { };
742
+
743
+
744
+ /**
745
+ * Application provided execution hook for the end hook.
746
+ *
747
+ * @type {Function}
748
+ * @private
749
+ */
750
+ goog.net.BrowserChannel.endExecutionHook_ = function() { };
751
+
752
+
753
+ /**
754
+ * Instantiates a ChannelRequest with the given parameters. Overidden in tests.
755
+ *
756
+ * @param {goog.net.BrowserChannel|goog.net.BrowserTestChannel} channel
757
+ * The BrowserChannel that owns this request.
758
+ * @param {goog.net.ChannelDebug} channelDebug A ChannelDebug to use for
759
+ * logging.
760
+ * @param {string=} opt_sessionId The session id for the channel.
761
+ * @param {string|number=} opt_requestId The request id for this request.
762
+ * @param {number=} opt_retryId The retry id for this request.
763
+ * @return {goog.net.ChannelRequest} The created channel request.
764
+ */
765
+ goog.net.BrowserChannel.createChannelRequest = function(
766
+ channel, channelDebug, opt_sessionId, opt_requestId, opt_retryId) {
767
+ return new goog.net.ChannelRequest(
768
+ channel,
769
+ channelDebug,
770
+ opt_sessionId,
771
+ opt_requestId,
772
+ opt_retryId);
773
+ };
774
+
775
+
776
+ /**
777
+ * Starts the channel. This initiates connections to the server.
778
+ *
779
+ * @param {string} testPath The path for the test connection.
780
+ * @param {string} channelPath The path for the channel connection.
781
+ * @param {Object} extraParams Extra parameter keys and values to add to the
782
+ * requests.
783
+ * @param {string=} opt_oldSessionId Session ID from a previous session.
784
+ * @param {number=} opt_oldArrayId The last array ID from a previous session.
785
+ */
786
+ goog.net.BrowserChannel.prototype.connect = function(testPath, channelPath,
787
+ extraParams, opt_oldSessionId, opt_oldArrayId) {
788
+ this.channelDebug_.debug('connect()');
789
+
790
+ goog.net.BrowserChannel.notifyStatEvent(
791
+ goog.net.BrowserChannel.Stat.CONNECT_ATTEMPT);
792
+
793
+ this.path_ = channelPath;
794
+ this.extraParams_ = extraParams || {};
795
+
796
+ // Attach parameters about the previous session if reconnecting.
797
+ if (opt_oldSessionId && goog.isDef(opt_oldArrayId)) {
798
+ this.extraParams_['OSID'] = opt_oldSessionId;
799
+ this.extraParams_['OAID'] = opt_oldArrayId;
800
+ }
801
+
802
+ this.connectTest_(testPath);
803
+ };
804
+
805
+
806
+ /**
807
+ * Disconnects and closes the channel.
808
+ */
809
+ goog.net.BrowserChannel.prototype.disconnect = function() {
810
+ this.channelDebug_.debug('disconnect()');
811
+
812
+ this.cancelRequests_();
813
+
814
+ if (this.state_ == goog.net.BrowserChannel.State.OPENED) {
815
+ var rid = this.nextRid_++;
816
+ var uri = this.forwardChannelUri_.clone();
817
+ uri.setParameterValue('SID', this.sid_);
818
+ uri.setParameterValue('RID', rid);
819
+ uri.setParameterValue('TYPE', 'terminate');
820
+
821
+ // Add the reconnect parameters.
822
+ this.addAdditionalParams_(uri);
823
+
824
+ var request = goog.net.BrowserChannel.createChannelRequest(
825
+ this, this.channelDebug_, this.sid_, rid);
826
+ request.sendUsingImgTag(uri);
827
+ this.onClose_();
828
+ }
829
+ };
830
+
831
+
832
+ /**
833
+ * Returns the session id of the channel. Only available after the
834
+ * channel has been opened.
835
+ * @return {string} Session ID.
836
+ */
837
+ goog.net.BrowserChannel.prototype.getSessionId = function() {
838
+ return this.sid_;
839
+ };
840
+
841
+
842
+ /**
843
+ * Starts the test channel to determine network conditions.
844
+ *
845
+ * @param {string} testPath The relative PATH for the test connection.
846
+ * @private
847
+ */
848
+ goog.net.BrowserChannel.prototype.connectTest_ = function(testPath) {
849
+ this.channelDebug_.debug('connectTest_()');
850
+ this.connectionTest_ = new goog.net.BrowserTestChannel(
851
+ this, this.channelDebug_);
852
+ this.connectionTest_.setExtraHeaders(this.extraHeaders_);
853
+ this.connectionTest_.connect(testPath);
854
+ };
855
+
856
+
857
+ /**
858
+ * Starts the regular channel which is run after the test channel is complete.
859
+ * @private
860
+ */
861
+ goog.net.BrowserChannel.prototype.connectChannel_ = function() {
862
+ this.channelDebug_.debug('connectChannel_()');
863
+ this.ensureInState_(goog.net.BrowserChannel.State.INIT,
864
+ goog.net.BrowserChannel.State.CLOSED);
865
+ this.forwardChannelUri_ =
866
+ this.getForwardChannelUri(/** @type {string} */ (this.path_));
867
+ this.ensureForwardChannel_();
868
+ };
869
+
870
+
871
+ /**
872
+ * Cancels all outstanding requests.
873
+ * @private
874
+ */
875
+ goog.net.BrowserChannel.prototype.cancelRequests_ = function() {
876
+ if (this.connectionTest_) {
877
+ this.connectionTest_.abort();
878
+ this.connectionTest_ = null;
879
+ }
880
+
881
+ if (this.backChannelRequest_) {
882
+ this.backChannelRequest_.cancel();
883
+ this.backChannelRequest_ = null;
884
+ }
885
+
886
+ if (this.backChannelTimerId_) {
887
+ goog.global.clearTimeout(this.backChannelTimerId_);
888
+ this.backChannelTimerId_ = null;
889
+ }
890
+
891
+ this.clearDeadBackchannelTimer_();
892
+
893
+ if (this.forwardChannelRequest_) {
894
+ this.forwardChannelRequest_.cancel();
895
+ this.forwardChannelRequest_ = null;
896
+ }
897
+
898
+ if (this.forwardChannelTimerId_) {
899
+ goog.global.clearTimeout(this.forwardChannelTimerId_);
900
+ this.forwardChannelTimerId_ = null;
901
+ }
902
+ };
903
+
904
+
905
+ /**
906
+ * Returns the extra HTTP headers to add to all the requests sent to the server.
907
+ *
908
+ * @return {Object} The HTTP headers, or null.
909
+ */
910
+ goog.net.BrowserChannel.prototype.getExtraHeaders = function() {
911
+ return this.extraHeaders_;
912
+ };
913
+
914
+
915
+ /**
916
+ * Sets extra HTTP headers to add to all the requests sent to the server.
917
+ *
918
+ * @param {Object} extraHeaders The HTTP headers, or null.
919
+ */
920
+ goog.net.BrowserChannel.prototype.setExtraHeaders = function(extraHeaders) {
921
+ this.extraHeaders_ = extraHeaders;
922
+ };
923
+
924
+
925
+ /**
926
+ * Returns the handler used for channel callback events.
927
+ *
928
+ * @return {goog.net.BrowserChannel.Handler} The handler.
929
+ */
930
+ goog.net.BrowserChannel.prototype.getHandler = function() {
931
+ return this.handler_;
932
+ };
933
+
934
+
935
+ /**
936
+ * Sets the handler used for channel callback events.
937
+ * @param {goog.net.BrowserChannel.Handler} handler The handler to set.
938
+ */
939
+ goog.net.BrowserChannel.prototype.setHandler = function(handler) {
940
+ this.handler_ = handler;
941
+ };
942
+
943
+
944
+ /**
945
+ * Returns whether the channel allows the use of a subdomain. There may be
946
+ * cases where this isn't allowed.
947
+ * @return {boolean} Whether a host prefix is allowed.
948
+ */
949
+ goog.net.BrowserChannel.prototype.getAllowHostPrefix = function() {
950
+ return this.allowHostPrefix_;
951
+ };
952
+
953
+
954
+ /**
955
+ * Sets whether the channel allows the use of a subdomain. There may be cases
956
+ * where this isn't allowed, for example, logging in with troutboard where
957
+ * using a subdomain causes Apache to force the user to authenticate twice.
958
+ * @param {boolean} allowHostPrefix Whether a host prefix is allowed.
959
+ */
960
+ goog.net.BrowserChannel.prototype.setAllowHostPrefix =
961
+ function(allowHostPrefix) {
962
+ this.allowHostPrefix_ = allowHostPrefix;
963
+ };
964
+
965
+
966
+ /**
967
+ * Returns whether the channel is buffered or not. This state is valid for
968
+ * querying only after the test connection has completed. This may be
969
+ * queried in the goog.net.BrowserChannel.okToMakeRequest() callback.
970
+ * A channel may be buffered if the test connection determines that
971
+ * a chunked response could not be sent down within a suitable time.
972
+ * @return {boolean} Whether the channel is buffered.
973
+ */
974
+ goog.net.BrowserChannel.prototype.isBuffered = function() {
975
+ return !this.useChunked_;
976
+ };
977
+
978
+
979
+ /**
980
+ * Returns whether chunked mode is allowed. In certain debugging situations,
981
+ * it's useful for the application to have a way to disable chunked mode for a
982
+ * user.
983
+
984
+ * @return {boolean} Whether chunked mode is allowed.
985
+ */
986
+ goog.net.BrowserChannel.prototype.getAllowChunkedMode =
987
+ function() {
988
+ return this.allowChunkedMode_;
989
+ };
990
+
991
+
992
+ /**
993
+ * Sets whether chunked mode is allowed. In certain debugging situations, it's
994
+ * useful for the application to have a way to disable chunked mode for a user.
995
+ * @param {boolean} allowChunkedMode Whether chunked mode is allowed.
996
+ */
997
+ goog.net.BrowserChannel.prototype.setAllowChunkedMode =
998
+ function(allowChunkedMode) {
999
+ this.allowChunkedMode_ = allowChunkedMode;
1000
+ };
1001
+
1002
+
1003
+ /**
1004
+ * Sends a request to the server. The format of the request is a Map data
1005
+ * structure of key/value pairs. These maps are then encoded in a format
1006
+ * suitable for the wire and then reconstituted as a Map data structure that
1007
+ * the server can process.
1008
+ * @param {Object|goog.structs.Map} map The map to send.
1009
+ */
1010
+ goog.net.BrowserChannel.prototype.sendMap = function(map) {
1011
+ if (this.state_ == goog.net.BrowserChannel.State.CLOSED) {
1012
+ throw Error('Invalid operation: sending map when state is closed');
1013
+ }
1014
+
1015
+ // We can only send 1000 maps per POST, but typically we should never have
1016
+ // that much to send, so warn if we exceed that (we still send all the maps).
1017
+ if (this.outgoingMaps_.length ==
1018
+ goog.net.BrowserChannel.MAX_MAPS_PER_REQUEST_) {
1019
+ // severe() is temporary so that we get these uploaded and can figure out
1020
+ // what's causing them. Afterwards can change to warning().
1021
+ this.channelDebug_.severe(
1022
+ 'Already have ' + goog.net.BrowserChannel.MAX_MAPS_PER_REQUEST_ +
1023
+ ' queued maps upon queueing ' + goog.json.serialize(map));
1024
+ }
1025
+
1026
+ this.outgoingMaps_.push(
1027
+ new goog.net.BrowserChannel.QueuedMap(this.nextMapId_++, map));
1028
+ if (this.state_ == goog.net.BrowserChannel.State.OPENING ||
1029
+ this.state_ == goog.net.BrowserChannel.State.OPENED) {
1030
+ this.ensureForwardChannel_();
1031
+ }
1032
+ };
1033
+
1034
+
1035
+ /**
1036
+ * When set to true, this changes the behavior of the forward channel so it
1037
+ * will not retry requests; it will fail after one network failure, and if
1038
+ * there was already one network failure, the request will fail immediately.
1039
+ * @param {boolean} failFast Whether or not to fail fast.
1040
+ */
1041
+ goog.net.BrowserChannel.prototype.setFailFast = function(failFast) {
1042
+ this.failFast_ = failFast;
1043
+ this.channelDebug_.info('setFailFast: ' + failFast);
1044
+ if ((this.forwardChannelRequest_ || this.forwardChannelTimerId_) &&
1045
+ this.forwardChannelRetryCount_ > this.getForwardChannelMaxRetries()) {
1046
+ this.channelDebug_.info(
1047
+ 'Retry count ' + this.forwardChannelRetryCount_ +
1048
+ ' > new maxRetries ' + this.getForwardChannelMaxRetries() +
1049
+ '. Fail immediately!');
1050
+ if (this.forwardChannelRequest_) {
1051
+ this.forwardChannelRequest_.cancel();
1052
+ // Go through the standard onRequestComplete logic to expose the max-retry
1053
+ // failure in the standard way.
1054
+ this.onRequestComplete(this.forwardChannelRequest_);
1055
+ } else { // i.e., this.forwardChannelTimerId_
1056
+ goog.global.clearTimeout(this.forwardChannelTimerId_);
1057
+ this.forwardChannelTimerId_ = null;
1058
+ // The error code from the last failed request is gone, so just use a
1059
+ // generic one.
1060
+ this.signalError_(goog.net.BrowserChannel.Error.REQUEST_FAILED);
1061
+ }
1062
+ }
1063
+ };
1064
+
1065
+
1066
+ /**
1067
+ * @return {number} The max number of forward-channel retries, which will be 0
1068
+ * in fail-fast mode.
1069
+ */
1070
+ goog.net.BrowserChannel.prototype.getForwardChannelMaxRetries = function() {
1071
+ return this.failFast_ ?
1072
+ 0 : goog.net.BrowserChannel.FORWARD_CHANNEL_MAX_RETRIES;
1073
+ };
1074
+
1075
+
1076
+ /**
1077
+ * @return {number} The max number of back-channel retries, which is a constant.
1078
+ */
1079
+ goog.net.BrowserChannel.prototype.getBackChannelMaxRetries = function() {
1080
+ // Back-channel retries is a constant.
1081
+ return goog.net.BrowserChannel.BACK_CHANNEL_MAX_RETRIES;
1082
+ };
1083
+
1084
+
1085
+ /**
1086
+ * Returns whether the channel is closed
1087
+ * @return {boolean} true if the channel is closed.
1088
+ */
1089
+ goog.net.BrowserChannel.prototype.isClosed = function() {
1090
+ return this.state_ == goog.net.BrowserChannel.State.CLOSED;
1091
+ };
1092
+
1093
+
1094
+ /**
1095
+ * Returns the browser channel state.
1096
+ * @return {goog.net.BrowserChannel.State} The current state of the browser
1097
+ * channel.
1098
+ */
1099
+ goog.net.BrowserChannel.prototype.getState = function() {
1100
+ return this.state_;
1101
+ };
1102
+
1103
+
1104
+ /**
1105
+ * Return the last status code received for a request.
1106
+ * @return {number} The last status code received for a request.
1107
+ */
1108
+ goog.net.BrowserChannel.prototype.getLastStatusCode = function() {
1109
+ return this.lastStatusCode_;
1110
+ };
1111
+
1112
+
1113
+ /**
1114
+ * @return {number} The last array id received.
1115
+ */
1116
+ goog.net.BrowserChannel.prototype.getLastArrayId = function() {
1117
+ return this.lastArrayId_;
1118
+ };
1119
+
1120
+
1121
+ /**
1122
+ * Returns whether there are outstanding requests servicing the channel.
1123
+ * @return {boolean} true if there are outstanding requests.
1124
+ */
1125
+ goog.net.BrowserChannel.prototype.hasOutstandingRequests = function() {
1126
+ return this.outstandingRequests_() != 0;
1127
+ };
1128
+
1129
+
1130
+ /**
1131
+ * Returns the number of outstanding requests.
1132
+ * @return {number} The number of outstanding requests to the server.
1133
+ * @private
1134
+ */
1135
+ goog.net.BrowserChannel.prototype.outstandingRequests_ = function() {
1136
+ var count = 0;
1137
+ if (this.backChannelRequest_) {
1138
+ count++;
1139
+ }
1140
+ if (this.forwardChannelRequest_) {
1141
+ count++;
1142
+ }
1143
+ return count;
1144
+ };
1145
+
1146
+
1147
+ /**
1148
+ * Ensures that a forward channel request is scheduled.
1149
+ * @private
1150
+ */
1151
+ goog.net.BrowserChannel.prototype.ensureForwardChannel_ = function() {
1152
+ if (this.forwardChannelRequest_) {
1153
+ // connection in process - no need to start a new request
1154
+ return;
1155
+ }
1156
+
1157
+ if (this.forwardChannelTimerId_) {
1158
+ // no need to start a new request - one is already scheduled
1159
+ return;
1160
+ }
1161
+
1162
+ this.forwardChannelTimerId_ = goog.net.BrowserChannel.setTimeout(
1163
+ goog.bind(this.onStartForwardChannelTimer_, this), 0);
1164
+ this.forwardChannelRetryCount_ = 0;
1165
+ };
1166
+
1167
+
1168
+ /**
1169
+ * Schedules a forward-channel retry for the specified request, unless the max
1170
+ * retries has been reached.
1171
+ * @param {goog.net.ChannelRequest} request The failed request to retry.
1172
+ * @return {boolean} true iff a retry was scheduled.
1173
+ * @private
1174
+ */
1175
+ goog.net.BrowserChannel.prototype.maybeRetryForwardChannel_ =
1176
+ function(request) {
1177
+ if (this.forwardChannelRequest_ || this.forwardChannelTimerId_) {
1178
+ // Should be impossible to be called in this state.
1179
+ this.channelDebug_.severe('Request already in progress');
1180
+ return false;
1181
+ }
1182
+
1183
+ if (this.state_ == goog.net.BrowserChannel.State.INIT || // no retry open_()
1184
+ (this.forwardChannelRetryCount_ >= this.getForwardChannelMaxRetries())) {
1185
+ return false;
1186
+ }
1187
+
1188
+ this.channelDebug_.debug('Going to retry POST');
1189
+
1190
+ this.forwardChannelTimerId_ = goog.net.BrowserChannel.setTimeout(
1191
+ goog.bind(this.onStartForwardChannelTimer_, this, request),
1192
+ this.getRetryTime_(this.forwardChannelRetryCount_));
1193
+ this.forwardChannelRetryCount_++;
1194
+ return true;
1195
+ };
1196
+
1197
+
1198
+ /**
1199
+ * Timer callback for ensureForwardChannel
1200
+ * @param {goog.net.ChannelRequest=} opt_retryRequest A failed request to retry.
1201
+ * @private
1202
+ */
1203
+ goog.net.BrowserChannel.prototype.onStartForwardChannelTimer_ = function(
1204
+ opt_retryRequest) {
1205
+ this.forwardChannelTimerId_ = null;
1206
+ this.startForwardChannel_(opt_retryRequest);
1207
+ };
1208
+
1209
+
1210
+ /**
1211
+ * Begins a new forward channel operation to the server.
1212
+ * @param {goog.net.ChannelRequest=} opt_retryRequest A failed request to retry.
1213
+ * @private
1214
+ */
1215
+ goog.net.BrowserChannel.prototype.startForwardChannel_ = function(
1216
+ opt_retryRequest) {
1217
+ this.channelDebug_.debug('startForwardChannel_');
1218
+
1219
+ if (this.state_ == goog.net.BrowserChannel.State.INIT) {
1220
+ if (opt_retryRequest) {
1221
+ this.channelDebug_.severe('Not supposed to retry the open');
1222
+ return;
1223
+ }
1224
+ this.open_();
1225
+ this.state_ = goog.net.BrowserChannel.State.OPENING;
1226
+ } else if (this.state_ == goog.net.BrowserChannel.State.OPENED) {
1227
+ if (!this.okToMakeRequest_()) {
1228
+ // channel is cancelled
1229
+ return;
1230
+ }
1231
+
1232
+ if (opt_retryRequest) {
1233
+ this.makeForwardChannelRequest_(opt_retryRequest);
1234
+ return;
1235
+ }
1236
+
1237
+ if (this.outgoingMaps_.length == 0) {
1238
+ this.channelDebug_.debug('startForwardChannel_ returned: ' +
1239
+ 'nothing to send');
1240
+ // no need to start a new forward channel request
1241
+ return;
1242
+ }
1243
+
1244
+ if (this.forwardChannelRequest_) {
1245
+ // Should be impossible to be called in this state.
1246
+ this.channelDebug_.severe('startForwardChannel_ returned: ' +
1247
+ 'connection already in progress');
1248
+ return;
1249
+ }
1250
+
1251
+ this.makeForwardChannelRequest_();
1252
+ this.channelDebug_.debug('startForwardChannel_ finished, sent request');
1253
+ }
1254
+ };
1255
+
1256
+
1257
+ /**
1258
+ * Establishes a new channel session with the the server.
1259
+ * @private
1260
+ */
1261
+ goog.net.BrowserChannel.prototype.open_ = function() {
1262
+ this.channelDebug_.debug('open_()');
1263
+ this.nextRid_ = Math.floor(Math.random() * 100000);
1264
+
1265
+ var rid = this.nextRid_++;
1266
+ var request = goog.net.BrowserChannel.createChannelRequest(
1267
+ this, this.channelDebug_, '', rid);
1268
+ request.setExtraHeaders(this.extraHeaders_);
1269
+ var requestText = this.dequeueOutgoingMaps_();
1270
+ var uri = this.forwardChannelUri_.clone();
1271
+ uri.setParameterValue('RID', rid);
1272
+ if (this.clientVersion_) {
1273
+ uri.setParameterValue('CVER', this.clientVersion_);
1274
+ }
1275
+
1276
+ // Add the reconnect parameters.
1277
+ this.addAdditionalParams_(uri);
1278
+
1279
+ request.xmlHttpPost(uri, requestText, true);
1280
+ this.forwardChannelRequest_ = request;
1281
+ };
1282
+
1283
+
1284
+ /**
1285
+ * Makes a forward channel request using XMLHTTP.
1286
+ * @param {goog.net.ChannelRequest=} opt_retryRequest A failed request to retry.
1287
+ * @private
1288
+ */
1289
+ goog.net.BrowserChannel.prototype.makeForwardChannelRequest_ =
1290
+ function(opt_retryRequest) {
1291
+ var rid;
1292
+ var requestText;
1293
+ if (opt_retryRequest) {
1294
+ if (this.channelVersion_ > 6) {
1295
+ // In version 7 and up we can tack on new arrays to a retry.
1296
+ this.requeuePendingMaps_();
1297
+ rid = this.nextRid_ - 1; // Must use last RID
1298
+ requestText = this.dequeueOutgoingMaps_();
1299
+ } else {
1300
+ // TODO(user): Remove this code and the opt_retryRequest passing
1301
+ // once server-side support for ver 7 is ubiquitous.
1302
+ rid = opt_retryRequest.getRequestId();
1303
+ requestText = /** @type {string} */ (opt_retryRequest.getPostData());
1304
+ }
1305
+ } else {
1306
+ rid = this.nextRid_++;
1307
+ requestText = this.dequeueOutgoingMaps_();
1308
+ }
1309
+
1310
+ var uri = this.forwardChannelUri_.clone();
1311
+ uri.setParameterValue('SID', this.sid_);
1312
+ uri.setParameterValue('RID', rid);
1313
+ uri.setParameterValue('AID', this.lastArrayId_);
1314
+ // Add the additional reconnect parameters.
1315
+ this.addAdditionalParams_(uri);
1316
+
1317
+ var request = goog.net.BrowserChannel.createChannelRequest(
1318
+ this,
1319
+ this.channelDebug_,
1320
+ this.sid_,
1321
+ rid,
1322
+ this.forwardChannelRetryCount_ + 1);
1323
+ request.setExtraHeaders(this.extraHeaders_);
1324
+
1325
+ // randomize from 50%-100% of the forward channel timeout to avoid
1326
+ // a big hit if servers happen to die at once.
1327
+ request.setTimeout(
1328
+ Math.round(goog.net.BrowserChannel.FORWARD_CHANNEL_RETRY_TIMEOUT * 0.50) +
1329
+ Math.round(goog.net.BrowserChannel.FORWARD_CHANNEL_RETRY_TIMEOUT * 0.50 *
1330
+ Math.random()));
1331
+ this.forwardChannelRequest_ = request;
1332
+ request.xmlHttpPost(uri, requestText, true);
1333
+ };
1334
+
1335
+
1336
+ /**
1337
+ * Adds the additional parameters from the handler to the given URI.
1338
+ * @param {goog.Uri} uri The URI to add the parameters to.
1339
+ * @private
1340
+ */
1341
+ goog.net.BrowserChannel.prototype.addAdditionalParams_ = function(uri) {
1342
+ // Add the additional reconnect parameters as needed.
1343
+ if (this.handler_) {
1344
+ var params = this.handler_.getAdditionalParams(this);
1345
+ if (params) {
1346
+ goog.structs.forEach(params, function(value, key, coll) {
1347
+ uri.setParameterValue(key, value);
1348
+ });
1349
+ }
1350
+ }
1351
+ };
1352
+
1353
+
1354
+ /**
1355
+ * Returns the request text from the outgoing maps and resets it.
1356
+ * @return {string} The encoded request text created from all the currently
1357
+ * queued outgoing maps.
1358
+ * @private
1359
+ */
1360
+ goog.net.BrowserChannel.prototype.dequeueOutgoingMaps_ = function() {
1361
+ var count = Math.min(this.outgoingMaps_.length,
1362
+ goog.net.BrowserChannel.MAX_MAPS_PER_REQUEST_);
1363
+ var sb = ['count=' + count];
1364
+ var offset;
1365
+ if (this.channelVersion_ > 6 && count > 0) {
1366
+ // To save a bit of bandwidth, specify the base mapId and the rest as
1367
+ // offsets from it.
1368
+ offset = this.outgoingMaps_[0].mapId;
1369
+ sb.push('ofs=' + offset);
1370
+ } else {
1371
+ offset = 0;
1372
+ }
1373
+ for (var i = 0; i < count; i++) {
1374
+ var mapId = this.outgoingMaps_[i].mapId;
1375
+ var map = this.outgoingMaps_[i].map;
1376
+ if (this.channelVersion_ <= 6) {
1377
+ // Map IDs were not used in ver 6 and before, just indexes in the request.
1378
+ mapId = i;
1379
+ } else {
1380
+ mapId -= offset;
1381
+ }
1382
+ try {
1383
+ goog.structs.forEach(map, function(value, key, coll) {
1384
+ sb.push('req' + mapId + '_' + key + '=' + encodeURIComponent(value));
1385
+ });
1386
+ } catch (ex) {
1387
+ // We send a map here because lots of the retry logic relies on map IDs,
1388
+ // so we have to send something.
1389
+ sb.push('req' + mapId + '_' + 'type' + '=' +
1390
+ encodeURIComponent('_badmap'));
1391
+ if (this.handler_) {
1392
+ this.handler_.badMapError(this, map);
1393
+ }
1394
+ }
1395
+ }
1396
+ this.pendingMaps_ = this.pendingMaps_.concat(
1397
+ this.outgoingMaps_.splice(0, count));
1398
+ return sb.join('&');
1399
+ };
1400
+
1401
+
1402
+ /**
1403
+ * Requeues unacknowledged sent arrays for retransmission in the next forward
1404
+ * channel request.
1405
+ * @private
1406
+ */
1407
+ goog.net.BrowserChannel.prototype.requeuePendingMaps_ = function() {
1408
+ this.outgoingMaps_ = this.pendingMaps_.concat(this.outgoingMaps_);
1409
+ this.pendingMaps_.length = 0;
1410
+ };
1411
+
1412
+
1413
+ /**
1414
+ * Ensures there is a backchannel request for receiving data from the server.
1415
+ * @private
1416
+ */
1417
+ goog.net.BrowserChannel.prototype.ensureBackChannel_ = function() {
1418
+ if (this.backChannelRequest_) {
1419
+ // already have one
1420
+ return;
1421
+ }
1422
+
1423
+ if (this.backChannelTimerId_) {
1424
+ // no need to start a new request - one is already scheduled
1425
+ return;
1426
+ }
1427
+
1428
+ this.backChannelAttemptId_ = 1;
1429
+ this.backChannelTimerId_ = goog.net.BrowserChannel.setTimeout(
1430
+ goog.bind(this.onStartBackChannelTimer_, this), 0);
1431
+ this.backChannelRetryCount_ = 0;
1432
+ };
1433
+
1434
+
1435
+ /**
1436
+ * Schedules a back-channel retry, unless the max retries has been reached.
1437
+ * @return {boolean} true iff a retry was scheduled.
1438
+ * @private
1439
+ */
1440
+ goog.net.BrowserChannel.prototype.maybeRetryBackChannel_ = function() {
1441
+ if (this.backChannelRequest_ || this.backChannelTimerId_) {
1442
+ // Should be impossible to be called in this state.
1443
+ this.channelDebug_.severe('Request already in progress');
1444
+ return false;
1445
+ }
1446
+
1447
+ if (this.backChannelRetryCount_ >= this.getBackChannelMaxRetries()) {
1448
+ return false;
1449
+ }
1450
+
1451
+ this.channelDebug_.debug('Going to retry GET');
1452
+
1453
+ this.backChannelAttemptId_++;
1454
+ this.backChannelTimerId_ = goog.net.BrowserChannel.setTimeout(
1455
+ goog.bind(this.onStartBackChannelTimer_, this),
1456
+ this.getRetryTime_(this.backChannelRetryCount_));
1457
+ this.backChannelRetryCount_++;
1458
+ return true;
1459
+ };
1460
+
1461
+
1462
+ /**
1463
+ * Timer callback for ensureBackChannel_.
1464
+ * @private
1465
+ */
1466
+ goog.net.BrowserChannel.prototype.onStartBackChannelTimer_ = function() {
1467
+ this.backChannelTimerId_ = null;
1468
+ this.startBackChannel_();
1469
+ };
1470
+
1471
+
1472
+ /**
1473
+ * Begins a new back channel operation to the server.
1474
+ * @private
1475
+ */
1476
+ goog.net.BrowserChannel.prototype.startBackChannel_ = function() {
1477
+ if (!this.okToMakeRequest_()) {
1478
+ // channel is cancelled
1479
+ return;
1480
+ }
1481
+
1482
+ this.channelDebug_.debug('Creating new HttpRequest');
1483
+ this.backChannelRequest_ = goog.net.BrowserChannel.createChannelRequest(
1484
+ this,
1485
+ this.channelDebug_,
1486
+ this.sid_,
1487
+ 'rpc',
1488
+ this.backChannelAttemptId_);
1489
+ this.backChannelRequest_.setExtraHeaders(this.extraHeaders_);
1490
+ var uri = this.backChannelUri_.clone();
1491
+ uri.setParameterValue('RID', 'rpc');
1492
+ uri.setParameterValue('SID', this.sid_);
1493
+ uri.setParameterValue('CI', this.useChunked_ ? '0' : '1');
1494
+ uri.setParameterValue('AID', this.lastArrayId_);
1495
+
1496
+ // Add the reconnect parameters.
1497
+ this.addAdditionalParams_(uri);
1498
+
1499
+ if (goog.userAgent.IE) {
1500
+ uri.setParameterValue('TYPE', 'html');
1501
+ this.backChannelRequest_.tridentGet(uri, Boolean(this.hostPrefix_));
1502
+ } else {
1503
+ uri.setParameterValue('TYPE', 'xmlhttp');
1504
+ this.backChannelRequest_.xmlHttpGet(uri, true /* decodeChunks */,
1505
+ this.hostPrefix_, false /* opt_noClose */);
1506
+ }
1507
+ this.channelDebug_.debug('New Request created');
1508
+ };
1509
+
1510
+
1511
+ /**
1512
+ * Gives the handler a chance to return an error code and stop channel
1513
+ * execution. A handler might want to do this to check that the user is still
1514
+ * logged in, for example.
1515
+ * @private
1516
+ * @return {boolean} If it's OK to make a request.
1517
+ */
1518
+ goog.net.BrowserChannel.prototype.okToMakeRequest_ = function() {
1519
+ if (this.handler_) {
1520
+ var result = this.handler_.okToMakeRequest(this);
1521
+ if (result != goog.net.BrowserChannel.Error.OK) {
1522
+ this.channelDebug_.debug('Handler returned error code from ' +
1523
+ 'okToMakeRequest');
1524
+ this.signalError_(result);
1525
+ return false;
1526
+ }
1527
+ }
1528
+ return true;
1529
+ };
1530
+
1531
+
1532
+ /**
1533
+ * Callback from BrowserTestChannel for when the channel is finished.
1534
+ * @param {goog.net.BrowserTestChannel} testChannel The BrowserTestChannel.
1535
+ * @param {boolean} useChunked Whether we can chunk responses.
1536
+ */
1537
+ goog.net.BrowserChannel.prototype.testConnectionFinished =
1538
+ function(testChannel, useChunked) {
1539
+ this.channelDebug_.debug('Test Connection Finished');
1540
+
1541
+ this.useChunked_ = this.allowChunkedMode_ && useChunked;
1542
+ this.lastStatusCode_ = testChannel.getLastStatusCode();
1543
+ this.connectChannel_();
1544
+ };
1545
+
1546
+
1547
+ /**
1548
+ * Callback from BrowserTestChannel for when the channel has an error.
1549
+ * @param {goog.net.BrowserTestChannel} testChannel The BrowserTestChannel.
1550
+ * @param {goog.net.ChannelRequest.Error} errorCode The error code of the
1551
+ failure.
1552
+ */
1553
+ goog.net.BrowserChannel.prototype.testConnectionFailure =
1554
+ function(testChannel, errorCode) {
1555
+ this.channelDebug_.debug('Test Connection Failed');
1556
+ this.lastStatusCode_ = testChannel.getLastStatusCode();
1557
+ this.signalError_(goog.net.BrowserChannel.Error.REQUEST_FAILED);
1558
+ };
1559
+
1560
+
1561
+ /**
1562
+ * Callback from BrowserTestChannel for when the channel is blocked.
1563
+ * @param {goog.net.BrowserTestChannel} testChannel The BrowserTestChannel.
1564
+ */
1565
+ goog.net.BrowserChannel.prototype.testConnectionBlocked =
1566
+ function(testChannel) {
1567
+ this.channelDebug_.debug('Test Connection Blocked');
1568
+ this.lastStatusCode_ = this.connectionTest_.getLastStatusCode();
1569
+ this.signalError_(goog.net.BrowserChannel.Error.BLOCKED);
1570
+ };
1571
+
1572
+
1573
+ /**
1574
+ * Callback from ChannelRequest for when new data is received
1575
+ * @param {goog.net.ChannelRequest} request The request object.
1576
+ * @param {string} responseText The text of the response.
1577
+ */
1578
+ goog.net.BrowserChannel.prototype.onRequestData =
1579
+ function(request, responseText) {
1580
+ if (this.state_ == goog.net.BrowserChannel.State.CLOSED ||
1581
+ (this.backChannelRequest_ != request &&
1582
+ this.forwardChannelRequest_ != request)) {
1583
+ // either CLOSED or a request we don't know about (perhaps an old request)
1584
+ return;
1585
+ }
1586
+ this.lastStatusCode_ = request.getLastStatusCode();
1587
+
1588
+ if (this.forwardChannelRequest_ == request &&
1589
+ this.state_ == goog.net.BrowserChannel.State.OPENED) {
1590
+ if (this.channelVersion_ > 7) {
1591
+ var response;
1592
+ try {
1593
+ response = (/** @type {Array} */ goog.json.unsafeParse(responseText));
1594
+ } catch (ex) {
1595
+ response = null;
1596
+ }
1597
+ if (goog.isArray(response) && response.length == 3) {
1598
+ this.handlePostResponse_(response);
1599
+ } else {
1600
+ this.channelDebug_.debug('Bad POST response data returned');
1601
+ this.signalError_(goog.net.BrowserChannel.Error.BAD_RESPONSE);
1602
+ }
1603
+ } else if (responseText != goog.net.BrowserChannel.MAGIC_RESPONSE_COOKIE) {
1604
+ this.channelDebug_.debug('Bad data returned - missing/invald ' +
1605
+ 'magic cookie');
1606
+ this.signalError_(goog.net.BrowserChannel.Error.BAD_RESPONSE);
1607
+ }
1608
+ } else {
1609
+ if (this.backChannelRequest_ == request) {
1610
+ this.clearDeadBackchannelTimer_();
1611
+ }
1612
+ if (!goog.string.isEmpty(responseText)) {
1613
+ this.onInput_(/** @type {Array} */ (goog.json.unsafeParse(responseText)));
1614
+ }
1615
+ }
1616
+ };
1617
+
1618
+
1619
+ /**
1620
+ * Handles a POST response from the server.
1621
+ * @param {Array} responseValues The key value pairs in the POST response.
1622
+ * @private
1623
+ */
1624
+ goog.net.BrowserChannel.prototype.handlePostResponse_ = function(
1625
+ responseValues) {
1626
+ // The first response value is set to 0 if server is missing backchannel.
1627
+ if (responseValues[0] == 0) {
1628
+ this.handleBackchannelMissing_();
1629
+ return;
1630
+ }
1631
+ this.lastPostResponseArrayId_ = responseValues[1];
1632
+ var outstandingArrays = this.lastPostResponseArrayId_ - this.lastArrayId_;
1633
+ if (0 < outstandingArrays) {
1634
+ var numOutstandingBackchannelBytes = responseValues[2];
1635
+ this.channelDebug_.debug(numOutstandingBackchannelBytes + ' bytes (in ' +
1636
+ outstandingArrays + ' arrays) are outstanding on the BackChannel');
1637
+ if (!this.shouldRetryBackChannel_(numOutstandingBackchannelBytes)) {
1638
+ return;
1639
+ }
1640
+ if (!this.deadBackChannelTimerId_) {
1641
+ // We expect to receive data within 2 RTTs or we retry the backchannel.
1642
+ this.deadBackChannelTimerId_ = goog.net.BrowserChannel.setTimeout(
1643
+ goog.bind(this.onBackChannelDead_, this),
1644
+ 2 * goog.net.BrowserChannel.RTT_ESTIMATE);
1645
+ }
1646
+ }
1647
+ };
1648
+
1649
+
1650
+ /**
1651
+ * Handles a POST response from the server telling us that it has detected that
1652
+ * we have no hanging GET connection.
1653
+ * @private
1654
+ */
1655
+ goog.net.BrowserChannel.prototype.handleBackchannelMissing_ = function() {
1656
+ // As long as the back channel was started before the POST was sent,
1657
+ // we should retry the backchannel. We give a slight buffer of RTT_ESTIMATE
1658
+ // so as not to excessively retry the backchannel
1659
+ this.channelDebug_.debug('Server claims our backchannel is missing.');
1660
+ if (this.backChannelTimerId_) {
1661
+ this.channelDebug_.debug('But we are currently starting the request.');
1662
+ return;
1663
+ } else if (!this.backChannelRequest_) {
1664
+ this.channelDebug_.warning(
1665
+ 'We do not have a BackChannel established');
1666
+ } else if (this.backChannelRequest_.getRequestStartTime() +
1667
+ goog.net.BrowserChannel.RTT_ESTIMATE <
1668
+ this.forwardChannelRequest_.getRequestStartTime()) {
1669
+ this.clearDeadBackchannelTimer_();
1670
+ this.backChannelRequest_.cancel();
1671
+ this.backChannelRequest_ = null;
1672
+ } else {
1673
+ return;
1674
+ }
1675
+ this.maybeRetryBackChannel_();
1676
+ goog.net.BrowserChannel.notifyStatEvent(
1677
+ goog.net.BrowserChannel.Stat.BACKCHANNEL_MISSING);
1678
+ };
1679
+
1680
+
1681
+ /**
1682
+ * Determines whether we should start the process of retrying a possibly
1683
+ * dead backchannel.
1684
+ * @param {number} outstandingBytes The number of bytes for which the server has
1685
+ * not yet received acknowledgement.
1686
+ * @return {boolean} Whether to start the backchannel retry timer.
1687
+ * @private
1688
+ */
1689
+ goog.net.BrowserChannel.prototype.shouldRetryBackChannel_ = function(
1690
+ outstandingBytes) {
1691
+ // Not too many outstanding bytes, not buffered and not after a retry.
1692
+ return outstandingBytes <
1693
+ goog.net.BrowserChannel.OUTSTANDING_DATA_BACKCHANNEL_RETRY_CUTOFF &&
1694
+ !this.isBuffered() &&
1695
+ this.backChannelRetryCount_ == 0;
1696
+ };
1697
+
1698
+
1699
+ /**
1700
+ * Decides which host prefix should be used, if any. If there is a handler,
1701
+ * allows the handler to validate a host prefix provided by the server, and
1702
+ * optionally override it.
1703
+ * @param {?string} serverHostPrefix The host prefix provided by the server.
1704
+ * @return {?string} The host prefix to actually use, if any. Will return null
1705
+ * if the use of host prefixes was disabled via setAllowHostPrefix().
1706
+ */
1707
+ goog.net.BrowserChannel.prototype.correctHostPrefix = function(
1708
+ serverHostPrefix) {
1709
+ if (this.allowHostPrefix_) {
1710
+ if (this.handler_) {
1711
+ return this.handler_.correctHostPrefix(serverHostPrefix);
1712
+ }
1713
+ return serverHostPrefix;
1714
+ }
1715
+ return null;
1716
+ };
1717
+
1718
+
1719
+ /**
1720
+ * Handles the timer that indicates that our backchannel is no longer able to
1721
+ * successfully receive data from the server.
1722
+ * @private
1723
+ */
1724
+ goog.net.BrowserChannel.prototype.onBackChannelDead_ = function() {
1725
+ if (goog.isDefAndNotNull(this.deadBackChannelTimerId_)) {
1726
+ this.deadBackChannelTimerId_ = null;
1727
+ this.backChannelRequest_.cancel();
1728
+ this.backChannelRequest_ = null;
1729
+ this.maybeRetryBackChannel_();
1730
+ goog.net.BrowserChannel.notifyStatEvent(
1731
+ goog.net.BrowserChannel.Stat.BACKCHANNEL_DEAD);
1732
+ }
1733
+ };
1734
+
1735
+
1736
+ /**
1737
+ * Clears the timer that indicates that our backchannel is no longer able to
1738
+ * successfully receive data from the server.
1739
+ * @private
1740
+ */
1741
+ goog.net.BrowserChannel.prototype.clearDeadBackchannelTimer_ = function() {
1742
+ if (goog.isDefAndNotNull(this.deadBackChannelTimerId_)) {
1743
+ goog.global.clearTimeout(this.deadBackChannelTimerId_);
1744
+ this.deadBackChannelTimerId_ = null;
1745
+ }
1746
+ };
1747
+
1748
+
1749
+ /**
1750
+ * Returns whether or not the given error/status combination is fatal or not.
1751
+ * On fatal errors we immediately close the session rather than retrying the
1752
+ * failed request.
1753
+ * @param {goog.net.ChannelRequest.Error?} error The error code for the failed
1754
+ * request.
1755
+ * @param {number} statusCode The last HTTP status code.
1756
+ * @return {boolean} Whether or not the error is fatal.
1757
+ * @private
1758
+ */
1759
+ goog.net.BrowserChannel.isFatalError_ =
1760
+ function(error, statusCode) {
1761
+ return error == goog.net.ChannelRequest.Error.UNKNOWN_SESSION_ID ||
1762
+ (error == goog.net.ChannelRequest.Error.STATUS &&
1763
+ statusCode > 0);
1764
+ };
1765
+
1766
+
1767
+ /**
1768
+ * Callback from ChannelRequest that indicates a request has completed.
1769
+ * @param {goog.net.ChannelRequest} request The request object.
1770
+ */
1771
+ goog.net.BrowserChannel.prototype.onRequestComplete =
1772
+ function(request) {
1773
+ this.channelDebug_.debug('Request complete');
1774
+ var type;
1775
+ if (this.backChannelRequest_ == request) {
1776
+ this.clearDeadBackchannelTimer_();
1777
+ this.backChannelRequest_ = null;
1778
+ type = goog.net.BrowserChannel.ChannelType_.BACK_CHANNEL;
1779
+ } else if (this.forwardChannelRequest_ == request) {
1780
+ this.forwardChannelRequest_ = null;
1781
+ type = goog.net.BrowserChannel.ChannelType_.FORWARD_CHANNEL;
1782
+ } else {
1783
+ // return if it was an old request from a previous session
1784
+ return;
1785
+ }
1786
+
1787
+ this.lastStatusCode_ = request.getLastStatusCode();
1788
+
1789
+ if (this.state_ == goog.net.BrowserChannel.State.CLOSED) {
1790
+ return;
1791
+ }
1792
+
1793
+ if (request.getSuccess()) {
1794
+ // Yay!
1795
+ if (type == goog.net.BrowserChannel.ChannelType_.FORWARD_CHANNEL) {
1796
+ var size = request.getPostData() ? request.getPostData().length : 0;
1797
+ goog.net.BrowserChannel.notifyTimingEvent(size,
1798
+ goog.now() - request.getRequestStartTime(),
1799
+ this.forwardChannelRetryCount_);
1800
+ this.ensureForwardChannel_();
1801
+ this.pendingMaps_.length = 0;
1802
+ } else { // i.e., back-channel
1803
+ this.ensureBackChannel_();
1804
+ }
1805
+ return;
1806
+ }
1807
+ // Else unsuccessful. Fall through.
1808
+
1809
+ var lastError = request.getLastError();
1810
+ if (!goog.net.BrowserChannel.isFatalError_(lastError,
1811
+ this.lastStatusCode_)) {
1812
+ // Maybe retry.
1813
+ this.channelDebug_.debug('Maybe retrying, last error: ' +
1814
+ goog.net.ChannelRequest.errorStringFromCode(
1815
+ /** @type {goog.net.ChannelRequest.Error} */ (lastError),
1816
+ this.lastStatusCode_));
1817
+ if (type == goog.net.BrowserChannel.ChannelType_.FORWARD_CHANNEL) {
1818
+ if (this.maybeRetryForwardChannel_(request)) {
1819
+ return;
1820
+ }
1821
+ }
1822
+ if (type == goog.net.BrowserChannel.ChannelType_.BACK_CHANNEL) {
1823
+ if (this.maybeRetryBackChannel_()) {
1824
+ return;
1825
+ }
1826
+ }
1827
+ // Else exceeded max retries. Fall through.
1828
+ this.channelDebug_.debug('Exceeded max number of retries');
1829
+ } else {
1830
+ // Else fatal error. Fall through and mark the pending maps as failed.
1831
+ this.channelDebug_.debug('Not retrying due to error type');
1832
+ }
1833
+
1834
+
1835
+ // Can't save this session. :(
1836
+ this.channelDebug_.debug('Error: HTTP request failed');
1837
+ switch (lastError) {
1838
+ case goog.net.ChannelRequest.Error.NO_DATA:
1839
+ this.signalError_(goog.net.BrowserChannel.Error.NO_DATA);
1840
+ break;
1841
+ case goog.net.ChannelRequest.Error.BAD_DATA:
1842
+ this.signalError_(goog.net.BrowserChannel.Error.BAD_DATA);
1843
+ break;
1844
+ case goog.net.ChannelRequest.Error.UNKNOWN_SESSION_ID:
1845
+ this.signalError_(goog.net.BrowserChannel.Error.UNKNOWN_SESSION_ID);
1846
+ break;
1847
+ default:
1848
+ this.signalError_(goog.net.BrowserChannel.Error.REQUEST_FAILED);
1849
+ break;
1850
+ }
1851
+ };
1852
+
1853
+
1854
+ /**
1855
+ * @param {number} retryCount Number of retries so far.
1856
+ * @return {number} Time in ms before firing next retry request.
1857
+ * @private
1858
+ */
1859
+ goog.net.BrowserChannel.prototype.getRetryTime_ = function(retryCount) {
1860
+ var retryTime = goog.net.BrowserChannel.RETRY_DELAY_MS +
1861
+ Math.floor(Math.random() * goog.net.BrowserChannel.RETRY_DELAY_SEED);
1862
+ if (!this.isActive()) {
1863
+ this.channelDebug_.debug('Inactive channel');
1864
+ retryTime =
1865
+ retryTime * goog.net.BrowserChannel.INACTIVE_CHANNEL_RETRY_FACTOR;
1866
+ }
1867
+ // Backoff for subsequent retries
1868
+ retryTime = retryTime * retryCount;
1869
+ return retryTime;
1870
+ };
1871
+
1872
+
1873
+ /**
1874
+ * Processes the data returned by the server.
1875
+ * @param {Array} respArray The response array returned by the server.
1876
+ * @private
1877
+ */
1878
+ goog.net.BrowserChannel.prototype.onInput_ = function(respArray) {
1879
+ // respArray is an array of arrays
1880
+ var batch = this.handler_ && this.handler_.channelHandleMultipleArrays ?
1881
+ [] : null;
1882
+ for (var i = 0; i < respArray.length; i++) {
1883
+ var nextArray = respArray[i];
1884
+ this.lastArrayId_ = nextArray[0];
1885
+ nextArray = nextArray[1];
1886
+ if (this.state_ == goog.net.BrowserChannel.State.OPENING) {
1887
+ if (nextArray[0] == 'c') {
1888
+ this.sid_ = nextArray[1];
1889
+ this.hostPrefix_ = this.correctHostPrefix(nextArray[2]);
1890
+ var negotiatedVersion = nextArray[3];
1891
+ if (goog.isDefAndNotNull(negotiatedVersion)) {
1892
+ this.channelVersion_ = negotiatedVersion;
1893
+ } else {
1894
+ // Servers prior to version 7 did not send this, so assume version 6.
1895
+ this.channelVersion_ = 6;
1896
+ }
1897
+ this.state_ = goog.net.BrowserChannel.State.OPENED;
1898
+ if (this.handler_) {
1899
+ this.handler_.channelOpened(this);
1900
+ }
1901
+ this.backChannelUri_ = this.getBackChannelUri(
1902
+ this.hostPrefix_, /** @type {string} */ (this.path_));
1903
+ // Open connection to receive data
1904
+ this.ensureBackChannel_();
1905
+ } else if (nextArray[0] == 'stop') {
1906
+ this.signalError_(goog.net.BrowserChannel.Error.STOP);
1907
+ }
1908
+ } else if (this.state_ == goog.net.BrowserChannel.State.OPENED) {
1909
+ if (nextArray[0] == 'stop') {
1910
+ if (batch && batch.length) {
1911
+ this.handler_.channelHandleMultipleArrays(this, batch);
1912
+ batch.length = 0;
1913
+ }
1914
+ this.signalError_(goog.net.BrowserChannel.Error.STOP);
1915
+ } else if (nextArray[0] == 'noop') {
1916
+ // ignore - noop to keep connection happy
1917
+ } else {
1918
+ if (batch) {
1919
+ batch.push(nextArray);
1920
+ } else if (this.handler_) {
1921
+ this.handler_.channelHandleArray(this, nextArray);
1922
+ }
1923
+ }
1924
+ // We have received useful data on the back-channel, so clear its retry
1925
+ // count. We do this because back-channels by design do not complete
1926
+ // quickly, so on a flaky connection we could have many fail to complete
1927
+ // fully but still deliver a lot of data before they fail. We don't want
1928
+ // to count such failures towards the retry limit, because we don't want
1929
+ // to give up on a session if we can still receive data.
1930
+ this.backChannelRetryCount_ = 0;
1931
+ }
1932
+ }
1933
+ if (batch && batch.length) {
1934
+ this.handler_.channelHandleMultipleArrays(this, batch);
1935
+ }
1936
+ };
1937
+
1938
+
1939
+ /**
1940
+ * Helper to ensure the BrowserChannel is in the expected state.
1941
+ * @param {...number} var_args The channel must be in one of the indicated
1942
+ * states.
1943
+ * @private
1944
+ */
1945
+ goog.net.BrowserChannel.prototype.ensureInState_ = function(var_args) {
1946
+ if (!goog.array.contains(arguments, this.state_)) {
1947
+ throw Error('Unexpected channel state: ' + this.state_);
1948
+ }
1949
+ };
1950
+
1951
+
1952
+ /**
1953
+ * Signals an error has occurred.
1954
+ * @param {goog.net.BrowserChannel.Error} error The error code for the failure.
1955
+ * @private
1956
+ */
1957
+ goog.net.BrowserChannel.prototype.signalError_ = function(error) {
1958
+ this.channelDebug_.info('Error code ' + error);
1959
+ if (error == goog.net.BrowserChannel.Error.REQUEST_FAILED ||
1960
+ error == goog.net.BrowserChannel.Error.BLOCKED) {
1961
+ // Ping google to check if it's a server error or user's network error.
1962
+ var imageUri = null;
1963
+ if (this.handler_) {
1964
+ imageUri = this.handler_.getNetworkTestImageUri(this);
1965
+ }
1966
+ goog.net.testGoogleCom(
1967
+ goog.bind(this.testGoogleComCallback_, this), imageUri);
1968
+ } else {
1969
+ goog.net.BrowserChannel.notifyStatEvent(
1970
+ goog.net.BrowserChannel.Stat.ERROR_OTHER);
1971
+ }
1972
+ this.onError_(error);
1973
+ };
1974
+
1975
+
1976
+ /**
1977
+ * Callback for testGoogleCom during error handling.
1978
+ * @param {boolean} networkUp Whether the network is up.
1979
+ * @private
1980
+ */
1981
+ goog.net.BrowserChannel.prototype.testGoogleComCallback_ = function(networkUp) {
1982
+ if (networkUp) {
1983
+ this.channelDebug_.info('Successfully pinged google.com');
1984
+ goog.net.BrowserChannel.notifyStatEvent(
1985
+ goog.net.BrowserChannel.Stat.ERROR_OTHER);
1986
+ } else {
1987
+ this.channelDebug_.info('Failed to ping google.com');
1988
+ goog.net.BrowserChannel.notifyStatEvent(
1989
+ goog.net.BrowserChannel.Stat.ERROR_NETWORK);
1990
+ // We cann onError_ here instead of signalError_ because the latter just
1991
+ // calls notifyStatEvent, and we don't want to have another stat event.
1992
+ this.onError_(goog.net.BrowserChannel.Error.NETWORK);
1993
+ }
1994
+ };
1995
+
1996
+
1997
+ /**
1998
+ * Called when we've determined the final error for a channel. It closes the
1999
+ * notifiers the handler of the error and closes the channel.
2000
+ * @param {goog.net.BrowserChannel.Error} error The error code for the failure.
2001
+ * @private
2002
+ */
2003
+ goog.net.BrowserChannel.prototype.onError_ = function(error) {
2004
+ this.channelDebug_.debug('HttpChannel: error - ' + error);
2005
+ this.state_ = goog.net.BrowserChannel.State.CLOSED;
2006
+ if (this.handler_) {
2007
+ this.handler_.channelError(this, error);
2008
+ }
2009
+ this.onClose_();
2010
+ this.cancelRequests_();
2011
+ };
2012
+
2013
+
2014
+ /**
2015
+ * Called when the channel has been closed. It notifiers the handler of the
2016
+ * event, and reports any pending or undelivered maps.
2017
+ * @private
2018
+ */
2019
+ goog.net.BrowserChannel.prototype.onClose_ = function() {
2020
+ this.state_ = goog.net.BrowserChannel.State.CLOSED;
2021
+ this.lastStatusCode_ = -1;
2022
+ if (this.handler_) {
2023
+ if (this.pendingMaps_.length == 0 && this.outgoingMaps_.length == 0) {
2024
+ this.handler_.channelClosed(this);
2025
+ } else {
2026
+ this.channelDebug_.debug('Number of undelivered maps' +
2027
+ ', pending: ' + this.pendingMaps_.length +
2028
+ ', outgoing: ' + this.outgoingMaps_.length);
2029
+
2030
+ var copyOfPendingMaps = goog.array.clone(this.pendingMaps_);
2031
+ var copyOfUndeliveredMaps = goog.array.clone(this.outgoingMaps_);
2032
+ this.pendingMaps_.length = 0;
2033
+ this.outgoingMaps_.length = 0;
2034
+
2035
+ this.handler_.channelClosed(this,
2036
+ copyOfPendingMaps,
2037
+ copyOfUndeliveredMaps);
2038
+ }
2039
+ }
2040
+ };
2041
+
2042
+
2043
+ /**
2044
+ * Gets the Uri used for the connection that sends data to the server.
2045
+ * @param {string} path The path on the host.
2046
+ * @return {goog.Uri} The forward channel URI.
2047
+ */
2048
+ goog.net.BrowserChannel.prototype.getForwardChannelUri =
2049
+ function(path) {
2050
+ var uri = this.createDataUri(null, path);
2051
+ this.channelDebug_.debug('GetForwardChannelUri: ' + uri);
2052
+ return uri;
2053
+ };
2054
+
2055
+
2056
+ /**
2057
+ * Gets the Uri used for the connection that receives data from the server.
2058
+ * @param {?string} hostPrefix The host prefix.
2059
+ * @param {string} path The path on the host.
2060
+ * @return {goog.Uri} The back channel URI.
2061
+ */
2062
+ goog.net.BrowserChannel.prototype.getBackChannelUri =
2063
+ function(hostPrefix, path) {
2064
+ var uri = this.createDataUri(this.shouldUseSecondaryDomains() ?
2065
+ hostPrefix : null, path);
2066
+ this.channelDebug_.debug('GetBackChannelUri: ' + uri);
2067
+ return uri;
2068
+ };
2069
+
2070
+
2071
+ /**
2072
+ * Creates a data Uri applying logic for secondary hostprefix, port
2073
+ * overrides, and versioning.
2074
+ * @param {?string} hostPrefix The host prefix.
2075
+ * @param {string} path The path on the host.
2076
+ * @param {number=} opt_overridePort Optional override port.
2077
+ * @return {goog.Uri} The data URI.
2078
+ */
2079
+ goog.net.BrowserChannel.prototype.createDataUri =
2080
+ function(hostPrefix, path, opt_overridePort) {
2081
+ var locationPage = window.location;
2082
+ var hostName;
2083
+ if (hostPrefix) {
2084
+ hostName = hostPrefix + '.' + locationPage.hostname;
2085
+ } else {
2086
+ hostName = locationPage.hostname;
2087
+ }
2088
+
2089
+ var port = opt_overridePort || locationPage.port;
2090
+
2091
+ var uri = goog.Uri.create(locationPage.protocol, null, hostName, port, path);
2092
+ if (this.extraParams_) {
2093
+ goog.structs.forEach(this.extraParams_, function(value, key, coll) {
2094
+ uri.setParameterValue(key, value);
2095
+ });
2096
+ }
2097
+
2098
+ // Add the protocol version to the URI.
2099
+ uri.setParameterValue('VER', this.channelVersion_);
2100
+
2101
+ // Add the reconnect parameters.
2102
+ this.addAdditionalParams_(uri);
2103
+
2104
+ return uri;
2105
+ };
2106
+
2107
+
2108
+ /**
2109
+ * Called when BC needs to create an XhrIo object. Override in a subclass if
2110
+ * you need to customize the behavior, for example to enable the creation of
2111
+ * XHR's capable of calling a secondary domain.
2112
+ * @param {?string} hostPrefix The host prefix, if we need an XhrIo object
2113
+ * capable of calling a secondary domain.
2114
+ * @return {!goog.net.XhrIo} A new XhrIo object.
2115
+ */
2116
+ goog.net.BrowserChannel.prototype.createXhrIo = function(hostPrefix) {
2117
+ if (hostPrefix) {
2118
+ throw new Error('Can\'t create secondary domain capable XhrIo object.');
2119
+ } else {
2120
+ return new goog.net.XhrIo();
2121
+ }
2122
+ };
2123
+
2124
+
2125
+ /**
2126
+ * Gets whether this channel is currently active. This is used to determine the
2127
+ * length of time to wait before retrying. This call delegates to the handler.
2128
+ * @return {boolean} Whether the channel is currently active.
2129
+ */
2130
+ goog.net.BrowserChannel.prototype.isActive = function() {
2131
+ return !!this.handler_ && this.handler_.isActive(this);
2132
+ };
2133
+
2134
+
2135
+ /**
2136
+ * Wrapper around SafeTimeout which calls the start and end execution hooks
2137
+ * with a try...finally block.
2138
+ * @param {Function} fn The callback function.
2139
+ * @param {number} ms The time in MS for the timer.
2140
+ * @return {number} The ID of the timer.
2141
+ */
2142
+ goog.net.BrowserChannel.setTimeout = function(fn, ms) {
2143
+ if (!goog.isFunction(fn)) {
2144
+ throw Error('Fn must not be null and must be a function');
2145
+ }
2146
+ return goog.global.setTimeout(function() {
2147
+ goog.net.BrowserChannel.onStartExecution();
2148
+ try {
2149
+ fn();
2150
+ } finally {
2151
+ goog.net.BrowserChannel.onEndExecution();
2152
+ }
2153
+ }, ms);
2154
+ };
2155
+
2156
+
2157
+ /**
2158
+ * Helper function to call the start hook
2159
+ */
2160
+ goog.net.BrowserChannel.onStartExecution = function() {
2161
+ goog.net.BrowserChannel.startExecutionHook_();
2162
+ };
2163
+
2164
+
2165
+ /**
2166
+ * Helper function to call the end hook
2167
+ */
2168
+ goog.net.BrowserChannel.onEndExecution = function() {
2169
+ goog.net.BrowserChannel.endExecutionHook_();
2170
+ };
2171
+
2172
+
2173
+ /**
2174
+ * Returns the singleton event target for stat events.
2175
+ * @return {goog.events.EventTarget} The event target for stat events.
2176
+ */
2177
+ goog.net.BrowserChannel.getStatEventTarget = function() {
2178
+ return goog.net.BrowserChannel.statEventTarget_;
2179
+ };
2180
+
2181
+
2182
+ /**
2183
+ * Helper function to call the stat event callback.
2184
+ * @param {goog.net.BrowserChannel.Stat} stat The stat.
2185
+ */
2186
+ goog.net.BrowserChannel.notifyStatEvent = function(stat) {
2187
+ var target = goog.net.BrowserChannel.statEventTarget_;
2188
+ target.dispatchEvent(
2189
+ new goog.net.BrowserChannel.StatEvent(target, stat));
2190
+ };
2191
+
2192
+
2193
+ /**
2194
+ * Helper function to notify listeners about POST request performance.
2195
+ *
2196
+ * @param {number} size Number of characters in the POST data.
2197
+ * @param {number} rtt The amount of time from POST start to response.
2198
+ * @param {number} retries The number of times the POST had to be retried.
2199
+ */
2200
+ goog.net.BrowserChannel.notifyTimingEvent = function(size, rtt, retries) {
2201
+ var target = goog.net.BrowserChannel.statEventTarget_;
2202
+ target.dispatchEvent(
2203
+ new goog.net.BrowserChannel.TimingEvent(target, size, rtt, retries));
2204
+ };
2205
+
2206
+
2207
+ /**
2208
+ * Override this in a subclass to enable secondary domains for non-IE browsers.
2209
+ * @return {boolean} Whether to use a secondary domain when the server
2210
+ * recommends it.
2211
+ */
2212
+ goog.net.BrowserChannel.prototype.shouldUseSecondaryDomains = function() {
2213
+ return goog.userAgent.IE;
2214
+ };
2215
+
2216
+
2217
+ /**
2218
+ * A LogSaver that can be used to accumulate all the debug logs for
2219
+ * BrowserChannels so they can be sent to the server when a problem is
2220
+ * detected.
2221
+ */
2222
+ goog.net.BrowserChannel.LogSaver = {};
2223
+
2224
+
2225
+ /**
2226
+ * Buffer for accumulating the debug log
2227
+ * @type {goog.structs.CircularBuffer}
2228
+ * @private
2229
+ */
2230
+ goog.net.BrowserChannel.LogSaver.buffer_ =
2231
+ new goog.structs.CircularBuffer(1000);
2232
+
2233
+
2234
+ /**
2235
+ * Whether we're currently accumulating the debug log.
2236
+ * @type {boolean}
2237
+ * @private
2238
+ */
2239
+ goog.net.BrowserChannel.LogSaver.enabled_ = false;
2240
+
2241
+
2242
+ /**
2243
+ * Formatter for saving logs.
2244
+ * @type {goog.debug.Formatter}
2245
+ * @private
2246
+ */
2247
+ goog.net.BrowserChannel.LogSaver.formatter_ = new goog.debug.TextFormatter();
2248
+
2249
+
2250
+ /**
2251
+ * Returns whether the LogSaver is enabled.
2252
+ * @return {boolean} Whether saving is enabled or disabled.
2253
+ */
2254
+ goog.net.BrowserChannel.LogSaver.isEnabled = function() {
2255
+ return goog.net.BrowserChannel.LogSaver.enabled_;
2256
+ };
2257
+
2258
+
2259
+ /**
2260
+ * Enables of disables the LogSaver.
2261
+ * @param {boolean} enable Whether to enable or disable saving.
2262
+ */
2263
+ goog.net.BrowserChannel.LogSaver.setEnabled = function(enable) {
2264
+ if (enable == goog.net.BrowserChannel.LogSaver.enabled_) {
2265
+ return;
2266
+ }
2267
+
2268
+ var fn = goog.net.BrowserChannel.LogSaver.addLogRecord;
2269
+ var logger = goog.debug.Logger.getLogger('goog.net');
2270
+ if (enable) {
2271
+ logger.addHandler(fn);
2272
+ } else {
2273
+ logger.removeHandler(fn);
2274
+ }
2275
+ };
2276
+
2277
+
2278
+ /**
2279
+ * Adds a log record.
2280
+ * @param {goog.debug.LogRecord} logRecord the LogRecord.
2281
+ */
2282
+ goog.net.BrowserChannel.LogSaver.addLogRecord = function(logRecord) {
2283
+ goog.net.BrowserChannel.LogSaver.buffer_.add(
2284
+ goog.net.BrowserChannel.LogSaver.formatter_.formatRecord(logRecord));
2285
+ };
2286
+
2287
+
2288
+ /**
2289
+ * Returns the log as a single string.
2290
+ * @return {string} The log as a single string.
2291
+ */
2292
+ goog.net.BrowserChannel.LogSaver.getBuffer = function() {
2293
+ return goog.net.BrowserChannel.LogSaver.buffer_.getValues().join('');
2294
+ };
2295
+
2296
+
2297
+ /**
2298
+ * Clears the buffer
2299
+ */
2300
+ goog.net.BrowserChannel.LogSaver.clearBuffer = function() {
2301
+ goog.net.BrowserChannel.LogSaver.buffer_.clear();
2302
+ };
2303
+
2304
+
2305
+
2306
+ /**
2307
+ * Interface for the browser channel handler
2308
+ * @constructor
2309
+ */
2310
+ goog.net.BrowserChannel.Handler = function() {
2311
+ };
2312
+
2313
+
2314
+ /**
2315
+ * Callback handler for when a batch of response arrays is received from the
2316
+ * server.
2317
+ * @type {Function}
2318
+ */
2319
+ goog.net.BrowserChannel.Handler.prototype.channelHandleMultipleArrays = null;
2320
+
2321
+
2322
+ /**
2323
+ * Whether it's okay to make a request to the server. A handler can return
2324
+ * false if the channel should fail. For example, if the user has logged out,
2325
+ * the handler may want all requests to fail immediately.
2326
+ * @param {goog.net.BrowserChannel} browserChannel The browser channel.
2327
+ * @return {goog.net.BrowserChannel.Error} An error code. The code should
2328
+ * return goog.net.BrowserChannel.Error.OK to indicate it's okay. Any other
2329
+ * error code will cause a failure.
2330
+ */
2331
+ goog.net.BrowserChannel.Handler.prototype.okToMakeRequest =
2332
+ function(browserChannel) {
2333
+ return goog.net.BrowserChannel.Error.OK;
2334
+ };
2335
+
2336
+
2337
+ /**
2338
+ * Indicates the BrowserChannel has successfully negotiated with the server
2339
+ * and can now send and receive data.
2340
+ * @param {goog.net.BrowserChannel} browserChannel The browser channel.
2341
+ */
2342
+ goog.net.BrowserChannel.Handler.prototype.channelOpened =
2343
+ function(browserChannel) {
2344
+ };
2345
+
2346
+
2347
+ /**
2348
+ * New input is available for the application to process.
2349
+ *
2350
+ * @param {goog.net.BrowserChannel} browserChannel The browser channel.
2351
+ * @param {Array} array The data array.
2352
+ */
2353
+ goog.net.BrowserChannel.Handler.prototype.channelHandleArray =
2354
+ function(browserChannel, array) {
2355
+ };
2356
+
2357
+
2358
+ /**
2359
+ * Indicates an error occurred on the BrowserChannel.
2360
+ *
2361
+ * @param {goog.net.BrowserChannel} browserChannel The browser channel.
2362
+ * @param {goog.net.BrowserChannel.Error} error The error code.
2363
+ */
2364
+ goog.net.BrowserChannel.Handler.prototype.channelError =
2365
+ function(browserChannel, error) {
2366
+ };
2367
+
2368
+
2369
+ /**
2370
+ * Indicates the BrowserChannel is closed. Also notifies about which maps,
2371
+ * if any, that may not have been delivered to the server.
2372
+ * @param {goog.net.BrowserChannel} browserChannel The browser channel.
2373
+ * @param {Array.<goog.net.BrowserChannel.QueuedMap>=} opt_pendingMaps The
2374
+ * array of pending maps, which may or may not have been delivered to the
2375
+ * server.
2376
+ * @param {Array.<goog.net.BrowserChannel.QueuedMap>=} opt_undeliveredMaps
2377
+ * The array of undelivered maps, which have definitely not been delivered
2378
+ * to the server.
2379
+ */
2380
+ goog.net.BrowserChannel.Handler.prototype.channelClosed =
2381
+ function(browserChannel, opt_pendingMaps, opt_undeliveredMaps) {
2382
+ };
2383
+
2384
+
2385
+ /**
2386
+ * Gets any parameters that should be added at the time another connection is
2387
+ * made to the server.
2388
+ * @param {goog.net.BrowserChannel} browserChannel The browser channel.
2389
+ * @return {Object} Extra parameter keys and values to add to the
2390
+ * requests.
2391
+ */
2392
+ goog.net.BrowserChannel.Handler.prototype.getAdditionalParams =
2393
+ function(browserChannel) {
2394
+ return {};
2395
+ };
2396
+
2397
+
2398
+ /**
2399
+ * Gets the URI of an image that can be used to test network connectivity.
2400
+ * @param {goog.net.BrowserChannel} browserChannel The browser channel.
2401
+ * @return {goog.Uri?} A custom URI to load for the network test.
2402
+ */
2403
+ goog.net.BrowserChannel.Handler.prototype.getNetworkTestImageUri =
2404
+ function(browserChannel) {
2405
+ return null;
2406
+ };
2407
+
2408
+
2409
+ /**
2410
+ * Gets whether this channel is currently active. This is used to determine the
2411
+ * length of time to wait before retrying.
2412
+ * @param {goog.net.BrowserChannel} browserChannel The browser channel.
2413
+ * @return {boolean} Whether the channel is currently active.
2414
+ */
2415
+ goog.net.BrowserChannel.Handler.prototype.isActive = function(browserChannel) {
2416
+ return true;
2417
+ };
2418
+
2419
+
2420
+ /**
2421
+ * Called by the channel if enumeration of the map throws an exception.
2422
+ * @param {goog.net.BrowserChannel} browserChannel The browser channel.
2423
+ * @param {Object} map The map that can't be enumerated.
2424
+ */
2425
+ goog.net.BrowserChannel.Handler.prototype.badMapError =
2426
+ function(browserChannel, map) {
2427
+ return;
2428
+ };
2429
+
2430
+
2431
+ /**
2432
+ * Allows the handler to override a host prefix provided by the server. Will
2433
+ * be called whenever the channel has received such a prefix and is considering
2434
+ * its use.
2435
+ * @param {?string} serverHostPrefix The host prefix provided by the server.
2436
+ * @return {?string} The host prefix the client should use.
2437
+ */
2438
+ goog.net.BrowserChannel.Handler.prototype.correctHostPrefix =
2439
+ function(serverHostPrefix) {
2440
+ return serverHostPrefix;
2441
+ };