[whatwg] Should events be paused on detached iframes?

On 8/25/10 1:12 AM, Ben Lerner wrote:
>> 1) "hibernating" documents are very limited in what one can do with
>> them (e.g. attempting to mutate the document in any way while
>> hibernating will throw it away).
> I assume such mutation could only come from other, fully-active,
> same-origin documents. Why should mutating the document cause it to be
> thrown away?

In Gecko's case, because such documents should not trigger network 
requests, run any script (including mutation event handlers), etc.  The 
fact that the cache even exists should be as not-exposed to everyone as 
possible.

> Suppose, for a hypothetical, that instead of throwing away the
> hibernated document, you returned an error on the DOM method in the
> caller document if it tried to mutate it.

This would almost certainly break pages, which get no exceptions if they 
try to do this right now.  Worse, it would break them in a 
timing-dependent way.

> outright broken? (I'm still trying to get a handle on the rationale
> behind either reloading or not pausing documents, beyond just
> "historical reasons", so I'm just brainstorming here...)

Don't underestimate "historical reasons".  They're also known as 
"compatibility with deployed content".  ;)

>> Note that in Gecko documents with active network requests never go
>> into hibernation right now, precisely because we don't want to have to
>> buffer potentially-arbitrary amounts of data (see JPEG push) for
>> arbitrary lengths of time. We still wouldn't want to do so in this
>> case...
> That's a tunable policy issue, right? I.e., buffer X Kb of data, then
> terminate active network requests.

The problem with that approach is that when the user then navigates back 
to the page it will be broken (e.g. if they left it early in the load 
its DOM may not even all be there).

> Maybe even be so kind as to fake up a
> pair of offline/online events. A web program probably has to be robust
> to these sorts of network-partitioning events anyway, right?

They aren't.  Welcome to the web.  Of course such events are also rare; 
if and when they happen users tend to just hit the reload button and 
move on.

-Boris

Received on Tuesday, 24 August 2010 23:47:06 UTC