JavaScript error while entering text in the Content Editor Web Part

While working on a project for one of our customers, we have stumbled on a quite odd error. While editing text in the Content Editor Web Part (CEWP) we got a JavaScript error on each key press.

As we have customized the SharePoint Rich Text Editor (RTE) by adding additional buttons and assets, I suspected our own extensions to be the reason of the error at first. Unfortunately, after removing the customization, the error persisted.

The error itself was quite odd: we got it while using the Content Editor Web Part only. While editing content using exactly the same RTE as a Rich HTML control there was no error. Furthermore, we received the error in the test environment only. Our development machines didn't show up any error at all!

After debugging the RTE2PUEditor.aspx page - the asset responsible of creating the instance of the RTE editor for the CEWP I have found out that it references multiple JavaScript files. After comparing these files to the one from our dev machines, I have found out that one of them - LAYOUTS\1033\BFORM.JS was different. After replacing it with the one from our development environment, the JavaScript error disappeared.

Looking at the reason of the error and the differences between the bform.js files we have found out that it has to have something to do with different SharePoint installs we we using. While we still use the updated RTM on our development machines, we have used the slipstreamed SP1 version of SharePoint on the test environment.

Update April 16, 2008:

Replacing the BFORM.JS only doesn't solve the whole issue. While editing the content using the RTE in the Edit Form, SharePoint keeps throwing the error on each key press. In order to fix it, you have to replace the LAYOUTS\1033\FORM.JS as well.