Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Document object created before Window object #2688
But the rough outline of creating a global, then creating the appropriate document and initializing it, and then replacing the old document if still needed, is probably right. We can even allocate the global and document and throw them away later based on metadata, but the only case where that makes sense is the XML namespace-based dispatching, and it's not clear to me that actually works (see #2656).
It seems ideally navigate goes async, then at some point once we have a response we queue a task that creates the new global, document, unloads the old, and then replaces old with new, all in the same task. The current setup with multiple tasks seems rather weird and likely wrong.
(Note that it might have to become more complicated since the task for the new document could be a distinct task from unloading the old document if we cross agent boundaries. Baby steps though.)