Permalink
Browse files

Merge remote-tracking branch 'upstream/master'

  • Loading branch information...
2 parents eb096e0 + af1d741 commit 238f9bd14fc9ea8f6af097a25b2db6b122b17a1a bharath committed Aug 22, 2012
@@ -85,9 +85,12 @@ Firebug.Activation = Obj.extend(Firebug.Module,
var hasAnnotation = Annotations.pageHasAnnotation(uri);
if (FBTrace.DBG_ACTIVATION)
- FBTrace.sysout("shouldCreateContext hasAnnotation "+hasAnnotation +
- " for "+uri.spec+" in "+browser.contentWindow.location +
- " using activateSameOrigin: "+Firebug.activateSameOrigin);
+ {
+ FBTrace.sysout("shouldCreateContext hasAnnotation " + hasAnnotation +
+ " for " + uri.spec + " in " +
+ (browser ? browser.contentWindow.location : "no browser") +
+ " using activateSameOrigin: " + Firebug.activateSameOrigin);
+ }
// Annotated, so return the value.
if (hasAnnotation)
@@ -97,9 +100,12 @@ Firebug.Activation = Obj.extend(Firebug.Module,
{
var dst = browser.FirebugLink.dst;
var dstURI = this.convertToURIKey(dst.spec, Firebug.activateSameOrigin);
+
if (FBTrace.DBG_ACTIVATION)
+ {
FBTrace.sysout("shouldCreateContext found FirebugLink pointing to " +
dstURI.spec, browser.FirebugLink);
+ }
if (dstURI && dstURI.equals(uri)) // and it matches us now
{
@@ -109,8 +115,10 @@ Firebug.Activation = Obj.extend(Firebug.Module,
if (srcURI)
{
if (FBTrace.DBG_ACTIVATION)
+ {
FBTrace.sysout("shouldCreateContext found FirebugLink pointing from " +
srcURI.spec, browser.FirebugLink);
+ }
// and it's on the same domain
if (srcURI.schemeIs("file") || (dstURI.host == srcURI.host))
@@ -1376,7 +1376,7 @@ var FirebugChrome =
var sidePanel = panelBar2.selectedPanel;
if (sidePanel)
- sidePanel.select(object);
+ sidePanel.refresh();
}
},
@@ -285,6 +285,7 @@ FirebugReps.Func = domplate(Firebug.Rep,
var monitored = scriptInfo ? FBS.fbs.isMonitored(scriptInfo.sourceFile.href,
scriptInfo.lineNo) : false;
+ var self = this;
var name = script ? StackFrame.getFunctionName(script, context) : fn.name;
return [
{
@@ -293,7 +294,11 @@ FirebugReps.Func = domplate(Firebug.Rep,
nol10n: true,
type: "checkbox",
checked: monitored,
- command: Obj.bindFixed(this.monitor, this, fn, monitored)
+ command: function()
+ {
+ var checked = this.hasAttribute("checked");
+ self.monitor(fn, !checked);
+ }
},
"-",
{
@@ -671,7 +676,7 @@ FirebugReps.Arr = domplate(Firebug.Rep,
highlightObject: function(object, context, target)
{
- // Highlighting huge amount of elements on the page can cause sericous performance
+ // Highlighting huge amount of elements on the page can cause serious performance
// problems (see issue 4736). So, avoid highlighting if the number of elements in
// the array exceeds specified limit.
var arr = this.getRealObject(object, context);
@@ -711,7 +716,7 @@ FirebugReps.Arr = domplate(Firebug.Rep,
else if (obj instanceof Ci.nsIDOMHistory)
return false;
// do this first to avoid exceptions
- else if (obj.toString() === "[xpconnect wrapped native prototype]")
+ else if (obj.toString && obj.toString() === "[xpconnect wrapped native prototype]")
return false;
else if (isFinite(obj.length) && typeof obj.splice === "function")
return true;
@@ -907,14 +912,12 @@ FirebugReps.Element = domplate(Firebug.Rep,
{
try
{
- return elt.getAttribute("class")
- ? ("." + elt.getAttribute("class").split(" ")[0])
- : "";
+ return elt.classList.length > 0 ? ("." + elt.classList[0]) : "";
}
catch (err)
{
+ return "";
}
- return "";
},
getValue: function(elt)
@@ -1109,7 +1112,6 @@ FirebugReps.Element = domplate(Firebug.Rep,
getContextMenuItems: function(elt, target, context)
{
var type;
- var monitored = EventMonitor.areEventsMonitored(elt, null, context);
var items = [];
if (Xml.isElementHTML(elt) || Xml.isElementXHTML(elt))
@@ -1175,9 +1177,12 @@ FirebugReps.Element = domplate(Firebug.Rep,
tooltiptext: "html.tip.Show_Events_In_Console",
id: "fbShowEventsInConsole",
type: "checkbox",
- checked: monitored,
- command: Obj.bindFixed(EventMonitor.toggleMonitorEvents,
- EventMonitor, elt, null, monitored, context)
+ checked: EventMonitor.areEventsMonitored(elt, null, context),
+ command: function()
+ {
+ var checked = this.hasAttribute("checked");
+ EventMonitor.toggleMonitorEvents(elt, null, !checked, context);
+ }
},
"-",
{
@@ -215,7 +215,7 @@ Firebug.TabContext.prototype =
// to iframes (documents), which can be already unloaded at this point.
// Removing listeners from such 'unloaded' documents (or window) can throw
// "TypeError: can't access dead object"
- // We should avoid these exceptions (event if they are not representing mem leaks)
+ // We should avoid these exceptions (even if they are not representing memory leaks)
this.unregisterAllListeners();
state.panelState = {};
@@ -294,8 +294,11 @@ Firebug.ConsolePanel.prototype = Obj.extend(Firebug.ActivablePanel,
type: "checkbox",
checked: strictValue,
tooltiptext: "console.option.tip.Show_Strict_Warnings",
- command: Obj.bindFixed(Options.setPref, Options,
- strictDomain, strictName, !strictValue)
+ command: function()
+ {
+ var checked = this.hasAttribute("checked");
+ Options.setPref(strictDomain, strictName, checked);
+ }
};
},
@@ -13,13 +13,17 @@ var MenuUtils =
{
optionMenu: function(context, label, tooltiptext, domain, option)
{
- var value = Options.getPref(domain, option);
+ var value = Options.getPref(domain, option), self = this;
return {
label: label,
tooltiptext: tooltiptext,
type: "checkbox",
checked: value,
- command: Obj.bindFixed(this.setPref, this, domain, option, !value)
+ command: function()
+ {
+ var checked = this.hasAttribute("checked");
+ self.setPref(domain, option, checked);
+ }
};
},
@@ -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)
@@ -1114,30 +1114,34 @@ Firebug.CSSStyleSheetPanel.prototype = Obj.extend(Firebug.Panel,
);
}
- if (this.infoTipType == "color")
- {
- items.push(
- {
- label: "CopyColor",
- tooltiptext: "css.tip.Copy_Color",
- command: Obj.bindFixed(System.copyToClipboard, System, this.infoTipObject)
- }
- );
- }
- else if (this.infoTipType == "image")
+ var propValue = Dom.getAncestorByClass(target, "cssPropValue");
+ if (propValue)
{
- items.push(
- {
- label: "CopyImageLocation",
- tooltiptext: "css.tip.Copy_Image_Location",
- command: Obj.bindFixed(System.copyToClipboard, System, this.infoTipObject)
- },
- {
- label: "OpenImageInNewTab",
- tooltiptext: "css.tip.Open_Image_In_New_Tab",
- command: Obj.bindFixed(Win.openNewTab, Win, this.infoTipObject)
- }
- );
+ if (this.infoTipType == "color")
+ {
+ items.push(
+ {
+ label: "CopyColor",
+ tooltiptext: "css.tip.Copy_Color",
+ command: Obj.bindFixed(System.copyToClipboard, System, this.infoTipObject)
+ }
+ );
+ }
+ else if (this.infoTipType == "image")
+ {
+ items.push(
+ {
+ label: "CopyImageLocation",
+ tooltiptext: "css.tip.Copy_Image_Location",
+ command: Obj.bindFixed(System.copyToClipboard, System, this.infoTipObject)
+ },
+ {
+ label: "OpenImageInNewTab",
+ tooltiptext: "css.tip.Open_Image_In_New_Tab",
+ command: Obj.bindFixed(Win.openNewTab, Win, this.infoTipObject)
+ }
+ );
+ }
}
if (!Url.isSystemStyleSheet(this.selection))
@@ -15,15 +15,14 @@ define([
"firebug/lib/dom",
"firebug/lib/css",
"firebug/lib/xpath",
- "firebug/lib/array",
"firebug/lib/fonts",
"firebug/lib/options",
"firebug/css/cssModule",
"firebug/css/cssPanel",
"firebug/chrome/menu"
],
function(Obj, Firebug, Firefox, Domplate, FirebugReps, Xpcom, Locale, Events, Url, Arr,
- SourceLink, Dom, Css, Xpath, Arr, Fonts, Options, CSSModule, CSSStyleSheetPanel, Menu) {
+ SourceLink, Dom, Css, Xpath, Fonts, Options, CSSModule, CSSStyleSheetPanel, Menu) {
with (Domplate) {
@@ -511,8 +510,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)
@@ -1308,6 +1308,13 @@ if (PrefLoader.getPref("allPagesActivation") == "on" || !PrefLoader.getPref("del
{
Firebug.GlobalUI.startFirebug(function()
{
+ var browser = Firebug.Firefox.getBrowserForWindow(this);
+ var uri = Firebug.Firefox.getCurrentURI();
+
+ // Open Firebug UI (e.g. if the annotations say so, issue 5623)
+ if (uri && Firebug.TabWatcher.shouldCreateContext(browser, uri.spec, null))
+ Firebug.toggleBar(true);
+
FBTrace.sysout("Firebug loaded by default since 'allPagesActivation' is on " +
"or 'delayLoad' is false");
});
@@ -346,6 +346,30 @@ Firebug.HTMLPanel.prototype = Obj.extend(WalkingPanel,
null : ["link", "script", "style"]);
},
+ updateNodeVisibility: function(node)
+ {
+ var wasHidden = node.classList.contains("nodeHidden");
+ if (!Xml.isVisible(node.repObject))
+ {
+ // Hide this node and, through CSS, every descendant.
+ node.classList.add("nodeHidden");
+ }
+ else if (wasHidden)
+ {
+ // The node has changed state from hidden to shown. While in the
+ // hidden state, some descendants may have been explicitly marked
+ // with .nodeHidden (not just through CSS inheritance), so we need
+ // to recheck the visibility of those.
+ node.classList.remove("nodeHidden");
+ var desc = Arr.cloneArray(node.getElementsByClassName("nodeHidden"));
+ for (var i = 0; i < desc.length; ++i)
+ {
+ if (Xml.isVisible(desc[i].repObject))
+ desc[i].classList.remove("nodeHidden");
+ }
+ }
+ },
+
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
getElementSourceText: function(node)
@@ -479,10 +503,7 @@ Firebug.HTMLPanel.prototype = Obj.extend(WalkingPanel,
if (!objectNodeBox)
return;
- if (Xml.isVisible(objectNodeBox.repObject))
- Css.removeClass(objectNodeBox, "nodeHidden");
- else
- Css.setClass(objectNodeBox, "nodeHidden");
+ this.updateNodeVisibility(objectNodeBox);
if (attrChange == MODIFICATION || attrChange == ADDITION)
{
@@ -1376,8 +1376,14 @@ Firebug.ScriptPanel.prototype = Obj.extend(Firebug.SourceBoxPanel,
optionMenu: function(label, option)
{
var checked = Firebug.Options.get(option);
- return {label: label, type: "checkbox", checked: checked,
- command: Obj.bindFixed(Firebug.Options.set, Firebug, option, !checked) };
+ return {
+ label: label, type: "checkbox", checked: checked,
+ command: function()
+ {
+ var checked = this.hasAttribute("checked");
+ Firebug.Options.set(option, checked)
+ }
+ };
},
getContextMenuItems: function(fn, target)
@@ -1970,4 +1976,4 @@ Firebug.registerPanel(Firebug.ScriptPanel);
return Firebug.ScriptPanel;
// ********************************************************************************************* //
-});
+});
Oops, something went wrong.

0 comments on commit 238f9bd

Please sign in to comment.