mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-27 17:51:20 -08:00
test(iframe): [PKG-IFRAME-05] verify native cached history and interrupted navigation
This commit is contained in:
1 parent
b35183c7af
commit
cb6c767731
19 files changed
+7908
-13
No files matched your search
@@ -0,0 +1,16 @@
|
||||
window.documentWitness = Math.random().toString(36)
|
||||
window.lifecycle = []
|
||||
window.fixtureErrors = []
|
||||
for (const name of ['pageshow', 'pagehide']) {
|
||||
addEventListener(name, event => window.lifecycle.push({ type: event.type, persisted: event.persisted }))
|
||||
}
|
||||
addEventListener('error', event => window.fixtureErrors.push(event.message))
|
||||
addEventListener('unhandledrejection', event => window.fixtureErrors.push(String(event.reason)))
|
||||
addEventListener('message', (event) => {
|
||||
if (window === window.parent || event.source !== window.parent)
|
||||
return
|
||||
if (event.data?.type === 'history-fixture-finish') {
|
||||
window.parent.postMessage({ type: 'history-fixture-old-document', data: { witness: window.documentWitness, executions: window.executions || 0 } }, '*')
|
||||
window.finishHeld()
|
||||
}
|
||||
})
|
||||
Reference in new issue
Block a user