Open Bug 1500617 Opened 6 years ago Updated 2 years ago

iframe navigation doesn't load pages as expected

Categories

(Core :: DOM: Navigation, defect, P3)

defect

Tracking

()

People

(Reporter: perry, Unassigned)

References

(Blocks 1 open bug)

Details

Steps to reproduce: 1) Navigate to https://en.wikipedia.org/wiki/Main_Page 2) Run the following in the console (don't uncomment anything): async function test() { let iframe = document.createElement('iframe'); await new Promise(resolve => { iframe.src = 'https://en.wikipedia.org/wiki/A'; iframe.addEventListener('load', resolve); document.body.appendChild(iframe); }); // page A // Hacky fix -- uncomment the following line to make this work // await new Promise(resolve => setTimeout(resolve, 0)); await new Promise(resolve => { iframe.addEventListener('load', resolve); iframe.src = 'https://en.wikipedia.org/wiki/B'; }); // page B // Hacky fix -- uncomment the following line to make this work // await new Promise(resolve => setTimeout(resolve, 0)); await new Promise(resolve => { iframe.addEventListener('load', resolve); iframe.contentWindow.history.go(-1); }); // expected navigate back to page A; actual: the outer window is navigated back await new Promise(resolve => { iframe.addEventListener('load', resolve); iframe.contentWindow.history.go(0); }); // expected: reload page A; actual: this is never run } test(); --- My vague guess is that the session history entries for the iframe loads are not recorded properly and/or at the right time. If the two `await new Promise(resolve => setTimeout(resolve, 0));` lines are uncommented, everything seems to work fine. However, if only the first line is uncommented, the final `iframe.contentWindow.history.go(0)` causes the iframe to navigate to page B, rather than reloading page A.
I believe Nika and Perry are going to have a synchronous chat about this.
Priority: -- → P2
Chrome looks like it has the bug too, but not Edge (per Nika). So, potentially a spec and, probably, WPT issue.
Priority: P2 → P3
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.