feat(firefox): provide navigationId for navigation requests

This commit is contained in:
Dmitry Gozman 2019-12-13 18:04:26 -08:00
parent 0b5c0a76ab
commit 86c31c5c93
2 changed files with 16 additions and 8 deletions

View file

@ -1 +1 @@
1006
1007

View file

@ -587,7 +587,7 @@ index 000000000000..673e93b0278a
+
diff --git a/testing/juggler/NetworkObserver.js b/testing/juggler/NetworkObserver.js
new file mode 100644
index 000000000000..cc8cb8fe9d83
index 000000000000..2afbc74a4170
--- /dev/null
+++ b/testing/juggler/NetworkObserver.js
@@ -0,0 +1,450 @@
@ -791,7 +791,7 @@ index 000000000000..cc8cb8fe9d83
+ postData: readRequestPostData(httpChannel),
+ headers: requestHeaders(httpChannel),
+ method: httpChannel.requestMethod,
+ isNavigationRequest: httpChannel.isMainDocumentChannel,
+ navigationId: httpChannel.isMainDocumentChannel ? requestId(httpChannel) : undefined,
+ cause: causeTypeToString(causeType),
+ });
+ }
@ -1447,10 +1447,10 @@ index 000000000000..f68780d529e7
+
diff --git a/testing/juggler/content/FrameTree.js b/testing/juggler/content/FrameTree.js
new file mode 100644
index 000000000000..2931c75e60d2
index 000000000000..640782151e30
--- /dev/null
+++ b/testing/juggler/content/FrameTree.js
@@ -0,0 +1,232 @@
@@ -0,0 +1,240 @@
+"use strict";
+const Ci = Components.interfaces;
+const Cr = Components.results;
@ -1529,7 +1529,7 @@ index 000000000000..2931c75e60d2
+
+ if (isStart) {
+ // Starting a new navigation.
+ frame._pendingNavigationId = helper.generateId();
+ frame._pendingNavigationId = this._channelId(channel);
+ frame._pendingNavigationURL = channel.URI.spec;
+ this.emit(FrameTree.Events.NavigationStarted, frame);
+ } else if (isTransferring || (isStop && frame._pendingNavigationId && !status)) {
@ -1561,6 +1561,14 @@ index 000000000000..2931c75e60d2
+ }
+ }
+
+ _channelId(channel) {
+ if (channel instanceof Ci.nsIHttpChannel) {
+ const httpChannel = channel.QueryInterface(Ci.nsIHttpChannel);
+ return String(httpChannel.channelId);
+ }
+ return helper.generateId();
+ }
+
+ _onDocShellCreated(docShell) {
+ // Bug 1142752: sometimes, the docshell appears to be immediately
+ // destroyed, bailout early to prevent random exceptions.
@ -4108,7 +4116,7 @@ index 000000000000..78b6601b91d0
+this.EXPORTED_SYMBOLS = ['t', 'checkScheme'];
diff --git a/testing/juggler/protocol/Protocol.js b/testing/juggler/protocol/Protocol.js
new file mode 100644
index 000000000000..829576c5a48c
index 000000000000..700571aeed45
--- /dev/null
+++ b/testing/juggler/protocol/Protocol.js
@@ -0,0 +1,668 @@
@ -4337,7 +4345,7 @@ index 000000000000..829576c5a48c
+ suspended: t.Optional(t.Boolean),
+ url: t.String,
+ method: t.String,
+ isNavigationRequest: t.Boolean,
+ navigationId: t.Optional(t.String),
+ cause: t.String,
+ },
+ 'responseReceived': {