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

Form change checker uses TinyMCE API without checking it exists

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 3.11.8, 4.0.2
    • 3.11.9, 4.0.3
    • Forms Library
    • MOODLE_311_STABLE, MOODLE_400_STABLE
    • MOODLE_311_STABLE, MOODLE_400_STABLE
    • MDL-75244-311
    • MDL-75244-400
    • MDL-75244-master
    • Hide
      1. Log in
      2. Navigate to the user profile
      3. Open the developer tools
      4. In the Console, possibly under settings, ensure that "Preserve log" is selected
      5. Run the following in the console:

        window.tinyMCE = {};
        

      6. Refresh the page
        1. Confirm that no errors were reported about reading properties of undefined, for example:

          Uncaught TypeError: Cannot read properties of undefined (reading 'some')
              at isAnyWatchedFormDirty (/sm/lib/requirejs.php/-1/core_form/changechecker.js:51:1867)
              at beforeUnloadHandler (/sm/lib/requirejs.php/-1/core_form/changechecker.js:51:2787)
          

      Show
      Log in Navigate to the user profile Open the developer tools In the Console, possibly under settings, ensure that "Preserve log" is selected Run the following in the console: window.tinyMCE = {}; Refresh the page Confirm that no errors were reported about reading properties of undefined , for example: Uncaught TypeError: Cannot read properties of undefined (reading 'some') at isAnyWatchedFormDirty (/sm/lib/requirejs.php/-1/core_form/changechecker.js:51:1867) at beforeUnloadHandler (/sm/lib/requirejs.php/-1/core_form/changechecker.js:51:2787)

    Description

      The Form Change Checker uses the window.tinyMCE API, and checks it exists, but it also uses window.tinyMCE.editors, which is a TinyMCE v3 feature.

      Newer versions of TinyMCE use a proper API for fetching editor instances and this causes the FCC to throw an error when checking the Editors.

      Attachments

        1. MDL-75244_master.png
          MDL-75244_master.png
          138 kB
        2. MDL-75244_v311.png
          MDL-75244_v311.png
          116 kB
        3. MDL-75244_v400.png
          MDL-75244_v400.png
          123 kB

        Issue Links

          Activity

            People

              dobedobedoh Andrew Lyons
              dobedobedoh Andrew Lyons
              Huong Nguyen Huong Nguyen
              Jun Pataleta Jun Pataleta
              John Edward Pedregosa John Edward Pedregosa
              David Woloszyn, Huong Nguyen, Jake Dallimore, Meirza, Michael Hawkins, Raquel Ortega, Safat Shahin, Stevani Andolo
              Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                22/Aug/22

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 1 hour, 54 minutes
                  1h 54m