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

Boris Zbarsky bzbarsky at MIT.EDU
Sun Jun 23 06:42:02 PDT 2013


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.

-Boris



More information about the whatwg mailing list