mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-23 22:01:20 -08:00
test(hls): [PKG-HLS-SDK-01] checkpoint unresolved Firefox diagnostics
This commit is contained in:
1 parent
2f9bee4ee0
commit
26b2983daf
18 files changed
+17776
-8
No files matched your search
@@ -0,0 +1,19 @@
|
||||
// Browser-only diagnostic observer; messages and termination still use native workers.
|
||||
export function observeWorkers() {
|
||||
const NativeWorker = window.Worker
|
||||
window.workerEvidence = []
|
||||
window.Worker = class extends NativeWorker {
|
||||
constructor(url, options) {
|
||||
super(url, options)
|
||||
const record = { url: String(url), messages: [], errors: [], terminated: 0 }
|
||||
window.workerEvidence.push(record)
|
||||
this.addEventListener('message', event => record.messages.push(event.data?.event))
|
||||
this.addEventListener('error', event => record.errors.push(event.message))
|
||||
const terminate = this.terminate.bind(this)
|
||||
this.terminate = () => {
|
||||
record.terminated++
|
||||
return terminate()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user