Event Pages Keep Chrome Slim And Running StrongBy: Zach Walton - June 21, 2012
I don’t use a lot of Chrome extensions, but I use a lot of Firefox extensions. I’m going to assume that extensions add a lot of weight to both browsers. It’s worse when you realize that half of those extensions are only used some of the time, yet are still adding to the memory that is being used.
Firefox still sucks when it comes to managing extensions, but Google is being proactive about fixing the problem. One of the previous solutions was through the use of background pages. It allowed the extension to offload all of its script onto a page that would help reduce the memory footprint of the browser. The only problem is that it continuously ran in the, well, background.
To help fix that problem, background pages have become event pages. Event pages are a little magical because they only exist when the extension needs it. Once the extension stops running, the event page vanishes freeing up even more memory.
To make event pages even better, Google will be releasing three new APIs that can work in tandem with event pages to manage memory and extensions. The first is the alarms API that will allow an extension to awake itself at set times. A new event API will let extensions when they have been installed and when they’re being unloaded. They are also developing a new version of the webRequest API that allows extensions do network interception without needing a background page.
Event pages will be hitting the Chrome beta and stable channels later this summer. They are currently available in the developer channel for experimentation. If you want to build your extension with event pages, you should check out the documentation before you start building.