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

JavaScript error when drag-dropping into a File manager

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.6
    • Fix Version/s: 2.5.6, 2.6.3
    • Component/s: Filepicker
    • Labels:
    • Environment:
      Safari 6.1 on OSX
    • Testing Instructions:
      Hide

      Drag and drop a file into a File manager component on a form (e.g. add a File resource to a course) and ensure it still works.

      Show
      Drag and drop a file into a File manager component on a form (e.g. add a File resource to a course) and ensure it still works.
    • Affected Branches:
      MOODLE_26_STABLE
    • Fixed Branches:
      MOODLE_25_STABLE, MOODLE_26_STABLE
    • Pull from Repository:
    • Pull Master Branch:

      Description

      A JavaScript error may be triggered when dragging and dropping a file into a File manager component, which halts JavaScript execution and leaves the page in a faulty state. This has been observed (inconsistently) using OSX Safari 6.1/6.1.1 and is caused by the 'dragover' event having a null value for the dataTransfer.types property. The lib/form/dndupload.js has_files() method assumes the event.dataTransfer.types property is an Array, and when it is not and attempts to read the length property, an error is triggered.

      I have tried to research whether this is specifically a Safari browser bug or a difference in interpretation of the W3C spec, and reproducing it consistently has been difficult as only one system has produced the error under normal use. On other systems with the same browser versions it has only occurred sporadically while stepping within the debugger. The solution is trivial and ensures that an Array is always returned so that
      reading the array length always succeeds.

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  12/May/14