You are not logged in.

#1 2006-07-14 17:08:56

augustash
Member
Registered: 2006-07-13
Posts: 3

Spellchecker Crash Firefox Fix

I commented on the http://sourceforge.net/tracker/index.ph … tid=635682 a little while ago.  However I know some do not check that and are looking for a quick mention.  This is more of a hack than anything but it does make firefox not crash.

Open up the editor_plugin_src.js for the spellchecker module.  under the execCommand function within the switch statement find case "mceSpellCheck":
On the bottom of this case there is a few lines. 

Change:

Code:

                    tinyMCE.switchClass(editor_id + '_spellchecker', 'mceMenuButtonSelected');
                    self._sendAjax(self.baseURL + "/tinyspell.php", self._ajaxResponse, 'post', args);

To:

Code:

                    tinyMCE.switchClass(editor_id + '_spellchecker', 'mceMenuButtonSelected');
                    alert('Please wait while we finish spell checking your document.');
                    self._sendAjax(self.baseURL + "/tinyspell.php", self._ajaxResponse, 'post', args);

Offline

 

#2 2006-07-18 19:28:26

maddogv6
Member
Registered: 2006-06-27
Posts: 9

Re: Spellchecker Crash Firefox Fix

I applied the above changes as recommended by augustash.  It didnt work.  Then I put the changes into editor_plugin.js.  Worked like a charm, however it is not a clean solution, but a hack as stated.  It will do for now.  However, I changed the code a little to show alert only on non-IE browsers
if (!tinyMCE.isMSIE) {alert('Initializing spell checker.  Click OK to continue.');}

A lil more input on this issue.  I have Firefox 1.5.0.4 on Windows XP.  I get the Firefox crash using the following simple example.

Code:

<html>
    <head>
        <title>TinyMCE Test 2</title>
        <script language="javascript" type="text/javascript" src="jscripts/tiny_mce/tiny_mce.js"></script>
        <script language="javascript" type="text/javascript">
            tinyMCE.init({
                mode : "textareas",
                plugins : "spellchecker",
                theme : "advanced",
                theme_advanced_buttons1 : "spellchecker"
            });
        </script>
    </head>
    <body>
        <form method="post">
            <TABLE>
                <tr>
                    <td>
                        <TEXTAREA id="elm2" name="textarea1" rows="25" cols="75"></TEXTAREA>
                    </td>
                </tr>
            </TABLE>
        </form>
    </body>
</html>

However, if I remove the TABLE tags surrounding the textarea, the code works just fine.  So it is an issue with TinyMCE enabled textareas embedded inside a HTML Table.  Hope this helps the developer.

Last edited by maddogv6 (2006-07-19 01:25:33)

Offline

 

#3 2006-07-26 00:38:10

iMarc
Member
Registered: 2006-07-26
Posts: 2

Re: Spellchecker Crash Firefox Fix

I've noticed the issue seems to be related to the object in focus.  If I put text in the TinyMCE editor, then click the spell check, Firefox crashes.  If I put text in the text editor, then click on a text box, then go back and click on the spellcheck button, the spellcheck works fine.

Perhaps you could change the JS code to take focus away from the editor then put it back.  It's still a hack but at least that would eliminate the need for the user to deal with the alert box.

Offline

 

#4 2006-07-28 01:48:13

rpetersen
Member
Registered: 2006-07-28
Posts: 3

Re: Spellchecker Crash Firefox Fix

I noticed the same thing that iMarc did, that if the editor has focus the problem happens but if it doesn't then all goes well.  I suspect that the reason the alert() hack works is because it is taking the focus away from the editor.  So rather than use the alert() in the location suggested by augustash I blur() the editor. So I change

Code:

tinyMCE.switchClass(editor_id + '_spellchecker', 'mceMenuButtonSelected');
self._sendAjax(self.baseURL + "/tinyspell.jsp", self._ajaxResponse, 'post', args);

to

Code:

tinyMCE.switchClass(editor_id + '_spellchecker', 'mceMenuButtonSelected');
inst.getBody().blur();
self._sendAjax(self.baseURL + "/tinyspell.jsp", self._ajaxResponse, 'post', args);

Thus far it appears to be working and not require user interaction.  P.S. You'll note in this I'm calling tinyspell.JSP rather than PHP, I've made a JSP version of the spellchecker, it currently only works with aspell, but I am working on the Google API.

Last edited by rpetersen (2006-07-28 07:08:41)

Offline

 

#5 2006-08-02 12:17:50

WyriHaximus
Member
Registered: 2006-02-25
Posts: 16

Re: Spellchecker Crash Firefox Fix

rpetersen wrote:

I noticed the same thing that iMarc did, that if the editor has focus the problem happens but if it doesn't then all goes well.  I suspect that the reason the alert() hack works is because it is taking the focus away from the editor.  So rather than use the alert() in the location suggested by augustash I blur() the editor. So I change

Code:

tinyMCE.switchClass(editor_id + '_spellchecker', 'mceMenuButtonSelected');
self._sendAjax(self.baseURL + "/tinyspell.jsp", self._ajaxResponse, 'post', args);

to

Code:

tinyMCE.switchClass(editor_id + '_spellchecker', 'mceMenuButtonSelected');
inst.getBody().blur();
self._sendAjax(self.baseURL + "/tinyspell.jsp", self._ajaxResponse, 'post', args);

Thus far it appears to be working and not require user interaction.  P.S. You'll note in this I'm calling tinyspell.JSP rather than PHP, I've made a JSP version of the spellchecker, it currently only works with aspell, but I am working on the Google API.

Great thank you for this fix. I came across this problem yesterday and it seems only affect the windows FF. A friend tested it for me on MAC and it worked fine there, didn't have time yet to try it with linux.

Offline

 

#6 2006-08-02 18:21:54

rpetersen
Member
Registered: 2006-07-28
Posts: 3

Re: Spellchecker Crash Firefox Fix

I develope on Linux and never saw the problem until I started testing on FF under windows.  That said the fix doesn't appear to have adverse effects under the platforms that don't have the bug.

Offline

 

#7 2006-09-21 03:36:31

stever
Member
Registered: 2005-07-12
Posts: 7

Re: Spellchecker Crash Firefox Fix

This fix has the problem that it often sends the window behind others. Instead change to:

Code:

inst.getBody().focus();

This works perfectly, and prevents the crash without moving the window around.

I think FF doesn't know what is focused at the time, thus the crash. This is why you can either blur or focus to fix it. But in this case, focus works best.

BTW: This is a security flaw with FF. Shouldn't someone inform them before someone learns to do code injection?

Offline

 

#8 2006-09-27 20:01:57

Peter
Member
Registered: 2006-03-08
Posts: 29

Re: Spellchecker Crash Firefox Fix

I have experienced the same problem, but this fix does not solve the problem for me.

I have found some other reasons. Perhaps you can confirm my results.

Bug concerning getBookmark()

Offline

 

#9 2006-12-26 21:52:50

sflitman
Member
From: Phoenix, Arizona, USA
Registered: 2006-12-25
Posts: 7
Website

Re: Spellchecker Crash Firefox Fix

This is the fix that works in FF 1.5.0.9

if (!tinyMCE.isMSIE) inst.getBody().blur()

Using focus() leads directly to the crash.   

Thanks for your help, rpetersen!

Steve

Offline

 

#10 2007-03-23 22:53:10

tripwater
Member
Registered: 2007-03-22
Posts: 30

Re: Spellchecker Crash Firefox Fix

Hey guys,

I have tried inst.getBody().blur(); as well as inst.getBody().focus(); and finally I tried


if (!tinyMCE.isMSIE) inst.getBody().blur()

FF 1.5.0.11 still crashes when I hit the spellcheck button. I tried changing focus to the drop list on the page then coming back to teh spellcheck and every combo crashes FF.

Not sure what else to do. At the same time, in IE it does not find any misspellings...I am at a loss

THanks for any help with this

Test page

Last edited by tripwater (2007-03-23 22:56:41)

Offline

 

#11 2007-03-26 15:45:03

tripwater
Member
Registered: 2007-03-22
Posts: 30

Re: Spellchecker Crash Firefox Fix

No ideas?

I have ASPELL and PSPELL on my server.

Last edited by tripwater (2007-03-26 15:50:01)

Offline

 

#12 2007-03-26 17:51:11

Kalyse
Member
Registered: 2007-03-24
Posts: 12

Re: Spellchecker Crash Firefox Fix

Great fix!

I like the blur fix,

Offline

 

#13 2007-03-26 17:54:21

tripwater
Member
Registered: 2007-03-22
Posts: 30

Re: Spellchecker Crash Firefox Fix

So, I wonder why it is working for you and not me...

Offline

 

#14 2007-03-27 18:16:33

tripwater
Member
Registered: 2007-03-22
Posts: 30

Re: Spellchecker Crash Firefox Fix

The thing that is killing me is I have it working perfectly on another server. THe only difference I am aware of is the other server I am going to a subdomain in the site and using https

But I have no idea if this is the reason or not for my issues. But I have curl, Pspell, aspell compiled in php and nothing is working. Right now, I went back to0 the google solution because someone in another post said they got it working for them but my problem still exists. FF crashes no matter what and IE says 'No misspellings found'

Offline

 

#15 2007-04-05 23:26:51

tripwater
Member
Registered: 2007-03-22
Posts: 30

Re: Spellchecker Crash Firefox Fix

Anyone got ideas on this? I still do not have a solution.

THanks

Offline

 

#16 2007-06-07 13:49:55

bah2002us
Member
Registered: 2007-06-07
Posts: 2

Re: Spellchecker Crash Firefox Fix

Code:

    
The following code is in the editor_plugin.js file in the spellchecker plugin folder

    /**
     * Perform AJAX call.
     *
     * @param {string} u URL of AJAX service.
     * @param {function} f Function to call when response arrives.
     * @param {string} m Request method post or get.
     * @param {Array} a Array with arguments to send.
     */
    _sendAjax : function(u, f, m, a) {
        var x = TinyMCE_SpellCheckerPlugin._getAjaxHTTP();

        x.open(m, u, true);

        x.onreadystatechange = function() {
            if (x.readyState == 4)
                f(x.responseXML, x.responseText);
        };

        if (m == 'post')
            x.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');

        x.send(a);
    }

in the above function area change the following line to the following:
from:

Code:

var x = TinyMCE_SpellCheckerPlugin._getAjaxHTTP();

to:

Code:

var x = '';
x = TinyMCE_SpellCheckerPlugin._getAjaxHTTP();

that should take care of the firefox crash that many people have when they click on the spellchecker button.
hope it helps.

Offline

 

#17 2007-09-19 12:16:39

eck
Member
Registered: 2007-09-12
Posts: 4

Re: Spellchecker Crash Firefox Fix

I had the same problem with TinyMCE sending data with AJAX.

The blur method works very well, but be sure you get the active editor before blurring.

inst = tinyMCE.selectedInstance;
inst.getBody().blur();

Offline

 

#18 2007-09-19 13:25:22

spocke
Administrator
From: Sweden, Skellefteċ
Registered: 2004-11-25
Posts: 11436
Website

Re: Spellchecker Crash Firefox Fix

Have you upgraded to the latest version, the 1.0.5 release fixed some crash issue with FF.

http://tinymce.moxiecode.com/punbb/view … hp?id=7183


Best regards,
Spocke - Main developer of TinyMCE

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2008 PunBB