Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Issue 5654: Style side panel doesn't display CSS rules after reload

  • Loading branch information...
commit 67cd674bb61be631d9b9dbf59468fdf8f8d0975f 1 parent b9f692e
Jan Odvarko authored August 22, 2012
14  extension/content/firebug/css/cssModule.js
@@ -192,7 +192,7 @@ Firebug.CSSModule = Obj.extend(Obj.extend(Firebug.Module, Firebug.EditorSelector
192 192
     cleanupSheets: function(doc, context)
193 193
     {
194 194
         if (!context)
195  
-            return;
  195
+            return false;
196 196
 
197 197
         // Due to the manner in which the layout engine handles multiple
198 198
         // references to the same sheet we need to kick it a little bit.
@@ -220,6 +220,8 @@ Firebug.CSSModule = Obj.extend(Obj.extend(Firebug.Module, Firebug.EditorSelector
220 220
             }
221 221
         }*/
222 222
 
  223
+        var result = true;
  224
+
223 225
         // https://bugzilla.mozilla.org/show_bug.cgi?id=500365
224 226
         // This voodoo touches each style sheet to force some Firefox internal change
225 227
         // to allow edits.
@@ -238,11 +240,17 @@ Firebug.CSSModule = Obj.extend(Obj.extend(Firebug.Module, Firebug.EditorSelector
238 240
             }
239 241
             catch(e)
240 242
             {
  243
+                result = false;
  244
+
241 245
                 if (FBTrace.DBG_ERRORS)
242  
-                    FBTrace.sysout("css.show: sheet.cssRules FAILS for "+
243  
-                        (styleSheets[i]?styleSheets[i].href:"null sheet")+e, e);
  246
+                    FBTrace.sysout("css.show: sheet.cssRules FAILS for " +
  247
+                        (styleSheets[i] ? styleSheets[i].href : "null sheet") + e, e);
244 248
             }
245 249
         }
  250
+
  251
+        // Return true only if all stylesheets are fully loaded and there is no
  252
+        // excpetion when accessing them.
  253
+        return result;
246 254
     },
247 255
 
248 256
     cleanupSheetHandler: function(event, context)
12  extension/content/firebug/css/stylePanel.js
@@ -510,8 +510,18 @@ CSSStylePanel.prototype = Obj.extend(CSSStyleSheetPanel.prototype,
510 510
 
511 511
     updateView: function(element)
512 512
     {
513  
-        CSSModule.cleanupSheets(element.ownerDocument, Firebug.currentContext);
  513
+        var result = CSSModule.cleanupSheets(element.ownerDocument, Firebug.currentContext);
514 514
 
  515
+        // If cleanupSheets returns false there was an exception thrown when accessing
  516
+        // a styleshet (probably since it isn't fully loaded yet). So, delay the panel
  517
+        // update and try it again a bit later (issue 5654).
  518
+        if (!result)
  519
+        {
  520
+            this.context.setTimeout(Obj.bindFixed(this.updateView, this, element), 200);
  521
+            return;
  522
+        }
  523
+
  524
+        // All stylesheets should be ready now, update the view.
515 525
         this.updateCascadeView(element);
516 526
 
517 527
         if (Dom.domUtils)

0 notes on commit 67cd674

Please sign in to comment.
Something went wrong with that request. Please try again.