Bug 1554014 Comment 10 Edit History

Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.

I'm really not sure how to fix this while still following the spec, honestly, nor how the spec could be changed to make this demo work, given its Firefox-specific reliance on a fundamental thing browsers really do want to do on `document.open` (remove the event listeners from the `Window` involved) not happening.  We could add some sort of "is the active script TinyMCE, if so don't remove `DOMContentLoaded` listeners during `open()`" thing, I guess, but that's about all I can think of at the moment.

It looks like more recent versions of TinyMCE have already fixed this code, as comment 8 notes.  In particular, I tried grabbing some old versions from https://www.nuget.org/packages/TinyMCE and it looks like 3.4.4 has the `DOMContentLoaded` bits but 3.4.5 does not.  It looks like that code was trying to work around some issue in very old Firefox releases that is long-since fixed; TinyMCE 3.4.5 was released in September 2011, so it sounds like already by that point whatever issue it was wasn't present in any Firefox versions people were still using.

In terms of site fixes, the simplest is updating TinyMCE; an update to 3.4.5 or later should fix things.  If that's too much risk, the simplest possible change is to edit `tiny_mce.js` and move the `z.open()` call to above the `if (a && !v.readonly) {` block instead of coming right after it.  At least that's what the minifier is calling the variables on the demo site linked in comment 4.  In terms of the original script this corresponds to moving `d.open()` to right before the `if (isGecko && !s.readonly) {` block.  That would ensure that the event listener is added after the `open()` call and hence gets called.
I'm really not sure how to fix this while still following the spec, honestly, nor how the spec could be changed to make this demo work, given its Firefox-specific reliance on a fundamental thing browsers really do want to do on `document.open` (remove the event listeners from the `Window` involved) not happening.  We could add some sort of "is the active script TinyMCE, if so don't remove `DOMContentLoaded` listeners during `open()`" thing, I guess, but that's about all I can think of at the moment.

It looks like more recent versions of TinyMCE have already fixed this code, as comment 8 notes.  In particular, I tried grabbing some old versions from https://www.nuget.org/packages/TinyMCE and it looks like 3.4.4 has the `DOMContentLoaded` bits but 3.4.5 does not.  It looks like that code was trying to work around some issue in very old Firefox releases that is long-since fixed; TinyMCE 3.4.5 was released in September 2011, so it sounds like already by that point whatever issue it was wasn't present in any Firefox versions people were still using.

In terms of site fixes, the simplest is updating TinyMCE; an update to 3.4.5 or later should fix things.  If that's too much risk, the simplest possible change is to edit `tiny_mce.js` and move the `z.open()` call to above the `if (a && !v.readonly) {` block instead of coming right after it inside the `setupIframe` function.  At least that's what the minifier is calling the variables on the demo site linked in comment 4.  In terms of the original script this corresponds to moving `d.open()` to right before the `if (isGecko && !s.readonly) {` block.  That would ensure that the event listener is added after the `open()` call and hence gets called.

Back to Bug 1554014 Comment 10