@@ -648,10 +648,10 @@ index 0000000000000000000000000000000000000000..673e93b0278a3502d94006696cea7e6e
648
648
+
649
649
diff --git a/testing/juggler/NetworkObserver.js b/testing/juggler/NetworkObserver.js
650
650
new file mode 100644
651
- index 0000000000000000000000000000000000000000..e38c9b37b531de4eac67c2a138b68a34053b155b
651
+ index 0000000000000000000000000000000000000000..66f61d432f9ad2f50931b780ec5ea0e33da53803
652
652
--- /dev/null
653
653
+++ b/testing/juggler/NetworkObserver.js
654
- @@ -0,0 +1,674 @@
654
+ @@ -0,0 +1,681 @@
655
655
+ "use strict";
656
656
+
657
657
+ const {EventEmitter} = ChromeUtils.import('resource://gre/modules/EventEmitter.jsm');
@@ -766,8 +766,8 @@ index 0000000000000000000000000000000000000000..e38c9b37b531de4eac67c2a138b68a34
766
766
+ return interceptor;
767
767
+ }
768
768
+
769
- + resumeInterceptedRequest(browser, requestId, headers) {
770
- + this._takeInterceptor(browser, requestId)._resume(headers);
769
+ + resumeInterceptedRequest(browser, requestId, method, headers, postData ) {
770
+ + this._takeInterceptor(browser, requestId)._resume(method, headers, postData );
771
771
+ }
772
772
+
773
773
+ getResponseBody(browser, requestId) {
@@ -806,14 +806,21 @@ index 0000000000000000000000000000000000000000..e38c9b37b531de4eac67c2a138b68a34
806
806
+ const newRequestId = this._requestId(newHttpChannel);
807
807
+ if (this._resumedRequestIdToHeaders.has(oldRequestId)) {
808
808
+ // When we call resetInterception on a request, we get a new "redirected" request for it.
809
- + const { headers } = this._resumedRequestIdToHeaders.get(oldRequestId);
809
+ + const { method, headers, postData } = this._resumedRequestIdToHeaders.get(oldRequestId);
810
810
+ if (headers) {
811
811
+ // Apply new request headers from interception resume.
812
812
+ for (const header of requestHeaders(newChannel))
813
813
+ newChannel.setRequestHeader(header.name, '', false /* merge */);
814
814
+ for (const header of headers)
815
815
+ newChannel.setRequestHeader(header.name, header.value, false /* merge */);
816
816
+ }
817
+ + if (method)
818
+ + newChannel.requestMethod = method;
819
+ + if (postData && newChannel instanceof Ci.nsIUploadChannel) {
820
+ + const synthesized = Cc["@mozilla.org/io/string-input-stream;1"].createInstance(Ci.nsIStringInputStream);
821
+ + synthesized.data = atob(postData);
822
+ + newChannel.setUploadStream(synthesized, 'application/octet-stream', -1);
823
+ + }
817
824
+ // Use the old request id for the new "redirected" request for protocol consistency.
818
825
+ this._resumedRequestIdToHeaders.delete(oldRequestId);
819
826
+ this._postResumeChannelIdToRequestId.set(newRequestId, oldRequestId);
@@ -1273,8 +1280,8 @@ index 0000000000000000000000000000000000000000..e38c9b37b531de4eac67c2a138b68a34
1273
1280
+ this._networkObserver._onIntercepted(httpChannel, this);
1274
1281
+ }
1275
1282
+
1276
- + _resume(headers) {
1277
- + this._networkObserver._resumedRequestIdToHeaders.set(this._networkObserver._requestId(this._httpChannel), { headers });
1283
+ + _resume(method, headers, postData ) {
1284
+ + this._networkObserver._resumedRequestIdToHeaders.set(this._networkObserver._requestId(this._httpChannel), { method, headers, postData });
1278
1285
+ this._intercepted.resetInterception();
1279
1286
+ }
1280
1287
+
@@ -4145,7 +4152,7 @@ index 0000000000000000000000000000000000000000..956988738079272be8d3998dcbbaa91a
4145
4152
+
4146
4153
diff --git a/testing/juggler/protocol/NetworkHandler.js b/testing/juggler/protocol/NetworkHandler.js
4147
4154
new file mode 100644
4148
- index 0000000000000000000000000000000000000000..22e7b4f9397e592f26ce447aafd6318398ad5b48
4155
+ index 0000000000000000000000000000000000000000..5d776ab6f28ccff44ef4663e8618ad9cf800f869
4149
4156
--- /dev/null
4150
4157
+++ b/testing/juggler/protocol/NetworkHandler.js
4151
4158
@@ -0,0 +1,166 @@
@@ -4207,8 +4214,8 @@ index 0000000000000000000000000000000000000000..22e7b4f9397e592f26ce447aafd63183
4207
4214
+ await Promise.all(Array.from(this._pendingRequstWillBeSentEvents));
4208
4215
+ }
4209
4216
+
4210
- + async resumeInterceptedRequest({requestId, headers}) {
4211
- + this._networkObserver.resumeInterceptedRequest(this._browser, requestId, headers);
4217
+ + async resumeInterceptedRequest({requestId, method, headers, postData }) {
4218
+ + this._networkObserver.resumeInterceptedRequest(this._browser, requestId, method, headers, postData );
4212
4219
+ }
4213
4220
+
4214
4221
+ async abortInterceptedRequest({requestId, errorCode}) {
@@ -4757,10 +4764,10 @@ index 0000000000000000000000000000000000000000..78b6601b91d0b7fcda61114e6846aa07
4757
4764
+ this.EXPORTED_SYMBOLS = ['t', 'checkScheme'];
4758
4765
diff --git a/testing/juggler/protocol/Protocol.js b/testing/juggler/protocol/Protocol.js
4759
4766
new file mode 100644
4760
- index 0000000000000000000000000000000000000000..a0913f7728931a938b850083213560a511b624a8
4767
+ index 0000000000000000000000000000000000000000..d0d27b9bd8132190841a7a4785d31a20738e3b18
4761
4768
--- /dev/null
4762
4769
+++ b/testing/juggler/protocol/Protocol.js
4763
- @@ -0,0 +1,747 @@
4770
+ @@ -0,0 +1,749 @@
4764
4771
+ const {t, checkScheme} = ChromeUtils.import('chrome://juggler/content/protocol/PrimitiveTypes.js');
4765
4772
+
4766
4773
+ // Protocol-specific types.
@@ -5102,7 +5109,9 @@ index 0000000000000000000000000000000000000000..a0913f7728931a938b850083213560a5
5102
5109
+ 'resumeInterceptedRequest': {
5103
5110
+ params: {
5104
5111
+ requestId: t.String,
5112
+ + method: t.Optional(t.String),
5105
5113
+ headers: t.Optional(t.Array(networkTypes.HTTPHeader)),
5114
+ + postData: t.Optional(t.String),
5106
5115
+ },
5107
5116
+ },
5108
5117
+ 'fulfillInterceptedRequest': {
0 commit comments