Bug 1736570 Comment 30 Edit History

Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.

Olli, I'm not sure I can answer your question, but I'll give a summary of what my patches did and then I'll NI Henri so hopefully he could have some more insights into this (as per my convo with Hsin-Yi).

Originally what prompted the changes was a small case written by zombie [here ](https://bugzilla.mozilla.org/show_bug.cgi?id=1589102#c0)
(in mochitests in a debug build with fission enabled)
```
let win = window.open();
win.location = "http://example.net/browser";
setTimeout(() => win.location = "about:blank", 300); // crash
```

Nika then provided [her analysis of what happened](https://bugzilla.mozilla.org/show_bug.cgi?id=1589102#c13)
> The root of the issue here is that loading about:blank inside of a BrowsingContext loads a document which inherits the principal from the global which triggered the load. This causes an issue, as we don't run about:blank loads through DocumentChannel, which means that we don't trigger a process switch to the correct process, and end up loading an about:blank with a principal which doesn't match the target process.
We need to support performing a process switch in this case so that the final loaded about:blank document is loaded in the current process.

Since as a team we agreed that all loads should be going via DocumentChannel, this was a remaining task - making about:blank go via DocumentChannel.

So even though my original work that prompted this has a lot of patches, there are only a few relevant ones 
- part 1 , where we enable about:srcdoc to take place via DocumentCHannel but also add a mechanism for getting the correct principal (will be used for about:blank loads too) https://phabricator.services.mozilla.com/D85079
- part 2, where we enable about:blank to take place via DocumentCHannel https://phabricator.services.mozilla.com/D85081
- part 3 where i fix tests that assumed about:blank loads happen instantaneously
Olli, I'm not sure I can answer your question, but I'll give a summary of what my patches did and then I'll NI Henri so hopefully he could have some more insights into this (as per my convo with Hsin-Yi).

Originally what prompted the changes was a small case written by zombie [here ](https://bugzilla.mozilla.org/show_bug.cgi?id=1589102#c0)
(in mochitests in a debug build with fission enabled)
```
let win = window.open();
win.location = "http://example.net/browser";
setTimeout(() => win.location = "about:blank", 300); // crash
```

Nika then provided [her analysis of what happened](https://bugzilla.mozilla.org/show_bug.cgi?id=1589102#c13)
> The root of the issue here is that loading about:blank inside of a BrowsingContext loads a document which inherits the principal from the global which triggered the load. This causes an issue, as we don't run about:blank loads through DocumentChannel, which means that we don't trigger a process switch to the correct process, and end up loading an about:blank with a principal which doesn't match the target process.
We need to support performing a process switch in this case so that the final loaded about:blank document is loaded in the current process.

Since as a team we agreed that all loads should be going via DocumentChannel, this was a remaining task - making about:blank go via DocumentChannel.

So even though my original work that prompted this has a lot of patches, there are only a few relevant ones 
- part 1 , where we enable about:srcdoc to take place via DocumentCHannel but also add a mechanism for getting the correct principal (will be used for about:blank loads too) https://phabricator.services.mozilla.com/D85079
- part 2, where we enable about:blank to take place via DocumentCHannel https://phabricator.services.mozilla.com/D85081
- part 3 where i fix tests that assumed about:blank loads happen instantaneously https://phabricator.services.mozilla.com/D85083

Back to Bug 1736570 Comment 30