Understanding Chrome Extensions : Part 1 (chrome architecture overview)

Saikumar Chintada
3 min readDec 3, 2017
Basic overview of important components in chrome browser (http://www.umlet.com/umletino/umletino.html)

Things you might want to know about chrome extensions :

  • Overview of Chrome Architecture
  • Difference between a Tab process and Extension process
  • Lifecycle of Extension process
  • Components of an Extension
  • Resources available to an Extension
  • Isolation of Context within the components
  • References of execution context within the Extension components
  • Privilege Restrictions
  • Security Issues

There are resources over the internet which explain the above concepts better than I can. So I cherry-pick some of the concepts that I think are the key points that help dive into the internals.

1. Overview of Chrom{e,ium} Architecture

Each tab has its own process, which runs independently from the browser

We all know that Google Chrome has this multi-process architecture.That means every tab you open is a different process. We have a browser process with which every tab process interacts with. Whenever a tab crashes, the remaining tabs of the browser stay unaffected.

Main Components of Chrome Browser:

  • Renderer Process
  • Browser Kernel
  • Plugin

Browser Kernel is the main process that co-ordinates the Renderer processes, which basically are tab processes. So there is a single Browser Kernel process and multiple Renderer processes, each corresponding to a tab. Each of the Renderer process is “sandboxed so that they have restricted privileges such as limited access to OS system calls, file system etc. The Renderer process proxies the web (untrusted source) and the Browser Process proxies the user.

The Renderer process is responsible for parsing the HTML-CSS, construction of DOM, V8 instance (Javascript execution) for a tab. It does not run with user privilege. This is to prevent a compromised Renderer process from accessing user’s file system. It processes the web page to bitmaps(some intermediate format) and sends it to the kernel which paints the web page to the display.

The Browser Kernel is responsible for all the privileged operations such as network, filesystem, OS system calls etc. For a tab (Renderer Process) to perform any user privileged operation such as file upload (access the file-system), it delegates the operation to the Browser Kernel through IPC (Inter process communication). The Browser Kernel caters the privileged needs and abstracts the OS for the Renderer process. Its also responsible for maintaining Persistent storage objects like cookie storage, local storage, indexedDB etc.

Plugins are not to be mistaken for chrome extensions. For example, Adobe Flash is a plugin. A pdf reader is a plugin. I have not explored the plugin architecture in chrome yet (but stay tuned). They are basically new technologies like Flash player, developed by 3rd parties which might be considered to be merged into the Browser Kernel. They being 3rd party software, run in a different process with user privileges. This is to protect the Kernel from a corrupted plugin.

Key points to remember :

  • Browser Kernel provides API for sandboxed Renderer processes to perform privileged operation. It manages the lifecycle of renderer processes.
  • A Renderer process takes the HTML,CSS,JS files and prepares them for the Kernel to display them.

PS : The content here is simplified to be able to understand the bigger picture. There is lot that I have not mentioned. Please feel free to point any mistakes. If anyone have interesting resources about the content, please do share.

--

--