Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-43018

Semicolons missing on minification

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.6
    • Fix Version/s: 2.6.1
    • Component/s: JavaScript
    • Labels:
    • Testing Instructions:
      Hide
      1. Open dev tools
      2. Turn debug_developer off
      3. Open any page in Moodle
      4. Confirm that the first JS loaded is the rollup including:
        • moodlesimple; and;
        • mcore
      5. Confirm that they both have -min.js in the filename
      6. Confirm that the entire file content is minified
      7. Turn the debug level up to debug_developer but leave yuicomboloading enabled
      8. Refresh the page
      9. Confirm that the moodlesimple filename is neither -min nor -debug (moodlesimple.js)
      10. Confirm that the file content is not minified
      11. Confirm the existence of Y.log in the content
      Show
      Open dev tools Turn debug_developer off Open any page in Moodle Confirm that the first JS loaded is the rollup including : moodlesimple; and; mcore Confirm that they both have -min.js in the filename Confirm that the entire file content is minified Turn the debug level up to debug_developer but leave yuicomboloading enabled Refresh the page Confirm that the moodlesimple filename is neither -min nor -debug (moodlesimple.js) Confirm that the file content is not minified Confirm the existence of Y.log in the content
    • Affected Branches:
      MOODLE_26_STABLE
    • Fixed Branches:
      MOODLE_26_STABLE
    • Pull Master Branch:
      MDL-43018-master

      Description

      if a javascript file ends with a semicolon, the semicolon is dropped at the end of a file. When combining some files, it breaks the code.

      javascript file 1:
      (function(foo){}(bar));

      javascript file 2:
      (function(bar){}(foo));

      combined invalid javascipt:
      (function(foo){}(bar))(function(bar){}(foo))

      should be:
      (function(foo){}(bar));(function(bar){}(foo));

      lib/classes/minify.php line 87
      $compressed[] = self::js($content);
      to
      $compressed[] = self::js($content) . ";";

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              dobedobedoh Andrew Nicols
              Reporter:
              syxton Matthew Davidson
              Peer reviewer:
              Frédéric Massart
              Integrator:
              Damyon Wiese
              Tester:
              Ankit Agarwal
              Participants:
              Component watchers:
              Andrew Nicols, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
              Votes:
              2 Vote for this issue
              Watchers:
              5 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Fix Release Date:
                13/Jan/14