Permalink
Browse files

Merge branch 'master' of https://github.com/firebug/firebug into issu…

…e4979
  • Loading branch information...
2 parents f00b7e2 + 0ebb7ea commit 95871de32bf2e411da1bd5e46ac940e8af267973 @SebastianZ SebastianZ committed May 19, 2013
@@ -229,7 +229,7 @@ var PerfInfoTip = domplate(Firebug.Rep,
render: function(timing, parentNode)
{
- var infoTip = Firebug.NetMonitor.TimeInfoTip.tableTag.replace({}, parentNode);
+ var infoTip = PerfInfoTip.tableTag.replace({}, parentNode);
// Insert top description.
this.separatorTag.insertRows({label: Locale.$STR("perftiming.bars.label")},
@@ -23,6 +23,7 @@ define([
"firebug/net/netUtils",
"firebug/net/netProgress",
"firebug/css/cssReps",
+ "firebug/net/timeInfoTip",
"firebug/js/breakpoint",
"firebug/net/xmlViewer",
"firebug/net/svgViewer",
@@ -37,7 +38,7 @@ define([
],
function(Obj, Firebug, Firefox, Domplate, Xpcom, Locale,
Events, Options, Url, SourceLink, Http, Css, Dom, Win, Search, Str,
- Arr, System, Menu, NetUtils, NetProgress, CSSInfoTip) {
+ Arr, System, Menu, NetUtils, NetProgress, CSSInfoTip, TimeInfoTip) {
with (Domplate) {
@@ -55,7 +56,7 @@ var NetRequestEntry = Firebug.NetMonitor.NetRequestEntry;
// ********************************************************************************************* //
/**
- * @panel Represents a Firebug panel that displayes info about HTTP activity associated with
+ * @panel Represents a Firebug panel that displays info about HTTP activity associated with
* the current page. This class is derived from <code>Firebug.ActivablePanel</code> in order
* to support activation (enable/disable). This allows to avoid (performance) expensive
* features if the functionality is not necessary for the user.
@@ -71,6 +72,9 @@ NetPanel.prototype = Obj.extend(Firebug.ActivablePanel,
enableA11y: true,
order: 60,
+ // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+ // Initialization
+
initialize: function(context, doc)
{
if (FBTrace.DBG_NET)
@@ -212,7 +216,8 @@ NetPanel.prototype = Obj.extend(Firebug.ActivablePanel,
if (FBTrace.DBG_NET)
FBTrace.sysout("net.netPanel.hide; " + this.context.getName());
- delete this.infoTipURL; // clear the state that is tracking the infotip so it is reset after next show()
+ // clear the state that is tracking the infotip so it is reset after next show()
+ delete this.infoTipURL;
this.wasScrolledToBottom = Dom.isScrolledToBottom(this.panelNode);
clearInterval(this.layoutInterval);
@@ -317,6 +322,9 @@ NetPanel.prototype = Obj.extend(Firebug.ActivablePanel,
};
},
+ // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+ // Context Menu
+
getContextMenuItems: function(nada, target)
{
var items = [];
@@ -473,7 +481,7 @@ NetPanel.prototype = Obj.extend(Firebug.ActivablePanel,
},
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
- // Context menu commands
+ // Context Menu Commands
copyURLParams: function(file)
{
@@ -696,8 +704,7 @@ NetPanel.prototype = Obj.extend(Firebug.ActivablePanel,
populateTimeInfoTip: function(infoTip, file)
{
- Firebug.NetMonitor.TimeInfoTip.render(this.context, file, infoTip);
- return true;
+ return TimeInfoTip.render(this.context, file, infoTip);
},
populateSizeInfoTip: function(infoTip, file)
@@ -448,7 +448,7 @@ Firebug.NetMonitor.NetRequestEntry = domplate(Firebug.Rep, new Firebug.Listener(
DIV({"class": "netAddressLabel netLabel"}, "$file.file|getRemoteAddress")
),
TD({"class": "netTimeCol netCol a11yFocus", "role": "gridcell",
- "aria-describedby": "fbNetTimeInfoTip" },
+ "aria-describedby": "fbNetTimeInfoTip" },
DIV({"class": "netLoadingIcon"}),
DIV({"class": "netBar"},
"&nbsp;",
@@ -1715,203 +1715,6 @@ Firebug.NetMonitor.NetInfoHeaders = domplate(Firebug.Rep, new Firebug.Listener()
// ********************************************************************************************* //
/**
- * @domplate Represents a template for popup tip that displays detailed timing info about
- * a network request.
- */
-Firebug.NetMonitor.TimeInfoTip = domplate(Firebug.Rep,
-{
- tableTag:
- TABLE({"class": "timeInfoTip", "id": "fbNetTimeInfoTip"},
- TBODY()
- ),
-
- timingsTag:
- FOR("time", "$timings",
- TR({"class": "timeInfoTipRow", $collapsed: "$time|hideBar"},
- TD({"class": "$time|getBarClass timeInfoTipBar",
- $loaded: "$time.loaded",
- $fromCache: "$time.fromCache",
- }),
- TD({"class": "timeInfoTipCell startTime"},
- "$time.start|formatStartTime"
- ),
- TD({"class": "timeInfoTipCell elapsedTime"},
- "$time.elapsed|formatTime"
- ),
- TD("$time|getLabel")
- )
- ),
-
- startTimeTag:
- TR(
- TD(),
- TD("$startTime.time|formatStartTime"),
- TD({"class": "timeInfoTipStartLabel", "colspan": 2},
- "$startTime|getLabel"
- )
- ),
-
- separatorTag:
- TR(
- TD({"class": "timeInfoTipSeparator", "colspan": 4, "height": "10px"},
- SPAN("$label")
- )
- ),
-
- eventsTag:
- FOR("event", "$events",
- TR({"class": "timeInfoTipEventRow"},
- TD({"class": "timeInfoTipBar", align: "center"},
- DIV({"class": "$event|getTimeStampClass timeInfoTipEventBar"})
- ),
- TD("$event.start|formatStartTime"),
- TD({"class": "timeInfotTipEventName", "colspan": 2},
- "$event|getTimeStampLabel"
- )
- )
- ),
-
- hideBar: function(obj)
- {
- return !obj.elapsed && obj.bar == "Blocking";
- },
-
- getBarClass: function(obj)
- {
- return "net" + obj.bar + "Bar";
- },
-
- getTimeStampClass: function(obj)
- {
- return obj.classes;
- },
-
- formatTime: function(time)
- {
- return Str.formatTime(time);
- },
-
- formatStartTime: function(time)
- {
- var label = Str.formatTime(time);
- if (!time)
- return label;
-
- return (time > 0 ? "+" : "") + label;
- },
-
- getLabel: function(obj)
- {
- return Locale.$STR("requestinfo." + obj.bar);
- },
-
- getTimeStampLabel: function(obj)
- {
- return obj.name;
- },
-
- render: function(context, file, parentNode)
- {
- var infoTip = Firebug.NetMonitor.TimeInfoTip.tableTag.replace({}, parentNode);
-
- var elapsed = file.loaded ? file.endTime - file.startTime :
- file.phase.phaseEndTime - file.startTime;
- var blockingEnd = NetUtils.getBlockingEndTime(file);
-
- //Helper log for debugging timing problems.
- //NetUtils.traceRequestTiming("net.timeInfoTip.render;", file);
-
- var startTime = 0;
-
- var timings = [];
- timings.push({bar: "Blocking",
- elapsed: blockingEnd - file.startTime,
- start: startTime});
-
- timings.push({bar: "Resolving",
- elapsed: file.connectingTime - file.resolvingTime,
- start: startTime += timings[0].elapsed});
-
- // Connecting time is measured till the sending time in order to include
- // also SSL negotiation.
- // xxxHonza: time between "connected" and "sending" is SSL negotiation?
- timings.push({bar: "Connecting",
- elapsed: file.connectStarted ? file.sendingTime - file.connectingTime : 0,
- start: startTime += timings[1].elapsed});
-
- // In Fx3.6 the STATUS_SENDING_TO is always fired (nsIHttpActivityDistributor)
- // In Fx3.5 the STATUS_SENDING_TO (nsIWebProgressListener) doesn't have to come
- // This workaround is for 3.5
- var sendElapsed = file.sendStarted ? file.waitingForTime - file.sendingTime : 0;
- var sendStarted = timings[0].elapsed + timings[1].elapsed + timings[2].elapsed;
-
- timings.push({bar: "Sending",
- elapsed: sendElapsed,
- start: file.sendStarted ? file.sendingTime - file.startTime : sendStarted});
-
- timings.push({bar: "Waiting",
- elapsed: file.respondedTime - file.waitingForTime,
- start: file.waitingForTime - file.startTime});
-
- timings.push({bar: "Receiving",
- elapsed: file.endTime - file.respondedTime,
- start: file.respondedTime - file.startTime,
- loaded: file.loaded, fromCache: file.fromCache});
-
- var events = [];
- var timeStamps = file.phase.timeStamps;
- for (var i=0; i<timeStamps.length; i++)
- {
- var timeStamp = timeStamps[i];
- events.push({
- name: timeStamp.label,
- classes: timeStamp.classes,
- start: timeStamp.time - file.startTime
- });
- }
-
- events.sort(function(a, b) {
- return a.start < b.start ? -1 : 1;
- });
-
- var phases = context.netProgress.phases;
-
- if (FBTrace.DBG_ERROR && phases.length == 0)
- FBTrace.sysout("net.render; ERROR no phases");
-
- // Insert start request time. It's computed since the beginning (page load start time)
- // i.e. from the first phase start.
- var firstPhaseStartTime = (phases.length > 0) ? phases[0].startTime : file.startTime;
-
- var startTime = {};
- startTime.time = file.startTime - firstPhaseStartTime;
- startTime.bar = "started.label";
- this.startTimeTag.insertRows({startTime: startTime}, infoTip.firstChild);
-
- // Insert separator.
- this.separatorTag.insertRows({label: Locale.$STR("requestinfo.phases.label")},
- infoTip.firstChild);
-
- // Insert request timing info.
- this.timingsTag.insertRows({timings: timings}, infoTip.firstChild);
-
- // Insert events timing info.
- if (events.length)
- {
- // Insert separator.
- this.separatorTag.insertRows({label: Locale.$STR("requestinfo.timings.label")},
- infoTip.firstChild);
-
- this.eventsTag.insertRows({events: events}, infoTip.firstChild);
- }
-
- return true;
- }
-});
-
-// ********************************************************************************************* //
-
-/**
* @domplate Represents a template for a pupup tip with detailed size info.
*/
Firebug.NetMonitor.SizeInfoTip = domplate(Firebug.Rep,
Oops, something went wrong.

0 comments on commit 95871de

Please sign in to comment.