Krzysztof Sikorski commited on 2021-11-16 00:33:17
Showing 5 changed files, with 2 additions and 36 deletions.
... | ... |
@@ -1,14 +1,6 @@ |
1 | 1 |
/* global NexusDataQueue, NexusDataSender, Preferences, WebRequestMonitor */ |
2 | 2 |
'use strict' |
3 | 3 |
|
4 |
-function generateSessionId() { |
|
5 |
- const timestamp = Date.now() |
|
6 |
- const suffix = 1000000 * Math.random() |
|
7 |
- return `${timestamp}_${suffix}` |
|
8 |
-} |
|
9 |
- |
|
10 |
-const sessionId = generateSessionId() |
|
11 |
- |
|
12 | 4 |
const preferences = new Preferences() |
13 | 5 |
preferences.load() |
14 | 6 |
preferences.listenForStorageChanges() |
... | ... |
@@ -17,5 +9,5 @@ const nexusDataQueue = new NexusDataQueue() |
17 | 9 |
|
18 | 10 |
const nexusDataSender = new NexusDataSender(preferences) |
19 | 11 |
|
20 |
-const webRequestMonitor = new WebRequestMonitor(sessionId, nexusDataQueue, nexusDataSender) |
|
12 |
+const webRequestMonitor = new WebRequestMonitor(nexusDataQueue, nexusDataSender) |
|
21 | 13 |
webRequestMonitor.addListeners() |
... | ... |
@@ -3,9 +3,7 @@ |
3 | 3 |
|
4 | 4 |
class NexusData { |
5 | 5 |
constructor() { |
6 |
- this._sessionId = null |
|
7 | 6 |
this._requestId = null |
8 |
- this._previousRequestId = null |
|
9 | 7 |
this._requestStartedAt = null |
10 | 8 |
this._responseCompletedAt = null |
11 | 9 |
this._method = null |
... | ... |
@@ -14,14 +12,6 @@ class NexusData { |
14 | 12 |
this._responseBodyParts = [] |
15 | 13 |
} |
16 | 14 |
|
17 |
- get sessionId() { |
|
18 |
- return this._sessionId |
|
19 |
- } |
|
20 |
- |
|
21 |
- set sessionId(value) { |
|
22 |
- this._sessionId = value |
|
23 |
- } |
|
24 |
- |
|
25 | 15 |
get requestId() { |
26 | 16 |
return this._requestId |
27 | 17 |
} |
... | ... |
@@ -30,14 +20,6 @@ class NexusData { |
30 | 20 |
this._requestId = value |
31 | 21 |
} |
32 | 22 |
|
33 |
- get previousRequestId() { |
|
34 |
- return this._previousRequestId |
|
35 |
- } |
|
36 |
- |
|
37 |
- set previousRequestId(value) { |
|
38 |
- this._previousRequestId = value |
|
39 |
- } |
|
40 |
- |
|
41 | 23 |
get requestStartedAt() { |
42 | 24 |
return this._requestStartedAt |
43 | 25 |
} |
... | ... |
@@ -5,15 +5,12 @@ |
5 | 5 |
class NexusDataQueue { |
6 | 6 |
constructor() { |
7 | 7 |
this._data = new Map() |
8 |
- this._currentRequestId = null |
|
9 | 8 |
} |
10 | 9 |
|
11 | 10 |
push(nexusData) { |
12 | 11 |
if (!(nexusData instanceof NexusData)) { |
13 | 12 |
window.console.error('[NexusDataQueue] push: argument is not an instance of NexusData!') |
14 | 13 |
} |
15 |
- nexusData.previousRequestId = this._currentRequestId |
|
16 |
- this._currentRequestId = nexusData.requestId |
|
17 | 14 |
this._data.set(nexusData.requestId, nexusData) |
18 | 15 |
} |
19 | 16 |
|
... | ... |
@@ -25,9 +25,6 @@ class NexusDataSender { |
25 | 25 |
} |
26 | 26 |
|
27 | 27 |
const jsonData = { |
28 |
- sessionId: nexusData.sessionId, |
|
29 |
- requestId: nexusData.requestId, |
|
30 |
- previousRequestId: nexusData.previousRequestId, |
|
31 | 28 |
requestStartedAt: this._formatDate(nexusData.requestStartedAt), |
32 | 29 |
responseCompletedAt: this._formatDate(nexusData.responseCompletedAt), |
33 | 30 |
method: nexusData.method, |
... | ... |
@@ -3,14 +3,13 @@ |
3 | 3 |
'use strict' |
4 | 4 |
|
5 | 5 |
class WebRequestMonitor { |
6 |
- constructor(sessionId, nexusDataQueue, nexusDataSender) { |
|
6 |
+ constructor(nexusDataQueue, nexusDataSender) { |
|
7 | 7 |
if (!(nexusDataQueue instanceof NexusDataQueue)) { |
8 | 8 |
window.console.error('[NexusDataSender] constructor: argument is not an instance of NexusDataQueue!') |
9 | 9 |
} |
10 | 10 |
if (!(nexusDataSender instanceof NexusDataSender)) { |
11 | 11 |
window.console.error('[NexusDataSender] constructor: argument is not an instance of NexusDataSender!') |
12 | 12 |
} |
13 |
- this._sessionId = sessionId |
|
14 | 13 |
this._nexusDataQueue = nexusDataQueue |
15 | 14 |
this._nexusDataSender = nexusDataSender |
16 | 15 |
} |
... | ... |
@@ -34,7 +33,6 @@ class WebRequestMonitor { |
34 | 33 |
|
35 | 34 |
_onBeforeRequest(details) { |
36 | 35 |
const nexusData = new NexusData() |
37 |
- nexusData.sessionId = this._sessionId |
|
38 | 36 |
nexusData.requestId = details.requestId |
39 | 37 |
nexusData.requestStartedAt = details.timeStamp |
40 | 38 |
nexusData.method = details.method |
41 | 39 |