Find file
Fetching contributors…
Cannot retrieve contributors at this time
66 lines (47 sloc) 2.15 KB

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)