- From: Ian Hickson <ian@hixie.ch>
- Date: Tue, 3 Dec 2013 23:05:19 +0000 (UTC)
- To: Ehsan Akhgari <ehsan@mozilla.com>, Andrew Wilson <atwilson@google.com>
- Cc: whatwg <whatwg@lists.whatwg.org>
On Wed, 9 Oct 2013, Ehsan Akhgari wrote: > > Right now the spec says[1] "Whenever a Document object is discarded, it > must be removed from the list of the worker's Documents of each worker > whose list contains that Document.". If I'm reading this correctly, > this implies that the worker object should be alive by the time that the > document gets discarded, which is not what Gecko implements. Generally the spec doesn't try to imply anything, so if you are reading it as implying something, you're probably reading it wrong. :-) Once a worker has shut down (its closing flag is set to true, its event loop is destroyed, and the "run a worker" algorithm has terminated), changing which documents are in the list of worker's Documents does nothing. So if you cleaned up the worker because it stopped being protected, then it doesn't matter what happens to the list of the worker's Documents. But, to make this clearer, I've adjusted the spec to explicit empty the list at the end of "run a worker". On Thu, 10 Oct 2013, Ehsan Akhgari wrote: > > It's even worse than that, we GC the worker object if we can prove that > it will not have any outstanding work to do in the future. That's what the spec allows, right. (Exactly what counts as outstanding work is precisely defined, see the definition of "protected worker". That definition might need some work, though.) > Well, removing a document from the worker's list of documents to me > implies that the worker object is not GCed, which implies that UAs > cannot GC worker objects until the document is discarded. You definitely don't want to read that far between the lines. Removing a document from the worker's list of documents means nothing more than that. The worker can have been GC'ed, in which case, nothing interesting happens. On Thu, 10 Oct 2013, Andrew Wilson wrote: > > > > It's even worse than that, we GC the worker object if we can prove > > that it will not have any outstanding work to do in the future. > > I suspect that would break in the case of SharedWorkers. SharedWorkers are explicitly exempted from this. I made a couple of changes to the spec here, hopefully they help (one change makes the text clearer to avoid the issue in this thread, the other change fixes the lifetime requirements to allow suspended workers to get GC'ed, since it doesn't make sense to require those to live...): http://html5.org/tools/web-apps-tracker?from=8328&to=8330 (Sorry for marking them editorial instead of normative.) -- Ian Hickson U+1047E )\._.,--....,'``. fL http://ln.hixie.ch/ U+263A /, _.. \ _\ ;`._ ,. Things that are impossible just take longer. `._.-(,_..'--(,_..'`-.;.'
Received on Tuesday, 3 December 2013 23:05:47 UTC