Fixed bug #14887: htmlArea RTE: RTE may be started before style sheets are loaded
authorStanislas Rolland <typo3@sjbr.ca>
Sun, 27 Jun 2010 23:12:24 +0000 (23:12 +0000)
committerStanislas Rolland <typo3@sjbr.ca>
Sun, 27 Jun 2010 23:12:24 +0000 (23:12 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@8069 709f56b5-9817-0410-a4d7-c38de5d9e867

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

index c9dcf88..d49bf57 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,7 @@
 2010-06-27  Stanislas Rolland  <typo3@sjbr.ca>
 
        * Fixed bug #14886: htmlArea RTE: Incorrect function scope when error is raised
+       * Fixed bug #14887: htmlArea RTE: RTE may be started before style sheets are loaded
 
 2010-06-26  Stanislas Rolland  <typo3@sjbr.ca>
 
index e28a744..e42f1ff 100644 (file)
@@ -1,6 +1,7 @@
 2010-06-27  Stanislas Rolland  <typo3@sjbr.ca>
 
        * Fixed bug #14886: htmlArea RTE: Incorrect function scope when error is raised
+       * Fixed bug #14887: htmlArea RTE: RTE may be started before style sheets are loaded
 
 2010-06-26  Stanislas Rolland  <typo3@sjbr.ca>
 
index 7bbf1e2..16698d7 100644 (file)
@@ -966,14 +966,26 @@ HTMLArea.Iframe = Ext.extend(Ext.BoxComponent, {
                if (Ext.isOpera) {
                        if (this.document.readyState != 'complete') {
                                stylesAreLoaded = false;
-                               errorText = 'Stylesheets not yet loaded';
+                               errorText = 'Document.readyState not complete';
                        }
                } else {
-                       Ext.each(this.document.styleSheets, function (styleSheet) {
-                               if (!Ext.isIE) try { rules = styleSheet.cssRules; } catch(e) { stylesAreLoaded = false; errorText = e; }
-                               if (Ext.isIE) try { rules = styleSheet.rules; } catch(e) { stylesAreLoaded = false; errorText = e; }
-                               if (Ext.isIE) try { rules = styleSheet.imports; } catch(e) { stylesAreLoaded = false; errorText = e; }
-                       });
+                               // Test if the styleSheets array is at all accessible
+                       if (Ext.isIE) {
+                               try { rules = this.document.styleSheets[0].rules; } catch(e) { stylesAreLoaded = false; errorText = e; }
+                       } else {
+                               try { rules = this.document.styleSheets[0].cssRules; } catch(e) { stylesAreLoaded = false; errorText = e; }
+                       }
+                               // Then test if all stylesheets are accessible
+                       if (stylesAreLoaded) {
+                               Ext.each(this.document.styleSheets, function (styleSheet) {
+                                       if (Ext.isIE) {
+                                               try { rules = styleSheet.rules; } catch(e) { stylesAreLoaded = false; errorText = e; return false; }
+                                               try { rules = styleSheet.imports; } catch(e) { stylesAreLoaded = false; errorText = e; return false; }
+                                       } else {
+                                               try { rules = styleSheet.cssRules; } catch(e) { stylesAreLoaded = false; errorText = e; return false; }
+                                       }
+                               });
+                       }
                }
                if (!stylesAreLoaded) {
                        this.getStyleSheets.defer(100, this);