• 
      

    Fix UglifyJS configuration to add "use strict".

    Review Request #14963 — Created March 26, 2026 and submitted

    Information

    Djblets
    release-5.2.x

    Reviewers

    UglifyJS 3.18.0 changed their default for the module setting, which
    made the resulting output no longer contain "use strict" at the
    beginning of the IIFE. It also has a long-standing bug where code like
    this:

    function(attributes, options) {
        var attrs = attributes || {};
        ...
        something(arguments);
    }
    

    gets converted to this:

    function(a, b) {
        var a = a || {};
        ...
        something(arguments);
    }
    

    Unfortunately, by reusing the same variable name for a, when running
    in non-strict mode, this aliases arguments, causing the value of
    arguments[0] that gets passed in to something to be whatever a is
    instead of the original arguments.

    This change adds in --no-module to the UglifyJS arguments, restoring
    the behavior that we previously saw in older builds.

    • Built static media and verified that the emitted code had "use
      strict".
    • Copied resulting minified files into a (previously broken) Review
      Board 7.0.5 container and verified that the bugs we saw were fixed.
    Summary ID
    Fix UglifyJS configuration to add "use strict".
    UglifyJS 3.18.0 changed their default for the `module` setting, which made the resulting output no longer contain "use strict" at the beginning of the IIFE. It also has a long-standing bug where code like this: ```javascript function(attributes, options) { var attrs = attributes || {}; ... something(arguments); } ``` gets converted to this: ```javascript function(a, b) { var a = a || {}; ... something(arguments); } ``` Unfortunately, by reusing the same variable name for `a`, when running in non-strict mode, this aliases `arguments`, causing the value of `arguments[0]` that gets passed in to `something` to be whatever `a` is instead of the original `arguments`. This change adds in `--no-module` to the UglifyJS arguments, restoring the behavior that we previously saw in older builds. Testing Done: - Built static media and verified that the emitted code had "use strict". - Copied resulting minified files into a (previously broken) Review Board 7.0.5 container and verified that the bugs we saw were fixed.
    ynlnnsyuzvpwrozwznvrpttvnonolmuk
    chipx86
    1. Ship It!
    2. 
        
    maubin
    1. Ship It!
    2. 
        
    david
    Review request changed
    Status:
    Completed
    Change Summary:
    Pushed to release-5.2.x (823e610)