Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

browser(firefox): expose resource timing info (#4205)

Pavel Feldman437fe17825f5
diff --git a/browser_patches/firefox/BUILD_NUMBER b/browser_patches/firefox/BUILD_NUMBER
index a1a6c96a89..6a179049da 100644
--- a/browser_patches/firefox/BUILD_NUMBER
+++ b/browser_patches/firefox/BUILD_NUMBER
@@ -1,2 +1,2 @@
-1195
-Changed: [email protected] Tue Oct 20 13:36:31 PDT 2020
+1196
+Changed: [email protected] Wed Oct 21 13:53:01 PDT 2020
diff --git a/browser_patches/firefox/juggler/NetworkObserver.js b/browser_patches/firefox/juggler/NetworkObserver.js
index 0264c1d82b..df7dedfe4c 100644
--- a/browser_patches/firefox/juggler/NetworkObserver.js
+++ b/browser_patches/firefox/juggler/NetworkObserver.js
@@ -507,6 +507,17 @@ class NetworkRequest {
return;
this.httpChannel.QueryInterface(Ci.nsIHttpChannelInternal);
+ this.httpChannel.QueryInterface(Ci.nsITimedChannel);
+ const timing = {
+ startTime: this.httpChannel.channelCreationTime,
+ domainLookupStart: this.httpChannel.domainLookupStartTime,
+ domainLookupEnd: this.httpChannel.domainLookupEndTime,
+ connectStart: this.httpChannel.connectStartTime,
+ secureConnectionStart: this.httpChannel.secureConnectionStartTime,
+ connectEnd: this.httpChannel.connectEndTime,
+ requestStart: this.httpChannel.requestStartTime,
+ responseStart: this.httpChannel.responseStartTime,
+ };
const headers = [];
let status = 0;
@@ -540,6 +551,7 @@ class NetworkRequest {
remotePort,
status,
statusText,
+ timing,
}, this._frameId);
}
@@ -559,6 +571,7 @@ class NetworkRequest {
if (pageNetwork) {
pageNetwork.emit(PageNetwork.Events.RequestFinished, {
requestId: this.requestId,
+ responseEndTime: this.httpChannel.responseEndTime,
}, this._frameId);
}
this._networkObserver._channelToRequest.delete(this.httpChannel);
diff --git a/browser_patches/firefox/juggler/protocol/Protocol.js b/browser_patches/firefox/juggler/protocol/Protocol.js
index e4466f0657..4f07a46a72 100644
--- a/browser_patches/firefox/juggler/protocol/Protocol.js
+++ b/browser_patches/firefox/juggler/protocol/Protocol.js
@@ -189,6 +189,16 @@ networkTypes.SecurityDetails = {
validTo: t.Number,
};
+networkTypes.ResourceTiming = {
+ startTime: t.Number,
+ domainLookupStart: t.Number,
+ domainLookupEnd: t.Number,
+ connectStart: t.Number,
+ secureConnectionStart: t.Number,
+ connectEnd: t.Number,
+ requestStart: t.Number,
+ responseStart: t.Number,
+};
const Browser = {
targets: ['browser'],
@@ -450,9 +460,11 @@ const Network = {
status: t.Number,
statusText: t.String,
headers: t.Array(networkTypes.HTTPHeader),
+ timing: networkTypes.ResourceTiming,
},
'requestFinished': {
requestId: t.String,
+ responseEndTime: t.Number,
},
'requestFailed': {
requestId: t.String,