Skip to content

Commit

Permalink
Small fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
nicjansma committed Sep 29, 2017
1 parent 0a66aba commit 6b03d7d
Showing 1 changed file with 18 additions and 8 deletions.
26 changes: 18 additions & 8 deletions perfbar.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,7 @@ var UW = unsafeWindow;
tb.register("Realtime", [
{name: "FPS", title: "Frames Per Second"},
{name: "LongTasks", title: "Long Tasks"},
{name: "Rage Clicks", title: "Race Clicks"}
{name: "Rage Clicks", title: "Rage Clicks"}
]);

tb.addContextMenu("Realtime", "LongTasks", function(menuButton$) {
Expand All @@ -562,21 +562,31 @@ var UW = unsafeWindow;
which = 'cross-origin';
}

var attr = "";
var desc = "";
if (longTask && longTask.attribution && longTask.attribution.length) {
attr = longTask.attribution[0].containerType ? longTask.attribution[0].containerType : "";
attr += " " + longTask.attribution[0].containerSrc ? longTask.attribution[0].containerSrc : "";
attr += " " + longTask.attribution[0].containerId ? longTask.attribution[0].containerId : "";
attr += " " + longTask.attribution[0].containerName ? longTask.attribution[0].containerName : "";
var attr = longTask.attribution[0];
desc = attr.containerType ? longTask.attribution[0].containerType : "";

if (attr.containerId) {
desc += " " + attr.containerId;
}

if (attr.containerName) {
desc += " " + attr.containerName;
}

if (attr.containerSrc) {
var src = attr.containerSrc.replace(/https?:\/\//, "");
desc += " " + src.substr(0, src.indexOf("/"));
}
}

if (!items[which]) {
debugger;
return;
}

items[which].items["item" + (++i)] = {
name: longTask.duration + "ms (" + attr + ")"
name: longTask.duration + "ms (" + desc + ")"
};
});

Expand Down

0 comments on commit 6b03d7d

Please sign in to comment.