409 points · by djoldman · 5y ago · 63 comments
Developing for the browser is a real challenge. I think working with html / css /js has been a neglected skill for a long time - most software engineers look down on that type of work and its rarely covered in comp sci course work.
Still, its good to see a lot of progress has been made, this book included.
My only critique - why use python instead of node.js?
Basically: server-side JavaScript is just not as widely known as Python, and it'd be additionally confusing when our browser starts running JavaScript. And in-browser JavaScript is a bit too restricted (by things like the same-origin policy) to do the whole thing inside a browser.
I am resisting the urge to disagree, but since you did (literally) write a book about building a browser, I will defer to your expertise and try to learn from you :)
Respect
Does it have RSS?
I don't think either is a super compelling choice anyways for this type of work. I think you want to use a systems language here. However Python is completely fine as a teaching language. Pretty much anyone who knows a similarly structured language can read it. And there is very little noise. So it can serve as a good reference if you want to follow along with a different language.
IMHO, those are job skills and not comp sci topics. They shouldn't be part of a degree program (except the most superficial treatment required to get some ugly UI up that may be required for something else). You have your whole career to pick them up.
This made me start digging into whether this was considered a "safe" way of executing untrusted JavaScript in a sandbox.
It's not completely clear to me if DukPy currently attempts safe evaluation - it's missing options for setting time or memory limits on executed code for example: https://github.com/amol-/dukpy
There's a QuickJS Python wrapper here which offers those limits: https://github.com/PetterS/quickjs
I'm pretty paranoid though any time it comes to security and dependencies written in C, so I'd love to see a Python wrapper around a JavaScript engine that has safe sandbox execution as a key goal plus an extensive track record to back it up!
The time limit and memory limit support looks good too: https://github.com/sqreen/PyMiniRacer/blob/f7b9da0d4987ca7d1...
That's exactly what we are hoping for.
http://browser.engineering/preface.html
So far, my co-author Pavel has taught from this book multiple times (including this semester). In the spring at least one other university will offer a course. We'll list all known courses offerings on the website.
Also, if anyone would like to teach from this book, please get in touch!
The funny thing is we can have the MINIX microkernel discussions all over again :)
EDIT: Reading you comment again I suspect you might have been joking :)
There's IPC. There's memory management. There's process management. There's network management. There's security. There's device management.
They all happen at a slightly higher layer, but they all exist similar to an OS. (I'm not sure if the higher layer makes it easier or harder to understand - but in terms of what you need to know, an OS class or three is definitely helpful)
Looks like RemoteHQ launched something called Remote Browser as well, which is a SaaS browser, but more for collaborative purposes with more than one person using the same browser at the same time.
https://www.html5rocks.com/en/tutorials/internals/howbrowser...
That article, along with a number of other resources, are listed here:
https://browser.engineering/bibliography.html
In my view, a critical part of really learning how something as complicated as a browser works is by trying to build it yourself. That's why our book is oriented around building a browser as you go.
edit: it's a great article! But nothing on rendering tables :-)
HTML 5 effort has cleaned up a lot of behaviors and specified how browser tags should behave. So it is, possibly, an approachable task now. Still daunting though.
I'm the rendering lead for Chrome, and know quite a lot about how it works. I also recently wrote a series of articles about the new rendering architecture of Chromium, see here:
https://developer.chrome.com/blog/renderingng/
Pavel is a professor at the University of Utah and has extensively studied CSS from an academic point of view. He also has a lot of experience teaching the material and making it accessible to students.
(This is a really fantastic resource; I'll probably use it as the basis of course once I get around to semi-retiring and taking a teaching job. Thanks, OP!)
W3C here is unfortunately a part to the problem.
Standardisation is good, but letting google pour streams halfassedly written RFCs onto other browsermakers is not good.
Non-enforcement of standards is also bad, and it's bad to extend W3C privileges to companies who themselves selectively implement their own proposals, so others' browsers can't match their behaviour.
https://www.fastcompany.com/90611677/flow-ekioh-web-browser-...
Also you should take a look at the WHATWG because it’s far more relevant than the W3C nowadays.
https://drewdevault.com/2020/03/18/Reckless-limitless-scope....
No idea how Flow does it, but building a browser is nearly impossible.
Flow didn't start "from scratch" recently, it's an evolution of a primarily SVG+CSS renderer for set top boxes. They also re-use Spidermonkey as their Javascript engine.
> WHATWG [is] far more relevant than the W3C nowadays.
Which is arguably part of the problem.
Thanks for answer!