Start For Free
 

Important Note: Please read the post about version 4.4.3 and 3.3.6. The fix described below introduces other problems and we recommend skipping these versions and upgrading to 4.4.3 and 3.3.6 instead. Also, if you applied the manual JavaScript fix, we urge you to remove it from your index.html

Firefox 18 introduces a new Javascript engine called IonMonkey. The creators claim that performance is enhanced, but that is not what this post is about. Mendix applications with complicated forms can run into a “too much recursion” error and start behaving unpredictably. Apparently at Firefox they are not aware that there is no such thing as too much recursion.

XKCD comic about recursion in tabletop roleplaying

(source: http://xkcd.com/244/ )

Earlier versions of Firefox and other browsers do not have this problem and we hope that Mozilla will fix this bug in a later release. Until they do we can provide you with a workaround. It is a tiny bit of Javascript that needs to be executed after the Mendix client is loaded in index.html. This patch works for Mendix versions 2.5.0 all the way up to 4.3.2. Here is the code:

<script>(function(){mendix.lang._seqCounter=0,mendix.lang.sequence=mendix.lang.runActions=mendix.lang.runBindActions=function(e,t,n){if(t instanceof Array){var r=e;e=t,t=n,n=r}t&&typeof t=="object"&&(n=t,t=null);if(e instanceof Array){var i=function(){var r=e.length;if(r!=0){var s=e.shift(),o=function(){typeof s=="function"?s.call(n,i):typeof n[s]=="function"?n[s](i):(logger.error("mendix.lang.sequence: function missing in scope: "+s),i())};mendix.lang._seqCounter++%10==0?setTimeout(o,0):o()}else typeof t=="function"&&t.call(n)};i()}else logger.error("mendix.lang.sequence: sequence is not an array, trying to call end"),typeof t=="function"&&t.call(n)}})(); </script>

Copy this long line of code and paste it after the loading of the Mendix client. The line that loads the client looks like this:

<script type="text/javascript" src="mxclientsystem/mxui/mxui.js"></script>
INSERT PATCH HERE

or this:

<script type="text/javascript" src="mxclientsystem/mendix/mendix.js"></script>
INSERT PATCH HERE

If your application has a custom theme, you might already have a copy of index.html in your theme directory. In this case, you add the patch to that index.html after the loading of the Mendix client. A zipped theme has to be unzipped, patched and then zipped again.

If you are still using the original index.html, you will have to copy it from the ‘deployment\web’ directory to your theme directory and then patch that copy. When you deploy your application, the patched index.html will overwrite the original index.html.

This fix will also be integrated into versions 4.4.0 and 3.3.4 that we are currently working on. Once you switch to either of those versions, you can get rid of this manual patch again.

Many thanks to our partner FlowFabric for reporting this and helping us diagnose the problem!

Connect With Us

Popular Articles