Review of Building Browser Extensions by Matt Frisbie
I recommend reading Building Browser Extensions for anyone starting their chrome extension developer creer or experienced veterans deciding to look into extension development.
First Chapter: What Are Browser Extensions?
The first sentence of Matt's book is "Browser extensions are strange and powerful parasites.". It definitely caught my attention although I, personally, don't agree with it. A parasite is an organism that takes advantage of the host without any benefit to the host. A chrome extension often brings value to the end user like saving time, or making them more organized - which is a benefit and therefore would make the relationship mutualistic. You wouldn't call your smartphone a parasite just because it has a lot of power and knowledge about your personal data.
Examples and Visuals
The book does a great job at showing real examples of chrome extension components. Like popup pages/options pages. Matt has even created a separate chrome extension that has a dozen of interactive demos: https://chrome.google.com/webstore/detail/example-chrome-extension/jnofdoejfipgalklopidpdeofjebihcf The source code of this extension is clean and well-commented, so anyone can follow with ease. The book also has a lot of visuals showing intricacies of a browser extension architecture. So if you're a visual learner, like me, you will like that about the book.
Matt does an excellent job at demonstrating real concepts like background service worker shutting down with live examples. He helps the reader learn by practice without the reader having to leave the book which is impressive.
The Extension Manifest
This chapter in the book is interesting. Matt goes over each key in manifest.json described here: https://developer.chrome.com/docs/extensions/mv3/manifest/ And extends it with information that is either missing or is browser-specific. I'd recommend readers to go here: https://developer.chrome.com/docs/extensions/ and read everything there before reading this book.
What is missing?
Personally, If I'm reading a book - I'd like to know what makes the author qualified to give me advice on the subject of the book. The book, no doubt, is filled with valuable information, but I struggled to find examples of real live extensions that were published by Matt. Here is one https://msfrisbie.github.io/chat-gpt-assistant/. Perhaps that is one of the reasons why I didn't find a lot of personal opinions while reading the book. It felt very technical. Which, I guess is what a book like this is supposed to feel like.
Matt mentioned OffscreenCanvas API, but not OffscreenDocument API. Perhaps that didn't exist at the moment of writing the book.
- Information about overriding Fetch/XHR and other browser APIs, like described here: https://chromane.com/blog/chrome-extension-for-twitter
- In-depth information about automated testing in chrome extensions. Like this: https://tweak-extension.com/blog/complete-guide-test-chrome-extension-puppeteer
- The section on Authorization didn't mention an option of storing session data on a non-extension origin. A lot of extensions don't have authentication code in their bundle, and rely on session data that is stored on their web-apps origin.
What I learned
- You can provide an .svg icon in manifest.action.default_icon
- When registering event handlers in the background service worker - that should always be done in the first turn of the event loop.
- Service workers internals interface
What I Liked
The book is very detail-oriented. It mentions stuff like "devtools reload" and "source of the messages sending" not receiving the runtime message; the ability to provide "default_icon" in an svg format. That is never mentioned in the official documentation as far as I know. You can only learn that stuff by experience, or in this book. It's main focus is different details that apply to browser extension platform like defining shortcuts, changing default search engine, etc.
Concise step-by-step guide on developing an extension for Safari.
It is very well organized and it's obvious that it took a lot of time and effort to put it all together in that way.
What I didn't like
The general pessimistic attitude towards the browser extension platform changes. Using phrases like "chrome extensions are parasites" or "the browser extension space is space is headed in a bizarre direction".
If you're a software developer looking to sharpen your browser extension development skills, or a novice looking into starting your career - this book is definitely worth the $40. A good chrome extension developer can easily find a $40/hour job in 2023. And reading this book from cover to cover will make you a good developer if you really understand it and apply your knowledge to real projects. Or if you are already working on a web app and your manager asks you to build a chrome extension - you can buy this book and learn browser extension development in a day. I'm looking forward to reading the second edition in a few years. You can buy it on Amazon: https://www.amazon.com/Building-Browser-Extensions-Create-Firefox/dp/148428724X
Also check out Matt's blog - it has some good articles :) https://mattfrisbie.substack.com/