W3C home > Mailing lists > Public > whatwg@whatwg.org > June 2013

Re: [whatwg] scrdoc and session history don't play along in the spec

From: Adam Barth <w3c@adambarth.com>
Date: Sun, 23 Jun 2013 09:57:14 -0700
Message-ID: <CAJE5ia9WnYAZKjvmfh3KbcHN_xYKfmtfxuWQP-sYebxzTePwrQ@mail.gmail.com>
To: Boris Zbarsky <bzbarsky@mit.edu>
Cc: whatwg <whatwg@lists.whatwg.org>
On Sun, Jun 23, 2013 at 6:42 AM, Boris Zbarsky <bzbarsky@mit.edu> wrote:
> On 6/23/13 1:15 AM, Adam Barth wrote:
>> One tricky case here is what happens if you modify the srcdoc attribute:
> Ah, indeed.
>> <iframe id="foo" srcdoc="aaa"></iframe>
>> <script>
>> [...] // Wait for the iframe to finish loading.
>> document.getElementById("foo").srcdoc = "bbb";
>> [...] // Wait for the iframe to finish loading.
>> document.getElementById("foo").contentWindow.document.body.innerHTML =
>> "ccc";
>> </script>
>> What happens if you click the back button now?
> I believe Gecko's upcoming implementation will show "aaa", but I haven't
> tested to make sure.
>> That's because we navigated back
>> in the history to "about:srcdoc", which then looked at the srcdoc
>> property and saw "bbb" even though the srcdoc property had "aaa" when
>> that history entry was created.
> Ah, we're just storing the srcdoc text in the history entry for srcdoc
> loads, I think, precisely because you can't rely on the value of the
> attribute.

I guess it depends on what you mean by "rely".  We just treat the
about:srcdoc URL as something that, when fetched, retrieves the value
currently stored in the srcdoc attribute.  In this case, when you go
back, we'll fetch about:srcdoc again and get the current value of the
srcdoc attribute, "bbb".

Received on Sunday, 23 June 2013 16:58:08 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 17:00:00 UTC