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

Quiz secure_window::close expect different arguments than it receives

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Duplicate
    • 3.1
    • None
    • Quiz
    • MOODLE_31_STABLE

    Description

      The function close of the module M.mod_quiz.secure_window is not using the right argument, it is called twice like this:

      M.mod_quiz.secure_window.close(url, 0)
      

              $this->page->requires->js_init_call('M.mod_quiz.secure_window.close',
                      array($url, $delay), false, quiz_get_js_module());
      

      But the function signature is this:

          close: function(Y, url, delay) {
              setTimeout(function() {
                  if (window.opener) {
                      window.opener.document.location.reload();
                      window.close();
                  } else {
                      window.location.href = url;
                  }
              }, delay*1000);
          }
      

      Which means that when there is no window opener (when HTTPS is used, or when the browser blocked the popup), the user is sent to the second argument, being delay when called. The delay is also always 0 as it's always undefined.

      Attachments

        Issue Links

          Activity

            People

              timhunt Tim Hunt
              fred Frédéric Massart
              Tim Hunt, Ilya Tregubov, Kevin Percy, Mathew May, Mihail Geshoski, Shamim Rezaie
              Votes:
              2 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: