https://bugzilla.wikimedia.org/show_bug.cgi?id=27046

           Summary: JS minification regression in ResourceLoader:
                    comment+linebreak as implied semicolon lost
           Product: MediaWiki
           Version: wikimedia-deployment
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: blocker
          Priority: Normal
         Component: Resource Loader
        AssignedTo: tpars...@wikimedia.org
        ReportedBy: br...@pobox.com
                CC: roan.katt...@gmail.com
            Blocks: 26611


Found this while tidying up work on SVGEdit; ext.svgedit.embedapi.js get
incorrectly minified by the new JSDistiller stuff.

This file is a short bit of (rather messy and comment-filled ;) third-party JS
which defines functions for communicated with an embedded iframe. I found I got
a syntax error at this point in the original file:

        var t = this //new callback
        for(var g = 0, args = []; g < arguments.length; g++){
          args.push(arguments[g]);
        }

which gets minified to:

        var t=thisfor(var g=0,args=[];g<arguments.length;g++){
        args.push(arguments[g]);
        }

The first line ('var t = this') allows the statement terminator to be implied
rather than using an explicit semicolon -- a poor practice, but legitimate in
JS. It also uses a double-slash single-line comment on the end.

The combination of these two seems to confuse the new minifier, and it ends up
slapping them together with neither a semicolon nor any whitespace at all!

It needs to either keep the line feed intact as a statement terminator, or add
a semicolon.

I'll work around it for now by adjusting the formatting in this particular
file.

Adding to MW 1.17 blockers (unless we won't be shipping this version of the
minifier -- the old code did fine)

-- 
Configure bugmail: https://bugzilla.wikimedia.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

_______________________________________________
Wikibugs-l mailing list
Wikibugs-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to