browsingContext.reload doesn't reset location of navigated iframe
Categories
(Remote Protocol :: WebDriver BiDi, defect, P3)
Tracking
(firefox151 fixed)
| Tracking | Status | |
|---|---|---|
| firefox151 | --- | fixed |
People
(Reporter: hbenl, Assigned: jdescottes)
References
(Blocks 1 open bug)
Details
(Whiteboard: [webdriver:m19], [wptsync upstream][webdriver:relnote])
Attachments
(3 files, 1 obsolete file)
When an iframe is navigated and then its page is reloaded, the reloaded iframe is not navigated to its original URL:
async def test_reload_resets_iframe_location(bidi_session, new_tab, inline):
url = inline("<iframe id='myframe' src='about:blank'></iframe>")
iframe_url = inline("Hello iframe")
contexts = await navigate_and_assert(bidi_session, new_tab, url)
frame = contexts[0]["children"][0]
await bidi_session.browsing_context.navigate(
context=frame["context"], url=iframe_url, wait="complete"
)
await bidi_session.browsing_context.reload(
context=new_tab["context"], wait="complete"
)
result = await bidi_session.script.evaluate(
expression="myframe.contentDocument.location.href",
target=ContextTarget(new_tab["context"]),
await_promise=False,
)
assert result["value"] == "about:blank"
The test passes when checking myframe.src instead of myframe.contentDocument.location.href, so the src attribute of the reloaded iframe is set to the expected URL but its contentDocument isn't.
The issue makes this Playwright test fail (although the test is for a different issue).
Comment 1•2 months ago
|
||
This sounds more like a platform bug. Can you reproduce it manually in Firefox?
| Reporter | ||
Comment 2•2 months ago
|
||
(In reply to Henrik Skupin [:whimboo][⌚️UTC+1] from comment #1)
This sounds more like a platform bug. Can you reproduce it manually in Firefox?
No, I couldn't. It would be a pretty serious bug if this was reproducible manually.
Updated•2 months ago
|
| Reporter | ||
Updated•2 months ago
|
| Assignee | ||
Comment 3•2 months ago
•
|
||
DevTools has switched to BrowserCommands.reload:
https://searchfox.org/firefox-main/rev/7b74d86ca4ce65e82fdaa3095d2d39a26d3ac4f6/browser/base/content/browser-commands.js#105-117
reload() {
if (gBrowser.currentURI.schemeIs("view-source")) {
// Bug 1167797: For view source, we always skip the cache
this.reloadSkipCache();
return;
}
gBrowser.reloadWithFlags(Ci.nsIWebNavigation.LOAD_FLAGS_NONE);
},
reloadSkipCache() {
// Bypass proxy and cache.
gBrowser.reloadWithFlags(kSkipCacheFlags);
},
Comment 4•2 months ago
|
||
We should most likely fix this in Marionette as well. AFAIK we are using the same method via the browsing context.
| Assignee | ||
Comment 5•2 months ago
|
||
Switching to the devtools API doesn't help.
The only thing which does help is to skip the cache for the reload.
(In reply to Holger Benl [:hbenl] from comment #2)
(In reply to Henrik Skupin [:whimboo][⌚️UTC+1] from comment #1)
This sounds more like a platform bug. Can you reproduce it manually in Firefox?
No, I couldn't. It would be a pretty serious bug if this was reproducible manually.
I can actually reproduce manually and there is a difference between chrome and firefox here.
| Assignee | ||
Comment 6•2 months ago
|
||
| Assignee | ||
Updated•2 months ago
|
| Assignee | ||
Comment 7•2 months ago
|
||
Can't really easily share a test page with iframes, but if you serve the attached test case, click on the link to navigate to iframe 2 and reload (using the reload button of Firefox/Chrome, not keyboard shortcuts):
- Firefox will still show iframe 2 after the reload
- Chrome will show iframe 1 again (after some delay though ...)
| Assignee | ||
Comment 8•2 months ago
•
|
||
(In reply to Julian Descottes [:jdescottes] from comment #5)
Switching to the devtools API doesn't help.
The only thing which does help is to skip the cache for the reload.
Ok interesting, I was trying with tab.linkedBrowser.reloadWithFlags, but this is actually a different codepath. The devtools solution works.
That being said, my test case from the previous comment is still valid, and there is still a difference between Chrome and Firefox. Maybe startingon about:blank makes it slightly different?
| Assignee | ||
Comment 9•2 months ago
|
||
(In reply to Henrik Skupin [:whimboo][⌚️UTC+1] from comment #4)
We should most likely fix this in Marionette as well. AFAIK we are using the same method via the browsing context.
I added a test case for classic, but Marionette doesn't hit the issue because it reloads bypassing the cache by default:
navigate.refresh = async function (browsingContext) {
const flags = Ci.nsIWebNavigation.LOAD_FLAGS_BYPASS_CACHE;
browsingContext.reload(flags);
};
| Assignee | ||
Comment 10•2 months ago
|
||
The API used by DevTools is not targeting a specific browser/browsingContext, and only works with the selected tab so it can't be used as is.
I tried to bisect the necessary changes, and it seems to boil down to https://searchfox.org/firefox-main/rev/7b74d86ca4ce65e82fdaa3095d2d39a26d3ac4f6/browser/components/tabbrowser/content/tabbrowser.js#786-792
const { browsingContext } = tab.linkedBrowser;
const { sessionHistory } = browsingContext;
if (sessionHistory) {
sessionHistory.reload(reloadFlags);
} else {
browsingContext.reload(reloadFlags);
}
| Assignee | ||
Updated•2 months ago
|
| Assignee | ||
Comment 11•2 months ago
|
||
Updated•2 months ago
|
| Assignee | ||
Comment 12•2 months ago
|
||
Updated•2 months ago
|
| Assignee | ||
Comment 13•2 months ago
|
||
Phabricator revisions:
Comment 14•2 months ago
|
||
(In reply to Julian Descottes [:jdescottes] from comment #7)
Created attachment 9556669 [details]
iframe_navigation.zipCan't really easily share a test page with iframes, but if you serve the attached test case, click on the link to navigate to iframe 2 and reload (using the reload button of Firefox/Chrome, not keyboard shortcuts):
- Firefox will still show iframe 2 after the reload
- Chrome will show iframe 1 again (after some delay though ...)
So it means that there is indeed a bug in Firefox when using the reload button for this scenario? Whether keyboard or the button is used we should produce the same results. If that is the case, we should indeed file a bug for it (if none exists yet).
| Assignee | ||
Comment 15•2 months ago
|
||
(In reply to Henrik Skupin [:whimboo][⌚️UTC+1] from comment #14)
(In reply to Julian Descottes [:jdescottes] from comment #7)
Created attachment 9556669 [details]
iframe_navigation.zipCan't really easily share a test page with iframes, but if you serve the attached test case, click on the link to navigate to iframe 2 and reload (using the reload button of Firefox/Chrome, not keyboard shortcuts):
- Firefox will still show iframe 2 after the reload
- Chrome will show iframe 1 again (after some delay though ...)
So it means that there is indeed a bug in Firefox when using the reload button for this scenario? Whether keyboard or the button is used we should produce the same results. If that is the case, we should indeed file a bug for it (if none exists yet).
Yes but it looks like a different scenario compared to the one from Holger for some reason. I can file a bug but I know that reloads triggered via buttons/keyboard shortcuts have historically been different between browsers.
| Assignee | ||
Comment 16•2 months ago
|
||
Why did Phabricator Automation override my whiteboard update???
| Assignee | ||
Updated•2 months ago
|
Comment 17•2 months ago
|
||
Comment 19•2 months ago
|
||
| bugherder | ||
https://hg.mozilla.org/mozilla-central/rev/1836450a0e2c
https://hg.mozilla.org/mozilla-central/rev/eed74152771e
Updated•26 days ago
|
Description
•