зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1353798 - [devtools] Cleanup server timings r=devtools-reviewers,ochameau,webdriver-reviewers,whimboo
Cleanup how the server timings are extracted andadded to distinct functions Differential Revision: https://phabricator.services.mozilla.com/D193429
This commit is contained in:
Родитель
9bf1e32517
Коммит
26665d9dae
|
@ -578,10 +578,8 @@ class NetworkEventActor extends Actor {
|
||||||
* @param object timings
|
* @param object timings
|
||||||
* Timing details about the network event.
|
* Timing details about the network event.
|
||||||
* @param object offsets
|
* @param object offsets
|
||||||
* @param object serverTimings
|
|
||||||
* Timing details extracted from the Server-Timing header.
|
|
||||||
*/
|
*/
|
||||||
addEventTimings(total, timings, offsets, serverTimings) {
|
addEventTimings(total, timings, offsets) {
|
||||||
// Ignore calls when this actor is already destroyed
|
// Ignore calls when this actor is already destroyed
|
||||||
if (this.isDestroyed()) {
|
if (this.isDestroyed()) {
|
||||||
return;
|
return;
|
||||||
|
@ -591,26 +589,23 @@ class NetworkEventActor extends Actor {
|
||||||
this._timings = timings;
|
this._timings = timings;
|
||||||
this._offsets = offsets;
|
this._offsets = offsets;
|
||||||
|
|
||||||
if (serverTimings) {
|
|
||||||
this._serverTimings = serverTimings;
|
|
||||||
}
|
|
||||||
|
|
||||||
this._onEventUpdate("eventTimings", { totalTime: total });
|
this._onEventUpdate("eventTimings", { totalTime: total });
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Store server timing information. They will be merged together
|
* Store server timing information. They are merged together
|
||||||
* with network event timing data when they are available and
|
* with network event timing data when they are available and
|
||||||
* notification sent to the client.
|
* notification sent to the client.
|
||||||
* See `addEventTimnings`` above for more information.
|
* See `addEventTimings` above for more information.
|
||||||
*
|
*
|
||||||
* @param object serverTimings
|
* @param object serverTimings
|
||||||
* Timing details extracted from the Server-Timing header.
|
* Timing details extracted from the Server-Timing header.
|
||||||
*/
|
*/
|
||||||
addServerTimings(serverTimings) {
|
addServerTimings(serverTimings) {
|
||||||
if (serverTimings) {
|
if (!serverTimings || this.isDestroyed()) {
|
||||||
this._serverTimings = serverTimings;
|
return;
|
||||||
}
|
}
|
||||||
|
this._serverTimings = serverTimings;
|
||||||
}
|
}
|
||||||
|
|
||||||
_createLongStringActor(string) {
|
_createLongStringActor(string) {
|
||||||
|
|
|
@ -165,6 +165,7 @@ class NetworkEventContentWatcher {
|
||||||
{} /* timings */,
|
{} /* timings */,
|
||||||
{} /* offsets */
|
{} /* offsets */
|
||||||
);
|
);
|
||||||
|
actor.addServerTimings({});
|
||||||
actor.addResponseContent(
|
actor.addResponseContent(
|
||||||
{
|
{
|
||||||
mimeType: channel.contentType,
|
mimeType: channel.contentType,
|
||||||
|
|
|
@ -446,13 +446,13 @@ export class NetworkObserver {
|
||||||
// There also is never any timing events, so we can fire this
|
// There also is never any timing events, so we can fire this
|
||||||
// event with zeroed out values.
|
// event with zeroed out values.
|
||||||
const timings = this.#setupHarTimings(httpActivity);
|
const timings = this.#setupHarTimings(httpActivity);
|
||||||
|
|
||||||
const serverTimings = this.#extractServerTimings(httpActivity.channel);
|
const serverTimings = this.#extractServerTimings(httpActivity.channel);
|
||||||
|
|
||||||
|
httpActivity.owner.addServerTimings(serverTimings);
|
||||||
httpActivity.owner.addEventTimings(
|
httpActivity.owner.addEventTimings(
|
||||||
timings.total,
|
timings.total,
|
||||||
timings.timings,
|
timings.timings,
|
||||||
timings.offsets,
|
timings.offsets
|
||||||
serverTimings
|
|
||||||
);
|
);
|
||||||
} else if (topic === "http-on-failed-opening-request") {
|
} else if (topic === "http-on-failed-opening-request") {
|
||||||
const { blockedReason } = lazy.NetworkUtils.getBlockedReason(
|
const { blockedReason } = lazy.NetworkUtils.getBlockedReason(
|
||||||
|
@ -993,11 +993,11 @@ export class NetworkObserver {
|
||||||
const result = this.#setupHarTimings(httpActivity);
|
const result = this.#setupHarTimings(httpActivity);
|
||||||
const serverTimings = this.#extractServerTimings(httpActivity.channel);
|
const serverTimings = this.#extractServerTimings(httpActivity.channel);
|
||||||
|
|
||||||
|
httpActivity.owner.addServerTimings(serverTimings);
|
||||||
httpActivity.owner.addEventTimings(
|
httpActivity.owner.addEventTimings(
|
||||||
result.total,
|
result.total,
|
||||||
result.timings,
|
result.timings,
|
||||||
result.offsets,
|
result.offsets
|
||||||
serverTimings
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -100,6 +100,7 @@ add_task(async function testAuthRequestWithoutListener() {
|
||||||
assertEventOwner(events[0], {
|
assertEventOwner(events[0], {
|
||||||
hasResponseStart: true,
|
hasResponseStart: true,
|
||||||
hasEventTimings: true,
|
hasEventTimings: true,
|
||||||
|
hasServerTimings: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
networkObserver.destroy();
|
networkObserver.destroy();
|
||||||
|
@ -150,6 +151,7 @@ add_task(async function testAuthRequestWithForwardingListener() {
|
||||||
hasResponseStart: true,
|
hasResponseStart: true,
|
||||||
hasEventTimings: true,
|
hasEventTimings: true,
|
||||||
hasAuthPrompt: true,
|
hasAuthPrompt: true,
|
||||||
|
hasServerTimings: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
networkObserver.destroy();
|
networkObserver.destroy();
|
||||||
|
@ -250,6 +252,7 @@ add_task(async function testAuthRequestWithWrongCredentialsListener() {
|
||||||
hasAuthPrompt: true,
|
hasAuthPrompt: true,
|
||||||
hasResponseStart: true,
|
hasResponseStart: true,
|
||||||
hasEventTimings: true,
|
hasEventTimings: true,
|
||||||
|
hasServerTimings: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
networkObserver.destroy();
|
networkObserver.destroy();
|
||||||
|
|
|
@ -178,10 +178,8 @@ export class NetworkEventRecord {
|
||||||
* The har-like timings.
|
* The har-like timings.
|
||||||
* @param {object} offsets
|
* @param {object} offsets
|
||||||
* The har-like timings, but as offset from the request start.
|
* The har-like timings, but as offset from the request start.
|
||||||
* @param {Array} serverTimings
|
|
||||||
* The server timings.
|
|
||||||
*/
|
*/
|
||||||
addEventTimings(total, timings, offsets, serverTimings) {}
|
addEventTimings(total, timings, offsets) {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add response cache entry.
|
* Add response cache entry.
|
||||||
|
|
Загрузка…
Ссылка в новой задаче