?
avatar PhocaCz
PhocaCz
14 Jul 2016

Hi, in every extension I use the modal box, I get the javascript error "Error: too much recursion" when closing the modal box

Joomla! 3.6

Steps to reproduce the issue

It is similar to this bug:
#11048
#11097
Just install extension which uses modal box (e.g. to select image, to select map, ...) in administration. Open the modal and click to close it - I have used e.g. Phoca Download, in administration of files - file edit - select the file - modal box will be opened but when clicking on close, the error stops the closing window.

Expected result

Modal will be closed.

Actual result

Modal will be not closed

Error: too much recursion

System information (as much as possible)

Joomla! 3.6 stable

Additional comments

Seems like this:
#11097
is the solution for tinymce only but not systematic solution for extensions which uses modal box

avatar PhocaCz PhocaCz - open - 14 Jul 2016
avatar ggppdk
ggppdk - comment - 15 Jul 2016

@dgt41

It is still causing a loop

tiny-close(-min).js should be like:

jQuery(window).bind("load", function ()
{   
    if (window.jModalClose_tinyMCE_added === undefined)  // check Flag
    {
        var __tmp1 = jModalClose !== undefined && typeof(jModalClose) == 'function'  ? jModalClose  :  false;

        jModalClose = function () {
            if (__tmp1)  __tmp.apply(this, arguments);
            tinyMCE.activeEditor.windowManager.close();
        }

        window.jModalClose_tinyMCE_added = 1;  // set Flag
    }

    if (window.SqueezeBox_tinyMCE_added === undefined)  // check Flag
    {
        var __tmp2 = SqueezeBox !== undefined  ?  SqueezeBox.close  :  false;
        if (SqueezeBox === undefined)  SqueezeBox = {};

        SqueezeBox.close = function () {
            if (__tmp2)  __tmp.apply(this, arguments);
            tinyMCE.activeEditor.windowManager.close();
        }

        window.SqueezeBox_tinyMCE_added = 1;  // set Flag
    }
});

behaviour.php should
. either always load tiny-mce(-min).js
. or use code like:

    // Patch for tinyMCE
    if (typeof tinyMCE != 'undefined' && tinyMCE)
    {
        if (window.jModalClose_tinyMCE_added === undefined)  // check Flag
        {
            var __tmp_1 = jModalClose;
            jModalClose = function () {
                if (__tmp_1)  __tmp_1.apply(this, arguments);
                tinyMCE.activeEditor.windowManager.close();
            };
            window.jModalClose_tinyMCE_added = 1;  // set Flag
        }
        if (window.SqueezeBox_tinyMCE_added === undefined)  // check Flag
        {
            var __tmp_2 = SqueezeBox.close;
            SqueezeBox.close = function () {
                if (__tmp_2)  __tmp_2.apply(this, arguments);
                tinyMCE.activeEditor.windowManager.close();
            };
            window.SqueezeBox_tinyMCE_added = 1;  // set Flag
        }
    }

[EDIT]
I have updated above code, i did not put flag checking to behaviour.php !!

avatar dgt41
dgt41 - comment - 15 Jul 2016

@ggppdk I should have thought of the flag usage in the first place! Thanks, I will update #11097 to reflect the above changes
Done!
@PhocaCz please test #11097

avatar ggppdk
ggppdk - comment - 15 Jul 2016

great, thanks !

A note: the flags (variables) are global scope so using:

window.

will not make difference, but for code consistency on reading it better make use of it, in all of the variable references

e.g.
https://github.com/dgt41/joomla-cms/blob/ffdc81ef2fcc1bff4271dd8cfd26a04f0698d8e4/libraries/cms/html/behavior.php#L423

SqueezeBox_tinyMCE_added = 1;
better be:
window.SqueezeBox_tinyMCE_added = 1;

and same for other references to them

will test later "today"

avatar PhocaCz
PhocaCz - comment - 15 Jul 2016

Hi, testing #11097
It works OK, modal box can be closed but in Firebug I get this error:

ReferenceError: jModalClose_tinyMCE_added is not defined
media/system/js/tiny-close.min.js
Line 1

jQuery(window).bind("load",function(){if(void 0===jModalClose_tinyMCE_added){var e=void 0!==jModalClose&&"function"==typeof jModalClose?jModalClose:!1;jModalClose=function(){e&&e.apply(this,arguments),tinyMCE.activeEditor.windowManager.close()},window.jModalClose_tinyMCE_added=1}if(void 0===SqueezeBox_tinyMCE_added){var e=void 0!==SqueezeBox?SqueezeBox.close:!1;void 0===SqueezeBox&&(SqueezeBox={}),SqueezeBox.close=function(){e&&e.apply(this,arguments),tinyMCE.activeEditor.windowManager.close()},SqueezeBox_tinyMCE_added=1}});

Jan

avatar ggppdk
ggppdk - comment - 16 Jul 2016

@PhocaCz

You have not seen my comment, i asked for people to wait

  • the minified version of the tiny-close.js file has not been updated, that is why you get the message

you can test with "Debug" ON, that will load the no-compressed file, (click CTRL-F5 to make sure you have latest version) and it will work

or just wait 1 more commit

avatar PhocaCz
PhocaCz - comment - 16 Jul 2016

Hi,

i asked for people to wait

Sorry for that. Anyway when I enable DEBUG ON - I get always the minified version (tiny-close.min.js), even I refresh the site, even I clear all the history?

I just renamed the tiny-close.js to tiny-close.min.js to test it properly and yes, I confirm, when the not compressed js file is loaded, it works without any error.

Thank you, Jan

DEBUG ON (tiny-close.min.js and tinymce.min.js loaded but other libraries load not compressed version):

  • /media/system/js/mootools-core-uncompressed.js
  • /media/system/js/core-uncompressed.js
  • /media/system/js/mootools-more-uncompressed.js
  • /media/jui/js/jquery.js
  • /media/jui/js/jquery-noconflict.js
  • /media/jui/js/jquery-migrate.js
  • /media/system/js/punycode-uncompressed.js
  • /media/system/js/validate-uncompressed.js
  • /media/jui/js/chosen.jquery.js
  • /media/editors/tinymce/tinymce.min.js
  • /media/jui/js/bootstrap.js
  • /media/system/js/html5fallback-uncompressed.js
  • /media/jui/js/bootstrap-tooltip-extended.js
  • /media/system/js/modal-uncompressed.js
  • /media/system/js/tiny-close.min.js" defer="defer
  • /media/system/js/calendar-uncompressed.js
  • /media/system/js/calendar-setup-uncompressed.js
  • /administrator/templates/isis/js/template.js?755f2ee550dd818ce276750c7bef68bc
avatar ggppdk
ggppdk - comment - 19 Jul 2016

@PhocaCz

#11091 was updated, please test
i tested the cases you reported too

avatar andrepereiradasilva
andrepereiradasilva - comment - 19 Jul 2016

@ggppdk Do you mean #11097

avatar ggppdk
ggppdk - comment - 19 Jul 2016
avatar PhocaCz
PhocaCz - comment - 19 Jul 2016

Hi, testing now, it works for me without any problems.

Thank you, Jan

Dne 19. 7. 2016 v 23:59 Georgios Papadakis napsal(a):

@andrepereiradasilva https://github.com/andrepereiradasilva
thanks, yes, #11097 #11097


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#11137 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AFIdtxPta9Yv7_XYiJLh5DG4LaqHyvEpks5qXUjRgaJpZM4JM7aL.


Tato zpráva byla zkontrolována na viry programem Avast Antivirus.
https://www.avast.com/antivirus

avatar brianteeman brianteeman - close - 19 Jul 2016
avatar brianteeman brianteeman - close - 19 Jul 2016
avatar brianteeman
brianteeman - comment - 19 Jul 2016

Closed as this is resolved by #11097

avatar brianteeman brianteeman - change - 19 Jul 2016
Status New Closed
Closed_Date 0000-00-00 00:00:00 2016-07-19 23:03:26
Closed_By brianteeman
avatar brianteeman brianteeman - close - 19 Jul 2016
avatar dgt41
dgt41 - comment - 21 Jul 2016

@PhocaCz can you mark your test in issues.joomla.org so we can set #11097 as RTC?

avatar brianteeman brianteeman - change - 21 Jul 2016
Labels Added: ?

Add a Comment

Login with GitHub to post a comment