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

On Fri, Apr 5, 2013 at 8:44 AM, Boris Zbarsky <bzbarsky@mit.edu> wrote:
> The session history algorithm in the spec navigates to urls.  As far as I
> can tell, on the face of it, this means that this testcase:
>
>   <iframe name="x" srcdoc="aaa"></iframe>
>   <a target="x" href="http://web.mit.edu">
>     Click me, then later hit back
>   </a>
>
> should fail to go back.
>
> The good news is that at least WebKit's srcdoc implementation ignores the
> spec here and makes back work, and so will Gecko's.  But the spec still
> needs to be fixed.  Again, as far as I can tell; actually telling anything
> for sure about the navigation/shistory part of the spec is impossible.  :(

One tricky case here is what happens if you modify the srcdoc attribute:

<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 that in
WebKit and Blink, you'll get "bbb".  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.

If you implemented srcdoc with wyciwyg in Gecko, you'd probably get
"aaa" because that's what you would have cached when you created the
original history item.

Adam

Received on Sunday, 23 June 2013 05:16:07 UTC