Hi all,
I was uploading a document of about 10 MB doc in FCKeditor v 2.4.3 from server. In IE it works fine but for the Firefox v>2.0 , I was getting this strange bug "script stack space quota is exhausted" . Thought It was inherent firefox problem, but why did FCKeditor caused it ?
After reading the code and having some inline tests , I found that the following code in FCKeditor start function caused this problem,
Here the regex match for stripping the before body and after body elements is the main problem which makes the firefox browser to run out of the memory for large documents.
I replaced the regex match with indexOf to find out start and end of the body tags and stripped it , it solved this problem.
Here is the fixed code.
I don't see a fix for this in the future versions also , Is this fixed in CKEditor3.0 ?
Thanks
I was uploading a document of about 10 MB doc in FCKeditor v 2.4.3 from server. In IE it works fine but for the Firefox v>2.0 , I was getting this strange bug "script stack space quota is exhausted" . Thought It was inherent firefox problem, but why did FCKeditor caused it ?
After reading the code and having some inline tests , I found that the following code in FCKeditor start function caused this problem,
/* Buggy regex match for body contents*/ /* Results in "script stack space quota is exhausted" for large documents*/ var G=A.match(FCKRegexLib.BeforeBody); var H=A.match(FCKRegexLib.AfterBody); if (G&&H){ var I=A.substr(G[1].length,A.length-G[1].length-H[1].length); A=G[1]+' '+H[1]; if (FCKBrowserInfo.IsGecko&&(I.length==0||FCKRegexLib.EmptyParagraph.test(I))) I='<br type="_moz">'; this._BodyHTML=I; }else this._BodyHTML=A; };
Here the regex match for stripping the before body and after body elements is the main problem which makes the firefox browser to run out of the memory for large documents.
I replaced the regex match with indexOf to find out start and end of the body tags and stripped it , it solved this problem.
Here is the fixed code.
/*fixed the memory problem using indexOf in mozilla browsers*/ if (FCKBrowserInfo.IsIE) A=A.replace(/(<base[^>]*?)\s*\/?>(?!\s*<\/base>)/gi,'$1></base>'); else if (!B){ var G=A.indexOf("<body>"); var H=A.indexOf("</body>"); if (G!=-1&&H!=-1){ var I=A.substr(G,H); //A=G[1]+' '+H[1]; if (FCKBrowserInfo.IsGecko&&(I.length==0||FCKRegexLib.EmptyParagraph.test(I))) I='<br type="_moz">'; this._BodyHTML=I; }else this._BodyHTML=A; };
I don't see a fix for this in the future versions also , Is this fixed in CKEditor3.0 ?
Thanks
Re: Firefox "script stack space quota is exhausted" fi
Thanks for the fix. I've opened a ticket for it:
http://dev.fckeditor.net/ticket/4212
You may CC yourself there, so you get notification on changes to it.
Frederico Knabben
CKEditor Project Lead and CKSource Owner
--
Follow us on: Twitter | Facebook | Google+ | LinkedIn
Re: Firefox "script stack space quota is exhausted" fi
Works like a charm in FCKedeitor 2.6.6
Thanx very much Mehmoodz