wiki:Drosera

Version 3 (modified by pewtermoose@gmail.com, 14 years ago) (diff)

Tweak the instructions for enabling Drosera; remove the Windows info as Drosera does not run on Windows

About Drosera

Drosera is a JavaScript debugger for WebKit that can be used with any application that uses WebKit. Like the Web Inspector, over 90% of it is written in HTML, CSS and JavaScript.

Getting Drosera

Drosera is included with all of the WebKit nightly builds, or you can build it yourself by running the build-drosera tool found in WebKitTools/Scripts.

Enabling Drosera

Drosera requires the Safari 3 Beta or one of the nightly builds. It cannot be used with Safari 2.

If you are using a nightly build of WebKit, Drosera is already enabled for you.

To allow Drosera to attach to Safari 3, enter the following command in Terminal:

defaults write com.apple.Safari WebKitScriptDebuggerEnabled -bool true

If you would like to debug your own WebKit-based application using Drosera, simply replace com.apple.Safari in the above command with your own application's bundle identifier or add the WebKitScriptDebuggerEnabled with a value of true to your Info.plist.

Using Drosera

Once Drosera is launched, you're presented with the Attach window, showing all running applications capable of being debugged with Drosera. Select the application you want to debug to load the debugging window.

Breakpoints

Double clicking a line number in the editor window sets a new breakpoint. To delete a breakpoint, simply drag the breakpoint arrow from the line number.

The breakpoint popup allows you to enable/disable the breakpoint, view how many times the code path has been reached, and whether to pause code execution or log output to the console when the breakpoint is reached. When pause is selected, you may enter JavaScript to be evaluated for conditional breaking, while log mode will evaluate any JavaScript and log its output to the console.

Console

Drosera's console is similiar to the JavaScript console in the Safari debug menu and shows the same errors and warnings. Breakpoints set to log mode allow output to be displayed in the console, and while a script is paused, JavaScript can be executed directly in the console.

Function and Variable Stacks

While a script is paused, you can examine the contents of the variables within various scopes of the code.

Drosera on Windows

Drosera is currently not available on Windows. Much of Drosera is written in JavaScript and should require very little modifications to run on Windows. The Cocoa application wrapper is not portable will need to be rewritten using native Windows APIs. Hop onto our irc channel if you're interested in porting Drosera to Windows.