зеркало из 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
|
||||
* Timing details about the network event.
|
||||
* @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
|
||||
if (this.isDestroyed()) {
|
||||
return;
|
||||
|
@ -591,26 +589,23 @@ class NetworkEventActor extends Actor {
|
|||
this._timings = timings;
|
||||
this._offsets = offsets;
|
||||
|
||||
if (serverTimings) {
|
||||
this._serverTimings = serverTimings;
|
||||
}
|
||||
|
||||
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
|
||||
* notification sent to the client.
|
||||
* See `addEventTimnings`` above for more information.
|
||||
* See `addEventTimings` above for more information.
|
||||
*
|
||||
* @param object serverTimings
|
||||
* Timing details extracted from the Server-Timing header.
|
||||
*/
|
||||
addServerTimings(serverTimings) {
|
||||
if (serverTimings) {
|
||||
this._serverTimings = serverTimings;
|
||||
if (!serverTimings || this.isDestroyed()) {
|
||||
return;
|
||||
}
|
||||
this._serverTimings = serverTimings;
|
||||
}
|
||||
|
||||
_createLongStringActor(string) {
|
||||
|
|
|
@ -165,6 +165,7 @@ class NetworkEventContentWatcher {
|
|||
{} /* timings */,
|
||||
{} /* offsets */
|
||||
);
|
||||
actor.addServerTimings({});
|
||||
actor.addResponseContent(
|
||||
{
|
||||
mimeType: channel.contentType,
|
||||
|
|
|
@ -446,13 +446,13 @@ export class NetworkObserver {
|
|||
// There also is never any timing events, so we can fire this
|
||||
// event with zeroed out values.
|
||||
const timings = this.#setupHarTimings(httpActivity);
|
||||
|
||||
const serverTimings = this.#extractServerTimings(httpActivity.channel);
|
||||
|
||||
httpActivity.owner.addServerTimings(serverTimings);
|
||||
httpActivity.owner.addEventTimings(
|
||||
timings.total,
|
||||
timings.timings,
|
||||
timings.offsets,
|
||||
serverTimings
|
||||
timings.offsets
|
||||
);
|
||||
} else if (topic === "http-on-failed-opening-request") {
|
||||
const { blockedReason } = lazy.NetworkUtils.getBlockedReason(
|
||||
|
@ -993,11 +993,11 @@ export class NetworkObserver {
|
|||
const result = this.#setupHarTimings(httpActivity);
|
||||
const serverTimings = this.#extractServerTimings(httpActivity.channel);
|
||||
|
||||
httpActivity.owner.addServerTimings(serverTimings);
|
||||
httpActivity.owner.addEventTimings(
|
||||
result.total,
|
||||
result.timings,
|
||||
result.offsets,
|
||||
serverTimings
|
||||
result.offsets
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -100,6 +100,7 @@ add_task(async function testAuthRequestWithoutListener() {
|
|||
assertEventOwner(events[0], {
|
||||
hasResponseStart: true,
|
||||
hasEventTimings: true,
|
||||
hasServerTimings: true,
|
||||
});
|
||||
|
||||
networkObserver.destroy();
|
||||
|
@ -150,6 +151,7 @@ add_task(async function testAuthRequestWithForwardingListener() {
|
|||
hasResponseStart: true,
|
||||
hasEventTimings: true,
|
||||
hasAuthPrompt: true,
|
||||
hasServerTimings: true,
|
||||
});
|
||||
|
||||
networkObserver.destroy();
|
||||
|
@ -250,6 +252,7 @@ add_task(async function testAuthRequestWithWrongCredentialsListener() {
|
|||
hasAuthPrompt: true,
|
||||
hasResponseStart: true,
|
||||
hasEventTimings: true,
|
||||
hasServerTimings: true,
|
||||
});
|
||||
|
||||
networkObserver.destroy();
|
||||
|
|
|
@ -178,10 +178,8 @@ export class NetworkEventRecord {
|
|||
* The har-like timings.
|
||||
* @param {object} offsets
|
||||
* 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.
|
||||
|
|
Загрузка…
Ссылка в новой задаче