DOMContentLoaded and load does not work properly if "devtools.webconsole.persistlog == true" - is getting higher

Issue #52
This commit is contained in:
janekptacijarabaci 2018-03-05 20:30:12 +01:00 • committed by Roy Tam
commit b8bbffacbe
3 changed files with 20 additions and 9 deletions

View file

@ -407,6 +407,9 @@ TargetEventsHandler.prototype = {
if (!Services.prefs.getBoolPref("devtools.webconsole.persistlog")) { if (!Services.prefs.getBoolPref("devtools.webconsole.persistlog")) {
NetMonitorView.RequestsMenu.reset(); NetMonitorView.RequestsMenu.reset();
NetMonitorView.Sidebar.toggle(false); NetMonitorView.Sidebar.toggle(false);
} else {
// If the log is persistent, just clear some informations.
NetMonitorView.RequestsMenu.resetNotPersistent();
} }
// Switch to the default network traffic inspector view. // Switch to the default network traffic inspector view.
if (NetMonitorController.getCurrentActivity() == ACTIVITY_TYPE.NONE) { if (NetMonitorController.getCurrentActivity() == ACTIVITY_TYPE.NONE) {

View file

@ -275,8 +275,15 @@ RequestsMenuView.prototype = Heritage.extend(WidgetMethods, {
this._addQueue = []; this._addQueue = [];
this._updateQueue = []; this._updateQueue = [];
this._firstRequestStartedMillis = -1; this._firstRequestStartedMillis = -1;
this._firstRequestStartedMillisInRequests = false;
this._lastRequestEndedMillis = -1; this._lastRequestEndedMillis = -1;
this.resetNotPersistent();
},
/**
* Reset informations that "devtools.webconsole.persistlog == true".
*/
resetNotPersistent: function () {
this._firstRequestStartedMillisNotPersistent = -1;
}, },
/** /**
@ -651,9 +658,7 @@ RequestsMenuView.prototype = Heritage.extend(WidgetMethods, {
// Append a network request item to this container. // Append a network request item to this container.
let requestItem = this.push([menuView, id], { let requestItem = this.push([menuView, id], {
attachment: { attachment: {
firstRequestStartedMillis: this._firstRequestStartedMillisInRequests firstRequestStartedMillisNotPersistent: this._firstRequestStartedMillisNotPersistent,
? null
: this._firstRequestStartedMillis,
startedDeltaMillis: unixTime - this._firstRequestStartedMillis, startedDeltaMillis: unixTime - this._firstRequestStartedMillis,
startedMillis: unixTime, startedMillis: unixTime,
method: method, method: method,
@ -665,8 +670,6 @@ RequestsMenuView.prototype = Heritage.extend(WidgetMethods, {
} }
}); });
this._firstRequestStartedMillisInRequests = true;
if (id == this._preferredItemId) { if (id == this._preferredItemId) {
this.selectedItem = requestItem; this.selectedItem = requestItem;
} }
@ -1528,6 +1531,9 @@ RequestsMenuView.prototype = Heritage.extend(WidgetMethods, {
if (this._firstRequestStartedMillis == -1) { if (this._firstRequestStartedMillis == -1) {
this._firstRequestStartedMillis = unixTime; this._firstRequestStartedMillis = unixTime;
} }
if (this._firstRequestStartedMillisNotPersistent == -1) {
this._firstRequestStartedMillisNotPersistent = unixTime;
}
}, },
/** /**
@ -1569,7 +1575,7 @@ RequestsMenuView.prototype = Heritage.extend(WidgetMethods, {
_ctx: null, _ctx: null,
_cachedWaterfallWidth: 0, _cachedWaterfallWidth: 0,
_firstRequestStartedMillis: -1, _firstRequestStartedMillis: -1,
_firstRequestStartedMillisInRequests: false, _firstRequestStartedMillisNotPersistent: -1,
_lastRequestEndedMillis: -1, _lastRequestEndedMillis: -1,
_updateQueue: [], _updateQueue: [],
_addQueue: [], _addQueue: [],

View file

@ -80,8 +80,10 @@ function getDisplayedTimingMarker(state, marker) {
} }
let firstRequestStartedMillis = null; let firstRequestStartedMillis = null;
if (state.requests.items.length) { if (state.requests.items.length) {
firstRequestStartedMillis = state.requests.items[0] firstRequestStartedMillis = state.requests
.attachment.firstRequestStartedMillis; .items[state.requests.items.length - 1]
.attachment
.firstRequestStartedMillisNotPersistent;
} }
if (timingMarker && firstRequestStartedMillis) { if (timingMarker && firstRequestStartedMillis) {
return timingMarker - firstRequestStartedMillis; return timingMarker - firstRequestStartedMillis;