test(iframe): [PKG-IFRAME-05] verify native cached history and interrupted navigation

This commit is contained in:
Harvey Zhao committed 2026-09-13 02:55:57 +08:00
1 parent b35183c7af
commit cb6c767731
19 files changed
+7908 -13

No files matched your search

+26
View File
@@ -0,0 +1,26 @@
<!doctype html>
<title>Iframe document history</title>
<script src="/observe.js"></script>
<script src="/tool.js"></script>
<iframe style="width: 640px; height: 360px" allowfullscreen></iframe>
<script>
window.timeline = []
window.callbacks = []
window.states = {}
window.track = (name, promise) => {
states[name] = { status: 'pending' }
promise.then(
(value) => (states[name] = { status: 'resolved', value }),
(error) => (states[name] = { status: 'rejected', error: error.message }),
)
}
const target = new URL('/child.html', location.href)
target.search = location.search
if (target.searchParams.get('relation') === 'cross') target.hostname = 'localhost'
window.targetFrame = document.querySelector('iframe')
addEventListener('message', (event) => {
if (event.source === targetFrame.contentWindow) timeline.push(event.data)
})
window.tool = new ArtplayerToolIframe({ iframe: targetFrame, url: target.href })
tool.message((packet) => callbacks.push(packet))
</script>