@openreplay/tracker 10.0.2 → 10.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/cjs/app/index.js +1 -1
- package/cjs/index.js +1 -1
- package/cjs/modules/Network/fetchProxy.js +4 -2
- package/cjs/utils.js +16 -2
- package/coverage/clover.xml +1575 -733
- package/coverage/coverage-final.json +22 -14
- package/coverage/lcov-report/index.html +60 -45
- package/coverage/lcov-report/main/app/canvas.ts.html +475 -0
- package/coverage/lcov-report/main/app/guards.ts.html +5 -2
- package/coverage/lcov-report/main/app/index.html +34 -19
- package/coverage/lcov-report/main/app/index.ts.html +1086 -45
- package/coverage/lcov-report/main/app/logger.ts.html +1 -1
- package/coverage/lcov-report/main/app/messages.gen.ts.html +179 -146
- package/coverage/lcov-report/main/app/nodes.ts.html +1 -1
- package/coverage/lcov-report/main/app/observer/iframe_observer.ts.html +1 -1
- package/coverage/lcov-report/main/app/observer/iframe_offsets.ts.html +1 -1
- package/coverage/lcov-report/main/app/observer/index.html +1 -1
- package/coverage/lcov-report/main/app/observer/shadow_root_observer.ts.html +1 -1
- package/coverage/lcov-report/main/app/observer/top_observer.ts.html +1 -1
- package/coverage/lcov-report/main/app/sanitizer.ts.html +1 -1
- package/coverage/lcov-report/main/app/session.ts.html +1 -1
- package/coverage/lcov-report/main/app/ticker.ts.html +1 -1
- package/coverage/lcov-report/main/index.html +20 -20
- package/coverage/lcov-report/main/index.ts.html +274 -100
- package/coverage/lcov-report/main/modules/Network/beaconProxy.ts.html +19 -19
- package/coverage/lcov-report/main/modules/Network/fetchProxy.ts.html +97 -97
- package/coverage/lcov-report/main/modules/Network/index.html +65 -65
- package/coverage/lcov-report/main/modules/Network/index.ts.html +33 -33
- package/coverage/lcov-report/main/modules/Network/networkMessage.ts.html +82 -73
- package/coverage/lcov-report/main/modules/Network/utils.ts.html +34 -34
- package/coverage/lcov-report/main/modules/Network/xhrProxy.ts.html +13 -13
- package/coverage/lcov-report/main/modules/attributeSender.ts.html +1 -1
- package/coverage/lcov-report/main/modules/axiosSpy.ts.html +1 -1
- package/coverage/lcov-report/main/modules/conditionsManager.ts.html +799 -0
- package/coverage/lcov-report/main/modules/connection.ts.html +1 -1
- package/coverage/lcov-report/main/modules/console.ts.html +1 -1
- package/coverage/lcov-report/main/modules/constructedStyleSheets.ts.html +1 -1
- package/coverage/lcov-report/main/modules/cssrules.ts.html +1 -1
- package/coverage/lcov-report/main/modules/exception.ts.html +1 -1
- package/coverage/lcov-report/main/modules/featureFlags.ts.html +10 -7
- package/coverage/lcov-report/main/modules/focus.ts.html +1 -1
- package/coverage/lcov-report/main/modules/fonts.ts.html +1 -1
- package/coverage/lcov-report/main/modules/img.ts.html +1 -1
- package/coverage/lcov-report/main/modules/index.html +27 -12
- package/coverage/lcov-report/main/modules/input.ts.html +1 -1
- package/coverage/lcov-report/main/modules/mouse.ts.html +1 -1
- package/coverage/lcov-report/main/modules/network.ts.html +2 -2
- package/coverage/lcov-report/main/modules/performance.ts.html +1 -1
- package/coverage/lcov-report/main/modules/scroll.ts.html +1 -1
- package/coverage/lcov-report/main/modules/selection.ts.html +1 -1
- package/coverage/lcov-report/main/modules/tabs.ts.html +1 -1
- package/coverage/lcov-report/main/modules/timing.ts.html +1 -1
- package/coverage/lcov-report/main/modules/userTesting/SignalManager.ts.html +370 -0
- package/coverage/lcov-report/main/modules/userTesting/dnd.ts.html +10 -22
- package/coverage/lcov-report/main/modules/userTesting/index.html +57 -27
- package/coverage/lcov-report/main/modules/userTesting/index.ts.html +814 -115
- package/coverage/lcov-report/main/modules/userTesting/recorder.ts.html +136 -67
- package/coverage/lcov-report/main/modules/userTesting/styles.ts.html +111 -39
- package/coverage/lcov-report/main/modules/userTesting/utils.ts.html +364 -0
- package/coverage/lcov-report/main/modules/viewport.ts.html +1 -1
- package/coverage/lcov-report/main/utils.ts.html +101 -59
- package/coverage/lcov-report/webworker/BatchWriter.ts.html +1 -1
- package/coverage/lcov-report/webworker/MessageEncoder.gen.ts.html +17 -5
- package/coverage/lcov-report/webworker/PrimitiveEncoder.ts.html +1 -1
- package/coverage/lcov-report/webworker/QueueSender.ts.html +1 -1
- package/coverage/lcov-report/webworker/index.html +9 -9
- package/coverage/lcov-report/webworker/index.ts.html +15 -9
- package/coverage/lcov.info +2699 -1150
- package/lib/app/index.js +1 -1
- package/lib/common/tsconfig.tsbuildinfo +1 -1
- package/lib/index.js +1 -1
- package/lib/modules/Network/fetchProxy.js +4 -2
- package/lib/utils.js +16 -2
- package/package.json +1 -1
|
@@ -23,16 +23,16 @@
|
|
|
23
23
|
<div class='clearfix'>
|
|
24
24
|
|
|
25
25
|
<div class='fl pad1y space-right2'>
|
|
26
|
-
<span class="strong">
|
|
26
|
+
<span class="strong">0% </span>
|
|
27
27
|
<span class="quiet">Statements</span>
|
|
28
|
-
<span class='fraction'>
|
|
28
|
+
<span class='fraction'>0/53</span>
|
|
29
29
|
</div>
|
|
30
30
|
|
|
31
31
|
|
|
32
32
|
<div class='fl pad1y space-right2'>
|
|
33
|
-
<span class="strong">
|
|
33
|
+
<span class="strong">0% </span>
|
|
34
34
|
<span class="quiet">Branches</span>
|
|
35
|
-
<span class='fraction'>
|
|
35
|
+
<span class='fraction'>0/23</span>
|
|
36
36
|
</div>
|
|
37
37
|
|
|
38
38
|
|
|
@@ -44,9 +44,9 @@
|
|
|
44
44
|
|
|
45
45
|
|
|
46
46
|
<div class='fl pad1y space-right2'>
|
|
47
|
-
<span class="strong">
|
|
47
|
+
<span class="strong">0% </span>
|
|
48
48
|
<span class="quiet">Lines</span>
|
|
49
|
-
<span class='fraction'>
|
|
49
|
+
<span class='fraction'>0/53</span>
|
|
50
50
|
</div>
|
|
51
51
|
|
|
52
52
|
|
|
@@ -166,12 +166,12 @@
|
|
|
166
166
|
<a name='L101'></a><a href='#L101'>101</a>
|
|
167
167
|
<a name='L102'></a><a href='#L102'>102</a>
|
|
168
168
|
<a name='L103'></a><a href='#L103'>103</a></td><td class="line-coverage quiet"><span class="cline-any cline-neutral"> </span>
|
|
169
|
-
<span class="cline-any cline-
|
|
169
|
+
<span class="cline-any cline-no"> </span>
|
|
170
170
|
<span class="cline-any cline-neutral"> </span>
|
|
171
|
-
<span class="cline-any cline-
|
|
171
|
+
<span class="cline-any cline-no"> </span>
|
|
172
172
|
<span class="cline-any cline-neutral"> </span>
|
|
173
173
|
<span class="cline-any cline-neutral"> </span>
|
|
174
|
-
<span class="cline-any cline-
|
|
174
|
+
<span class="cline-any cline-no"> </span>
|
|
175
175
|
<span class="cline-any cline-no"> </span>
|
|
176
176
|
<span class="cline-any cline-no"> </span>
|
|
177
177
|
<span class="cline-any cline-neutral"> </span>
|
|
@@ -184,7 +184,7 @@
|
|
|
184
184
|
<span class="cline-any cline-no"> </span>
|
|
185
185
|
<span class="cline-any cline-neutral"> </span>
|
|
186
186
|
<span class="cline-any cline-neutral"> </span>
|
|
187
|
-
<span class="cline-any cline-
|
|
187
|
+
<span class="cline-any cline-no"> </span>
|
|
188
188
|
<span class="cline-any cline-neutral"> </span>
|
|
189
189
|
<span class="cline-any cline-no"> </span>
|
|
190
190
|
<span class="cline-any cline-no"> </span>
|
|
@@ -238,8 +238,8 @@
|
|
|
238
238
|
<span class="cline-any cline-neutral"> </span>
|
|
239
239
|
<span class="cline-any cline-neutral"> </span>
|
|
240
240
|
<span class="cline-any cline-neutral"> </span>
|
|
241
|
-
<span class="cline-any cline-
|
|
242
|
-
<span class="cline-any cline-
|
|
241
|
+
<span class="cline-any cline-no"> </span>
|
|
242
|
+
<span class="cline-any cline-no"> </span>
|
|
243
243
|
<span class="cline-any cline-neutral"> </span>
|
|
244
244
|
<span class="cline-any cline-neutral"> </span>
|
|
245
245
|
<span class="cline-any cline-no"> </span>
|
|
@@ -268,12 +268,12 @@
|
|
|
268
268
|
<span class="cline-any cline-neutral"> </span>
|
|
269
269
|
<span class="cline-any cline-neutral"> </span>
|
|
270
270
|
<span class="cline-any cline-neutral"> </span></td><td class="text"><pre class="prettyprint lang-js">import { NetworkRequest } from '../../../common/messages.gen.js'
|
|
271
|
-
import NetworkMessage from './networkMessage.js'
|
|
271
|
+
<span class="cstat-no" title="statement not covered" >import NetworkMessage from './networkMessage.js'</span>
|
|
272
272
|
import { RequestResponseData } from './types.js'
|
|
273
|
-
import { genStringBody, getURL } from './utils.js'
|
|
273
|
+
<span class="cstat-no" title="statement not covered" >import { genStringBody, getURL } from './utils.js'</span>
|
|
274
274
|
|
|
275
275
|
// https://fetch.spec.whatwg.org/#concept-bodyinit-extract
|
|
276
|
-
const getContentType = <span class="fstat-no" title="function not covered" >(d</span>ata?: BodyInit) => {
|
|
276
|
+
const getContentType = <span class="cstat-no" title="statement not covered" ><span class="fstat-no" title="function not covered" >(d</span>ata?: BodyInit) => {</span>
|
|
277
277
|
<span class="cstat-no" title="statement not covered" > <span class="missing-if-branch" title="if path not taken" >I</span>if (data instanceof Blob) {</span>
|
|
278
278
|
<span class="cstat-no" title="statement not covered" > return data.type</span>
|
|
279
279
|
}
|
|
@@ -286,7 +286,7 @@ const getContentType = <span class="fstat-no" title="function not covered" >(d</
|
|
|
286
286
|
<span class="cstat-no" title="statement not covered" > return 'text/plain;charset=UTF-8'</span>
|
|
287
287
|
}
|
|
288
288
|
|
|
289
|
-
export class
|
|
289
|
+
<span class="cstat-no" title="statement not covered" >export class B</span>eaconProxyHandler<T extends typeof navigator.sendBeacon> implements ProxyHandler<T> {
|
|
290
290
|
<span class="fstat-no" title="function not covered" > constructor(</span>
|
|
291
291
|
private readonly <span class="cstat-no" title="statement not covered" >ignoredHeaders: boolean | string[],</span>
|
|
292
292
|
private readonly <span class="cstat-no" title="statement not covered" >setSessionTokenHeader: (cb: (name: string, value: string) => void) => void,</span>
|
|
@@ -340,8 +340,8 @@ export class BeaconProxyHandler<T extends typeof navigator.sendBeacon> imp
|
|
|
340
340
|
}
|
|
341
341
|
}
|
|
342
342
|
|
|
343
|
-
export default class
|
|
344
|
-
public static
|
|
343
|
+
<span class="cstat-no" title="statement not covered" >export default class B</span>eaconProxy {
|
|
344
|
+
public static <span class="cstat-no" title="statement not covered" >origSendBeacon = window?.navigator?.sendBeacon</span>
|
|
345
345
|
|
|
346
346
|
public <span class="fstat-no" title="function not covered" >static </span>hasSendBeacon() {
|
|
347
347
|
<span class="cstat-no" title="statement not covered" > return !!BeaconProxy.origSendBeacon</span>
|
|
@@ -376,7 +376,7 @@ export default class BeaconProxy {
|
|
|
376
376
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
377
377
|
Code coverage generated by
|
|
378
378
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
379
|
-
at 2023-
|
|
379
|
+
at 2023-12-15T15:55:44.965Z
|
|
380
380
|
</div>
|
|
381
381
|
<script src="../../../prettify.js"></script>
|
|
382
382
|
<script>
|
|
@@ -23,30 +23,30 @@
|
|
|
23
23
|
<div class='clearfix'>
|
|
24
24
|
|
|
25
25
|
<div class='fl pad1y space-right2'>
|
|
26
|
-
<span class="strong">
|
|
26
|
+
<span class="strong">0% </span>
|
|
27
27
|
<span class="quiet">Statements</span>
|
|
28
|
-
<span class='fraction'>
|
|
28
|
+
<span class='fraction'>0/149</span>
|
|
29
29
|
</div>
|
|
30
30
|
|
|
31
31
|
|
|
32
32
|
<div class='fl pad1y space-right2'>
|
|
33
|
-
<span class="strong">
|
|
33
|
+
<span class="strong">0% </span>
|
|
34
34
|
<span class="quiet">Branches</span>
|
|
35
|
-
<span class='fraction'>
|
|
35
|
+
<span class='fraction'>0/93</span>
|
|
36
36
|
</div>
|
|
37
37
|
|
|
38
38
|
|
|
39
39
|
<div class='fl pad1y space-right2'>
|
|
40
|
-
<span class="strong">
|
|
40
|
+
<span class="strong">0% </span>
|
|
41
41
|
<span class="quiet">Functions</span>
|
|
42
|
-
<span class='fraction'>
|
|
42
|
+
<span class='fraction'>0/20</span>
|
|
43
43
|
</div>
|
|
44
44
|
|
|
45
45
|
|
|
46
46
|
<div class='fl pad1y space-right2'>
|
|
47
|
-
<span class="strong">
|
|
47
|
+
<span class="strong">0% </span>
|
|
48
48
|
<span class="quiet">Lines</span>
|
|
49
|
-
<span class='fraction'>
|
|
49
|
+
<span class='fraction'>0/147</span>
|
|
50
50
|
</div>
|
|
51
51
|
|
|
52
52
|
|
|
@@ -386,12 +386,12 @@
|
|
|
386
386
|
<span class="cline-any cline-neutral"> </span>
|
|
387
387
|
<span class="cline-any cline-neutral"> </span>
|
|
388
388
|
<span class="cline-any cline-neutral"> </span>
|
|
389
|
-
<span class="cline-any cline-
|
|
390
|
-
<span class="cline-any cline-
|
|
389
|
+
<span class="cline-any cline-no"> </span>
|
|
390
|
+
<span class="cline-any cline-no"> </span>
|
|
391
391
|
<span class="cline-any cline-neutral"> </span>
|
|
392
392
|
<span class="cline-any cline-neutral"> </span>
|
|
393
393
|
<span class="cline-any cline-neutral"> </span>
|
|
394
|
-
<span class="cline-any cline-
|
|
394
|
+
<span class="cline-any cline-no"> </span>
|
|
395
395
|
<span class="cline-any cline-neutral"> </span>
|
|
396
396
|
<span class="cline-any cline-neutral"> </span>
|
|
397
397
|
<span class="cline-any cline-neutral"> </span>
|
|
@@ -499,35 +499,35 @@
|
|
|
499
499
|
<span class="cline-any cline-neutral"> </span>
|
|
500
500
|
<span class="cline-any cline-neutral"> </span>
|
|
501
501
|
<span class="cline-any cline-neutral"> </span>
|
|
502
|
-
<span class="cline-any cline-
|
|
502
|
+
<span class="cline-any cline-no"> </span>
|
|
503
503
|
<span class="cline-any cline-neutral"> </span>
|
|
504
|
-
<span class="cline-any cline-
|
|
505
|
-
<span class="cline-any cline-
|
|
506
|
-
<span class="cline-any cline-
|
|
507
|
-
<span class="cline-any cline-
|
|
508
|
-
<span class="cline-any cline-
|
|
509
|
-
<span class="cline-any cline-
|
|
504
|
+
<span class="cline-any cline-no"> </span>
|
|
505
|
+
<span class="cline-any cline-no"> </span>
|
|
506
|
+
<span class="cline-any cline-no"> </span>
|
|
507
|
+
<span class="cline-any cline-no"> </span>
|
|
508
|
+
<span class="cline-any cline-no"> </span>
|
|
509
|
+
<span class="cline-any cline-no"> </span>
|
|
510
510
|
<span class="cline-any cline-neutral"> </span>
|
|
511
511
|
<span class="cline-any cline-neutral"> </span>
|
|
512
512
|
<span class="cline-any cline-neutral"> </span>
|
|
513
|
-
<span class="cline-any cline-
|
|
514
|
-
<span class="cline-any cline-
|
|
513
|
+
<span class="cline-any cline-no"> </span>
|
|
514
|
+
<span class="cline-any cline-no"> </span>
|
|
515
515
|
<span class="cline-any cline-neutral"> </span>
|
|
516
|
-
<span class="cline-any cline-
|
|
516
|
+
<span class="cline-any cline-no"> </span>
|
|
517
517
|
<span class="cline-any cline-neutral"> </span>
|
|
518
518
|
<span class="cline-any cline-neutral"> </span>
|
|
519
|
-
<span class="cline-any cline-
|
|
519
|
+
<span class="cline-any cline-no"> </span>
|
|
520
520
|
<span class="cline-any cline-neutral"> </span>
|
|
521
521
|
<span class="cline-any cline-neutral"> </span>
|
|
522
522
|
<span class="cline-any cline-neutral"> </span>
|
|
523
|
-
<span class="cline-any cline-
|
|
523
|
+
<span class="cline-any cline-no"> </span>
|
|
524
524
|
<span class="cline-any cline-no"> </span>
|
|
525
525
|
<span class="cline-any cline-neutral"> </span>
|
|
526
526
|
<span class="cline-any cline-neutral"> </span>
|
|
527
|
-
<span class="cline-any cline-
|
|
528
|
-
<span class="cline-any cline-
|
|
527
|
+
<span class="cline-any cline-no"> </span>
|
|
528
|
+
<span class="cline-any cline-no"> </span>
|
|
529
529
|
<span class="cline-any cline-neutral"> </span>
|
|
530
|
-
<span class="cline-any cline-
|
|
530
|
+
<span class="cline-any cline-no"> </span>
|
|
531
531
|
<span class="cline-any cline-no"> </span>
|
|
532
532
|
<span class="cline-any cline-no"> </span>
|
|
533
533
|
<span class="cline-any cline-no"> </span>
|
|
@@ -550,7 +550,7 @@
|
|
|
550
550
|
<span class="cline-any cline-neutral"> </span>
|
|
551
551
|
<span class="cline-any cline-neutral"> </span>
|
|
552
552
|
<span class="cline-any cline-neutral"> </span>
|
|
553
|
-
<span class="cline-any cline-
|
|
553
|
+
<span class="cline-any cline-no"> </span>
|
|
554
554
|
<span class="cline-any cline-neutral"> </span>
|
|
555
555
|
<span class="cline-any cline-neutral"> </span>
|
|
556
556
|
<span class="cline-any cline-neutral"> </span>
|
|
@@ -562,15 +562,15 @@
|
|
|
562
562
|
<span class="cline-any cline-neutral"> </span>
|
|
563
563
|
<span class="cline-any cline-neutral"> </span>
|
|
564
564
|
<span class="cline-any cline-neutral"> </span>
|
|
565
|
-
<span class="cline-any cline-
|
|
566
|
-
<span class="cline-any cline-
|
|
565
|
+
<span class="cline-any cline-no"> </span>
|
|
566
|
+
<span class="cline-any cline-no"> </span>
|
|
567
567
|
<span class="cline-any cline-neutral"> </span>
|
|
568
568
|
<span class="cline-any cline-neutral"> </span>
|
|
569
|
-
<span class="cline-any cline-
|
|
569
|
+
<span class="cline-any cline-no"> </span>
|
|
570
570
|
<span class="cline-any cline-neutral"> </span>
|
|
571
|
-
<span class="cline-any cline-
|
|
572
|
-
<span class="cline-any cline-
|
|
573
|
-
<span class="cline-any cline-
|
|
571
|
+
<span class="cline-any cline-no"> </span>
|
|
572
|
+
<span class="cline-any cline-no"> </span>
|
|
573
|
+
<span class="cline-any cline-no"> </span>
|
|
574
574
|
<span class="cline-any cline-neutral"> </span>
|
|
575
575
|
<span class="cline-any cline-neutral"> </span>
|
|
576
576
|
<span class="cline-any cline-no"> </span>
|
|
@@ -578,30 +578,30 @@
|
|
|
578
578
|
<span class="cline-any cline-no"> </span>
|
|
579
579
|
<span class="cline-any cline-neutral"> </span>
|
|
580
580
|
<span class="cline-any cline-neutral"> </span>
|
|
581
|
-
<span class="cline-any cline-
|
|
582
|
-
<span class="cline-any cline-
|
|
583
|
-
<span class="cline-any cline-
|
|
584
|
-
<span class="cline-any cline-
|
|
585
|
-
<span class="cline-any cline-
|
|
586
|
-
<span class="cline-any cline-
|
|
587
|
-
<span class="cline-any cline-
|
|
588
|
-
<span class="cline-any cline-
|
|
589
|
-
<span class="cline-any cline-
|
|
581
|
+
<span class="cline-any cline-no"> </span>
|
|
582
|
+
<span class="cline-any cline-no"> </span>
|
|
583
|
+
<span class="cline-any cline-no"> </span>
|
|
584
|
+
<span class="cline-any cline-no"> </span>
|
|
585
|
+
<span class="cline-any cline-no"> </span>
|
|
586
|
+
<span class="cline-any cline-no"> </span>
|
|
587
|
+
<span class="cline-any cline-no"> </span>
|
|
588
|
+
<span class="cline-any cline-no"> </span>
|
|
589
|
+
<span class="cline-any cline-no"> </span>
|
|
590
590
|
<span class="cline-any cline-neutral"> </span>
|
|
591
|
-
<span class="cline-any cline-
|
|
591
|
+
<span class="cline-any cline-no"> </span>
|
|
592
592
|
<span class="cline-any cline-neutral"> </span>
|
|
593
593
|
<span class="cline-any cline-neutral"> </span>
|
|
594
|
-
<span class="cline-any cline-
|
|
594
|
+
<span class="cline-any cline-no"> </span>
|
|
595
595
|
<span class="cline-any cline-no"> </span>
|
|
596
596
|
<span class="cline-any cline-no"> </span>
|
|
597
597
|
<span class="cline-any cline-no"> </span>
|
|
598
598
|
<span class="cline-any cline-neutral"> </span>
|
|
599
599
|
<span class="cline-any cline-neutral"> </span>
|
|
600
|
-
<span class="cline-any cline-
|
|
600
|
+
<span class="cline-any cline-no"> </span>
|
|
601
601
|
<span class="cline-any cline-neutral"> </span>
|
|
602
602
|
<span class="cline-any cline-neutral"> </span>
|
|
603
603
|
<span class="cline-any cline-neutral"> </span>
|
|
604
|
-
<span class="cline-any cline-
|
|
604
|
+
<span class="cline-any cline-no"> </span>
|
|
605
605
|
<span class="cline-any cline-no"> </span>
|
|
606
606
|
<span class="cline-any cline-no"> </span>
|
|
607
607
|
<span class="cline-any cline-no"> </span>
|
|
@@ -609,7 +609,7 @@
|
|
|
609
609
|
<span class="cline-any cline-neutral"> </span>
|
|
610
610
|
<span class="cline-any cline-neutral"> </span>
|
|
611
611
|
<span class="cline-any cline-neutral"> </span>
|
|
612
|
-
<span class="cline-any cline-
|
|
612
|
+
<span class="cline-any cline-no"> </span>
|
|
613
613
|
<span class="cline-any cline-no"> </span>
|
|
614
614
|
<span class="cline-any cline-neutral"> </span>
|
|
615
615
|
<span class="cline-any cline-neutral"> </span>
|
|
@@ -673,7 +673,7 @@
|
|
|
673
673
|
<span class="cline-any cline-neutral"> </span>
|
|
674
674
|
<span class="cline-any cline-neutral"> </span>
|
|
675
675
|
<span class="cline-any cline-neutral"> </span>
|
|
676
|
-
<span class="cline-any cline-
|
|
676
|
+
<span class="cline-any cline-no"> </span>
|
|
677
677
|
<span class="cline-any cline-neutral"> </span>
|
|
678
678
|
<span class="cline-any cline-neutral"> </span>
|
|
679
679
|
<span class="cline-any cline-neutral"> </span>
|
|
@@ -682,7 +682,7 @@
|
|
|
682
682
|
<span class="cline-any cline-neutral"> </span>
|
|
683
683
|
<span class="cline-any cline-neutral"> </span>
|
|
684
684
|
<span class="cline-any cline-neutral"> </span>
|
|
685
|
-
<span class="cline-any cline-
|
|
685
|
+
<span class="cline-any cline-no"> </span>
|
|
686
686
|
<span class="cline-any cline-neutral"> </span>
|
|
687
687
|
<span class="cline-any cline-neutral"> </span>
|
|
688
688
|
<span class="cline-any cline-neutral"> </span>
|
|
@@ -702,12 +702,12 @@
|
|
|
702
702
|
* we can intercept the network requests
|
|
703
703
|
* in not-so-hacky way
|
|
704
704
|
* */
|
|
705
|
-
import NetworkMessage, { RequestState } from './networkMessage.js'
|
|
706
|
-
import { formatByteSize, genStringBody, getStringResponseByType, getURL } from './utils.js'
|
|
705
|
+
<span class="cstat-no" title="statement not covered" >import NetworkMessage, { RequestState } from './networkMessage.js'</span>
|
|
706
|
+
<span class="cstat-no" title="statement not covered" >import { formatByteSize, genStringBody, getStringResponseByType, getURL } from './utils.js'</span>
|
|
707
707
|
import { RequestResponseData } from './types.js'
|
|
708
708
|
import { NetworkRequest } from '../../../common/messages.gen.js'
|
|
709
709
|
|
|
710
|
-
export class
|
|
710
|
+
<span class="cstat-no" title="statement not covered" >export class R</span>esponseProxyHandler<T extends Response> implements ProxyHandler<T> {
|
|
711
711
|
public resp: Response
|
|
712
712
|
public item: NetworkMessage
|
|
713
713
|
|
|
@@ -815,35 +815,35 @@ export class ResponseProxyHandler<T extends Response> implements ProxyHand
|
|
|
815
815
|
}
|
|
816
816
|
}
|
|
817
817
|
|
|
818
|
-
export class
|
|
819
|
-
constructor(
|
|
820
|
-
private readonly ignoredHeaders: boolean | string[]
|
|
821
|
-
private readonly setSessionTokenHeader: (cb: (name: string, value: string) => void) => void
|
|
822
|
-
private readonly sanitize: (data: RequestResponseData) => RequestResponseData
|
|
823
|
-
private readonly sendMessage: (item: NetworkRequest) => void
|
|
824
|
-
private readonly isServiceUrl: (url: string) => boolean
|
|
825
|
-
private readonly tokenUrlMatcher?: (url: string) => boolean
|
|
818
|
+
<span class="cstat-no" title="statement not covered" >export class F</span>etchProxyHandler<T extends typeof fetch> implements ProxyHandler<T> {
|
|
819
|
+
<span class="fstat-no" title="function not covered" > constructor(</span>
|
|
820
|
+
private readonly <span class="cstat-no" title="statement not covered" >ignoredHeaders: boolean | string[],</span>
|
|
821
|
+
private readonly <span class="cstat-no" title="statement not covered" >setSessionTokenHeader: (cb: (name: string, value: string) => void) => void,</span>
|
|
822
|
+
private readonly <span class="cstat-no" title="statement not covered" >sanitize: (data: RequestResponseData) => RequestResponseData,</span>
|
|
823
|
+
private readonly <span class="cstat-no" title="statement not covered" >sendMessage: (item: NetworkRequest) => void,</span>
|
|
824
|
+
private readonly <span class="cstat-no" title="statement not covered" >isServiceUrl: (url: string) => boolean,</span>
|
|
825
|
+
private readonly <span class="cstat-no" title="statement not covered" >tokenUrlMatcher?: (url: string) => boolean,</span>
|
|
826
826
|
) {}
|
|
827
827
|
|
|
828
|
-
public apply(target: T, _: typeof window, argsList: [RequestInfo | URL, RequestInit]) {
|
|
829
|
-
const input = argsList[0]
|
|
830
|
-
const init = argsList[1]
|
|
828
|
+
public <span class="fstat-no" title="function not covered" >apply(</span>target: T, _: typeof window, argsList: [RequestInfo | URL, RequestInit]) {
|
|
829
|
+
const input = <span class="cstat-no" title="statement not covered" >argsList[0]</span>
|
|
830
|
+
const init = <span class="cstat-no" title="statement not covered" >argsList[1]</span>
|
|
831
831
|
// @ts-ignore
|
|
832
|
-
|
|
832
|
+
<span class="cstat-no" title="statement not covered" > <span class="missing-if-branch" title="if path not taken" >I</span>if (!input || !input?.url) <span class="cstat-no" title="statement not covered" >return <ReturnType<T>>target.apply(window, argsList)</span></span>
|
|
833
833
|
|
|
834
834
|
const isORUrl =
|
|
835
|
-
input instanceof URL || typeof input === 'string'
|
|
835
|
+
<span class="cstat-no" title="statement not covered" > input instanceof URL || typeof input === 'string'</span>
|
|
836
836
|
? this.isServiceUrl(String(input))
|
|
837
|
-
:
|
|
837
|
+
: this.isServiceUrl(String(input.url))
|
|
838
838
|
|
|
839
|
-
<span class="missing-if-branch" title="if path not taken" >I</span>if (isORUrl) {
|
|
839
|
+
<span class="cstat-no" title="statement not covered" > <span class="missing-if-branch" title="if path not taken" >I</span>if (isORUrl) {</span>
|
|
840
840
|
<span class="cstat-no" title="statement not covered" > return target.apply(window, argsList)</span>
|
|
841
841
|
}
|
|
842
842
|
|
|
843
|
-
const item = new NetworkMessage(this.ignoredHeaders, this.setSessionTokenHeader, this.sanitize)
|
|
844
|
-
this.beforeFetch(item, input as RequestInfo, init)
|
|
843
|
+
const item = <span class="cstat-no" title="statement not covered" >new NetworkMessage(this.ignoredHeaders, this.setSessionTokenHeader, this.sanitize)</span>
|
|
844
|
+
<span class="cstat-no" title="statement not covered" > this.beforeFetch(item, input as RequestInfo, init)</span>
|
|
845
845
|
|
|
846
|
-
this.setSessionTokenHeader(<span class="fstat-no" title="function not covered" >(n</span>ame, value) => {
|
|
846
|
+
<span class="cstat-no" title="statement not covered" > this.setSessionTokenHeader(<span class="fstat-no" title="function not covered" >(n</span>ame, value) => {</span>
|
|
847
847
|
<span class="cstat-no" title="statement not covered" > <span class="missing-if-branch" title="if path not taken" >I</span>if (this.tokenUrlMatcher !== undefined) {</span>
|
|
848
848
|
<span class="cstat-no" title="statement not covered" > <span class="missing-if-branch" title="if path not taken" >I</span>if (!this.tokenUrlMatcher(item.url)) {</span>
|
|
849
849
|
<span class="cstat-no" title="statement not covered" > return</span>
|
|
@@ -866,7 +866,7 @@ export class FetchProxyHandler<T extends typeof fetch> implements ProxyHan
|
|
|
866
866
|
}
|
|
867
867
|
}
|
|
868
868
|
})
|
|
869
|
-
return (<ReturnType<T>>target.apply(window, argsList))
|
|
869
|
+
<span class="cstat-no" title="statement not covered" > return (<ReturnType<T>>target.apply(window, argsList))</span>
|
|
870
870
|
.then(this.afterFetch(item))
|
|
871
871
|
.catch(<span class="fstat-no" title="function not covered" >(e</span>) => {
|
|
872
872
|
// mock finally
|
|
@@ -876,48 +876,48 @@ export class FetchProxyHandler<T extends typeof fetch> implements ProxyHan
|
|
|
876
876
|
})
|
|
877
877
|
}
|
|
878
878
|
|
|
879
|
-
protected beforeFetch(item: NetworkMessage, input: RequestInfo, init?: RequestInit) {
|
|
879
|
+
protected <span class="fstat-no" title="function not covered" >beforeFetch(</span>item: NetworkMessage, input: RequestInfo | string, init?: RequestInit) {
|
|
880
880
|
let url: URL,
|
|
881
|
-
method = 'GET'
|
|
882
|
-
requestHeader: HeadersInit = {}
|
|
881
|
+
method = <span class="cstat-no" title="statement not covered" >'GET',</span>
|
|
882
|
+
requestHeader: HeadersInit = <span class="cstat-no" title="statement not covered" >{}</span>
|
|
883
883
|
|
|
884
884
|
// handle `input` content
|
|
885
|
-
if (typeof input === 'string') {
|
|
885
|
+
<span class="cstat-no" title="statement not covered" > if (typeof input === 'string') {</span>
|
|
886
886
|
// when `input` is a string
|
|
887
|
-
|
|
888
|
-
url = getURL(input)
|
|
889
|
-
|
|
890
|
-
} else
|
|
887
|
+
<span class="cstat-no" title="statement not covered" > method = init?.method || 'GET'</span>
|
|
888
|
+
<span class="cstat-no" title="statement not covered" > url = getURL(input)</span>
|
|
889
|
+
<span class="cstat-no" title="statement not covered" > requestHeader = init?.headers || {}</span>
|
|
890
|
+
} else {
|
|
891
891
|
// when `input` is a `Request` object
|
|
892
892
|
<span class="cstat-no" title="statement not covered" > method = input.method || 'GET'</span>
|
|
893
893
|
<span class="cstat-no" title="statement not covered" > url = getURL(input.url)</span>
|
|
894
894
|
<span class="cstat-no" title="statement not covered" > requestHeader = input.headers</span>
|
|
895
895
|
}
|
|
896
896
|
|
|
897
|
-
item.method = <NetworkMessage['method']>method
|
|
898
|
-
item.requestType = 'fetch'
|
|
899
|
-
item.requestHeader = requestHeader
|
|
900
|
-
item.url = url.toString()
|
|
901
|
-
item.name = (url.pathname.split('/').pop() || '') + url.search
|
|
902
|
-
item.status = 0
|
|
903
|
-
item.statusText = 'Pending'
|
|
904
|
-
item.readyState = 1
|
|
905
|
-
if (!item.startTime) {
|
|
897
|
+
<span class="cstat-no" title="statement not covered" > item.method = <NetworkMessage['method']>method</span>
|
|
898
|
+
<span class="cstat-no" title="statement not covered" > item.requestType = 'fetch'</span>
|
|
899
|
+
<span class="cstat-no" title="statement not covered" > item.requestHeader = requestHeader</span>
|
|
900
|
+
<span class="cstat-no" title="statement not covered" > item.url = url.toString()</span>
|
|
901
|
+
<span class="cstat-no" title="statement not covered" > item.name = (url.pathname.split('/').pop() || '') + url.search</span>
|
|
902
|
+
<span class="cstat-no" title="statement not covered" > item.status = 0</span>
|
|
903
|
+
<span class="cstat-no" title="statement not covered" > item.statusText = 'Pending'</span>
|
|
904
|
+
<span class="cstat-no" title="statement not covered" > item.readyState = 1</span>
|
|
905
|
+
<span class="cstat-no" title="statement not covered" > <span class="missing-if-branch" title="if path not taken" >I</span>if (!item.startTime) {</span>
|
|
906
906
|
// UNSENT
|
|
907
|
-
item.startTime = performance.now()
|
|
907
|
+
<span class="cstat-no" title="statement not covered" > item.startTime = performance.now()</span>
|
|
908
908
|
}
|
|
909
909
|
|
|
910
|
-
|
|
910
|
+
<span class="cstat-no" title="statement not covered" > if (Object.prototype.toString.call(requestHeader) === '[object Headers]') {</span>
|
|
911
911
|
<span class="cstat-no" title="statement not covered" > item.requestHeader = {}</span>
|
|
912
912
|
<span class="cstat-no" title="statement not covered" > for (const [key, value] of <Headers>requestHeader) {</span>
|
|
913
913
|
<span class="cstat-no" title="statement not covered" > item.requestHeader[key] = value</span>
|
|
914
914
|
}
|
|
915
915
|
} else {
|
|
916
|
-
item.requestHeader = requestHeader
|
|
916
|
+
<span class="cstat-no" title="statement not covered" > item.requestHeader = requestHeader</span>
|
|
917
917
|
}
|
|
918
918
|
|
|
919
919
|
// save GET data
|
|
920
|
-
<span class="missing-if-branch" title="if path not taken" >I</span>if (url.search &&
|
|
920
|
+
<span class="cstat-no" title="statement not covered" > <span class="missing-if-branch" title="if path not taken" >I</span>if (url.search && url.searchParams) {</span>
|
|
921
921
|
<span class="cstat-no" title="statement not covered" > item.getData = {}</span>
|
|
922
922
|
<span class="cstat-no" title="statement not covered" > for (const [key, value] of url.searchParams) {</span>
|
|
923
923
|
<span class="cstat-no" title="statement not covered" > item.getData[key] = value</span>
|
|
@@ -925,7 +925,7 @@ export class FetchProxyHandler<T extends typeof fetch> implements ProxyHan
|
|
|
925
925
|
}
|
|
926
926
|
|
|
927
927
|
// save POST data
|
|
928
|
-
|
|
928
|
+
<span class="cstat-no" title="statement not covered" > <span class="missing-if-branch" title="if path not taken" >I</span>if (init?.body) {</span>
|
|
929
929
|
<span class="cstat-no" title="statement not covered" > item.requestData = genStringBody(init.body)</span>
|
|
930
930
|
}
|
|
931
931
|
}
|
|
@@ -989,8 +989,8 @@ export class FetchProxyHandler<T extends typeof fetch> implements ProxyHan
|
|
|
989
989
|
}
|
|
990
990
|
}
|
|
991
991
|
|
|
992
|
-
export default class
|
|
993
|
-
public static create(
|
|
992
|
+
<span class="cstat-no" title="statement not covered" >export default class F</span>etchProxy {
|
|
993
|
+
public <span class="fstat-no" title="function not covered" >static </span>create(
|
|
994
994
|
ignoredHeaders: boolean | string[],
|
|
995
995
|
setSessionTokenHeader: (cb: (name: string, value: string) => void) => void,
|
|
996
996
|
sanitize: (data: RequestResponseData) => RequestResponseData,
|
|
@@ -998,7 +998,7 @@ export default class FetchProxy {
|
|
|
998
998
|
isServiceUrl: (url: string) => boolean,
|
|
999
999
|
tokenUrlMatcher?: (url: string) => boolean,
|
|
1000
1000
|
) {
|
|
1001
|
-
return new Proxy(
|
|
1001
|
+
<span class="cstat-no" title="statement not covered" > return new Proxy(</span>
|
|
1002
1002
|
fetch,
|
|
1003
1003
|
new FetchProxyHandler(
|
|
1004
1004
|
ignoredHeaders,
|
|
@@ -1018,7 +1018,7 @@ export default class FetchProxy {
|
|
|
1018
1018
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
1019
1019
|
Code coverage generated by
|
|
1020
1020
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
1021
|
-
at 2023-
|
|
1021
|
+
at 2023-12-15T15:55:44.965Z
|
|
1022
1022
|
</div>
|
|
1023
1023
|
<script src="../../../prettify.js"></script>
|
|
1024
1024
|
<script>
|