Fix JS bug caused by UglifyJS+Backbone 1.6.1
Review Request #14959 — Created March 25, 2026 and discarded
Review Board 7.0.5 shipped with a bad bug which was causing review
requests on the frontend to show up without any inline editor pencils.
We hadn't hit this in development because it only affects the minified
sources (and previous versions of Review Board shipped with older
versions of Spina and thus older versions of Backbone).The core issue here is related to the way that UglifyJS collapses
variables when not running in strict mode.In Backbone 1.6.1, the model constructor does something like this:
var Model = function(attributes, options) { var attrs = attributes || {}; if (options.parse) attrs = this.parse(attrs, options) || {}; this.initialize.apply(this, arguments); };When running just like this,
attrsandargumentsare separate
variables. However, after minification, it looks like this:function(e,t){ var e=e||{}; if(t.parse) e=this.parse(e,t)||{}; this.initialize.apply(this,arguments); }In this,
attrsandargumentsare collapsed into a single variable
ewhich gets reassigned when we callparse(), which changes the
value ofarguments[0]. When we then callthis.initialize(), it's
being called with the parsed data instead of the original attributes. If
backbone was in strict mode,argumentswould not be allowed to be
aliased like this (and presumably uglify would do the right thing), but
alas.In order to avoid hitting this, this change updates our
ReviewablePage
model in a couple ways:
parse()now passes througheditorDataso it's available in
this.attributesafter the parse operation.initialize()now usesthis.attributesinstead of theattributes
argument which gets munged by the constructor.
Built and minified JS media and copied it into my RB 7.0.5 docker
container. Verified that the fix works correctly.Review Board 7.1.x is not affected by this because we've switched
to using Terser on that branch, which does not exhibit the same
issue.
| Summary | ID |
|---|---|
| knlsnqvrxyunropxtkytqpvwxtnnutss |