How ariya/phantomjs works
PhantomJS is a scriptable headless WebKit runtime. A user runs a script through the executable; the Phantom controller provides page and system-facing objects, while WebPage supports page automation, network activity, and rendering. The README also identifies headless testing, screen capture, and network monitoring as product uses. The graph emphasizes these runtime stages and documented core capabilities; several connections are supported only by source-index references, so unsampled behavior is not expanded into a detailed pipeline.
Main entry points: phantom.cpp Phantom controller · webpage.cpp WebPage engine · cookiejar.cpp Cookie jar · main.cpp Executable entry
Components 23
Runtime control
- Executable entry
src/main.cpp - Phantom controller
src/phantom.cpp - JS bootstrap
src/bootstrap.js - Runtime configuration
src/config.cpp - Command-line parser
src/qcommandline/qcommandline.cpp
Web automation
- WebPage engine
src/webpage.cpp - Page JS API
src/modules/webpage.js - Network access
src/networkaccessmanager.cpp - Cookie jar
src/cookiejar.cpp - Web server API
src/webserver.cpp - HTTP server engine
src/mongoose/mongoose.c
Script APIs
- Child processes
src/childprocess.cpp - Child process API
src/modules/child_process.js - Filesystem API
src/filesystem.cpp - Filesystem JS API
src/modules/fs.js - System API
src/system.cpp - System JS API
src/modules/system.js - Cookie JS API
src/modules/cookiejar.js - Interactive REPL
src/repl.cpp
Runtime services
- Terminal support
src/terminal.cpp - Text encoding
src/encoding.cpp - Callback support
src/callback.cpp
Other components
- Script user
Connections 18
- Script user → Executable entry: runs script
- Executable entry → Phantom controller: starts
src/main.cpp - Phantom controller → WebPage engine: creates pages
src/phantom.cpp - Phantom controller → Runtime configuration: uses settings
src/phantom.cpp - Phantom controller → Child processes: creates
src/phantom.cpp - Phantom controller → System API: uses
src/phantom.cpp - Phantom controller → Web server API: creates
src/phantom.cpp - Phantom controller → Cookie jar: creates
src/phantom.cpp - WebPage engine → Network access: uses
src/webpage.cpp - Network access → Cookie jar: uses
src/networkaccessmanager.cpp - Web server API → HTTP server engine: starts server
src/webserver.cpp - Phantom controller → Interactive REPL: uses
src/phantom.cpp - Interactive REPL → Terminal support: uses
- Child process API → Child processes: wraps
- Page JS API → WebPage engine: wraps
- Filesystem JS API → Filesystem API: wraps
- System JS API → System API: wraps
- Cookie JS API → Cookie jar: wraps