Fergal Daly | 1242e4f | 2020-04-14 04:26:27 | [diff] [blame] | 1 | # What is RenderDocument? |
| 2 | |
| 3 | ## TL;DR |
| 4 | |
Fergal Daly | 788154c9 | 2020-04-27 05:34:34 | [diff] [blame] | 5 | Chrome currently switches to a new RenderFrameHost |
| 6 | when loading a new document |
| 7 | if the render process is different to the previous one. |
| 8 | The RenderDocument project is about making the switch to happen unconditionally. |
| 9 | This: |
| 10 | |
| 11 | * Eliminates the logic for navigating inside the same RenderFrameHost |
| 12 | * Makes RenderFrameHost in the browser process 1:1 with the Document. |
| 13 | * Prevents security bugs, |
| 14 | e.g. reusing the data/capabilities from the wrong document. |
Fergal Daly | 1242e4f | 2020-04-14 04:26:27 | [diff] [blame] | 15 | |
| 16 | ## Details |
| 17 | |
| 18 | Previously when we navigate a frame from one page to another, |
| 19 | the second page may appear in a new RenderFrame |
| 20 | or we may reuse the existing RenderFrame to load the second page. |
| 21 | Which happens depends on many things, |
| 22 | including which site-isolation policy we are following |
| 23 | and whether the pages are from the same site or not. |
| 24 | With RenderDocument, |
| 25 | the second page will always use a new RenderFrame |
| 26 | (excluding navigation within a document). |
| 27 | |
| 28 | Also when reloading a crashed frame |
| 29 | we reused the browser-side RenderFrameHost. |
| 30 | With RenderDocument we create a new RenderFrameHost |
| 31 | for crashed frames. |
| 32 | |
| 33 | ## Read more |
| 34 | |
| 35 | https://crbug.com/936696 |
| 36 | |
Fergal Daly | 788154c9 | 2020-04-27 05:34:34 | [diff] [blame] | 37 | [design doc](https://docs.google.com/document/d/1C2VKkFRSc0kdmqjKan1G4NlNlxWZqE4Wam41FNMgnmA) |
| 38 | |
Fergal Daly | 1242e4f | 2020-04-14 04:26:27 | [diff] [blame] | 39 | [high-level view of the work needed](https://docs.google.com/document/d/1UzVOmTj2IJ0ecz7CZicTK6ow2rr9wgLTGfY5hjyLmT4) |
| 40 | |
| 41 | [discussion of how we can land it safely](https://docs.google.com/document/d/1ZHWWEYT1L5Zgh2lpC7DHXXZjKcptI877KKOqjqxE2Ns) |
| 42 | |
| 43 | # Stages |
| 44 | |
Fergal Daly | 788154c9 | 2020-04-27 05:34:34 | [diff] [blame] | 45 | We have 3 stages that are behind flags. |
Fergal Daly | 1242e4f | 2020-04-14 04:26:27 | [diff] [blame] | 46 | |
| 47 | 1. crashed-frames: |
Karl Police | 4855222c | 2021-03-17 00:49:00 | [diff] [blame] | 48 | A new `RenderFrameHost` is used for reloading a crashed document. |
Fergal Daly | 1242e4f | 2020-04-14 04:26:27 | [diff] [blame] | 49 | 2. subframes: |
Karl Police | 4855222c | 2021-03-17 00:49:00 | [diff] [blame] | 50 | A new `RenderFrameHost` is used for every nested document. |
Fergal Daly | 1242e4f | 2020-04-14 04:26:27 | [diff] [blame] | 51 | 3. main frames: |
Karl Police | 4855222c | 2021-03-17 00:49:00 | [diff] [blame] | 52 | A new `RenderFrameHost` is used for every document. |
Fergal Daly | 1242e4f | 2020-04-14 04:26:27 | [diff] [blame] | 53 | |
| 54 | # Test changes |
| 55 | |
| 56 | ## RenderFrameHost reference becomes invalid |
| 57 | |
| 58 | Enabling this for subframes and main frames causes many tests to fail. |
| 59 | It is common for tests to get a reference to a RenderFrameHost |
| 60 | and then navigate that frame, |
| 61 | assuming that the reference will remain valid. |
| 62 | This assumption is no longer valid. |
| 63 | The test needs to get a reference to the new RenderFrameHost, |
| 64 | e.g. by traversing the frame tree again. |