Skip to content
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 Apr 28, 2010 Tom Robinson Remove extra "require".

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.