Open Bug 1886450 Opened 2 years ago Updated 2 months ago

Iframe content doesn't update after refresh when using src="data:text/html"

Categories

(Core :: DOM: Navigation, defect)

Firefox 124
defect

Tracking

()

People

(Reporter: kontakt, Unassigned)

References

(Depends on 1 open bug)

Details

Attachments

(1 file)

User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:124.0) Gecko/20100101 Firefox/124.0

Steps to reproduce:

Create an html document file with the following iframe:

<iframe
  sandbox="allow-scripts allow-popups allow-popups-to-escape-sandbox"
  src="data:text/html;charset=UTF-8,A"
></iframe>

Open it in Firefox. It displays the iframe with the capital letter A inside of it.

Then, go back to editing the html document in your IDE and change the iframe's src to "data:text/html;charset=UTF-8,B".

Go back to Firefox and press Reload

Actual results:

The contents of the iframe didn't change. - it still displays the letter A.

The Inspector shows the src attribute as updated, but the contents of the iframe are still outdated

Expected results:

The iframe contents should update

The same happens if you use srcdoc instead of src

The Bugbug bot thinks this bug should belong to the 'Core::DOM: Editor' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.

Component: Untriaged → DOM: Editor
Product: Firefox → Core

The sandbox attributes are irrelevant - you can reproduce it just as well with first loading a document with

<iframe srcdoc="A"></iframe>

and then changing the source document to

<iframe srcdoc="B"></iframe>

And then reloading the page in Firefox

Component: DOM: Editor → DOM: Navigation

I can reproduce the behavior as described (using a local file), though I'm not sure it is a valid issue. I assume the problem is that we're hitting the networking cache, so I'm going to move it there.

If you hold "shift" when you reload, then the page updates appropriately. This works whether you are clicking on the reload button or using the shortcut (so, it would be shift-command-R on Mac OS for instance).

Status: UNCONFIRMED → NEW
Component: DOM: Navigation → Networking: Cache
Ever confirmed: true

I reproduced the same locally, but file and data URLs aren't cached at the networking level.
Looking around I found bug 527897, which seemed related.
Looking at the code in bug 527897 comment 0, it referenced the code in nsDocShell::MaybeHandleSubframeHistory.
If I make this method always return false, the bug goes away, so I think that's a good place to start.

Component: Networking: Cache → DOM: Navigation
See Also: → 527897

Thanks for taking a look.

I'll mark this S3 because the force reload workaround does exist.

Severity: -- → S3
Depends on: 2037346
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: