fix(tracker): fix message prop

This commit is contained in:
sylenien 2022-09-12 12:18:55 +02:00
parent 4e41fdfcf3
commit d77374c1e3
26 changed files with 305 additions and 276 deletions

View file

@ -3068,21 +3068,29 @@ func (msg *Zustand) EncodeWithIndex() []byte {
return data
}
func (msg *Zustand) Decode() Message {
return msg
}
func (msg *Zustand) TypeID() int {
return 79
}
type ReplaceVCSS struct {
message
ID uint64
Styles string
SheetID string
SheetID uint64
BaseURL string
}
func (msg *ReplaceVCSS) Encode() []byte {
buf := make([]byte, 41+len(msg.Styles)+len(msg.SheetID)+len(msg.BaseURL))
buf := make([]byte, 41+len(msg.Styles)+len(msg.BaseURL))
buf[0] = 83
p := 1
p = WriteUint(msg.ID, buf, p)
p = WriteString(msg.Styles, buf, p)
p = WriteString(msg.SheetID, buf, p)
p = WriteUint(msg.SheetID, buf, p)
p = WriteString(msg.BaseURL, buf, p)
return buf[:p]
}
@ -3098,14 +3106,6 @@ func (msg *ReplaceVCSS) EncodeWithIndex() []byte {
return data
}
func (msg *Zustand) Decode() Message {
return msg
}
func (msg *Zustand) TypeID() int {
return 79
}
func (msg *ReplaceVCSS) Decode() Message {
return msg
}

View file

@ -1327,7 +1327,7 @@ func DecodeReplaceVCSS(reader io.Reader) (Message, error) {
if msg.Styles, err = ReadString(reader); err != nil {
return nil, err
}
if msg.SheetID, err = ReadString(reader); err != nil {
if msg.SheetID, err = ReadUint(reader); err != nil {
return nil, err
}
if msg.BaseURL, err = ReadString(reader); err != nil {

View file

@ -970,3 +970,5 @@ class IOSIssueEvent(Message):
self.context_string = context_string
self.context = context
self.payload = payload

View file

@ -672,7 +672,7 @@ class MessageCodec(Codec):
return ReplaceVCSS(
id=self.read_uint(reader),
styles=self.read_string(reader),
sheet_id=self.read_string(reader),
sheet_id=self.read_uint(reader),
base_url=self.read_string(reader)
)
@ -847,3 +847,4 @@ class MessageCodec(Codec):
context=self.read_string(reader),
payload=self.read_string(reader)
)

View file

@ -326,6 +326,18 @@ export default class DOMManager extends ListWalker<Message> {
}
deleteRule(styleSheet, msg)
return
case "replace_vcss":
styleSheet = this.styleSheets.get(msg.id)
if (!styleSheet) {
logger.warn("No stylesheet was created for ", msg)
return
}
const toRemove = styleSheet.cssRules.length
for (let i = 0; i < toRemove; i++) {
styleSheet.deleteRule(i)
}
styleSheet.insertRule(msg.styles)
return
case "adopted_ss_replace":
styleSheet = this.styleSheets.get(msg.sheetID)
if (!styleSheet) {

View file

@ -1,9 +1,8 @@
import type StatedScreen from '../../StatedScreen';
import type { CssInsertRule, CssDeleteRule } from '../../messages';
import type { CssInsertRule, CssDeleteRule, ReplaceVcss } from '../../messages';
type CSSRuleMessage = CssInsertRule | CssDeleteRule;
type CSSRuleMessage = CssInsertRule | CssDeleteRule | ReplaceVcss;
import logger from 'App/logger';
import ListWalker from '../ListWalker';

View file

@ -1,4 +1,5 @@
// Auto-generated, do not edit
/* eslint-disable */
import PrimitiveReader from './PrimitiveReader'
import type { RawMessage } from './raw'
@ -540,7 +541,7 @@ export default class RawMessageReader extends PrimitiveReader {
case 83: {
const id = this.readUint(); if (id === null) { return resetPointer() }
const styles = this.readString(); if (styles === null) { return resetPointer() }
const sheetID = this.readString(); if (sheetID === null) { return resetPointer() }
const sheetID = this.readUint(); if (sheetID === null) { return resetPointer() }
const baseURL = this.readString(); if (baseURL === null) { return resetPointer() }
return {
tp: "replace_vcss",

View file

@ -1,4 +1,5 @@
// Auto-generated, do not edit
/* eslint-disable */
import type { Timed } from './timed'
import type { RawMessage } from './raw'
@ -166,3 +167,4 @@ export type IosPerformanceEvent = RawIosPerformanceEvent & Timed
export type IosLog = RawIosLog & Timed
export type IosNetworkCall = RawIosNetworkCall & Timed

View file

@ -1,4 +1,5 @@
// Auto-generated, do not edit
/* eslint-disable */
export interface RawTimestamp {
@ -310,7 +311,7 @@ export interface RawReplaceVcss {
tp: "replace_vcss",
id: number,
styles: string,
sheetID: string,
sheetID: number,
baseURL: string,
}

View file

@ -1,4 +1,5 @@
// @ts-nocheck
/* eslint-disable */
// Auto-generated, do not edit
export const TP_MAP = {

View file

@ -1,4 +1,5 @@
// Auto-generated, do not edit
/* eslint-disable */
import type { RawMessage } from './raw'
@ -392,10 +393,11 @@ type TrReplaceVCSS = [
type: 83,
id: number,
styles: string,
sheetID: string,
sheetID: number,
baseURL: string,
]
export type TrackerMessage = TrBatchMetadata | TrPartitionedMessage | TrTimestamp | TrSetPageLocation | TrSetViewportSize | TrSetViewportScroll | TrCreateDocument | TrCreateElementNode | TrCreateTextNode | TrMoveNode | TrRemoveNode | TrSetNodeAttribute | TrRemoveNodeAttribute | TrSetNodeData | TrSetNodeScroll | TrSetInputTarget | TrSetInputValue | TrSetInputChecked | TrMouseMove | TrConsoleLog | TrPageLoadTiming | TrPageRenderTiming | TrJSException | TrRawCustomEvent | TrUserID | TrUserAnonymousID | TrMetadata | TrCSSInsertRule | TrCSSDeleteRule | TrFetch | TrProfiler | TrOTable | TrStateAction | TrRedux | TrVuex | TrMobX | TrNgRx | TrGraphQL | TrPerformanceTrack | TrResourceTiming | TrConnectionInformation | TrSetPageVisibility | TrLongTask | TrSetNodeAttributeURLBased | TrSetCSSDataURLBased | TrTechnicalInfo | TrCustomIssue | TrCSSInsertRuleURLBased | TrMouseClick | TrCreateIFrameDocument | TrAdoptedSSReplaceURLBased | TrAdoptedSSInsertRuleURLBased | TrAdoptedSSDeleteRule | TrAdoptedSSAddOwner | TrAdoptedSSRemoveOwner | TrZustand | TrReplaceVCSS
export default function translate(tMsg: TrackerMessage): RawMessage | null {

View file

@ -464,6 +464,6 @@ end
message 83, 'ReplaceVCSS' do
uint 'ID'
string 'Styles'
string 'SheetID'
uint 'SheetID'
string 'BaseURL'
end

View file

@ -1,4 +1,5 @@
// Auto-generated, do not edit
/* eslint-disable */
import PrimitiveReader from './PrimitiveReader'
import type { RawMessage } from './raw'

View file

@ -1,4 +1,5 @@
// Auto-generated, do not edit
/* eslint-disable */
import type { Timed } from './timed'
import type { RawMessage } from './raw'

View file

@ -1,4 +1,5 @@
// Auto-generated, do not edit
/* eslint-disable */
<% $messages.select { |msg| msg.replayer }.each do |msg| %>
export interface Raw<%= msg.name.snake_case.pascal_case %> {

View file

@ -1,8 +1,7 @@
// @ts-nocheck
/* eslint-disable */
// Auto-generated, do not edit
export const TP_MAP = {
<%= $messages.select { |msg| msg.tracker || msg.replayer }.map { |msg| " #{msg.id}: \"#{msg.name.snake_case}\"," }.join "\n" %>
} as const

View file

@ -1,4 +1,5 @@
// Auto-generated, do not edit
/* eslint-disable */
import type { RawMessage } from './raw'

View file

@ -1,4 +1,5 @@
// Auto-generated, do not edit
/* eslint-disable */
export declare const enum Type {
<%= $messages.select { |msg| msg.tracker }.map { |msg| "#{ msg.name } = #{ msg.id }," }.join "\n " %>

View file

@ -1,4 +1,5 @@
// Auto-generated, do not edit
/* eslint-disable */
import * as Messages from '../../common/messages.gen.js'
export { default } from '../../common/messages.gen.js'

View file

@ -1,4 +1,5 @@
// Auto-generated, do not edit
/* eslint-disable */
import * as Messages from '../common/messages.gen.js'
import Message from '../common/messages.gen.js'
@ -17,4 +18,3 @@ export default class MessageEncoder extends PrimitiveEncoder {
}
}

View file

@ -34,7 +34,7 @@ module.exports = {
'@typescript-eslint/no-unsafe-member-access': 'off',
'@typescript-eslint/no-unsafe-call': 'off',
'@typescript-eslint/restrict-plus-operands': 'warn',
'@typescript-eslint/no-unsafe-return': 'warn',
'@typescript-eslint/no-unsafe-return': 'off',
'no-useless-escape': 'warn',
'no-control-regex': 'warn',
'@typescript-eslint/restrict-template-expressions': 'warn',

View file

@ -1,4 +1,5 @@
// Auto-generated, do not edit
/* eslint-disable */
export declare const enum Type {
BatchMetadata = 81,
@ -450,11 +451,10 @@ export type ReplaceVCSS = [
/*type:*/ Type.ReplaceVCSS,
/*id:*/ number,
/*styles:*/ string,
/*sheetID:*/ string,
/*sheetID:*/ number,
/*baseURL:*/ string,
]
type Message = BatchMetadata | PartitionedMessage | Timestamp | SetPageLocation | SetViewportSize | SetViewportScroll | CreateDocument | CreateElementNode | CreateTextNode | MoveNode | RemoveNode | SetNodeAttribute | RemoveNodeAttribute | SetNodeData | SetNodeScroll | SetInputTarget | SetInputValue | SetInputChecked | MouseMove | ConsoleLog | PageLoadTiming | PageRenderTiming | JSException | RawCustomEvent | UserID | UserAnonymousID | Metadata | CSSInsertRule | CSSDeleteRule | Fetch | Profiler | OTable | StateAction | Redux | Vuex | MobX | NgRx | GraphQL | PerformanceTrack | ResourceTiming | ConnectionInformation | SetPageVisibility | LongTask | SetNodeAttributeURLBased | SetCSSDataURLBased | TechnicalInfo | CustomIssue | CSSInsertRuleURLBased | MouseClick | CreateIFrameDocument | AdoptedSSReplaceURLBased | AdoptedSSInsertRuleURLBased | AdoptedSSDeleteRule | AdoptedSSAddOwner | AdoptedSSRemoveOwner | Zustand | ReplaceVCSS
export default Message

View file

@ -1,4 +1,5 @@
// Auto-generated, do not edit
/* eslint-disable */
import * as Messages from '../../common/messages.gen.js'
export { default } from '../../common/messages.gen.js'
@ -721,7 +722,7 @@ export function Zustand(
export function ReplaceVCSS(
id: number,
styles: string,
sheetID: string,
sheetID: number,
baseURL: string,
): Messages.ReplaceVCSS {
return [
@ -732,3 +733,4 @@ export function ReplaceVCSS(
baseURL,
]
}

View file

@ -50,7 +50,7 @@ export default function (app: App | null) {
}
}
if (parentNodeID && id >= 0) {
app.send(ReplaceVCSS(parentNodeID, entireStyle, id.toString(), app.getBaseHref()))
app.send(ReplaceVCSS(parentNodeID, entireStyle, id, app.getBaseHref()))
}
} else {
app.debug.error('Owner Node not found')

View file

@ -1,4 +1,5 @@
// Auto-generated, do not edit
/* eslint-disable */
import * as Messages from '../common/messages.gen.js'
import Message from '../common/messages.gen.js'
@ -234,7 +235,7 @@ export default class MessageEncoder extends PrimitiveEncoder {
break
case Messages.Type.ReplaceVCSS:
return this.uint(msg[1]) && this.string(msg[2]) && this.string(msg[3]) && this.string(msg[4])
return this.uint(msg[1]) && this.string(msg[2]) && this.uint(msg[3]) && this.string(msg[4])
break
}