Open Bug 478273 Opened 15 years ago Updated 6 months ago

Don't restore iframes from history if the node's id has changed

Categories

(Core :: DOM: Navigation, defect)

x86
Windows XP
defect

Tracking

()

People

(Reporter: jkoett, Unassigned)

References

Details

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.6) Gecko/2009011913 Firefox/3.0.6
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.6) Gecko/2009011913 Firefox/3.0.6

IFrames don't reload on refresh.  We have two companies that pay us to display their iframe on our page, company a and company b.  On the first load, company a's description comes up, with their iframe below it.  Pressing 'refresh' on the page, shows company b's description BUT company a's iframe is still displayed.  The src on the page shows the proper src (company b's src) on the iframe, but the content of the iframe stays as company a's content.

Reproducible: Always

Steps to Reproduce:
1.Create an html page with just the text "Yahoo<br/><iframe src="http://www.yahoo.com" />"
2.View the page in firefox.
3.Change the html to be just the text "Google<br/><iframe src="http://www.google.ca" />"
4.Press 'refresh'.
Actual Results:  
Yahoo's page will still be displayed in the iframe, even though the text above it has changed to "Google", and viewing the src of the page shows google as the src of the iframe.

Expected Results:  
Google's page should show in the iframe.

This bug has already been reported and marked as resolved/duplicate, but I have the latest version of Firefox 3 (Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.6) Gecko/2009011913 Firefox/3.0.6), and it happens for me every time.

Here are the bugs marked as resolved:
https://bugzilla.mozilla.org/show_bug.cgi?id=235185
and this one is listed as a duplicate of the bug above, but is more closely related to the bug I'm reporting now:
https://bugzilla.mozilla.org/show_bug.cgi?id=354176

Thanks for your help :),
Joel.
Status: UNCONFIRMED → RESOLVED
Closed: 15 years ago
Resolution: --- → DUPLICATE
At the request of Boris, I am re-opening this bug with the following amendments:

Certainly iframes with different ids should be considered two different iframes, and not reloaded with the same content, ie., if the steps to reproduce include ids in the iframe:

Steps to Reproduce:
1.Create an html page with just the text "Yahoo<br/><iframe
id="yahoo" src="http://www.yahoo.com" />"
2.View the page in firefox.
3.Change the html to be just the text "Google<br/><iframe
id="google" src="http://www.google.ca" />"
4.Press 'refresh'.
Actual Results:  
Yahoo's page will still be displayed in the iframe, even though the text above
it has changed to "Google", and the ids of the iframes have changed, and viewing the src of the page shows google as the
src of the iframe.

Expected Results:  
Google's page should show in the iframe.

I would also like to ask if there is some way to detect what the iframe's src was initialized with?  This would only take into account iframes that are loaded via static HTML (not javascript - somebody else can elaborate on this if they choose to, but the bug I am concerned with has nothing to do with dynamically created iframes), then the src I would be referring to as "original url" would be the src that was passed to the browser via the HTML code "<iframe src='ORGINAL_URL' />".  If there was some way to detect this variable, would it make sense to treat iframes as different and have the content reloaded if this original url was different from the next url passed on 'refresh'?  Such as the case listed above (google vs. yahoo)?

Thanks for your thoughts :),
Joel.
Status: RESOLVED → UNCONFIRMED
Resolution: DUPLICATE → ---
The other thing Joel and I talked about was possibly detecting iframes that have never been navigated (i.e. still have the original URI from their @src loaded) and not restoring those from history either, at least if the @src has changed.

Smaug, you're working on this mess, right?  ;)
Status: UNCONFIRMED → NEW
Component: General → Document Navigation
Ever confirmed: true
Product: Firefox → Core
QA Contact: general → docshell
Summary: IFrames Don't Reload on Refresh. → Don't restore iframes from history if the node's id has changed
Depends on: 527897
This still happens in Firefox 8.
Still happens Nightly 18.0a1.  This is driving me nuts.  The Facebook Like button iframes are restored every session reload.  This makes the facebook like buttons like the older post when a new post comes out.
Not sure if this is the same bug, but I'm currently developing a website with iframes.  My iframe HTML loads certain CSS and JS resources, as does the main (top-level) page (a completely different set of files).  As I update files on the server, I can refresh the page, and FF will load the updated versions of my resources for the MAIN page.  But it will continue to load stale CSS/JS files into the iframes, even if I press SHIFT-refresh.

To work around this I either need to completely clear my cache (ensuring my page is not open in any tabs while I do so), or else I can open the relevant JS and CSS files directly in their own tabs and refresh each one, before refreshing my page.

It's getting to be really annoying!
Dean, that sounds like a different bug, worth filing separately...
Boris - you're right.  In fact it turned out it has nothing to do with iframes at all.  For some reason my JS/CSS is being served from the BFcache without checking modification date at the server, even when loading the (normally iframed) page in the full window.

Sorry for the irrelevant post!
Is there anything that I can do to help fix this bug? :)
Already posted this on bug 356558 but it seems to be relevant here, too.

I've created a scrolling activity feed, sometimes these posts contain content embedded in iframes, like YouTube videos. It's sorted from newest to oldest. No dynamic client side activity with javascript or anything like that.

If I have these 3 iframe scattered down the page:

<iframe src="C"></iframe> - video C displays
<iframe src="B"></iframe> - video B displays
<iframe src="A"></iframe> - video A displays

Everything matches and all is right. If a new video gets added to the top of the feed, I end up with this

<iframe src="D"></iframe> - video C displays
<iframe src="C"></iframe> - video B displays
<iframe src="B"></iframe> - video A displays
<iframe src="A"></iframe> - video A displays

So it *seems* to be caching the iframes purely based on their relative position in the document. So far it seems like reloading each iframe with javascript (this.contentWindow.location.href = this.src;) is the easiest way to work around this. Doesn't seem like any amount of change to the markup (unique names, IDs, changes to any other attribute) is enough to convince firefox to lay off the cache.
I have this bug too now on Firefox 62.0b9

Hey Chalda,
Can you still reproduce this issue?

Flags: needinfo?(chalda82)

Redirect a needinfo that is pending on an inactive user to the triage owner.
:hsinyi, since the bug has high severity, could you have a look please?

For more information, please visit auto_nag documentation.

Flags: needinfo?(chalda82) → needinfo?(htsai)

In the process of migrating remaining bugs to the new severity system, the severity for this bug cannot be automatically determined. Please retriage this bug using the new severity system.

Severity: major → --

Similar as comment 2, STR below still reproduces the issue.

Steps to Reproduce:
1.Create an html page with just the text "Example<br/><iframe id="example" src="https://www.example.com" />"
2.View the page in firefox.
3.Change the html to be just the text "Live DOM Viewer<br/><iframe src="https://software.hixie.ch/utilities/js/live-dom-viewer/" />"
4.Press 'refresh'.

Actual Results:
Example's page will still be displayed in the iframe, even though the text above it has changed to "Live DOM Viewer", and viewing the src of the page shows Live DOM Viewer as the src of the iframe.

Expected Results:
Live DOM Viewer's page should show in the iframe.

Severity: -- → S3
Flags: needinfo?(htsai)

This is still happening. Also it is not really clear what the iframe contents are cached based on? I've tested and even if the iframe has no ID or name attribute, Firefox reuses the previous source, even if an src attribute is not set.

It is also interesting how this seemed a good idea to load old content into unrelated iframes, just because they appear in the same page? What situation is this desired to show such stale data? Also it causes performance issues, as those iframes are not really loaded from cache. The address is cached, but the content is loaded over network. So basically Firefox is loading content that is not at all needed and requested by the actual page.

You need to log in before you can comment on or make changes to this bug.