Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Narwhal support for JavaScriptCore (including JSCocoa and WebView). Only tested on OS X. Not as complete as narwhal-rhino.
C C++ JavaScript Objective-C Shell
Pull request Compare This branch is 22 commits behind 280north:master.
Latest commit 21ef395 Tom Robinson Remove extra "require".
Failed to load latest commit information.
bin Enable debugging through NARWHAL_DEBUGGER
include Conditional compilation for Leopard/Snow Leopard
lib Remove extra "require".
src Higher resolution OS.sleep()
tests Interpreter module
.gitignore Update .gitignore
Info.plist Refactor narwhal-jsc, build webkit-debug version, cleanup Makefile, a…
Makefile Use sh to run configure to workaround permissions issues.
NWDebug.h Refactor narwhal-jsc, build webkit-debug version, cleanup Makefile, a…
NWDebug.m Enable debugging through NARWHAL_DEBUGGER Add debuger/profile API to README
bootstrap.js Enable debugging through NARWHAL_DEBUGGER
configure Conditional compilation for Leopard/Snow Leopard
narwhal-jsc.c Refactor initialization
narwhal.c Remove context/locking junk
package.json Fix http downloading larger files.

Narwhal JavaScriptCore / JSCocoa Platform


git clone git:// narwhal
cd narwhal/engines
git clone git:// jsc
cd jsc

# run narwhal-jsc directly, defaults to bare JavaScriptCore mode:
# equivalent to above:

# runs with a webkit instance, providing a browser environment (async operations don't work. no run loop)

# runs with a webkit instance, AppKit setup, runloop running, Web Inspector enabled  
# equivalent to above
NARWHAL_JSC_MODE=webkit-debug bin/narwhal-jsc

cd ../..
NARWHAL_ENGINE=jsc bin/narwhal
NARWHAL_ENGINE=jsc NARWHAL_JSC_MODE=webkit-debug bin/narwhal
# etc ...

Profiler and Debugger

In the webkit-debug mode the global object _inspector is the WebInspector object. You can call these Objective-C methods by replacing the colons with underscores (the sender argument is ignored and can be omitted).

For example, to enable the debugger (doesn't automatically break though):


The following methods are currently exposed through _inspector:


currentlyDebugging = _inspector.isDebuggingJavaScript();

enabled = _inspector.isJavaScriptProfilingEnabled();

currentlyProfiling = _inspector.isProfilingJavaScript();


  • Only builds on Mac OS X and JSCocoa support is currently broken, but both of these things can be fixed with improved Makefiles (or Jakefiles)
Something went wrong with that request. Please try again.