Skip to content

FrameManager.load() never sets iframe.src, so browser remount/reload can blank the page #238

Description

@sandmor

I have been using @readium/navigator and found a problem, the library can suddenly show a blank page (often after resize/layout changes) even though nothing in the app threw an error and the iframe is still there.

Tracing it, I notice that FrameManager.load() causes the iframe to navigate through contentWindow.location.replace(source) but never sets iframe.src.

After a successful load the document becomes visible, but the iframe’s src stays at its default (about:blank / empty). Any later browser navigation that goes through src (e.g. remounting/reparenting the iframe, or other src-based reload) restores about:blank. The iframe element remains in the DOM and looks fine; the app gets no load error from the navigator.

The same pattern seems to exist in FXLFrameManager and WebPubFrameManager.

// FrameManager.load()
this.frame.contentWindow!.location.replace(this.source);
// iframe.src is never set

So after location.replace(blobUrl) the document content is correctly loaded, but iframe.src is empty. So moving the iframe in the DOM (or otherwise reloading from src) then shows a blank page.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions