Can't uglify dhtmlxgrid_pro.js in RoR 3.2

Hi all,

My app uses dhtmlxgrid pro. It seems to be working fine at run-time. Recently we switched to latest RoR 3.2 from 3.0. It supports assets pipeline. One of the useful features there is automatic assets (js, css) compression. However I have discovered that dhtmlxgrid_pro.js fails to compress. I know it is compressed already but as far as I know there is no way exclude certain asset from compression. In fact all other compressed scripts re-compress just fine. Below is an error I am getting including stack trace. The error is easily reproducible by this small snippet… Any idea what could be wrong with dhtmlxgrid_pro.js?

require ‘uglifier’
Uglifier.compile(File.read(’/tmp/dhtmlxgrid_pro.js’))

Ruby: ruby-1.9.3, ruby-1.8.7, jruby-1.6.2
dhtmlxGrid: 3.0 Pro

home/alex/.rvm/gems/ruby-1.8.7-p358/gems/execjs-1.3.2/lib/execjs/external_runtime.rb:71:in `extract_result’: Unexpected token: name (g) (line: 5, col: 303041, pos: 303163) (ExecJS::ProgramError)

Error
at new JS_Parse_Error (/tmp/execjs20120515-30527-57edqu-0.js:3096:22)
at js_error (/tmp/execjs20120515-30527-57edqu-0.js:3104:15)
at croak (/tmp/execjs20120515-30527-57edqu-0.js:3557:17)
at token_error (/tmp/execjs20120515-30527-57edqu-0.js:3564:17)
at unexpected (/tmp/execjs20120515-30527-57edqu-0.js:3570:17)
at Object.semicolon [as 1] (/tmp/execjs20120515-30527-57edqu-0.js:3590:51)
at prog1 (/tmp/execjs20120515-30527-57edqu-0.js:4133:28)
at simple_statement (/tmp/execjs20120515-30527-57edqu-0.js:3726:35)
at /tmp/execjs20120515-30527-57edqu-0.js:3634:35
at block_ (/tmp/execjs20120515-30527-57edqu-0.js:3822:32)
from /home/alex/.rvm/gems/ruby-1.8.7-p358/gems/execjs-1.3.2/lib/execjs/external_runtime.rb:31:in exec' from /home/alex/.rvm/gems/ruby-1.8.7-p358/gems/execjs-1.3.2/lib/execjs/external_runtime.rb:44:incompile_to_tempfile’
from /home/alex/.rvm/gems/ruby-1.8.7-p358/gems/execjs-1.3.2/lib/execjs/external_runtime.rb:27:in exec' from /home/alex/.rvm/gems/ruby-1.8.7-p358/gems/uglifier-1.2.4/lib/uglifier.rb:101:incompile’
from /home/alex/.rvm/gems/ruby-1.8.7-p358/gems/uglifier-1.2.4/lib/uglifier.rb:43:in `compile’
from /home/alex/NetBeansProjects/tests/lib/test_uglifier.rb:15

Figured out that debugger; line is causing the problem in the snippet below. Anybody knows what this line is for?

dhtmlXGridObject.prototype.splitAt = function (a) { this._fake.doColResize = function (b, c, d, e, f) { debugger; var k = -1, g = 0; if (arguments[1]._cellIndex == a - 1) { k = this._initalSplR + (b.clientX - e); if (!this._initalSplF) this._initalSplF = arguments[3] + this.objBox.scrollWidth - this.objBox.offsetWidth; if (this.objBox.scrollWidth == this.objBox.offsetWidth && (this._fake.alter_split_resize || b.clientX - e > 0)) arguments[3] = this._initalSplF || arguments[3] } else if (this.obj.offsetWidth < this.entBox.offsetWidth) k = this.obj.offsetWidth; g = this.doColResizeA.apply(this, arguments); this._correctSplit(k); this.resized = this._fake.resized = 1; return g }; };

Figured that debugger; is a browser JS breakpoint and it is clearly a leftover that needs to be removed from release code. Also there is a problem in gem uglifier gem. More details are here github.com/lautis/uglifier/issues/32