A docshell is part of a tree (it has a parent, it has children). It
starts from browser.xul, and ends with iframes of the content documents.
Each docshell has different privileges. See:
The PresShell (presentation shell) is also very interesting. It's not
at the DOM level anymore, it's not at the rendering level yet. It's the
thing that is on top of the layout operations (it holds the frames).
The PresContext (presentation context) comes along with the presshell.
It's the thing that will tell the presShell under what contrains the
layout should be computed (media, pagination, sizes, ...).
>From here, it's very exciting to look at the headers of the different
objects used in this code. You can end up in very interesting places like
the DeviceContext that provides many info about the device used, or the
RefreshDriver the handles the timing/clock of a page.
It's not too hard to read. There's many comments. If you never got a change to
go through these files, I really recommend you to take a look.
PS: These are my understanding of how things work. Feel free to correct
me if I'm wrong :)