diff --git a/extension/content/firebug/css/cssModule.js b/extension/content/firebug/css/cssModule.js index 7e7dca595e..ee157b51f0 100644 --- a/extension/content/firebug/css/cssModule.js +++ b/extension/content/firebug/css/cssModule.js @@ -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. @@ -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. @@ -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) diff --git a/extension/content/firebug/css/stylePanel.js b/extension/content/firebug/css/stylePanel.js index 8cf722a97f..f0c19f5966 100644 --- a/extension/content/firebug/css/stylePanel.js +++ b/extension/content/firebug/css/stylePanel.js @@ -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)