How did Apple create Safari, and what is PhantomJS?
While Chromium is a single code-base with bindings for multiple platforms, WebKit is not. Instead, WebKit is based around the concept of ports.
These ports are manually kept in sync. Some maintained by third parties (e.g. not by webkit.org or Apple). Some ports are better than others. “WebKit”, as such, has also become an abstract API, rather than just a framework.
A few popular ports:
- Safari for Mac.
- Mobile Safari for iOS.
- Safari for Windows (abandoned).
- QtWebKit (by Nokia; due to it being implemented atop Qt, it works on Mac/Linux/Windows).
- Android browser (abandoned, uses Chromium now).
- Chromium (abandoned, uses Blink now).
PhantomJS is a headless browser using the QtWebKit engine at its core.
The current release cycle of PhantomJS (1.9.x) is based on Qt 4.8.5, which bundles QtWebKit 2.2.4, which was branched off of upstream WebKit in May 2011. Due to the many layers in between, it will take a long time for PhantomJS to get anywhere near the feature-set of current Safari 8. PhantomJS by design is nothing like Safari but, if anything, it is probably like an alpha version (branched from SVN trunk) of Safari 4. Which is why, contrary to Safari 5.0, PhantomJS has only partial support for ES5.
Chromium has its abstraction layer at a higher level (platform independent). When run headless, it is exactly like an actual instance of Chrome on the same platform. When used in a virtual machine on a remote server, one doesn’t even need to be “headless”. We can use regular Chromium (under Xvfb). In theory the visual rendering through Xvfb and VM hypervisor could be different, however.
- Konqueror on Wikipedia
- Safari on Wikipedia
- WebKit on Wikipedia
- Sherlock on Wikipedia
- V8 on Wikipedia
- Blink on Wikipedia
- phantomjs.org (Official website)
- WebKit for Developers by Paul Irish
Update (September 2018): I recently read Creative Selection, which talks about the engineering choices behind Safari and iPhone, how some of its features came to be, and the role of Steve Jobs day-to-day. It is written by Ken Kocienda, an engineer who worked on both projects. The book was a good and quick read.
I previously read Steve Jobs by Walter Isaacson. The biography was great, but it didn’t cover much of Apple’s internal practices. Creative Selection covers this gap.