diff --git a/backend/pkg/messages/filters.go b/backend/pkg/messages/filters.go index 7a363f3d8..f74dbc124 100644 --- a/backend/pkg/messages/filters.go +++ b/backend/pkg/messages/filters.go @@ -10,5 +10,5 @@ func IsMobileType(id int) bool { } func IsDOMType(id int) bool { - return 0 == id || 4 == id || 5 == id || 6 == id || 7 == id || 8 == id || 9 == id || 10 == id || 11 == id || 12 == id || 13 == id || 14 == id || 15 == id || 16 == id || 18 == id || 19 == id || 20 == id || 37 == id || 38 == id || 49 == id || 50 == id || 51 == id || 54 == id || 55 == id || 57 == id || 58 == id || 59 == id || 60 == id || 61 == id || 67 == id || 68 == id || 69 == id || 70 == id || 71 == id || 72 == id || 73 == id || 74 == id || 75 == id || 76 == id || 77 == id || 113 == id || 114 == id || 117 == id || 118 == id || 119 == id || 122 == id || 93 == id || 96 == id || 100 == id || 101 == id || 102 == id || 103 == id || 104 == id || 105 == id || 106 == id || 111 == id + return 0 == id || 4 == id || 5 == id || 6 == id || 7 == id || 8 == id || 9 == id || 10 == id || 11 == id || 12 == id || 13 == id || 14 == id || 15 == id || 16 == id || 18 == id || 19 == id || 20 == id || 37 == id || 38 == id || 49 == id || 50 == id || 51 == id || 43 == id || 52 == id || 54 == id || 55 == id || 57 == id || 58 == id || 59 == id || 60 == id || 61 == id || 67 == id || 68 == id || 69 == id || 70 == id || 71 == id || 72 == id || 73 == id || 74 == id || 75 == id || 76 == id || 77 == id || 113 == id || 114 == id || 117 == id || 118 == id || 119 == id || 122 == id || 93 == id || 96 == id || 100 == id || 101 == id || 102 == id || 103 == id || 104 == id || 105 == id || 106 == id || 111 == id } diff --git a/backend/pkg/messages/messages.go b/backend/pkg/messages/messages.go index 19be1a0c7..37f32b8a0 100644 --- a/backend/pkg/messages/messages.go +++ b/backend/pkg/messages/messages.go @@ -2,119 +2,121 @@ package messages const ( - MsgTimestamp = 0 - MsgSessionStart = 1 - MsgSessionEndDeprecated = 3 - MsgSetPageLocationDeprecated = 4 - MsgSetViewportSize = 5 - MsgSetViewportScroll = 6 - MsgCreateDocument = 7 - MsgCreateElementNode = 8 - MsgCreateTextNode = 9 - MsgMoveNode = 10 - MsgRemoveNode = 11 - MsgSetNodeAttribute = 12 - MsgRemoveNodeAttribute = 13 - MsgSetNodeData = 14 - MsgSetCSSData = 15 - MsgSetNodeScroll = 16 - MsgSetInputTarget = 17 - MsgSetInputValue = 18 - MsgSetInputChecked = 19 - MsgMouseMove = 20 - MsgNetworkRequestDeprecated = 21 - MsgConsoleLog = 22 - MsgPageLoadTiming = 23 - MsgPageRenderTiming = 24 - MsgJSExceptionDeprecated = 25 - MsgIntegrationEvent = 26 - MsgCustomEvent = 27 - MsgUserID = 28 - MsgUserAnonymousID = 29 - MsgMetadata = 30 - MsgPageEventDeprecated = 31 - MsgInputEvent = 32 - MsgPageEvent = 33 - MsgCSSInsertRule = 37 - MsgCSSDeleteRule = 38 - MsgFetch = 39 - MsgProfiler = 40 - MsgOTable = 41 - MsgStateAction = 42 - MsgReduxDeprecated = 44 - MsgVuex = 45 - MsgMobX = 46 - MsgNgRx = 47 - MsgGraphQLDeprecated = 48 - MsgPerformanceTrack = 49 - MsgStringDict = 50 - MsgSetNodeAttributeDict = 51 - MsgResourceTimingDeprecated = 53 - MsgConnectionInformation = 54 - MsgSetPageVisibility = 55 - MsgPerformanceTrackAggr = 56 - MsgLoadFontFace = 57 - MsgSetNodeFocus = 58 - MsgLongTask = 59 - MsgSetNodeAttributeURLBased = 60 - MsgSetCSSDataURLBased = 61 - MsgIssueEventDeprecated = 62 - MsgTechnicalInfo = 63 - MsgCustomIssue = 64 - MsgAssetCache = 66 - MsgCSSInsertRuleURLBased = 67 - MsgMouseClick = 68 - MsgMouseClickDeprecated = 69 - MsgCreateIFrameDocument = 70 - MsgAdoptedSSReplaceURLBased = 71 - MsgAdoptedSSReplace = 72 - MsgAdoptedSSInsertRuleURLBased = 73 - MsgAdoptedSSInsertRule = 74 - MsgAdoptedSSDeleteRule = 75 - MsgAdoptedSSAddOwner = 76 - MsgAdoptedSSRemoveOwner = 77 - MsgJSException = 78 - MsgZustand = 79 - MsgBatchMeta = 80 - MsgBatchMetadata = 81 - MsgPartitionedMessage = 82 - MsgNetworkRequest = 83 - MsgWSChannel = 84 - MsgInputChange = 112 - MsgSelectionChange = 113 - MsgMouseThrashing = 114 - MsgUnbindNodes = 115 - MsgResourceTiming = 116 - MsgTabChange = 117 - MsgTabData = 118 - MsgCanvasNode = 119 - MsgTagTrigger = 120 - MsgRedux = 121 - MsgSetPageLocation = 122 - MsgGraphQL = 123 - MsgWebVitals = 124 - MsgIssueEvent = 125 - MsgSessionEnd = 126 - MsgSessionSearch = 127 - MsgMobileSessionStart = 90 - MsgMobileSessionEnd = 91 - MsgMobileMetadata = 92 - MsgMobileEvent = 93 - MsgMobileUserID = 94 - MsgMobileUserAnonymousID = 95 - MsgMobileScreenChanges = 96 - MsgMobileCrash = 97 - MsgMobileViewComponentEvent = 98 - MsgMobileClickEvent = 100 - MsgMobileInputEvent = 101 - MsgMobilePerformanceEvent = 102 - MsgMobileLog = 103 - MsgMobileInternalError = 104 - MsgMobileNetworkCall = 105 - MsgMobileSwipeEvent = 106 - MsgMobileBatchMeta = 107 - MsgMobilePerformanceAggregated = 110 - MsgMobileIssueEvent = 111 + MsgTimestamp = 0 + MsgSessionStart = 1 + MsgSessionEndDeprecated = 3 + MsgSetPageLocationDeprecated = 4 + MsgSetViewportSize = 5 + MsgSetViewportScroll = 6 + MsgCreateDocument = 7 + MsgCreateElementNode = 8 + MsgCreateTextNode = 9 + MsgMoveNode = 10 + MsgRemoveNode = 11 + MsgSetNodeAttribute = 12 + MsgRemoveNodeAttribute = 13 + MsgSetNodeData = 14 + MsgSetCSSData = 15 + MsgSetNodeScroll = 16 + MsgSetInputTarget = 17 + MsgSetInputValue = 18 + MsgSetInputChecked = 19 + MsgMouseMove = 20 + MsgNetworkRequestDeprecated = 21 + MsgConsoleLog = 22 + MsgPageLoadTiming = 23 + MsgPageRenderTiming = 24 + MsgJSExceptionDeprecated = 25 + MsgIntegrationEvent = 26 + MsgCustomEvent = 27 + MsgUserID = 28 + MsgUserAnonymousID = 29 + MsgMetadata = 30 + MsgPageEventDeprecated = 31 + MsgInputEvent = 32 + MsgPageEvent = 33 + MsgCSSInsertRule = 37 + MsgCSSDeleteRule = 38 + MsgFetch = 39 + MsgProfiler = 40 + MsgOTable = 41 + MsgStateAction = 42 + MsgReduxDeprecated = 44 + MsgVuex = 45 + MsgMobX = 46 + MsgNgRx = 47 + MsgGraphQLDeprecated = 48 + MsgPerformanceTrack = 49 + MsgStringDictDeprecated = 50 + MsgSetNodeAttributeDictDeprecated = 51 + MsgStringDict = 43 + MsgSetNodeAttributeDict = 52 + MsgResourceTimingDeprecated = 53 + MsgConnectionInformation = 54 + MsgSetPageVisibility = 55 + MsgPerformanceTrackAggr = 56 + MsgLoadFontFace = 57 + MsgSetNodeFocus = 58 + MsgLongTask = 59 + MsgSetNodeAttributeURLBased = 60 + MsgSetCSSDataURLBased = 61 + MsgIssueEventDeprecated = 62 + MsgTechnicalInfo = 63 + MsgCustomIssue = 64 + MsgAssetCache = 66 + MsgCSSInsertRuleURLBased = 67 + MsgMouseClick = 68 + MsgMouseClickDeprecated = 69 + MsgCreateIFrameDocument = 70 + MsgAdoptedSSReplaceURLBased = 71 + MsgAdoptedSSReplace = 72 + MsgAdoptedSSInsertRuleURLBased = 73 + MsgAdoptedSSInsertRule = 74 + MsgAdoptedSSDeleteRule = 75 + MsgAdoptedSSAddOwner = 76 + MsgAdoptedSSRemoveOwner = 77 + MsgJSException = 78 + MsgZustand = 79 + MsgBatchMeta = 80 + MsgBatchMetadata = 81 + MsgPartitionedMessage = 82 + MsgNetworkRequest = 83 + MsgWSChannel = 84 + MsgInputChange = 112 + MsgSelectionChange = 113 + MsgMouseThrashing = 114 + MsgUnbindNodes = 115 + MsgResourceTiming = 116 + MsgTabChange = 117 + MsgTabData = 118 + MsgCanvasNode = 119 + MsgTagTrigger = 120 + MsgRedux = 121 + MsgSetPageLocation = 122 + MsgGraphQL = 123 + MsgWebVitals = 124 + MsgIssueEvent = 125 + MsgSessionEnd = 126 + MsgSessionSearch = 127 + MsgMobileSessionStart = 90 + MsgMobileSessionEnd = 91 + MsgMobileMetadata = 92 + MsgMobileEvent = 93 + MsgMobileUserID = 94 + MsgMobileUserAnonymousID = 95 + MsgMobileScreenChanges = 96 + MsgMobileCrash = 97 + MsgMobileViewComponentEvent = 98 + MsgMobileClickEvent = 100 + MsgMobileInputEvent = 101 + MsgMobilePerformanceEvent = 102 + MsgMobileLog = 103 + MsgMobileInternalError = 104 + MsgMobileNetworkCall = 105 + MsgMobileSwipeEvent = 106 + MsgMobileBatchMeta = 107 + MsgMobilePerformanceAggregated = 110 + MsgMobileIssueEvent = 111 ) type Timestamp struct { @@ -1317,13 +1319,13 @@ func (msg *PerformanceTrack) TypeID() int { return 49 } -type StringDict struct { +type StringDictDeprecated struct { message Key uint64 Value string } -func (msg *StringDict) Encode() []byte { +func (msg *StringDictDeprecated) Encode() []byte { buf := make([]byte, 21+len(msg.Value)) buf[0] = 50 p := 1 @@ -1332,22 +1334,22 @@ func (msg *StringDict) Encode() []byte { return buf[:p] } -func (msg *StringDict) Decode() Message { +func (msg *StringDictDeprecated) Decode() Message { return msg } -func (msg *StringDict) TypeID() int { +func (msg *StringDictDeprecated) TypeID() int { return 50 } -type SetNodeAttributeDict struct { +type SetNodeAttributeDictDeprecated struct { message ID uint64 NameKey uint64 ValueKey uint64 } -func (msg *SetNodeAttributeDict) Encode() []byte { +func (msg *SetNodeAttributeDictDeprecated) Encode() []byte { buf := make([]byte, 31) buf[0] = 51 p := 1 @@ -1357,12 +1359,60 @@ func (msg *SetNodeAttributeDict) Encode() []byte { return buf[:p] } +func (msg *SetNodeAttributeDictDeprecated) Decode() Message { + return msg +} + +func (msg *SetNodeAttributeDictDeprecated) TypeID() int { + return 51 +} + +type StringDict struct { + message + Key string + Value string +} + +func (msg *StringDict) Encode() []byte { + buf := make([]byte, 21+len(msg.Key)+len(msg.Value)) + buf[0] = 43 + p := 1 + p = WriteString(msg.Key, buf, p) + p = WriteString(msg.Value, buf, p) + return buf[:p] +} + +func (msg *StringDict) Decode() Message { + return msg +} + +func (msg *StringDict) TypeID() int { + return 43 +} + +type SetNodeAttributeDict struct { + message + ID uint64 + Name string + Value string +} + +func (msg *SetNodeAttributeDict) Encode() []byte { + buf := make([]byte, 31+len(msg.Name)+len(msg.Value)) + buf[0] = 52 + p := 1 + p = WriteUint(msg.ID, buf, p) + p = WriteString(msg.Name, buf, p) + p = WriteString(msg.Value, buf, p) + return buf[:p] +} + func (msg *SetNodeAttributeDict) Decode() Message { return msg } func (msg *SetNodeAttributeDict) TypeID() int { - return 51 + return 52 } type ResourceTimingDeprecated struct { diff --git a/backend/pkg/messages/read-message.go b/backend/pkg/messages/read-message.go index 3521a0e29..37920bfa0 100644 --- a/backend/pkg/messages/read-message.go +++ b/backend/pkg/messages/read-message.go @@ -792,10 +792,37 @@ func DecodePerformanceTrack(reader BytesReader) (Message, error) { return msg, err } +func DecodeStringDictDeprecated(reader BytesReader) (Message, error) { + var err error = nil + msg := &StringDictDeprecated{} + if msg.Key, err = reader.ReadUint(); err != nil { + return nil, err + } + if msg.Value, err = reader.ReadString(); err != nil { + return nil, err + } + return msg, err +} + +func DecodeSetNodeAttributeDictDeprecated(reader BytesReader) (Message, error) { + var err error = nil + msg := &SetNodeAttributeDictDeprecated{} + if msg.ID, err = reader.ReadUint(); err != nil { + return nil, err + } + if msg.NameKey, err = reader.ReadUint(); err != nil { + return nil, err + } + if msg.ValueKey, err = reader.ReadUint(); err != nil { + return nil, err + } + return msg, err +} + func DecodeStringDict(reader BytesReader) (Message, error) { var err error = nil msg := &StringDict{} - if msg.Key, err = reader.ReadUint(); err != nil { + if msg.Key, err = reader.ReadString(); err != nil { return nil, err } if msg.Value, err = reader.ReadString(); err != nil { @@ -810,10 +837,10 @@ func DecodeSetNodeAttributeDict(reader BytesReader) (Message, error) { if msg.ID, err = reader.ReadUint(); err != nil { return nil, err } - if msg.NameKey, err = reader.ReadUint(); err != nil { + if msg.Name, err = reader.ReadString(); err != nil { return nil, err } - if msg.ValueKey, err = reader.ReadUint(); err != nil { + if msg.Value, err = reader.ReadString(); err != nil { return nil, err } return msg, err @@ -2121,8 +2148,12 @@ func ReadMessage(t uint64, reader BytesReader) (Message, error) { case 49: return DecodePerformanceTrack(reader) case 50: - return DecodeStringDict(reader) + return DecodeStringDictDeprecated(reader) case 51: + return DecodeSetNodeAttributeDictDeprecated(reader) + case 43: + return DecodeStringDict(reader) + case 52: return DecodeSetNodeAttributeDict(reader) case 53: return DecodeResourceTimingDeprecated(reader) diff --git a/ee/connectors/msgcodec/messages.py b/ee/connectors/msgcodec/messages.py index 0ad3a15be..53450583d 100644 --- a/ee/connectors/msgcodec/messages.py +++ b/ee/connectors/msgcodec/messages.py @@ -449,7 +449,7 @@ class PerformanceTrack(Message): self.used_js_heap_size = used_js_heap_size -class StringDict(Message): +class StringDictDeprecated(Message): __id__ = 50 def __init__(self, key, value): @@ -457,7 +457,7 @@ class StringDict(Message): self.value = value -class SetNodeAttributeDict(Message): +class SetNodeAttributeDictDeprecated(Message): __id__ = 51 def __init__(self, id, name_key, value_key): @@ -466,6 +466,23 @@ class SetNodeAttributeDict(Message): self.value_key = value_key +class StringDict(Message): + __id__ = 43 + + def __init__(self, key, value): + self.key = key + self.value = value + + +class SetNodeAttributeDict(Message): + __id__ = 52 + + def __init__(self, id, name, value): + self.id = id + self.name = name + self.value = value + + class ResourceTimingDeprecated(Message): __id__ = 53 diff --git a/ee/connectors/msgcodec/messages.pyx b/ee/connectors/msgcodec/messages.pyx index 37183b755..b07658d51 100644 --- a/ee/connectors/msgcodec/messages.pyx +++ b/ee/connectors/msgcodec/messages.pyx @@ -671,7 +671,7 @@ cdef class PerformanceTrack(PyMessage): self.used_js_heap_size = used_js_heap_size -cdef class StringDict(PyMessage): +cdef class StringDictDeprecated(PyMessage): cdef public int __id__ cdef public unsigned long key cdef public str value @@ -682,7 +682,7 @@ cdef class StringDict(PyMessage): self.value = value -cdef class SetNodeAttributeDict(PyMessage): +cdef class SetNodeAttributeDictDeprecated(PyMessage): cdef public int __id__ cdef public unsigned long id cdef public unsigned long name_key @@ -695,6 +695,30 @@ cdef class SetNodeAttributeDict(PyMessage): self.value_key = value_key +cdef class StringDict(PyMessage): + cdef public int __id__ + cdef public str key + cdef public str value + + def __init__(self, str key, str value): + self.__id__ = 43 + self.key = key + self.value = value + + +cdef class SetNodeAttributeDict(PyMessage): + cdef public int __id__ + cdef public unsigned long id + cdef public str name + cdef public str value + + def __init__(self, unsigned long id, str name, str value): + self.__id__ = 52 + self.id = id + self.name = name + self.value = value + + cdef class ResourceTimingDeprecated(PyMessage): cdef public int __id__ cdef public unsigned long timestamp diff --git a/ee/connectors/msgcodec/msgcodec.py b/ee/connectors/msgcodec/msgcodec.py index 6745ee99a..6d771b559 100644 --- a/ee/connectors/msgcodec/msgcodec.py +++ b/ee/connectors/msgcodec/msgcodec.py @@ -447,18 +447,31 @@ class MessageCodec(Codec): ) if message_id == 50: - return StringDict( + return StringDictDeprecated( key=self.read_uint(reader), value=self.read_string(reader) ) if message_id == 51: - return SetNodeAttributeDict( + return SetNodeAttributeDictDeprecated( id=self.read_uint(reader), name_key=self.read_uint(reader), value_key=self.read_uint(reader) ) + if message_id == 43: + return StringDict( + key=self.read_string(reader), + value=self.read_string(reader) + ) + + if message_id == 52: + return SetNodeAttributeDict( + id=self.read_uint(reader), + name=self.read_string(reader), + value=self.read_string(reader) + ) + if message_id == 53: return ResourceTimingDeprecated( timestamp=self.read_uint(reader), diff --git a/ee/connectors/msgcodec/msgcodec.pyx b/ee/connectors/msgcodec/msgcodec.pyx index 1936ffea5..9055ca0d7 100644 --- a/ee/connectors/msgcodec/msgcodec.pyx +++ b/ee/connectors/msgcodec/msgcodec.pyx @@ -545,18 +545,31 @@ cdef class MessageCodec: ) if message_id == 50: - return StringDict( + return StringDictDeprecated( key=self.read_uint(reader), value=self.read_string(reader) ) if message_id == 51: - return SetNodeAttributeDict( + return SetNodeAttributeDictDeprecated( id=self.read_uint(reader), name_key=self.read_uint(reader), value_key=self.read_uint(reader) ) + if message_id == 43: + return StringDict( + key=self.read_string(reader), + value=self.read_string(reader) + ) + + if message_id == 52: + return SetNodeAttributeDict( + id=self.read_uint(reader), + name=self.read_string(reader), + value=self.read_string(reader) + ) + if message_id == 53: return ResourceTimingDeprecated( timestamp=self.read_uint(reader), diff --git a/frontend/app/player/common/ListWalker.ts b/frontend/app/player/common/ListWalker.ts index d29fa3c1c..e0c336b15 100644 --- a/frontend/app/player/common/ListWalker.ts +++ b/frontend/app/player/common/ListWalker.ts @@ -7,7 +7,7 @@ export default class ListWalker { append(m: T): void { if (this.length > 0 && this.last && m.time < this.last.time) { - console.error("Trying to append message with the less time then the list tail:", m.time, 'vs', this.last.time, m, this) + console.error("Trying to append message with the less time then the list tail:", m.time, 'vs', this.last.time, m, this.last, this) return } this.list.push(m); diff --git a/frontend/app/player/web/MessageLoader.ts b/frontend/app/player/web/MessageLoader.ts index f38c2739c..aa4bf58ad 100644 --- a/frontend/app/player/web/MessageLoader.ts +++ b/frontend/app/player/web/MessageLoader.ts @@ -77,6 +77,7 @@ export default class MessageLoader { let artificialStartTime = Infinity; let startTimeSet = false; + msgs.forEach((msg) => { if (msg.tp === MType.Redux || msg.tp === MType.ReduxDeprecated) { if ('actionTime' in msg && msg.actionTime) { diff --git a/frontend/app/player/web/managers/DOM/DOMManager.ts b/frontend/app/player/web/managers/DOM/DOMManager.ts index 641ce83ce..3003f0b79 100644 --- a/frontend/app/player/web/managers/DOM/DOMManager.ts +++ b/frontend/app/player/web/managers/DOM/DOMManager.ts @@ -19,9 +19,10 @@ import { } from './VirtualDOM'; import { deleteRule, insertRule } from './safeCSSRules'; - -function isStyleVElement(vElem: VElement): vElem is VElement & { node: StyleElement } { - return vElem.tagName.toLowerCase() === "style" +function isStyleVElement( + vElem: VElement +): vElem is VElement & { node: StyleElement } { + return vElem.tagName.toLowerCase() === 'style'; } function setupWindowLogging(vTexts: Map, vElements: Map, olVRoots: Map) { @@ -33,38 +34,50 @@ function setupWindowLogging(vTexts: Map, vElements: Map olVRoots } -const IGNORED_ATTRS = [ "autocomplete" ] -const ATTR_NAME_REGEXP = /([^\t\n\f \/>"'=]+)/ +const IGNORED_ATTRS = ['autocomplete']; +const ATTR_NAME_REGEXP = /([^\t\n\f \/>"'=]+)/; export default class DOMManager extends ListWalker { - private readonly vTexts: Map = new Map() // map vs object here? - private readonly vElements: Map = new Map() - private readonly olVRoots: Map = new Map() + private readonly vTexts: Map = new Map(); // map vs object here? + private readonly vElements: Map = new Map(); + private readonly olVRoots: Map = new Map(); /** required to keep track of iframes, frameId : vnodeId */ - private readonly iframeRoots: Record = {} + private readonly iframeRoots: Record = {}; /** Constructed StyleSheets https://developer.mozilla.org/en-US/docs/Web/API/Document/adoptedStyleSheets * as well as