W3C home > Mailing lists > Public > whatwg@whatwg.org > August 2010

[whatwg] Question on iframe.srcdoc address (about:srcdoc)

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Tue, 10 Aug 2010 10:30:33 -0700
Message-ID: <AANLkTik-=4Hi9zyQun0oRzgUECMriAnsWMSCUD8Y1x84@mail.gmail.com>
On Mon, Aug 9, 2010 at 6:39 PM, Justin Schuh <jschuh at chromium.org> wrote:
> I'm working on implementing iframe.srcdoc in WebKit, and section 2.5.1
> states:
>
> "This specification defines the?URL about:srcdoc as a reserved, though
> unresolvable, about: URI, that is used as the document's address of iframe
> srcdoc documents."
>
> It seems like it would make more sense for the address to be the data URL of
> the frame's document. This would be easier to implement in WebKit, and I
> expect other data URL supporting browsers as well. Is there some reasoning
> I'm missing for the decision to use about:srcdoc?

A few (not necessarily valid) reasons I can think of off the top of my head:

1. data: urls are unique-origin automatically, and there's no special
handling of that wrt sandbox=allow-same-origin (that is, the flag does
nothing, because the url isn't same-origin to begin with).  @srcdoc,
on the other hand, should be same-origin by default (though behind a
sandbox, and thus *treated* as unique-origin unless the
allow-same-origin flag is set).  Thus, roundtripping the url back into
@src would produce a document with different behavior.

2. @srcdoc doesn't require a doctype for its document, but data: urls
need them or else they can trip into quirks mode.  Again,
roundtripping behavior becomes inconsistent (unless you detect for
no-doctype and add it to the data: url automatically).

~TJ
Received on Tuesday, 10 August 2010 10:30:33 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:59:26 UTC