tracker: 16.0.2 fix str dictionary keys
This commit is contained in:
parent
cf9ecdc9a4
commit
9aca716e6b
5 changed files with 10 additions and 4 deletions
Binary file not shown.
Binary file not shown.
|
|
@ -1,3 +1,7 @@
|
||||||
|
## 16.0.2
|
||||||
|
|
||||||
|
- fix attributeSender key generation to prevent calling native methods on objects
|
||||||
|
|
||||||
## 16.0.1
|
## 16.0.1
|
||||||
|
|
||||||
- drop computing ts digits
|
- drop computing ts digits
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "@openreplay/tracker",
|
"name": "@openreplay/tracker",
|
||||||
"description": "The OpenReplay tracker main package",
|
"description": "The OpenReplay tracker main package",
|
||||||
"version": "16.0.1",
|
"version": "16.0.2",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"logging",
|
"logging",
|
||||||
"replay"
|
"replay"
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,9 @@ export class StringDictionary {
|
||||||
|
|
||||||
getKey = (str: string): [number, boolean] => {
|
getKey = (str: string): [number, boolean] => {
|
||||||
let isNew = false
|
let isNew = false
|
||||||
if (!this.backDict[str]) {
|
// avoiding potential native object properties
|
||||||
|
const safeKey = `__${str}`
|
||||||
|
if (!this.backDict[safeKey]) {
|
||||||
isNew = true
|
isNew = true
|
||||||
// shaving the first 2 digits of the timestamp (since they are irrelevant for next millennia)
|
// shaving the first 2 digits of the timestamp (since they are irrelevant for next millennia)
|
||||||
const shavedTs = Date.now() % 10 ** (13 - 2)
|
const shavedTs = Date.now() % 10 ** (13 - 2)
|
||||||
|
|
@ -26,10 +28,10 @@ export class StringDictionary {
|
||||||
} else {
|
} else {
|
||||||
this.lastSuffix = 1
|
this.lastSuffix = 1
|
||||||
}
|
}
|
||||||
this.backDict[str] = id
|
this.backDict[safeKey] = id
|
||||||
this.lastTs = shavedTs
|
this.lastTs = shavedTs
|
||||||
}
|
}
|
||||||
return [this.backDict[str], isNew]
|
return [this.backDict[safeKey], isNew]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue