Fixed bug #9472: htmlArea RTE: Safari may crash when the RTE closes
authorStanislas Rolland <typo3@sjbr.ca>
Thu, 2 Oct 2008 21:31:57 +0000 (21:31 +0000)
committerStanislas Rolland <typo3@sjbr.ca>
Thu, 2 Oct 2008 21:31:57 +0000 (21:31 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@4276 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
typo3/sysext/rtehtmlarea/ChangeLog
typo3/sysext/rtehtmlarea/htmlarea/htmlarea.js

index cc35e2c..587f31e 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,7 @@
 2008-10-02  Stanislas Rolland  <typo3@sjbr.ca>
 
        * Fixed bug #9444: htmlArea RTE: Incorrect assigment of class to one line <ol> in Firefox
+       * Fixed bug #9472: htmlArea RTE: Safari may crash when the RTE closes
 
 2008-10-01  Stanislas Rolland  <typo3@sjbr.ca>
 
index f133c69..b7c84b8 100644 (file)
@@ -1,6 +1,7 @@
 2008-10-02  Stanislas Rolland  <typo3@sjbr.ca>
 
        * Fixed bug #9444: htmlArea RTE: Incorrect assigment of class to one line <ol> in Firefox
+       * Fixed bug #9472: htmlArea RTE: Safari may crash when the RTE closes
 
 2008-10-01  Stanislas Rolland  <typo3@sjbr.ca>
 
index 9afc786..a8f553a 100644 (file)
@@ -2077,7 +2077,9 @@ HTMLArea._eventCacheConstructor = function() {
  * Register an event
  */
 HTMLArea._addEvent = function(el,evname,func,useCapture) {
-       if (typeof(useCapture) == "undefined") var useCapture = false;
+       if (typeof(useCapture) == "undefined") {
+               var useCapture = false;
+       }
        if (HTMLArea.is_gecko) {
                el.addEventListener(evname, func, !HTMLArea.is_opera || useCapture);
        } else {
@@ -2090,7 +2092,9 @@ HTMLArea._addEvent = function(el,evname,func,useCapture) {
  * Register a list of events
  */
 HTMLArea._addEvents = function(el,evs,func,useCapture) {
-       if (typeof(useCapture) == "undefined") var useCapture = false;
+       if (typeof(useCapture) == "undefined") {
+               var useCapture = false;
+       }
        for (var i = evs.length; --i >= 0;) {
                HTMLArea._addEvent(el,evs[i], func, useCapture);
        }
@@ -2100,10 +2104,18 @@ HTMLArea._addEvents = function(el,evs,func,useCapture) {
  * Remove an event listener
  */
 HTMLArea._removeEvent = function(el,evname,func) {
-       if(HTMLArea.is_gecko) {
-               try { el.removeEventListener(evname, func, true); el.removeEventListener(evname, func, false); } catch(e) { }
+       if (HTMLArea.is_gecko) {
+                       // Avoid Safari 3.1.2 crashes when removing events from orphan windows or frames
+               if (HTMLArea.is_safari && !HTMLArea.is_chrome && el.document && !el.parent) {
+                       try {
+                               el.removeEventListener(evname, func, true);
+                               el.removeEventListener(evname, func, false);
+                       } catch(e) { }
+               }
        } else {
-               try { el.detachEvent("on" + evname, func); } catch(e) { }
+               try {
+                       el.detachEvent("on" + evname, func);
+               } catch(e) { }
        }
 };
 
@@ -3587,6 +3599,10 @@ HTMLArea.Dialog = HTMLArea.Base.extend({
                                        this.dialogWindow.blur();
                                }
                                this.dialogWindow.close();
+                                       // Safari 3.1.2 does not set the closed flag
+                               if (!this.dialogWindow.closed) {
+                                       this.dialogWindow = null;
+                               }
                        }
                                // Opera unload event may be triggered after the editor iframe is gone
                        if (this.plugin.editor._iframe) {