Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into issue5639
Browse files Browse the repository at this point in the history
  • Loading branch information
fflorent committed Aug 26, 2012
2 parents c802123 + aa8b8b1 commit e9bb01a
Show file tree
Hide file tree
Showing 57 changed files with 843 additions and 247 deletions.
4 changes: 4 additions & 0 deletions extension/bootstrap.js
Expand Up @@ -73,6 +73,7 @@ function startup(params, reason)

// GCLI commands
Cu.import("resource://firebug/gcli.js");
FirebugGCLICommands.startup();
}

function shutdown(params, reason)
Expand All @@ -94,6 +95,9 @@ function shutdown(params, reason)
Cu.reportError(e);
}

// Unregister all GCLI commands
FirebugGCLICommands.shutdown();

// xxxHonza: I think this shouldn't be here (perhaps in firebug-service.js)
// Shutdown Firebug's JSD debugger service.
var fbs = Cu.import("resource://firebug/firebug-service.js", {}).fbs;
Expand Down
2 changes: 1 addition & 1 deletion extension/content/firebug/branch.properties
@@ -1,5 +1,5 @@
# DO NOT MERGE INTO TRUNK
RELEASE=.0a0
RELEASE=.0a2
VERSION=1.11
TRUNK=
# To allow build.xml to drop the xpi directly into the svn working copy for getfirebug.com
Expand Down
14 changes: 11 additions & 3 deletions extension/content/firebug/chrome/activation.js
Expand Up @@ -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)
Expand All @@ -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
{
Expand All @@ -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))
Expand Down
10 changes: 6 additions & 4 deletions extension/content/firebug/chrome/chrome.js
Expand Up @@ -1376,7 +1376,7 @@ var FirebugChrome =

var sidePanel = panelBar2.selectedPanel;
if (sidePanel)
sidePanel.select(object);
sidePanel.refresh();
}
},

Expand Down Expand Up @@ -1511,9 +1511,11 @@ var FirebugChrome =
var realObject = rep ? rep.getRealObject(object, Firebug.currentContext) : null;
var realRep = realObject ? Firebug.getRep(realObject, Firebug.currentContext) : null;

if (FBTrace.DBG_OPTIONS)
FBTrace.sysout("chrome.onContextShowing object:"+object+" rep: "+rep+
" realObject: "+realObject+" realRep:"+realRep);
if (FBTrace.DBG_MENU)
{
FBTrace.sysout("chrome.onContextShowing object:"+object+", rep: "+rep+
", realObject: "+realObject+", realRep:"+realRep);
}

if (realObject && realRep)
{
Expand Down
30 changes: 22 additions & 8 deletions extension/content/firebug/chrome/menu.js
Expand Up @@ -4,9 +4,10 @@ define([
"firebug/lib/trace",
"firebug/lib/locale",
"firebug/lib/options",
"firebug/lib/css"
"firebug/lib/css",
"firebug/lib/deprecated"
],
function(FBTrace, Locale, Options, Css) {
function(FBTrace, Locale, Options, Css, Deprecated) {

// ********************************************************************************************* //
// Constants
Expand All @@ -30,7 +31,7 @@ Menu.createMenu = function(popup, label)

Menu.createMenuItem = function(popup, item, before)
{
if (typeof(item) == "string" && item.charAt(0) == "-")
if ((typeof(item) == "string" && item == "-") || item.label == "-")
return Menu.createMenuSeparator(popup, before);

var menuitem = popup.ownerDocument.createElement("menuitem");
Expand Down Expand Up @@ -116,17 +117,30 @@ Menu.createMenuHeader = function(popup, item)
return header;
};

Menu.createMenuSeparator = function(popup, before)
Menu.createMenuSeparator = function(popup, item, before)
{
if (item instanceof Node)
{
return Deprecated.deprecated("The function's header changed to "+
"createMenuSeparator(popup, item, before)",
Menu.createMenuSeparator, [popup, null, before])();
}

if (!popup.firstChild)
return;

var menuitem = popup.ownerDocument.createElement("menuseparator");
if (FBTrace.DBG_MENU)
FBTrace.sysout("createMenuSeparator", {popup: popup, item: item, before: before});

var menuItem = popup.ownerDocument.createElement("menuseparator");
if (item && item.id)
menuItem.setAttribute("id", item.id);

if (before)
popup.insertBefore(menuitem, before);
popup.insertBefore(menuItem, before);
else
popup.appendChild(menuitem);
return menuitem;
popup.appendChild(menuItem);
return menuItem;
};

/**
Expand Down
31 changes: 20 additions & 11 deletions extension/content/firebug/chrome/reps.js
Expand Up @@ -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 [
{
Expand All @@ -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);
}
},
"-",
{
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -1108,8 +1111,11 @@ FirebugReps.Element = domplate(Firebug.Rep,

getContextMenuItems: function(elt, target, context)
{
// XXX: Temporary fix for issue 5577.
if (Dom.getAncestorByClass(target, "cssElementRuleContainer"))
return;

var type;
var monitored = EventMonitor.areEventsMonitored(elt, null, context);
var items = [];

if (Xml.isElementHTML(elt) || Xml.isElementXHTML(elt))
Expand Down Expand Up @@ -1175,9 +1181,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);
}
},
"-",
{
Expand Down
2 changes: 1 addition & 1 deletion extension/content/firebug/chrome/tabContext.js
Expand Up @@ -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 = {};
Expand Down
32 changes: 14 additions & 18 deletions extension/content/firebug/console/commandHistory.js
Expand Up @@ -78,25 +78,21 @@ Firebug.CommandHistory = function()
var command;
var commandLine = Firebug.CommandLine.getCommandLine(context);

if (dir < 0)
{
if (commandPointer > 0)
commandPointer--;
}
else
{
if (commandPointer < commands.length)
commandPointer++;
}
commandPointer += dir;
if (commandPointer < 0)
commandPointer = 0;
else if (commandPointer > commands.length)
commandPointer = commands.length;

if (commandPointer < commands.length)
{
command = commands[commandPointer];
if (commandsPopup.state == "open")
{
var commandElements = commandsPopup.ownerDocument.getElementsByClassName(
"commandHistoryItem");
this.selectCommand(commandElements[commandPointer]);
var commandElement = commandsPopup.children[commandPointer];
this.selectCommand(commandElement);

Dom.scrollMenupopup(commandsPopup, commandElement);
}
}
else
Expand All @@ -119,7 +115,7 @@ Firebug.CommandHistory = function()
this.show = function(element)
{
if (this.isShown())
return this.hide;
return this.hide();

Dom.eraseNode(commandsPopup);

Expand All @@ -145,17 +141,16 @@ Firebug.CommandHistory = function()
commandsPopup.openPopup(element, "before_start", 0, 0, false, false);

// make sure last element is visible
var box = doc.getAnonymousNodes(commandsPopup)[0];
var scrollBox = doc.getAnonymousNodes(box)[1];
scrollBox.scrollTop = scrollBox.scrollHeight;
setTimeout(Dom.scrollMenupopup, 10, commandsPopup, hbox);
this.isOpen = true;

return true;
};

this.hide = function()
{
commandsPopup.hidePopup();

this.isOpen = false;
return true;
};

Expand Down Expand Up @@ -205,6 +200,7 @@ Firebug.CommandHistory = function()
{
Firebug.chrome.setGlobalAttribute("fbCommandLineHistoryButton", "checked", "false");
Firebug.chrome.setGlobalAttribute("fbCommandEditorHistoryButton", "checked", "false");
this.isOpen = false;
};
};

Expand Down
3 changes: 2 additions & 1 deletion extension/content/firebug/console/commandLine.js
Expand Up @@ -878,7 +878,8 @@ Firebug.CommandLine = Obj.extend(Firebug.Module,
this.commandHistory.hide();
return true;
}

if (this.commandHistory.isOpen && !event.metaKey && !event.ctrlKey && !event.altKey)
this.commandHistory.hide();
return false;
},

Expand Down
17 changes: 1 addition & 16 deletions extension/content/firebug/console/console.js
Expand Up @@ -13,6 +13,7 @@ define([
"firebug/chrome/searchBox",
"firebug/console/consolePanel",
"firebug/console/commandEditor",
"firebug/console/functionMonitor",
],
function(Obj, Firebug, Firefox, Events, Win, Search, Xml, Options) {

Expand Down Expand Up @@ -404,22 +405,6 @@ Firebug.Console = Obj.extend(ActivableConsole,
}
},

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Firebug.Debugger listener

onMonitorScript: function(context, frame)
{
Firebug.Console.log(frame, context);
},

onFunctionCall: function(context, frame, depth, calling)
{
if (calling)
Firebug.Console.openGroup([frame, "depth:"+depth], context);
else
Firebug.Console.closeGroup(context);
},

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// BTI

Expand Down
7 changes: 5 additions & 2 deletions extension/content/firebug/console/consolePanel.js
Expand Up @@ -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);
}
};
},

Expand Down
6 changes: 5 additions & 1 deletion extension/content/firebug/console/errors.js
Expand Up @@ -371,8 +371,12 @@ var Errors = Firebug.Errors = Obj.extend(Firebug.Module,
correctLineNumbersOnExceptions(object, error);
}

if (Firebug.showStackTrace && Firebug.errorStackTrace)
if (Firebug.errorStackTrace)
{
error.correctWithStackTrace(Firebug.errorStackTrace);
if (!Firebug.showStackTrace)
error.trace = null;
}

var msgId = lessTalkMoreAction(context, object, isWarning);
if (!msgId)
Expand Down

0 comments on commit e9bb01a

Please sign in to comment.