A Computer Science degree traditionally includes courses like OS, Databases, and Compilers. Students attach to these systems, leaving them powerless over part of their computing environment. These classes replace magic with code:Others reasons for these classes: a focus on speed; learning low-level APIs; practice with C; knowing the stack; using systems better; and the importance of the system covered. Linux, Postgres, or LLVM look like improvements, additions, and optimizations atop an understandable core.
But web browsers internals are still opaque to students, faculty, and industry programmers. This book dissipates this mystery by systematically explaining all major components of a web browser.
If you follow along with the text, you will write a basic browser weighing in around 1000 lines of code (twice that if you also do the exercises). Most of the chapters will take 4–6 hours to read, implement, and debug for someone with a few years' programming experience. However, chapter 5 (Structuring Web Pages) and chapter 6 (Applying User Styles) are more difficult and may take twice as long.
Your web browser will “work” and be useful at every step of the way, and every chapter will tackle a glaring problem.This idea is from J. Wilcox, inspired in turn by S. Zdancewic's course on compilers. In that way, you will also practice growing and improving complex software. The text tries to avoid unnecessary changes and refactorings. That way, if you feel particularly interested in a particular component, you can flesh it out and add missing features, without making later chapters more difficult.
James R. Wilcox and I dreamed up this course during a late-night chat at ICFP 2018. Max Willsey proof-read and helped sequence the chapters. Zach Tatlock encouraged me to develop this into a course. I am thankful to all of them. I also thank the students of CS 6968, who found many errors and suggested important simplifications.
This book is a work in progress, and I would love to hear your suggestions on how to make it clearer, shorter, and more complete.