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

Semicolons missing on minification

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.6
    • 2.6.1
    • JavaScript
    • MOODLE_26_STABLE
    • MOODLE_26_STABLE
    • MDL-43018-master
    • 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

    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

              dobedobedoh Andrew Lyons
              syxton Matthew Davidson
              Frédéric Massart Frédéric Massart
              Damyon Wiese Damyon Wiese
              Ankit Agarwal Ankit Agarwal
              Andrew Lyons, Huong Nguyen, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze, Stevani Andolo
              Votes:
              2 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                13/Jan/14