feat(firefox): provide navigationId for navigation requests (#249)

This commit is contained in:
Dmitry Gozman 2019-12-14 08:21:23 -08:00 committed by Pavel Feldman
parent 09bf6b1906
commit 927669b890

View file

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