tracker: porting 14.x.x patches

This commit is contained in:
nick-delirium 2024-11-12 15:14:52 +01:00
parent d6d6e26208
commit 61e15b62ef
No known key found for this signature in database
GPG key ID: 93ABD695DF5FDBA0
6 changed files with 32 additions and 18 deletions

View file

@ -1,7 +1,7 @@
{
"name": "@openreplay/tracker-assist",
"description": "Tracker plugin for screen assistance through the WebRTC",
"version": "10.0.0",
"version": "10.0.1",
"keywords": [
"WebRTC",
"assistance",

View file

@ -380,14 +380,17 @@ export default class Assist {
if (this.app.active()) {
this.assistDemandedRestart = true
this.app.stop()
setTimeout(() => {
this.app.start().then(() => { this.assistDemandedRestart = false })
.then(() => {
this.remoteControl?.reconnect(ids)
})
.catch(e => app.debug.error(e))
// TODO: check if it's needed; basically allowing some time for the app to finish everything before starting again
}, 400)
this.app.waitStatus(0)
.then(() => {
this.app.allowAppStart()
setTimeout(() => {
this.app.start().then(() => { this.assistDemandedRestart = false })
.then(() => {
this.remoteControl?.reconnect(ids)
})
.catch(e => app.debug.error(e))
}, 100)
})
}
})

View file

@ -3,6 +3,13 @@
- new webvitals messages source (new msg type)
- new structure for string dictionary (new msg type)
## 14.0.13
- fixes for restart logic
- fixed top context check in case of crossdomain placement
- fixed crossdomain restart logic (when triggered via assist)
- keep allowstart option on manual stop
## 14.0.11 & .12
- fix for node maintainer stability around `#document` nodes (mainly iframes field)

View file

@ -593,6 +593,10 @@ export default class App {
return
}
const nextCommand = this.pollingQueue.order[0]
if (nextCommand && this.pollingQueue[nextCommand].length === 0) {
this.pollingQueue.order = this.pollingQueue.order.filter((c: any) => c !== nextCommand)
return
}
if (this.pollingQueue[nextCommand].includes(data.context)) {
this.pollingQueue[nextCommand] = this.pollingQueue[nextCommand].filter(
(c: string) => c !== data.context,
@ -1770,7 +1774,6 @@ export default class App {
}
this.canvasRecorder?.clear()
this.messages.length = 0
this.trackedFrames = []
this.parentActive = false
} finally {
this.activityState = ActivityState.NotActive

View file

@ -30,11 +30,4 @@ export default class IFrameObserver extends Observer {
this.app.send(CreateIFrameDocument(rootNodeId, docID))
})
}
disconnect() {
if (this.docId !== undefined) {
this.app.send(RemoveNode(this.docId))
}
super.disconnect()
}
}

View file

@ -95,6 +95,14 @@ function processOptions(obj: any): obj is Options {
return true
}
const canAccessTop = () => {
try {
return Boolean(window.top)
} catch {
return false
}
}
export default class API {
public featureFlags: FeatureFlags
@ -108,7 +116,7 @@ export default class API {
}
if (
(window as any).__OPENREPLAY__ ||
(!this.crossdomainMode && inIframe() && (window.top as any)?.__OPENREPLAY__)
(!this.crossdomainMode && inIframe() && canAccessTop() && (window.top as any)?.__OPENREPLAY__)
) {
console.error('OpenReplay: one tracker instance has been initialised already')
return