Skip to content

Commit

Permalink
Issue 5654: Style side panel doesn't display CSS rules after reload
Browse files Browse the repository at this point in the history
  • Loading branch information
janodvarko committed Aug 29, 2012
1 parent ac22aae commit 7ad441f
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 deletions.
14 changes: 11 additions & 3 deletions extension/content/firebug/css/cssModule.js
Expand Up @@ -192,7 +192,7 @@ Firebug.CSSModule = Obj.extend(Obj.extend(Firebug.Module, Firebug.EditorSelector
cleanupSheets: function(doc, context)
{
if (!context)
return;
return false;

// Due to the manner in which the layout engine handles multiple
// references to the same sheet we need to kick it a little bit.
Expand Down Expand Up @@ -220,6 +220,8 @@ Firebug.CSSModule = Obj.extend(Obj.extend(Firebug.Module, Firebug.EditorSelector
}
}*/

var result = true;

// https://bugzilla.mozilla.org/show_bug.cgi?id=500365
// This voodoo touches each style sheet to force some Firefox internal change
// to allow edits.
Expand All @@ -238,11 +240,17 @@ Firebug.CSSModule = Obj.extend(Obj.extend(Firebug.Module, Firebug.EditorSelector
}
catch(e)
{
result = false;

if (FBTrace.DBG_ERRORS)
FBTrace.sysout("css.show: sheet.cssRules FAILS for "+
(styleSheets[i]?styleSheets[i].href:"null sheet")+e, e);
FBTrace.sysout("css.show: sheet.cssRules FAILS for " +
(styleSheets[i] ? styleSheets[i].href : "null sheet") + e, e);
}
}

// Return true only if all stylesheets are fully loaded and there is no
// excpetion when accessing them.
return result;
},

cleanupSheetHandler: function(event, context)
Expand Down
12 changes: 11 additions & 1 deletion extension/content/firebug/css/stylePanel.js
Expand Up @@ -511,8 +511,18 @@ CSSStylePanel.prototype = Obj.extend(CSSStyleSheetPanel.prototype,

updateView: function(element)
{
CSSModule.cleanupSheets(element.ownerDocument, Firebug.currentContext);
var result = CSSModule.cleanupSheets(element.ownerDocument, Firebug.currentContext);

// If cleanupSheets returns false there was an exception thrown when accessing
// a styleshet (probably since it isn't fully loaded yet). So, delay the panel
// update and try it again a bit later (issue 5654).
if (!result)
{
this.context.setTimeout(Obj.bindFixed(this.updateView, this, element), 200);
return;
}

// All stylesheets should be ready now, update the view.
this.updateCascadeView(element);

if (Dom.domUtils)
Expand Down

0 comments on commit 7ad441f

Please sign in to comment.