Skip to content

Fallback base URL computation for a document with about:srcdoc but not an iframe srcdoc document #3989

@tkent-google

Description

@tkent-google

Demo: http://jsfiddle.net/int32_t/oztck57e/5/
Bug report from a web author: https://crbug.com/875642

Specification link 1: https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#document-open-steps Step 11.3
Specification link 2: https://html.spec.whatwg.org/multipage/urls-and-fetching.html#fallback-base-url

The demo page has three nested documents,

  • Top
    • iframe srcdoc doc1
      • iframe about:blank doc2

According to the specification, doc2's URL will be about:srcdoc by doc2.open(). See specification link 1. After that, fallback base URL computation for doc2 returns about:srcdoc because the document is neither an iframe srcdoc document nor about:blank. See specification link 2.

Chrome currently follows the specification. So relative URLs in doc2 can't be resolved.
Firefox throws an exception on doc2.open(). So doc2's URL is not changed.
Safari's behavior is not understandable. But anyway the base URL of doc2 is the URL of the top document.

Proposal:
I'd like to change the specification so that doc2 has the top document URL as the fallback base URL in this case. For example, changing

  1. If document's URL is about:blank,

to

  1. if document's URL is about:blank or about:srcdoc,

in https://html.spec.whatwg.org/multipage/urls-and-fetching.html#fallback-base-url

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions