Commit 54e07fba authored by timothy@apple.com's avatar timothy@apple.com

Remove the Drosera project, code and resources since it has been

replaced with the Web Inspector's debugger. Removes references to
Drosera in various scripts and makefiles.

Rubber-stamped by Mark Rowe.

* BuildSlaveSupport/build-launcher-app:
* Drosera/DebuggerDocument.cpp: Removed.
* Drosera/DebuggerDocument.h: Removed.
* Drosera/Drosera.icns: Removed.
* Drosera/DroseraWin.make: Removed.
* Drosera/English.lproj/Debugger.nib/classes.nib: Removed.
* Drosera/English.lproj/Debugger.nib/info.nib: Removed.
* Drosera/English.lproj/Debugger.nib/keyedobjects.nib: Removed.
* Drosera/English.lproj/MainMenu.nib/classes.nib: Removed.
* Drosera/English.lproj/MainMenu.nib/info.nib: Removed.
* Drosera/English.lproj/MainMenu.nib/keyedobjects.nib: Removed.
* Drosera/ForwardingHeaders/wtf/Assertions.h: Removed.
* Drosera/ForwardingHeaders/wtf/HashTraits.h: Removed.
* Drosera/ForwardingHeaders/wtf/Noncopyable.h: Removed.
* Drosera/ForwardingHeaders/wtf/OwnPtr.h: Removed.
* Drosera/ForwardingHeaders/wtf/Platform.h: Removed.
* Drosera/ForwardingHeaders/wtf/RetainPtr.h: Removed.
* Drosera/Images/Drosera.ico: Removed.
* Drosera/Images/SourceArrow.png: Removed.
* Drosera/Images/SourceArrowBlank.png: Removed.
* Drosera/Images/SourceArrowOpen.png: Removed.
* Drosera/Images/background_stripe.png: Removed.
* Drosera/Images/breakPoint.tif: Removed.
* Drosera/Images/breakPointDisabled.tif: Removed.
* Drosera/Images/breakpointeditor.png: Removed.
* Drosera/Images/close.tif: Removed.
* Drosera/Images/close_active.tif: Removed.
* Drosera/Images/close_hover.tif: Removed.
* Drosera/Images/console.png: Removed.
* Drosera/Images/continue.tif: Removed.
* Drosera/Images/fileIcon.jpg: Removed.
* Drosera/Images/finishFunction.tif: Removed.
* Drosera/Images/glossyFooterFill.tif: Removed.
* Drosera/Images/glossyHeader.png: Removed.
* Drosera/Images/glossyHeaderPressed.png: Removed.
* Drosera/Images/gradientBackground.png: Removed.
* Drosera/Images/gutter.png: Removed.
* Drosera/Images/navLeftDisabled.png: Removed.
* Drosera/Images/navLeftNormal.png: Removed.
* Drosera/Images/navLeftPressed.png: Removed.
* Drosera/Images/navRightDisabled.png: Removed.
* Drosera/Images/navRightNormal.png: Removed.
* Drosera/Images/navRightPressed.png: Removed.
* Drosera/Images/pause.tif: Removed.
* Drosera/Images/popUpArrows.png: Removed.
* Drosera/Images/programCounter.tif: Removed.
* Drosera/Images/programCounterBreakPoint.tif: Removed.
* Drosera/Images/programCounterBreakPointDisabled.tif: Removed.
* Drosera/Images/run.tif: Removed.
* Drosera/Images/siteCollapsed.tif: Removed.
* Drosera/Images/siteExpanded.tif: Removed.
* Drosera/Images/siteIcon.tif: Removed.
* Drosera/Images/small.ico: Removed.
* Drosera/Images/splitterBar.tif: Removed.
* Drosera/Images/splitterDimple.tif: Removed.
* Drosera/Images/step.tif: Removed.
* Drosera/Images/stepOut.tif: Removed.
* Drosera/Images/stepOver.tif: Removed.
* Drosera/Images/stop.tif: Removed.
* Drosera/Images/toolbarBackground.png: Removed.
* Drosera/Images/verticalSplitterBar.tiff: Removed.
* Drosera/Images/verticalSplitterDimple.tiff: Removed.
* Drosera/Makefile: Removed.
* Drosera/breakpointEditor.html: Removed.
* Drosera/config.h: Removed.
* Drosera/console.css: Removed.
* Drosera/console.html: Removed.
* Drosera/console.js: Removed.
* Drosera/debugger.css: Removed.
* Drosera/debugger.html: Removed.
* Drosera/debugger.js: Removed.
* Drosera/mac/DebuggerApplication.h: Removed.
* Drosera/mac/DebuggerApplication.mm: Removed.
* Drosera/mac/DebuggerClient.h: Removed.
* Drosera/mac/DebuggerClient.mm: Removed.
* Drosera/mac/DebuggerDocumentPlatform.mm: Removed.
* Drosera/mac/Drosera.xcodeproj/project.pbxproj: Removed.
* Drosera/mac/Info.plist: Removed.
* Drosera/mac/LauncherInfo.plist: Removed.
* Drosera/mac/Makefile: Removed.
* Drosera/mac/ServerConnection.h: Removed.
* Drosera/mac/ServerConnection.mm: Removed.
* Drosera/mac/launcher.m: Removed.
* Drosera/mac/main.m: Removed.
* Drosera/viewer.css: Removed.
* Drosera/viewer.html: Removed.
* Drosera/win/BaseDelegate.h: Removed.
* Drosera/win/DebuggerClient.cpp: Removed.
* Drosera/win/DebuggerClient.h: Removed.
* Drosera/win/DebuggerDocumentPlatform.cpp: Removed.
* Drosera/win/Drosera.cpp: Removed.
* Drosera/win/Drosera.h: Removed.
* Drosera/win/Drosera.vcproj/Drosera.rc: Removed.
* Drosera/win/Drosera.vcproj/Drosera.vcproj: Removed.
* Drosera/win/DroseraPrefix.cpp: Removed.
* Drosera/win/DroseraPrefix.h: Removed.
* Drosera/win/Info.plist: Removed.
* Drosera/win/ServerConnection.cpp: Removed.
* Drosera/win/ServerConnection.h: Removed.
* Drosera/win/resource.h: Removed.
* Makefile:
* Scripts/build-drosera: Removed.
* Scripts/gdb-drosera: Removed.
* Scripts/run-drosera: Removed.
* Scripts/run-drosera-nightly.cmd: Removed.
* Scripts/run-drosera.cmd: Removed.
* Scripts/webkitdirs.pm:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@33547 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent e1445878
......@@ -38,8 +38,6 @@ use webkitdirs;
my @xcodeBuildArguments = XcodeOptions();
my $nightlyLauncherTemplatePath = "$FindBin::Bin/../WebKitLauncher";
my $nightlyLauncherStagingPath = productDir() . "/WebKit.app";
my $droseraProjectPath = "$FindBin::Bin/../Drosera/mac";
my $droseraStagingPath = productDir() . "/DroseraLauncher.app";
sub buildNightlyLauncher
{
......@@ -93,35 +91,6 @@ sub copyNightlyLauncher
}
}
sub buildDroseraLauncher
{
chdir($droseraProjectPath);
system("xcodebuild", "clean", "-alltargets", @xcodeBuildArguments, @ARGV) == 0 or die "Failed cleaning Drosera project";
# Build native platform only right now, as building universal with the 10.4u SDK cause Xcode to look for WebKit,
# WebCore & JavaScriptCore in the SDK under /Developer/SDKs/MacOSX10.4u.sdk/$(BUILT_PRODUCTS_DIR) where they do not exist
system("xcodebuild", "-alltargets", @xcodeBuildArguments, @ARGV) == 0 or die "Failed building Drosera project";
chdirWebKit();
}
sub setDroseraLauncherVersion
{
my $revision = currentSVNRevision();
my $infoPlist = "$droseraStagingPath/Contents/Info.plist";
my $data;
open(IN, $infoPlist) or die "Couldn't open Info.plist in built application for reading";
{
undef $/;
$data = <IN>;
}
close(IN);
open(OUT, ">$infoPlist") or die "Couldn't open Info.plist in built application for writing";
$data =~ s/VERSION/$revision/g;
print OUT $data;
close(OUT);
}
chdirWebKit();
buildNightlyLauncher();
copyNightlyLauncher();
buildDroseraLauncher();
setDroseraLauncherVersion();
2008-05-16 Timothy Hatcher <timothy@apple.com>
Remove the Drosera project, code and resources since it has been
replaced with the Web Inspector's debugger. Removes references to
Drosera in various scripts and makefiles.
Rubber-stamped by Mark Rowe.
* BuildSlaveSupport/build-launcher-app:
* Drosera/DebuggerDocument.cpp: Removed.
* Drosera/DebuggerDocument.h: Removed.
* Drosera/Drosera.icns: Removed.
* Drosera/DroseraWin.make: Removed.
* Drosera/English.lproj/Debugger.nib/classes.nib: Removed.
* Drosera/English.lproj/Debugger.nib/info.nib: Removed.
* Drosera/English.lproj/Debugger.nib/keyedobjects.nib: Removed.
* Drosera/English.lproj/MainMenu.nib/classes.nib: Removed.
* Drosera/English.lproj/MainMenu.nib/info.nib: Removed.
* Drosera/English.lproj/MainMenu.nib/keyedobjects.nib: Removed.
* Drosera/ForwardingHeaders/wtf/Assertions.h: Removed.
* Drosera/ForwardingHeaders/wtf/HashTraits.h: Removed.
* Drosera/ForwardingHeaders/wtf/Noncopyable.h: Removed.
* Drosera/ForwardingHeaders/wtf/OwnPtr.h: Removed.
* Drosera/ForwardingHeaders/wtf/Platform.h: Removed.
* Drosera/ForwardingHeaders/wtf/RetainPtr.h: Removed.
* Drosera/Images/Drosera.ico: Removed.
* Drosera/Images/SourceArrow.png: Removed.
* Drosera/Images/SourceArrowBlank.png: Removed.
* Drosera/Images/SourceArrowOpen.png: Removed.
* Drosera/Images/background_stripe.png: Removed.
* Drosera/Images/breakPoint.tif: Removed.
* Drosera/Images/breakPointDisabled.tif: Removed.
* Drosera/Images/breakpointeditor.png: Removed.
* Drosera/Images/close.tif: Removed.
* Drosera/Images/close_active.tif: Removed.
* Drosera/Images/close_hover.tif: Removed.
* Drosera/Images/console.png: Removed.
* Drosera/Images/continue.tif: Removed.
* Drosera/Images/fileIcon.jpg: Removed.
* Drosera/Images/finishFunction.tif: Removed.
* Drosera/Images/glossyFooterFill.tif: Removed.
* Drosera/Images/glossyHeader.png: Removed.
* Drosera/Images/glossyHeaderPressed.png: Removed.
* Drosera/Images/gradientBackground.png: Removed.
* Drosera/Images/gutter.png: Removed.
* Drosera/Images/navLeftDisabled.png: Removed.
* Drosera/Images/navLeftNormal.png: Removed.
* Drosera/Images/navLeftPressed.png: Removed.
* Drosera/Images/navRightDisabled.png: Removed.
* Drosera/Images/navRightNormal.png: Removed.
* Drosera/Images/navRightPressed.png: Removed.
* Drosera/Images/pause.tif: Removed.
* Drosera/Images/popUpArrows.png: Removed.
* Drosera/Images/programCounter.tif: Removed.
* Drosera/Images/programCounterBreakPoint.tif: Removed.
* Drosera/Images/programCounterBreakPointDisabled.tif: Removed.
* Drosera/Images/run.tif: Removed.
* Drosera/Images/siteCollapsed.tif: Removed.
* Drosera/Images/siteExpanded.tif: Removed.
* Drosera/Images/siteIcon.tif: Removed.
* Drosera/Images/small.ico: Removed.
* Drosera/Images/splitterBar.tif: Removed.
* Drosera/Images/splitterDimple.tif: Removed.
* Drosera/Images/step.tif: Removed.
* Drosera/Images/stepOut.tif: Removed.
* Drosera/Images/stepOver.tif: Removed.
* Drosera/Images/stop.tif: Removed.
* Drosera/Images/toolbarBackground.png: Removed.
* Drosera/Images/verticalSplitterBar.tiff: Removed.
* Drosera/Images/verticalSplitterDimple.tiff: Removed.
* Drosera/Makefile: Removed.
* Drosera/breakpointEditor.html: Removed.
* Drosera/config.h: Removed.
* Drosera/console.css: Removed.
* Drosera/console.html: Removed.
* Drosera/console.js: Removed.
* Drosera/debugger.css: Removed.
* Drosera/debugger.html: Removed.
* Drosera/debugger.js: Removed.
* Drosera/mac/DebuggerApplication.h: Removed.
* Drosera/mac/DebuggerApplication.mm: Removed.
* Drosera/mac/DebuggerClient.h: Removed.
* Drosera/mac/DebuggerClient.mm: Removed.
* Drosera/mac/DebuggerDocumentPlatform.mm: Removed.
* Drosera/mac/Drosera.xcodeproj/project.pbxproj: Removed.
* Drosera/mac/Info.plist: Removed.
* Drosera/mac/LauncherInfo.plist: Removed.
* Drosera/mac/Makefile: Removed.
* Drosera/mac/ServerConnection.h: Removed.
* Drosera/mac/ServerConnection.mm: Removed.
* Drosera/mac/launcher.m: Removed.
* Drosera/mac/main.m: Removed.
* Drosera/viewer.css: Removed.
* Drosera/viewer.html: Removed.
* Drosera/win/BaseDelegate.h: Removed.
* Drosera/win/DebuggerClient.cpp: Removed.
* Drosera/win/DebuggerClient.h: Removed.
* Drosera/win/DebuggerDocumentPlatform.cpp: Removed.
* Drosera/win/Drosera.cpp: Removed.
* Drosera/win/Drosera.h: Removed.
* Drosera/win/Drosera.vcproj/Drosera.rc: Removed.
* Drosera/win/Drosera.vcproj/Drosera.vcproj: Removed.
* Drosera/win/DroseraPrefix.cpp: Removed.
* Drosera/win/DroseraPrefix.h: Removed.
* Drosera/win/Info.plist: Removed.
* Drosera/win/ServerConnection.cpp: Removed.
* Drosera/win/ServerConnection.h: Removed.
* Drosera/win/resource.h: Removed.
* Makefile:
* Scripts/build-drosera: Removed.
* Scripts/gdb-drosera: Removed.
* Scripts/run-drosera: Removed.
* Scripts/run-drosera-nightly.cmd: Removed.
* Scripts/run-drosera.cmd: Removed.
* Scripts/webkitdirs.pm:
2008-05-15 Stephanie Lewis <slewis@apple.com>
Reviewed by Anders.
......
/*
* Copyright (C) 2007 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "config.h"
#include "DebuggerDocument.h"
#include "ServerConnection.h"
#include <JavaScriptCore/JSContextRef.h>
#include <JavaScriptCore/JSRetainPtr.h>
#include <JavaScriptCore/JSStringRefCF.h>
#include <JavaScriptCore/RetainPtr.h>
DebuggerDocument::DebuggerDocument(ServerConnection* serverConn)
: m_server(serverConn)
{
ASSERT(m_server);
}
//-- Callbacks
JSValueRef DebuggerDocument::breakpointEditorHTMLCallback(JSContextRef context, JSObjectRef /*function*/, JSObjectRef /*thisObject*/, size_t /*argumentCount*/, const JSValueRef /*arguments*/[], JSValueRef* /*exception*/)
{
RetainPtr<CFURLRef> htmlURLRef(AdoptCF, ::CFBundleCopyResourceURL(::CFBundleGetBundleWithIdentifier(CFSTR("org.webkit.drosera")), CFSTR("breakpointEditor"), CFSTR("html"), 0));
if (!htmlURLRef)
return JSValueMakeUndefined(context);
// FIXME: I'm open to a better way to do this. We convert from UInt8 to CFString to JSString (3 string types!)
RetainPtr<CFReadStreamRef> readStreamRef(AdoptCF, CFReadStreamCreateWithFile(0, htmlURLRef.get()));
CFReadStreamRef readStream = readStreamRef.get();
if (!CFReadStreamOpen(readStream))
return JSValueMakeUndefined(context);
// Large enough for current BreakPointEditor.html but won't need to be changed if that file changes
// because we loop over the entire file and read it in bufferLength pieces at a time
const CFIndex bufferLength = 740;
UInt8 buffer[bufferLength];
Vector<UInt8, bufferLength> charBuffer;
CFIndex readResult = bufferLength;
while (readResult == bufferLength) {
readResult = CFReadStreamRead(readStream, buffer, bufferLength);
// Error condition (-1) will not copy any data
for (int i = 0; i < readResult; i++)
charBuffer.append(buffer[i]);
}
CFReadStreamClose(readStream);
if (readResult == -1)
return JSValueMakeUndefined(context);
// FIXME: Is there a way to determine the encoding?
RetainPtr<CFStringRef> fileContents(AdoptCF, CFStringCreateWithBytes(0, charBuffer.data(), charBuffer.size(), kCFStringEncodingUTF8, true));
JSRetainPtr<JSStringRef> fileContentsJS(Adopt, JSStringCreateWithCFString(fileContents.get()));
JSValueRef ret = JSValueMakeString(context, fileContentsJS.get());
return ret;
}
JSValueRef DebuggerDocument::pauseCallback(JSContextRef context, JSObjectRef /*function*/, JSObjectRef thisObject, size_t /*argumentCount*/, const JSValueRef /*arguments*/[], JSValueRef* /*exception*/)
{
DebuggerDocument* debuggerDocument = reinterpret_cast<DebuggerDocument*>(JSObjectGetPrivate(thisObject));
debuggerDocument->platformPause();
return JSValueMakeUndefined(context);
}
JSValueRef DebuggerDocument::resumeCallback(JSContextRef context, JSObjectRef /*function*/, JSObjectRef thisObject, size_t /*argumentCount*/, const JSValueRef /*arguments*/[], JSValueRef* /*exception*/)
{
DebuggerDocument* debuggerDocument = reinterpret_cast<DebuggerDocument*>(JSObjectGetPrivate(thisObject));
debuggerDocument->platformResume();
return JSValueMakeUndefined(context);
}
JSValueRef DebuggerDocument::stepIntoCallback(JSContextRef context, JSObjectRef /*function*/, JSObjectRef thisObject, size_t /*argumentCount*/, const JSValueRef /*arguments*/[], JSValueRef* /*exception*/)
{
DebuggerDocument* debuggerDocument = reinterpret_cast<DebuggerDocument*>(JSObjectGetPrivate(thisObject));
debuggerDocument->platformStepInto();
return JSValueMakeUndefined(context);
}
JSValueRef DebuggerDocument::evaluateScriptCallback(JSContextRef context, JSObjectRef /*function*/, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
{
DebuggerDocument* debuggerDocument = reinterpret_cast<DebuggerDocument*>(JSObjectGetPrivate(thisObject));
if (argumentCount < 2)
return JSValueMakeUndefined(context);
if (!JSValueIsNumber(context, arguments[1]))
return JSValueMakeUndefined(context);
double callFrame = JSValueToNumber(context, arguments[1], exception);
ASSERT(!*exception);
JSRetainPtr<JSStringRef> script(Adopt, JSValueToStringCopy(context, arguments[0], exception));
ASSERT(!*exception);
JSValueRef ret = debuggerDocument->platformEvaluateScript(context, script.get(), (int)callFrame);
return ret;
}
JSValueRef DebuggerDocument::currentFunctionStackCallback(JSContextRef context, JSObjectRef /*function*/, JSObjectRef thisObject, size_t /*argumentCount*/, const JSValueRef /*arguments*/[], JSValueRef* exception)
{
DebuggerDocument* debuggerDocument = reinterpret_cast<DebuggerDocument*>(JSObjectGetPrivate(thisObject));
Vector<JSValueRef> stack;
debuggerDocument->getPlatformCurrentFunctionStack(context, stack);
return DebuggerDocument::toJSArray(context, stack, exception);
}
JSValueRef DebuggerDocument::localScopeVariableNamesForCallFrameCallback(JSContextRef context, JSObjectRef /*function*/, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
{
DebuggerDocument* debuggerDocument = reinterpret_cast<DebuggerDocument*>(JSObjectGetPrivate(thisObject));
if (argumentCount < 1)
return JSValueMakeUndefined(context);
if (!JSValueIsNumber(context, arguments[0]))
return JSValueMakeUndefined(context);
double callFrame = JSValueToNumber(context, arguments[0], exception);
ASSERT(!*exception);
// Get the variable names
Vector<JSValueRef> localVariableNames;
debuggerDocument->getPlatformLocalScopeVariableNamesForCallFrame(context, static_cast<int>(callFrame), localVariableNames);
return DebuggerDocument::toJSArray(context, localVariableNames, exception);
}
JSValueRef DebuggerDocument::valueForScopeVariableNamedCallback(JSContextRef context, JSObjectRef /*function*/, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
{
DebuggerDocument* debuggerDocument = reinterpret_cast<DebuggerDocument*>(JSObjectGetPrivate(thisObject));
if (argumentCount < 2)
return JSValueMakeUndefined(context);
if (!JSValueIsString(context, arguments[0]))
return JSValueMakeUndefined(context);
JSRetainPtr<JSStringRef> key(Adopt, JSValueToStringCopy(context, arguments[0], exception));
ASSERT(!*exception);
if (!JSValueIsNumber(context, arguments[1]))
return JSValueMakeUndefined(context);
double callFrame = JSValueToNumber(context, arguments[1], exception);
ASSERT(!*exception);
return debuggerDocument->platformValueForScopeVariableNamed(context, key.get(), (int)callFrame);
}
JSValueRef DebuggerDocument::logCallback(JSContextRef context, JSObjectRef /*function*/, JSObjectRef /*thisObject*/, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
{
if (argumentCount < 1)
return JSValueMakeUndefined(context);
if (!JSValueIsString(context, arguments[0]))
return JSValueMakeUndefined(context);
JSRetainPtr<JSStringRef> msg(Adopt, JSValueToStringCopy(context, arguments[0], exception));
ASSERT(!*exception);
DebuggerDocument::platformLog(msg.get());
return JSValueMakeUndefined(context);
}
//-- These are the calls into the JS. --//
bool DebuggerDocument::isPaused(JSContextRef context) const
{
JSObjectRef globalObject = JSContextGetGlobalObject(context);
JSRetainPtr<JSStringRef> string(Adopt, JSStringCreateWithUTF8CString("isPaused"));
JSValueRef objectProperty = JSObjectGetProperty(context, globalObject, string.get(), 0);
return JSValueToBoolean(context, objectProperty);
}
void DebuggerDocument::updateFileSource(JSContextRef context, JSStringRef documentSource, JSStringRef url)
{
JSValueRef documentSourceValue = JSValueMakeString(context, documentSource);
JSValueRef urlValue = JSValueMakeString(context, url);
JSValueRef forceValue = JSValueMakeBoolean(context, true);
JSValueRef arguments[] = { documentSourceValue, urlValue, forceValue };
int argumentsSize = sizeof(arguments)/sizeof(arguments[0]);
DebuggerDocument::callGlobalFunction(context, "updateFileSource", argumentsSize, arguments);
}
void DebuggerDocument::didParseScript(JSContextRef context, JSStringRef source, JSStringRef documentSource, JSStringRef url, JSValueRef sourceId, JSValueRef baseLine)
{
JSValueRef sourceValue = JSValueMakeString(context, source);
JSValueRef documentSourceValue = JSValueMakeString(context, documentSource);
JSValueRef urlValue = JSValueMakeString(context, url);
JSValueRef arguments[] = { sourceValue, documentSourceValue, urlValue, sourceId, baseLine };
int argumentsSize = sizeof(arguments)/sizeof(arguments[0]);
DebuggerDocument::callGlobalFunction(context, "didParseScript", argumentsSize, arguments);
}
void DebuggerDocument::willExecuteStatement(JSContextRef context, JSValueRef sourceId, JSValueRef lineno, JSValueRef* exception)
{
JSValueRef arguments[] = { sourceId, lineno };
int argumentsSize = sizeof(arguments)/sizeof(arguments[0]);
DebuggerDocument::callGlobalFunction(context, "willExecuteStatement", argumentsSize, arguments, exception);
if (exception && *exception)
logException(context, *exception);
}
void DebuggerDocument::didEnterCallFrame(JSContextRef context, JSValueRef sourceId, JSValueRef lineno, JSValueRef* exception)
{
JSValueRef arguments[] = { sourceId, lineno };
int argumentsSize = sizeof(arguments)/sizeof(arguments[0]);
DebuggerDocument::callGlobalFunction(context, "didEnterCallFrame", argumentsSize, arguments, exception);
if (exception && *exception)
logException(context, *exception);
}
void DebuggerDocument::willLeaveCallFrame(JSContextRef context, JSValueRef sourceId, JSValueRef lineno, JSValueRef* exception)
{
JSValueRef arguments[] = { sourceId, lineno };
int argumentsSize = sizeof(arguments)/sizeof(arguments[0]);
DebuggerDocument::callGlobalFunction(context, "willLeaveCallFrame", argumentsSize, arguments, exception);
if (exception && *exception)
logException(context, *exception);
}
void DebuggerDocument::exceptionWasRaised(JSContextRef context, JSValueRef sourceId, JSValueRef lineno, JSValueRef* exception)
{
JSValueRef arguments[] = { sourceId, lineno };
int argumentsSize = sizeof(arguments)/sizeof(arguments[0]);
DebuggerDocument::callGlobalFunction(context, "exceptionWasRaised", argumentsSize, arguments, exception);
}
void DebuggerDocument::windowScriptObjectAvailable(JSContextRef context, JSObjectRef windowObject, JSValueRef* exception)
{
JSRetainPtr<JSStringRef> droseraStr(Adopt, JSStringCreateWithUTF8CString("DebuggerDocument"));
JSValueRef droseraObject = JSObjectMake(context, getDroseraJSClass(), this);
JSObjectSetProperty(context, windowObject, droseraStr.get(), droseraObject, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete, exception);
if (exception && *exception)
logException(context, *exception);
}
JSValueRef DebuggerDocument::toJSArray(JSContextRef context, Vector<JSValueRef>& vectorValues, JSValueRef* exception)
{
JSObjectRef globalObject = JSContextGetGlobalObject(context);
JSRetainPtr<JSStringRef> constructorString(Adopt, JSStringCreateWithUTF8CString("Array"));
JSValueRef constructorProperty = JSObjectGetProperty(context, globalObject, constructorString.get(), exception);
ASSERT(!*exception);
JSObjectRef arrayConstructor = JSValueToObject(context, constructorProperty, exception);
ASSERT(!*exception);
JSObjectRef array = JSObjectCallAsConstructor(context, arrayConstructor, 0, 0, exception);
ASSERT(!*exception);
JSRetainPtr<JSStringRef> pushString(Adopt, JSStringCreateWithUTF8CString("push"));
JSValueRef pushValue = JSObjectGetProperty(context, array, pushString.get(), exception);
ASSERT(!*exception);
JSObjectRef push = JSValueToObject(context, pushValue, exception);
ASSERT(!*exception);
for (Vector<JSValueRef>::iterator it = vectorValues.begin(); it != vectorValues.end(); ++it) {
JSObjectCallAsFunction(context, push, array, 1, it, exception);
ASSERT(!*exception);
}
return array;
}
// Private
JSValueRef DebuggerDocument::callGlobalFunction(JSContextRef context, const char* functionName, int argumentCount, JSValueRef arguments[], JSValueRef* exception)
{
JSObjectRef globalObject = JSContextGetGlobalObject(context);
return callFunctionOnObject(context, globalObject, functionName, argumentCount, arguments, exception);
}
JSValueRef DebuggerDocument::callFunctionOnObject(JSContextRef context, JSObjectRef object, const char* functionName, int argumentCount, JSValueRef arguments[], JSValueRef* exception)
{
JSRetainPtr<JSStringRef> string(Adopt, JSStringCreateWithUTF8CString(functionName));
JSValueRef objectProperty = JSObjectGetProperty(context, object, string.get(), exception);
JSObjectRef function = JSValueToObject(context, objectProperty, exception);
ASSERT(JSObjectIsFunction(context, function));
JSValueRef returnValue = JSObjectCallAsFunction(context, function, 0, argumentCount, arguments, exception);
if (exception && *exception)
logException(context, *exception);
return returnValue;
}
JSClassRef DebuggerDocument::getDroseraJSClass()
{
static JSClassRef droseraClass = 0;
if (!droseraClass) {
JSClassDefinition classDefinition = {0};
classDefinition.staticFunctions = DebuggerDocument::staticFunctions();
droseraClass = JSClassCreate(&classDefinition);
}
return droseraClass;
}
JSStaticFunction* DebuggerDocument::staticFunctions()
{
static JSStaticFunction staticFunctions[] = {
{ "breakpointEditorHTML", DebuggerDocument::breakpointEditorHTMLCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "currentFunctionStack", DebuggerDocument::currentFunctionStackCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "evaluateScript", DebuggerDocument::evaluateScriptCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "localScopeVariableNamesForCallFrame", DebuggerDocument::localScopeVariableNamesForCallFrameCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "pause", DebuggerDocument::pauseCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "resume", DebuggerDocument::resumeCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "stepInto", DebuggerDocument::stepIntoCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "valueForScopeVariableNamed", DebuggerDocument::valueForScopeVariableNamedCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "log", DebuggerDocument::logCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ 0, 0, 0 }
};
return staticFunctions;
}
void DebuggerDocument::logException(JSContextRef context, JSValueRef exception)
{
if (!exception)
return;
JSRetainPtr<JSStringRef> msg(Adopt, JSValueToStringCopy(context, exception, 0));
DebuggerDocument::platformLog(msg.get());
}
/*
* Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef DebuggerDocument_H
#define DebuggerDocument_H
#pragma warning(push)
#pragma warning(disable: 4510 4512 4610)
#include <JavaScriptCore/JSObjectRef.h>
#pragma warning(pop)
#include <JavaScriptCore/Vector.h>
// Forward Declarations
#if PLATFORM(MAC)
#include <JavaScriptCore/RetainPtr.h>
@class ServerConnection;
typedef RetainPtr<ServerConnection> ServerConnectionRef;
#else if PLATFORM(WIN)
#include <wtf/OwnPtr.h>
class ServerConnection;
typedef OwnPtr<ServerConnection> ServerConnectionRef;