Details

    • Testing Instructions:
      Hide
      1. Be sure that either Tex Filter is activated or Site Administration > Plugins > Text editors > TinyMCE HTML editor > Insert equation "Require TeX filter" setting is unchecked
      2. Using firefox version 24 open any page that uses the HTML editor and click the Insert an equation tool
      3. Verify that firefox don't crash and Dragmath editor is working

      Note: you will see a security warning saying that the application editor is unknown and you will need to check the box saying that you "accept the risk" and want to execute the application. Later when you click on the "Insert" button of the Dragmath dialog you will get another security warning asking you if you authorise this action. Life is really hard for people wanting to use java applets now, but all these problems aren't really Moodle's problems and are not the subject of this issue

      Show
      Be sure that either Tex Filter is activated or Site Administration > Plugins > Text editors > TinyMCE HTML editor > Insert equation "Require TeX filter" setting is unchecked Using firefox version 24 open any page that uses the HTML editor and click the Insert an equation tool Verify that firefox don't crash and Dragmath editor is working Note: you will see a security warning saying that the application editor is unknown and you will need to check the box saying that you "accept the risk" and want to execute the application. Later when you click on the "Insert" button of the Dragmath dialog you will get another security warning asking you if you authorise this action. Life is really hard for people wanting to use java applets now, but all these problems aren't really Moodle's problems and are not the subject of this issue
    • Affected Branches:
      MOODLE_24_STABLE, MOODLE_25_STABLE, MOODLE_26_STABLE
    • Fixed Branches:
      MOODLE_24_STABLE, MOODLE_25_STABLE, MOODLE_26_STABLE
    • Pull 2.4 Branch:
    • Pull 2.5 Branch:
    • Pull Master Branch:
    • Rank:
      52734

      Description

      Replication instructions:

      1. Be sure Tex and Algebra Notation Filters are activated
      2. Using firefox open any page that uses the HTML editor and click the Insert an equation tool:

      Result: Firefox window closes and a error report window appears.

      1. dragmath.php
        3 kB
        Mauno Korpelainen
      1. Tracker.jpg
        12 kB
      2. Tracker2.jpg
        16 kB

        Issue Links

          Activity

          Hide
          Tim Hunt added a comment -

          Nothing to do with the quiz. Fixing component.

          Show
          Tim Hunt added a comment - Nothing to do with the quiz. Fixing component.
          Hide
          Joshua Holden added a comment -

          I'm seeing a similar bug with Moodle 2.4 and Firefox 24. Could it be a recent Firefox and/or Java update?

          Show
          Joshua Holden added a comment - I'm seeing a similar bug with Moodle 2.4 and Firefox 24. Could it be a recent Firefox and/or Java update?
          Hide
          Mauno Korpelainen added a comment -

          It's a new security feature in Firefox. Java files of Dragmath should have more data about publisher (unknown?) or some files used in www.dragmath.bham.ac.uk/demo.html are not probably included to the package version used in moodle. Other modern browsers have started to block this kind java applets too with a note "I accept the risk and want to run the application" - they just don't all crash like FF 24.

          You could send a bug report to sourceforge.net/p/dragmath/bugs/ or email directly - see www.dragmath.bham.ac.uk/index.html#Contact - dragmath tracker has not been very active recently because the maintainers Chris Sangwin and Alex Billingsley have been busy with other projects.

          Otherwise this can't be fixed in moodle.

          Show
          Mauno Korpelainen added a comment - It's a new security feature in Firefox. Java files of Dragmath should have more data about publisher (unknown?) or some files used in www.dragmath.bham.ac.uk/demo.html are not probably included to the package version used in moodle. Other modern browsers have started to block this kind java applets too with a note "I accept the risk and want to run the application" - they just don't all crash like FF 24. You could send a bug report to sourceforge.net/p/dragmath/bugs/ or email directly - see www.dragmath.bham.ac.uk/index.html#Contact - dragmath tracker has not been very active recently because the maintainers Chris Sangwin and Alex Billingsley have been busy with other projects. Otherwise this can't be fixed in moodle.
          Hide
          Mauno Korpelainen added a comment -

          I am going to test this today - it looks like Firefox 24 crashes only when dragmath applet is inside object tags but it does not crash inside deprecated applet tags so this crashing might be caused by some of current object parameters https://developer.mozilla.org/en-US/docs/Web/HTML/Element/object

          Show
          Mauno Korpelainen added a comment - I am going to test this today - it looks like Firefox 24 crashes only when dragmath applet is inside object tags but it does not crash inside deprecated applet tags so this crashing might be caused by some of current object parameters https://developer.mozilla.org/en-US/docs/Web/HTML/Element/object
          Hide
          Mauno Korpelainen added a comment - - edited

          Nothing wrong in object tags but there were a couple of other issues in file lib/editor/tinymce/plugins/dragmath/dragmath.php

          I suppose this affects all versions of moodle 2.4 to 2.6 - and was working fine in moodle 2.3 that had different plugin structure.

          <HTML> start tag was not closed and I changed also the script paths and lang strings for insert and cancel - attached dragmath.php file works on my test site with Firefox 24 without crashing (tested with the latest 2.6 and 2.5.2)

          Show
          Mauno Korpelainen added a comment - - edited Nothing wrong in object tags but there were a couple of other issues in file lib/editor/tinymce/plugins/dragmath/dragmath.php I suppose this affects all versions of moodle 2.4 to 2.6 - and was working fine in moodle 2.3 that had different plugin structure. <HTML> start tag was not closed and I changed also the script paths and lang strings for insert and cancel - attached dragmath.php file works on my test site with Firefox 24 without crashing (tested with the latest 2.6 and 2.5.2)
          Hide
          Mauno Korpelainen added a comment -

          Here the changes I tested in file lib/editor/tinymce/plugins/dragmath/dragmath.php:

          Line 62
          <html <?php echo $htmllang ?>>
          
          Line 66
          <script type="text/javascript" src="<?php echo $editor->tinyMCE.baseURL; ?>/tiny_mce_popup.js"></script>
          
          Line 67
          <script type="text/javascript" src="<?php echo $editor->moodle_plugin_base; ?>dragmath/tinymce/js/dragmath.js"></script>
          
          Line 81
          <input type="submit" id="insert" name="insert" value="<?php print_string('common:insert', 'editor_tinymce'); ?>" onclick="return DragMathDialog.insert();" />
          
          Line 82
          <input type="button" id="cancel" name="cancel" value="<?php print_string('cancel'); ?>" onclick="return tinyMCEPopup.close();" />
          
          Show
          Mauno Korpelainen added a comment - Here the changes I tested in file lib/editor/tinymce/plugins/dragmath/dragmath.php: Line 62 <html <?php echo $htmllang ?>> Line 66 <script type= "text/javascript" src= "<?php echo $editor->tinyMCE.baseURL; ?>/tiny_mce_popup.js" ></script> Line 67 <script type= "text/javascript" src= "<?php echo $editor->moodle_plugin_base; ?>dragmath/tinymce/js/dragmath.js" ></script> Line 81 <input type= "submit" id= "insert" name= "insert" value= "<?php print_string('common:insert', 'editor_tinymce'); ?>" onclick= " return DragMathDialog.insert();" /> Line 82 <input type= "button" id= "cancel" name= "cancel" value= "<?php print_string('cancel'); ?>" onclick= " return tinyMCEPopup.close();" />
          Hide
          Jean-Michel Vedrine added a comment -

          Hello Mauno,
          On my test site it seems to work fine with just line 62 change.
          Can you explain why you think the other changes are necessary ? IMHO it was a lot better to use get_tinymce_base_url and get_tinymce_file_url but maybe I am missing something ?

          Show
          Jean-Michel Vedrine added a comment - Hello Mauno, On my test site it seems to work fine with just line 62 change. Can you explain why you think the other changes are necessary ? IMHO it was a lot better to use get_tinymce_base_url and get_tinymce_file_url but maybe I am missing something ?
          Hide
          Geoffrey Rowland added a comment -

          On Moodle 2.5.2+ (with Essential theme) I needed all of Mauno's changes to dragmath.php
          Have voted for this

          Show
          Geoffrey Rowland added a comment - On Moodle 2.5.2+ (with Essential theme) I needed all of Mauno's changes to dragmath.php Have voted for this
          Hide
          Mauno Korpelainen added a comment -

          Jean-Michel,

          I tested this again trying different combinations - when I originally tested crashing I wanted to use such functions that come from tinymce editor itself and tinyMCE.baseURL is one of core tinymce functions and moodle_plugin_base is given in editor init code (params)

          <script type="text/javascript" src="<?php echo $editor->get_tinymce_base_url(); ?>tiny_mce_popup.js"></script>

          crashed when I had purged all caches including browser cache and had line 62 changed of course.

          On the other hand

          <script type="text/javascript" src="<?php echo $plugin->get_tinymce_file_url('js/dragmath.js'); ?>"></script>

          looks OK (defined in lib/editor/tinymce/classes/plugin.php) and even if it won't work with tinymce 4 (it has different file structure) it is probably not necessary to use moodle_plugin_base after all.

          I have not checked why insert and cancel lost translation with

          {#insert}

          and

          {#cancel}

          but using

          <?php print_string('common:insert', 'editor_tinymce'); ?>

          and

          <?php print_string('cancel'); ?>

          work in any case.

          Show
          Mauno Korpelainen added a comment - Jean-Michel, I tested this again trying different combinations - when I originally tested crashing I wanted to use such functions that come from tinymce editor itself and tinyMCE.baseURL is one of core tinymce functions and moodle_plugin_base is given in editor init code (params) <script type= "text/javascript" src= "<?php echo $editor->get_tinymce_base_url(); ?>tiny_mce_popup.js" ></script> crashed when I had purged all caches including browser cache and had line 62 changed of course. On the other hand <script type= "text/javascript" src= "<?php echo $plugin->get_tinymce_file_url('js/dragmath.js'); ?>" ></script> looks OK (defined in lib/editor/tinymce/classes/plugin.php) and even if it won't work with tinymce 4 (it has different file structure) it is probably not necessary to use moodle_plugin_base after all. I have not checked why insert and cancel lost translation with {#insert} and {#cancel} but using <?php print_string('common:insert', 'editor_tinymce'); ?> and <?php print_string('cancel'); ?> work in any case.
          Hide
          Mauno Korpelainen added a comment -

          Test round 3 (in moodle 2.6):

          Original lines

          <script type="text/javascript" src="<?php echo $editor->get_tinymce_base_url(); ?>tiny_mce_popup.js"></script>
          <script type="text/javascript" src="<?php echo $plugin->get_tinymce_file_url('js/dragmath.js'); ?>"></script>

          worked ok if line 62 was changed and language strings insert and cancel are given with

          <?php print_string('common:insert', 'editor_tinymce'); ?>

          and

          <?php print_string('cancel'); ?>

          Could this be some kind of timeout issue?

          Show
          Mauno Korpelainen added a comment - Test round 3 (in moodle 2.6): Original lines <script type= "text/javascript" src= "<?php echo $editor->get_tinymce_base_url(); ?>tiny_mce_popup.js" ></script> <script type= "text/javascript" src= "<?php echo $plugin->get_tinymce_file_url('js/dragmath.js'); ?>" ></script> worked ok if line 62 was changed and language strings insert and cancel are given with <?php print_string('common:insert', 'editor_tinymce'); ?> and <?php print_string('cancel'); ?> Could this be some kind of timeout issue?
          Hide
          Mauno Korpelainen added a comment -

          Changing lines 62, 81 and 82 should not break anything in any browser - dragmath gives anyway security warnings before applet is loeded and after Insert is pressed (Unknown publisher) so it's not a very user friendly plugin this way...

          Show
          Mauno Korpelainen added a comment - Changing lines 62, 81 and 82 should not break anything in any browser - dragmath gives anyway security warnings before applet is loeded and after Insert is pressed (Unknown publisher) so it's not a very user friendly plugin this way...
          Hide
          Jean-Michel Vedrine added a comment -

          But Mauno, how can $editor->tinyMCE.baseURL; work here ? It is certainly a core tinymce function and available from javascript but not here.
          Unless I really understand nothing the goal of get_tinymce_base_url was precisely to have an equivalent to tinyMCE.baseURL that we can use in php, No ?
          I don't understand your fix.
          For me your line:

          <script type="text/javascript" src="<?php echo $editor->tinyMCE.baseURL; ?>/tiny_mce_popup.js"></script>
          

          produce a notice
          Notice: Undefined property: tinymce_texteditor::$tinyMCE in C:\wamp\www\moodle_test\lib\editor\tinymce\plugins\dragmath\dragmath.php on line 66
          You can see this if you display the source.

          Show
          Jean-Michel Vedrine added a comment - But Mauno, how can $editor->tinyMCE.baseURL; work here ? It is certainly a core tinymce function and available from javascript but not here. Unless I really understand nothing the goal of get_tinymce_base_url was precisely to have an equivalent to tinyMCE.baseURL that we can use in php, No ? I don't understand your fix. For me your line: <script type= "text/javascript" src= "<?php echo $editor->tinyMCE.baseURL; ?>/tiny_mce_popup.js" ></script> produce a notice Notice: Undefined property: tinymce_texteditor::$tinyMCE in C:\wamp\www\moodle_test\lib\editor\tinymce\plugins\dragmath\dragmath.php on line 66 You can see this if you display the source.
          Hide
          Mauno Korpelainen added a comment -

          Jean-Michel,

          yes, you are right, tinyMCE.baseURL comes from javascript and get_tinymce_base_url() from php and if you read my previous comments changing lines 62, 81 and 82 is enough - original script lines are ok. If you compare moodle 2.3 plugin to moodle 2.4/5/6 plugin moodle 2.3 plugin had a different location, different doctype, no dir="ltr" lang="en" xml:lang="en" in html tag, paths were

          <script type="text/javascript" src="../../tiny_mce_popup.js"></script><script type="text/javascript" src="js/dragmath.js"></script>

          , plugin was using applet tags...

          So I tried one piece of code after another and suddenly dragmath did not crash anymore...

          But if we change only line 62 and leave lines 81 & 82 untouched my Firefox 24 simply crashes.

          Show
          Mauno Korpelainen added a comment - Jean-Michel, yes, you are right, tinyMCE.baseURL comes from javascript and get_tinymce_base_url() from php and if you read my previous comments changing lines 62, 81 and 82 is enough - original script lines are ok. If you compare moodle 2.3 plugin to moodle 2.4/5/6 plugin moodle 2.3 plugin had a different location, different doctype, no dir="ltr" lang="en" xml:lang="en" in html tag, paths were <script type= "text/javascript" src= "../../tiny_mce_popup.js" ></script><script type= "text/javascript" src= "js/dragmath.js" ></script> , plugin was using applet tags... So I tried one piece of code after another and suddenly dragmath did not crash anymore... But if we change only line 62 and leave lines 81 & 82 untouched my Firefox 24 simply crashes.
          Hide
          Jean-Michel Vedrine added a comment -

          Mauno,
          I am OK to change lines 62, 81 and 82. I can prepare github branchs and submit to peer review so that this is fixed in all Moodle supported versions. No problem for me.
          But before that I would prefer to understand what makes firefox crashing

          Show
          Jean-Michel Vedrine added a comment - Mauno, I am OK to change lines 62, 81 and 82. I can prepare github branchs and submit to peer review so that this is fixed in all Moodle supported versions. No problem for me. But before that I would prefer to understand what makes firefox crashing
          Hide
          Jean-Michel Vedrine added a comment -

          I can confirm that just changing lines 62 (missing ">" in html tag) and lines 81, 82 (use print_string rather than the javascript # form to call languages strings) fix the problem.
          I also discovered that another tinyMCE plugin have the same missing ">" see lib\editor\tinymce\plugins\moodleemoticon\dialog.php line 43

          Show
          Jean-Michel Vedrine added a comment - I can confirm that just changing lines 62 (missing ">" in html tag) and lines 81, 82 (use print_string rather than the javascript # form to call languages strings) fix the problem. I also discovered that another tinyMCE plugin have the same missing ">" see lib\editor\tinymce\plugins\moodleemoticon\dialog.php line 43
          Hide
          Mauno Korpelainen added a comment -

          I have not found any good explanation why Firefox crashes here but my guess is that it has something to do with translation: dragmath.php is checking session language and sends language strings to applet (object param language) from a xml file using $lang

          <html <?php echo $htmllang ?>>

          is using a function from weblib.php

          function get_html_lang($dir = false) {
              $direction = '';
              if ($dir) {
                  if (right_to_left()) {
                      $direction = ' dir="rtl"';
                  } else {
                      $direction = ' dir="ltr"';
                  }
              }
              // Accessibility: added the 'lang' attribute to $direction, used in theme <html> tag.
              $language = str_replace('_', '-', current_language());
              @header('Content-Language: '.$language);
              return ($direction.' lang="'.$language.'" xml:lang="'.$language.'"');
          }

          (in 2.3 plugin had only <html> )
          And finally language strings of buttons use two methods

          {#cancel}

          that fails and

          <?php print_string('cancel'); ?>

          that does not fail.

          Show
          Mauno Korpelainen added a comment - I have not found any good explanation why Firefox crashes here but my guess is that it has something to do with translation: dragmath.php is checking session language and sends language strings to applet (object param language) from a xml file using $lang <html <?php echo $htmllang ?>> is using a function from weblib.php function get_html_lang($dir = false ) { $direction = ''; if ($dir) { if (right_to_left()) { $direction = ' dir= "rtl" '; } else { $direction = ' dir= "ltr" '; } } // Accessibility: added the 'lang' attribute to $direction, used in theme <html> tag. $language = str_replace('_', '-', current_language()); @header('Content-Language: '.$language); return ($direction.' lang= "'.$language.'" xml:lang= "'.$language.'" '); } (in 2.3 plugin had only <html> ) And finally language strings of buttons use two methods {#cancel} that fails and <?php print_string('cancel'); ?> that does not fail.
          Hide
          Jean-Michel Vedrine added a comment -

          I created a master branch patch on my github account.
          I will backport to 2.4 and 2.5, add testing insructions and put on peer review.

          Show
          Jean-Michel Vedrine added a comment - I created a master branch patch on my github account. I will backport to 2.4 and 2.5, add testing insructions and put on peer review.
          Hide
          Jean-Michel Vedrine added a comment -

          Note that lines 81 and 82 are now too long (this is reported by codechecker) but I always have trouble to see where is the best place to split such lines: it always seems to me that they are most readable on the same line even if I know coding guidelines say to split them
          Anyway we will see what the peer reviewer will say.

          Show
          Jean-Michel Vedrine added a comment - Note that lines 81 and 82 are now too long (this is reported by codechecker) but I always have trouble to see where is the best place to split such lines: it always seems to me that they are most readable on the same line even if I know coding guidelines say to split them Anyway we will see what the peer reviewer will say.
          Hide
          Jean-Michel Vedrine added a comment -

          As always I forgot to move issue workflow

          Show
          Jean-Michel Vedrine added a comment - As always I forgot to move issue workflow
          Hide
          Jean-Michel Vedrine added a comment -

          Requesting peer review.

          Show
          Jean-Michel Vedrine added a comment - Requesting peer review.
          Hide
          Petr Škoda added a comment -

          +1, thanks everybody, submitting for integration

          Show
          Petr Škoda added a comment - +1, thanks everybody, submitting for integration
          Hide
          Jean-Michel Vedrine added a comment -

          Thanks Petr

          Show
          Jean-Michel Vedrine added a comment - Thanks Petr
          Hide
          Marina Glancy added a comment -

          I did grep and it showed that moodleemoticons have the same code, created an issue MDL-42637

          Show
          Marina Glancy added a comment - I did grep and it showed that moodleemoticons have the same code, created an issue MDL-42637
          Hide
          Marina Glancy added a comment -

          Thanks guys, integrated in 2.4, 2.5 and 2.6.
          I tried to test it but even having Firefox v24 my browser does not crush without patch as well.

          Show
          Marina Glancy added a comment - Thanks guys, integrated in 2.4, 2.5 and 2.6. I tried to test it but even having Firefox v24 my browser does not crush without patch as well.
          Hide
          Marina Glancy added a comment -

          I pass the test, I tried on all versions 2.4, 2.5 and 2.6. I can see the buttons in the current language (default, set for course, set in user session). The patch obviously does not break anything.

          If somebody notices that it still does not fix the problem please create a new issue.

          Show
          Marina Glancy added a comment - I pass the test, I tried on all versions 2.4, 2.5 and 2.6. I can see the buttons in the current language (default, set for course, set in user session). The patch obviously does not break anything. If somebody notices that it still does not fix the problem please create a new issue.
          Hide
          Jean-Michel Vedrine added a comment -

          Thanks Marina,
          Same as you, with some of my computers and on some Moodle websites, firefox 24 was not crashing even without the patch ! I was unable to find what combination trigger the bug
          But as you say the patch obviously does not break anything, and once applied it solves the problem on all my sites where firefox 24 was crashing, so best to have it integrated.

          Show
          Jean-Michel Vedrine added a comment - Thanks Marina, Same as you, with some of my computers and on some Moodle websites, firefox 24 was not crashing even without the patch ! I was unable to find what combination trigger the bug But as you say the patch obviously does not break anything, and once applied it solves the problem on all my sites where firefox 24 was crashing, so best to have it integrated.
          Hide
          Dan Poltawski added a comment -

          Congratulations - this issue has been included in Moodle and is now available on our git mirrors and shortly will become available on the download servers shortly.

          Show
          Dan Poltawski added a comment - Congratulations - this issue has been included in Moodle and is now available on our git mirrors and shortly will become available on the download servers shortly.

            People

            • Votes:
              5 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: