Rewrite of the low level libs for OSX hosted mode. We now use all public
APIs and the standard install of WebKit. Because of this change there is
no longer any need to produce two different mac targets, so this also
reverses the changes to the build in r2000.
Review by: scottb (desk), jat (desk)
git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@2168 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/jni/mac/10.4/DispWrapper.cpp b/jni/mac/10.4/DispWrapper.cpp
deleted file mode 100644
index aea305f..0000000
--- a/jni/mac/10.4/DispWrapper.cpp
+++ /dev/null
@@ -1,159 +0,0 @@
-/*
- * Copyright 2007 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-#include "DispWrapper.h"
-#include "FunctionObject.h"
-
-using namespace KJS;
-
-const ClassInfo DispWrapper::info = {"DispWrapper", 0, 0, 0};
-
-JSValue *DispWrapper::getter(ExecState* exec, JSObject* thisObj,
- const Identifier& propertyName, const PropertySlot& slot)
-{
- TRACE("ENTER DispWrapper::getter");
- if (propertyName.ustring() == "toString") {
- return new ToStringFunction();
- }
- if (thisObj->classInfo() == &DispWrapper::info) {
- DispWrapper* dispWrap = static_cast<DispWrapper*>(thisObj);
- jobject dispObj = dispWrap->dispObj;
- jstring jpropName = gEnv->NewString((const jchar*)propertyName.data(),
- propertyName.size());
- if (!jpropName || gEnv->ExceptionCheck()) {
- gEnv->ExceptionClear();
- return jsUndefined();
- }
- jint result = gEnv->CallIntMethod(dispObj, gGetFieldMeth, jpropName);
- if (!result || gEnv->ExceptionCheck()) {
- gEnv->ExceptionClear();
- return jsUndefined();
- }
- TRACE("SUCCESS DispWrapper::getter");
- return (JSValue*)result;
- }
- return jsUndefined();
-}
-
-/*
- * Construct a JavaScript wrapper around a WebKitDispatchAdapter object.
- *
- * dispObj a GlobalRef to the Java object to wrap
- */
-DispWrapper::DispWrapper(jobject dispObj): dispObj(dispObj) { }
-
-/*
- * Free GlobalRef on the underlying WebKitDispatchAdapter object.
- */
-DispWrapper::~DispWrapper() {
- gEnv->DeleteGlobalRef(dispObj);
-}
-
-bool DispWrapper::getOwnPropertySlot(ExecState *exec,
- const Identifier& propertyName, PropertySlot& slot)
-{
- slot.setCustom(this, getter);
- return true;
-}
-
-/*
- * Tells JavaScript that we can store properties into this object.
- * Note that we do not verify the property exists, so we
- *
- * exec JS execution state
- * proeprtyName the property to be updated
- */
-bool DispWrapper::canPut(ExecState *exec, const Identifier &propertyName)
- const
-{
- return true;
-}
-
-/*
- * Store a value into a field on a Java object.
- *
- * exec JS execution state
- * propertyName the name of the field
- * value the JS value to store in the field
- * attr unused attributes of the property
- *
- * Silently catches any Java exceptions in WebKitDispatchAdapter.setField(),
- * including undefined fields, so updates to undefined fields in Java objects
- * will be silently ignored. TODO: is that the desired behavior?
- */
-void DispWrapper::put(ExecState *exec, const Identifier &propertyName,
- JSValue *value, int attr)
-{
- TRACE("ENTER DispWrapper::put");
- jstring jpropName = gEnv->NewString((const jchar*)propertyName.data(),
- propertyName.size());
- if (!jpropName || gEnv->ExceptionCheck()) {
- gEnv->ExceptionClear();
- return;
- }
- gwtGCProtect(value); // Java will take ownership of this value
- gEnv->CallVoidMethod(dispObj, gSetFieldMeth, jpropName, (jint)value);
- if (gEnv->ExceptionCheck()) {
- gEnv->ExceptionClear();
- return;
- }
- TRACE("SUCCESS DispWrapper::put");
-}
-
-/*
- * Prevent JavaScript from deleting fields from a Java object.
- */
-bool DispWrapper::deleteProperty(ExecState *exec,
- const Identifier &propertyName)
-{
- return false;
-}
-
-/*
- * Return a string representation of the Java object.
- * Calls obj.toString() on the Java object.
- *
- * exec JS execution state
- * hint unused
- *
- * Returns undefined if toString() failed, or the string returned (which may
- * be null).
- */
-JSValue *DispWrapper::defaultValue(ExecState *exec, JSType hint) const {
- jstring result = (jstring)gEnv->CallObjectMethod(dispObj, gToStringMeth);
- if (gEnv->ExceptionCheck()) {
- return jsUndefined();
- } else if (!result) {
- return jsNull();
- } else {
- JStringWrap jresult(gEnv, result);
- return jsString(UString((const UChar*)jresult.jstr(), jresult.length()));
- }
-}
-
-/*
- * Tell JavaScript that this object does not implement call functionality.
- */
-bool DispWrapper::implementsCall() const {
- return false;
-}
-
-/*
- * Prevent JavaScript from calling the WebKitDispatchAdapter object
- * as if it were a function.
- */
-JSValue *DispWrapper::callAsFunction(ExecState *, JSObject *, const List &) {
- return jsUndefined();
-}
diff --git a/jni/mac/10.4/DispWrapper.h b/jni/mac/10.4/DispWrapper.h
deleted file mode 100644
index f752659..0000000
--- a/jni/mac/10.4/DispWrapper.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright 2007 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-#ifndef DISP_WRAPPER_H
-#define DISP_WRAPPER_H
-
-#include "gwt-webkit.h"
-#include <kjs/object.h>
-
-/*
- * This class wraps Java WebKitDispatchAdapter objects.
- */
-class DispWrapper : public KJS::JSObject {
-public:
- // dispObj MUST be a global ref
- DispWrapper(jobject dispObj);
- virtual ~DispWrapper();
- jobject getDispObj();
-
-public:
- // implementations of JSObject methods
- const KJS::ClassInfo *classInfo() const { return &info; }
-
- virtual bool getOwnPropertySlot(KJS::ExecState*, const KJS::Identifier&,
- KJS::PropertySlot&);
- virtual bool canPut(KJS::ExecState*, const KJS::Identifier&) const;
- virtual void put(KJS::ExecState*, const KJS::Identifier&, KJS::JSValue*, int);
- virtual bool deleteProperty(KJS::ExecState*, const KJS::Identifier&);
- virtual KJS::JSValue *defaultValue(KJS::ExecState*, KJS::JSType) const;
- virtual bool implementsCall() const;
- virtual KJS::JSValue *callAsFunction(KJS::ExecState*, KJS::JSObject*,
- const KJS::List&);
-
- static const KJS::ClassInfo info;
-
-private:
- static KJS::JSValue* getter(KJS::ExecState*, KJS::JSObject*,
- const KJS::Identifier&, const KJS::PropertySlot&);
-
-private:
- jobject dispObj;
-};
-
-inline jobject DispWrapper::getDispObj() {
- return dispObj;
-}
-
-#endif
diff --git a/jni/mac/10.4/FuncWrapper.cpp b/jni/mac/10.4/FuncWrapper.cpp
deleted file mode 100644
index 207705f..0000000
--- a/jni/mac/10.4/FuncWrapper.cpp
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * Copyright 2007 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-#include "FuncWrapper.h"
-#include <kjs/array_object.h>
-
-using namespace KJS;
-
-/*
- * Constructor for FuncWrapper.
- *
- * name JavaScript name of the function
- * funcObj a GlobalRef of the Java MethodDispatch object (to be freed in
- * the destructor, so the caller no longer has ownership)
- */
-FuncWrapper::FuncWrapper(const UString& name, jobject funcObj)
- : FunctionObject(name), funcObj(funcObj) { }
-
-/*
- * Destructor for FuncWrapper.
- *
- * Frees the GlobalRef for the Java MethodDispatch object.
- */
-FuncWrapper::~FuncWrapper() {
- gEnv->DeleteGlobalRef(funcObj);
-}
-
-/*
- * Call a Java MethodDispatch interface from JavaScript.
- * All JSValue* values passed to Java must be GC-protected, since Java
- * will take ownership of them and eventually unprotect them.
- *
- * execState the KJS execution state to run in
- * thisObj the JavaScript object wrapper for the Java object this method
- * is defined on
- * args the argument list
- *
- * Returns the JSValue returned from the Java method.
- */
-JSValue *FuncWrapper::callAsFunction(ExecState* execState, JSObject* thisObj,
- const List& args)
-{
- TRACE("ENTER FuncWrapper::callAsFunction");
-
- // create the array of JSValue* (passed as integers to Java)
- int argc = args.size();
- jintArray jsargs = gEnv->NewIntArray(argc);
- if (!jsargs || gEnv->ExceptionCheck()) {
- TRACE("FAIL FuncWrapper::callAsFunction: NewIntArray");
- return jsUndefined();
- }
-
- // protect the JSValue* values and store them in the array
- for (int i = 0; i < argc; ++i) {
- JSValue* arg = args[i];
- gwtGCProtect(arg);
- gEnv->SetIntArrayRegion(jsargs, i, 1, reinterpret_cast<jint*>(&arg));
- if (gEnv->ExceptionCheck()) {
- TRACE("FAIL FuncWrapper::callAsFunction: SetIntArrayRegion");
- return jsUndefined();
- }
- }
-
- // protect the "this" object, as Java will eventually unprotect it
- gwtGCProtect(thisObj);
- jint result = gEnv->CallIntMethod(funcObj, gInvokeMeth, execState,
- thisObj, jsargs);
- if (gEnv->ExceptionCheck()) {
- TRACE("FAIL FuncWrapper::callAsFunction: java exception is active");
- return jsUndefined();
- }
-
- if (execState->hadException()) {
- TRACE("FAIL FuncWrapper::callAsFunction: js exception is active");
- return jsUndefined();
- }
-
- TRACE("SUCCESS FuncWrapper::callAsFunction");
- return reinterpret_cast<JSValue*>(result);
-}
diff --git a/jni/mac/10.4/FuncWrapper.h b/jni/mac/10.4/FuncWrapper.h
deleted file mode 100644
index c827814..0000000
--- a/jni/mac/10.4/FuncWrapper.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright 2007 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-#ifndef FUNC_WRAPPER_H
-#define FUNC_WRAPPER_H
-
-#include "FunctionObject.h"
-#include <jni.h>
-
-/*
- * Wraps Java methods (MethodDispatch)
- */
-class FuncWrapper : public FunctionObject {
-public:
- // funcObj MUST be a global ref
- FuncWrapper(const KJS::UString& name, jobject funcObj);
- virtual ~FuncWrapper();
- jobject getFuncObj();
-
-public:
- virtual KJS::JSValue *callAsFunction(KJS::ExecState*, KJS::JSObject*,
- const KJS::List&);
-
-private:
- jobject funcObj;
-};
-
-inline jobject FuncWrapper::getFuncObj() {
- return funcObj;
-}
-
-#endif
diff --git a/jni/mac/10.4/FunctionObject.cpp b/jni/mac/10.4/FunctionObject.cpp
deleted file mode 100644
index 2f2e270..0000000
--- a/jni/mac/10.4/FunctionObject.cpp
+++ /dev/null
@@ -1,165 +0,0 @@
-/*
- * Copyright 2007 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-#include "FunctionObject.h"
-#include <kjs/array_object.h>
-
-using namespace KJS;
-
-const ClassInfo FunctionObject::info = {"Function", 0, 0, 0};
-
-class CallFunction : public FunctionObject {
-public:
- CallFunction(): FunctionObject("call") {
- }
-
- virtual JSValue *callAsFunction(ExecState *exec, JSObject *thisObj,
- const List &args)
- {
- // Copied from FunctionProtoFunc::callAsFunction()
- JSValue *thisArg = args[0];
- JSObject *func = thisObj;
-
- if (!func->implementsCall()) {
- return throwError(exec, TypeError);
- }
-
- JSObject *callThis;
- if (thisArg->isUndefinedOrNull()) {
- callThis = exec->dynamicInterpreter()->globalObject();
- } else {
- callThis = thisArg->toObject(exec);
- }
-
- return func->call(exec, callThis, args.copyTail());
- }
-};
-
-class ApplyFunction : public FunctionObject {
-public:
- ApplyFunction(): FunctionObject("apply") {
- }
-
- virtual JSValue *callAsFunction(ExecState *exec, JSObject *thisObj,
- const List &args)
- {
- // Copied from FunctionProtoFunc::callAsFunction()
- JSObject *func = thisObj;
- if (!func->implementsCall()) {
- return throwError(exec, TypeError);
- }
-
- JSValue *thisArg = args[0];
- JSObject *applyThis;
- if (thisArg->isUndefinedOrNull()) {
- applyThis = exec->dynamicInterpreter()->globalObject();
- } else {
- applyThis = thisArg->toObject(exec);
- }
-
- JSValue *argArray = args[1];
- List applyArgs;
- if (!argArray->isUndefinedOrNull()) {
- if (!argArray->isObject(&ArrayInstance::info)) {
- return throwError(exec, TypeError);
- }
-
- JSObject *argArrayObj = static_cast<JSObject *>(argArray);
- unsigned int length = argArrayObj->get(exec, lengthPropertyName)
- ->toUInt32(exec);
- for (unsigned int i = 0; i < length; ++i) {
- applyArgs.append(argArrayObj->get(exec,i));
- }
- }
- return func->call(exec, applyThis, applyArgs);
- }
-};
-
-
-static UString makeFunctionString(const UString& name) {
- return "\nfunction " + name + "() {\n [native code]\n}\n";
-}
-
-JSValue *FunctionObject::getter(ExecState* exec, JSObject* obj,
- const Identifier& propertyName, const PropertySlot& slot)
-{
- if (propertyName.ustring() == "toString") {
- return new ToStringFunction();
- } else if (propertyName.ustring() == "call") {
- return new CallFunction();
- } else if (propertyName.ustring() == "apply") {
- return new ApplyFunction();
- }
- return jsUndefined();
-}
-
-FunctionObject::FunctionObject(const UString& name): name(name) {
-}
-
-bool FunctionObject::getOwnPropertySlot(ExecState *exec,
- const Identifier& propertyName, PropertySlot& slot)
-{
- if (propertyName.ustring() == "toString") {
- slot.setCustom(this, getter);
- return true;
- }
- if (propertyName.ustring() == "call") {
- slot.setCustom(this, getter);
- return true;
- }
- if (propertyName.ustring() == "apply") {
- slot.setCustom(this, getter);
- return true;
- }
- return false;
-}
-
-bool FunctionObject::canPut(ExecState *exec, const Identifier &propertyName)
- const
-{
- return false;
-}
-
-void FunctionObject::put(ExecState *exec, const Identifier &propertyName,
- JSValue *value, int attr)
-{
-}
-
-bool FunctionObject::deleteProperty(ExecState *exec,
- const Identifier &propertyName)
-{
- return false;
-}
-
-JSValue *FunctionObject::defaultValue(ExecState *exec, JSType hint) const {
- return jsString(makeFunctionString(name));
-}
-
-bool FunctionObject::implementsCall() const {
- return true;
-}
-
-// ToStringFunction
-ToStringFunction::ToStringFunction(): FunctionObject("toString") {
-}
-
-JSValue *ToStringFunction::callAsFunction(ExecState *exec, JSObject *thisObj,
- const List &args)
-{
- if (!thisObj) {
- return throwError(exec, TypeError);
- }
- return jsString(thisObj->toString(exec));
-}
diff --git a/jni/mac/10.4/FunctionObject.h b/jni/mac/10.4/FunctionObject.h
deleted file mode 100644
index 4f8e908..0000000
--- a/jni/mac/10.4/FunctionObject.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright 2007 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-#ifndef FUNCTION_OBJECT_H
-#define FUNCTION_OBJECT_H
-
-#include "gwt-webkit.h"
-#include <kjs/object.h>
-
-class FunctionObject : public KJS::JSObject {
-protected:
- FunctionObject(const KJS::UString& name);
-
-public:
- const KJS::ClassInfo *classInfo() const { return &info; }
-
- // shared implementations of JSObject methods
- virtual bool getOwnPropertySlot(KJS::ExecState*, const KJS::Identifier&,
- KJS::PropertySlot&);
- virtual bool canPut(KJS::ExecState*, const KJS::Identifier&) const;
- virtual void put(KJS::ExecState*, const KJS::Identifier&, KJS::JSValue*, int);
- virtual bool deleteProperty(KJS::ExecState*, const KJS::Identifier&);
- virtual KJS::JSValue *defaultValue(KJS::ExecState*, KJS::JSType) const;
- virtual bool implementsCall() const;
-
- // subclasses must implement
- virtual KJS::JSValue *callAsFunction(KJS::ExecState*, KJS::JSObject*,
- const KJS::List&) = 0;
-
- static const KJS::ClassInfo info;
-
-private:
- static KJS::JSValue* getter(KJS::ExecState*, KJS::JSObject*,
- const KJS::Identifier&, const KJS::PropertySlot&);
-
-private:
- KJS::UString name;
-};
-
-class ToStringFunction : public FunctionObject {
-public:
- ToStringFunction();
- virtual KJS::JSValue *callAsFunction(KJS::ExecState*, KJS::JSObject*,
- const KJS::List&);
-};
-
-#endif
diff --git a/jni/mac/10.4/Makefile b/jni/mac/10.4/Makefile
deleted file mode 100644
index 752cb4a..0000000
--- a/jni/mac/10.4/Makefile
+++ /dev/null
@@ -1,147 +0,0 @@
-# Copyright 2007 Google Inc.
-#
-# Licensed under the Apache License, Version 2.0 (the "License"); you may not
-# use this file except in compliance with the License. You may obtain a copy of
-# the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations under
-# the License.
-
-##
-# Try a GWT_TOOLS default if it isn't set
-##
-GWT_TOOLS ?= ../../../../tools
-
-##
-# External WebKit products.
-##
-WEBKIT_REDIST=$(GWT_TOOLS)/redist/webkit/WebKit-418.9.tar.gz
-WEBKIT_INCLUDE=$(GWT_TOOLS)/sdk/WebKit-418.9
-
-##
-# External SWT products.
-##
-SWT_ORIGINAL_SRC = $(GWT_TOOLS)/lib/eclipse/org.eclipse.swt.carbon-macosx-3.2.1.src.zip
-SWT_PATCH_DIR = ./swt-build
-SWT_LIBS=$(SWT_PATCH_DIR)/libswt-webkit-carbon-3235.jnilib \
- $(SWT_PATCH_DIR)/libswt-agl-carbon-3235.jnilib \
- $(SWT_PATCH_DIR)/libswt-carbon-3235.jnilib \
- $(SWT_PATCH_DIR)/libswt-pi-carbon-3235.jnilib
-
-
-##
-# Built products.
-##
-GWT_LL_LIB=libgwt-ll.jnilib
-GWT_WEBKIT_LIB=libgwt-webkit.jnilib
-
-##
-# Tools.
-##
-CC = g++
-TAR = tar
-SHELL = /bin/sh
-FIX_INSTALL_NAME = $(SHELL) ./fix-install-name.sh
-LOCALIZE_FRAMEWORK_INSTALL_NAMES = /usr/bin/env ruby ./localize-framework-install-names.rb
-
-##
-# Compile configuration.
-##
-ARCHS = -arch i386 -arch ppc
-CFLAGS = -Wall -c $(ARCHS) -DCARBON -I/System/Library/Frameworks/JavaVM.framework/Headers -fno-exceptions -fno-rtti
-LFLAGS = -bundle $(ARCHS) -isysroot /Developer/SDKs/MacOSX10.4u.sdk
-
-##
-# JavaScriptCore options.
-##
-JSCORE_CFLAGS = $(CFLAGS) -I$(WEBKIT_INCLUDE)/JavaScriptCore
-JSCORE_LFLAGS = $(LFLAGS) -framework JavaScriptCore -F./Frameworks
-JSCORE_INSTALL_NAME = "@loader_path/Frameworks/JavaScriptCore.framework/Versions/A/JavaScriptCore"
-WEBCORE_INSTALL_NAME = "@loader_path/Frameworks/WebCore.framework/Versions/A/WebCore"
-WEBKIT_INSTALL_NAME = "@loader_path/Frameworks/WebKit.framework/Versions/A/WebKit"
-
-##
-# Intermediates
-##
-GWT_LL_OBJECTS = gwt-ll.o gwt-args.o
-GWT_WEBKIT_OBJECTS = gwt-webkit.o DispWrapper.o FuncWrapper.o FunctionObject.o
-
-#-------------------------------------------------------------------------------
-# Rules
-#-------------------------------------------------------------------------------
-
-##
-# Default rule.
-##
-all: $(GWT_LL_LIB) $(GWT_WEBKIT_LIB) $(SWT_LIBS)
-
-staging: all
- cp libgwt-*.jnilib ../../build/staging/gwt-mac-0.0.0/
-
-##
-# Copy WebKit binary frameworks locally.
-##
-Frameworks: $(WEBKIT_REDIST)
- $(TAR) -zxvf $(WEBKIT_REDIST)
- $(LOCALIZE_FRAMEWORK_INSTALL_NAMES)
-
-##
-# Rule for cpp files.
-##
-%.o: %.cpp
- $(CC) -c -o $@ $< $(JSCORE_CFLAGS)
-
-##
-# Rule for gwt-ll objects.
-##
-gwt-ll.o: ../../core/gwt-ll.cpp
- $(CC) -c -o gwt-ll.o $(CFLAGS) ../../core/gwt-ll.cpp
-
-gwt-args.o: gwt-args.cpp
- $(CC) -c -o gwt-args.o $(CFLAGS) gwt-args.cpp
-
-gwt-webkit.o: gwt-webkit.h
-
-##
-# Rule for final lib for gwt-ll.
-##
-$(GWT_LL_LIB): $(GWT_LL_OBJECTS)
- $(CC) -o $(GWT_LL_LIB) $(LFLAGS) $(GWT_LL_OBJECTS)
-
-##
-# Rule for final lib for gwt-webkit.
-##
-$(GWT_WEBKIT_LIB): Frameworks $(GWT_WEBKIT_OBJECTS)
- $(CC) -o $(GWT_WEBKIT_LIB) $(JSCORE_LFLAGS) $(GWT_WEBKIT_OBJECTS)
- $(FIX_INSTALL_NAME) JavaScriptCore $(JSCORE_INSTALL_NAME) $(GWT_WEBKIT_LIB)
-
-install: $(GWT_LL_LIB) $(GWT_WEBKIT_LIB)
- cp $(GWT_LL_LIB) $(GWT_WEBKIT_LIB) prebuilt/
-
-##
-# Unpack and patch SWT source.
-##
-$(SWT_PATCH_DIR): $(SWT_ORIGINAL_SRC) ./org.eclipse.swt/webkit.c ./org.eclipse.swt/make_macosx.mak
- unzip $(SWT_ORIGINAL_SRC) -d $(SWT_PATCH_DIR)
- cp ./org.eclipse.swt/webkit.c ./org.eclipse.swt/make_macosx.mak $(SWT_PATCH_DIR)
-
-##
-# Build SWT.
-##
-$(SWT_LIBS):$(SWT_PATCH_DIR) Frameworks
- make -C $(SWT_PATCH_DIR) -f make_macosx.mak
- $(FIX_INSTALL_NAME) WebKit $(WEBKIT_INSTALL_NAME) $(SWT_PATCH_DIR)/libswt-webkit-carbon-3235.jnilib
- $(FIX_INSTALL_NAME) WebCore $(WEBCORE_INSTALL_NAME) $(SWT_PATCH_DIR)/libswt-webkit-carbon-3235.jnilib
- $(FIX_INSTALL_NAME) JavaScriptCore $(JSCORE_INSTALL_NAME) $(SWT_PATCH_DIR)/libswt-webkit-carbon-3235.jnilib
-
-##
-# Clean rule.
-##
-clean:
- @-rm -f $(GWT_LL_LIB) $(GWT_WEBKIT_LIB) *.o
- @-rm -rf ./Frameworks $(SWT_PATCH_DIR)
diff --git a/jni/mac/10.4/fix-install-name.sh b/jni/mac/10.4/fix-install-name.sh
deleted file mode 100644
index 9ccfaaf..0000000
--- a/jni/mac/10.4/fix-install-name.sh
+++ /dev/null
@@ -1,37 +0,0 @@
-#!/bin/sh
-# Copyright 2006 Google Inc.
-#
-# Licensed under the Apache License, Version 2.0 (the "License"); you may not
-# use this file except in compliance with the License. You may obtain a copy of
-# the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations under
-# the License.
-
-
-if [ $# -ne 3 ]; then
- echo 1>&2 "usage: fix-install-path framework_name new_install_path jnilib"
- exit 1
-fi
-
-FRAMEWORK="./Frameworks/${1}.framework/Versions/A/${1}"
-INSTALL_NAME=$2
-JNILIB=$3
-
-if [ ! -f ${JNILIB} ]; then
- echo 1>&2 "Unable to locate: ${JNILIB}"
- exit 1
-fi
-
-if [ ! -f ${FRAMEWORK} ]; then
- echo 1>&2 "Unable to locate: ${FRAMEWORK}"
- exit 1
-fi
-
-CURRENT_NAME=`otool -D ${FRAMEWORK} | tail -n 1`
-install_name_tool -change "${CURRENT_NAME}" "${INSTALL_NAME}" ${JNILIB}
diff --git a/jni/mac/10.4/gwt-args.cpp b/jni/mac/10.4/gwt-args.cpp
deleted file mode 100644
index 12b6eee..0000000
--- a/jni/mac/10.4/gwt-args.cpp
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright 2007 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-#include "gwt-ll.h"
-#include "JStringWrap.h"
-
-// http://unixjunkie.blogspot.com/2006/07/access-argc-and-argv-from-anywhere.html
-extern "C" int *_NSGetArgc(void);
-extern "C" char ***_NSGetArgv(void);
-
-/*
- * Class: com_google_gwt_dev_shell_mac_LowLevelSaf
- * Method: _getArgc
- * Signature: ()I
- */
-JNIEXPORT jint JNICALL Java_com_google_gwt_dev_shell_mac_LowLevelSaf__1getArgc
- (JNIEnv* env , jclass) {
- return *_NSGetArgc();
-}
-
-/*
- * Class: com_google_gwt_dev_shell_mac_LowLevelSaf
- * Method: _getArgv
- * Signature: ()Ljava/lang/String;
- */
-JNIEXPORT jstring JNICALL
-Java_com_google_gwt_dev_shell_mac_LowLevelSaf__1getArgv
- (JNIEnv* env, jclass, jint i)
-{
- int argc = *_NSGetArgc();
- if (i < 0 || i >= argc) {
- return 0;
- }
- char **argv = *_NSGetArgv();
- return env->NewStringUTF(argv[i]);
-}
diff --git a/jni/mac/10.4/gwt-ll.h b/jni/mac/10.4/gwt-ll.h
deleted file mode 100644
index a1e2212..0000000
--- a/jni/mac/10.4/gwt-ll.h
+++ /dev/null
@@ -1,237 +0,0 @@
-/* DO NOT EDIT THIS FILE - it is machine generated */
-#include <jni.h>
-/* Header for class com_google_gwt_dev_shell_mac_LowLevelSaf */
-
-#ifndef _Included_com_google_gwt_dev_shell_mac_LowLevelSaf
-#define _Included_com_google_gwt_dev_shell_mac_LowLevelSaf
-#ifdef __cplusplus
-extern "C" {
-#endif
-/*
- * Class: com_google_gwt_dev_shell_mac_LowLevelSaf
- * Method: isNull
- * Signature: (I)Z
- */
-JNIEXPORT jboolean JNICALL Java_com_google_gwt_dev_shell_mac_LowLevelSaf_isNull
- (JNIEnv *, jclass, jint);
-
-/*
- * Class: com_google_gwt_dev_shell_mac_LowLevelSaf
- * Method: isUndefined
- * Signature: (I)Z
- */
-JNIEXPORT jboolean JNICALL Java_com_google_gwt_dev_shell_mac_LowLevelSaf_isUndefined
- (JNIEnv *, jclass, jint);
-
-/*
- * Class: com_google_gwt_dev_shell_mac_LowLevelSaf
- * Method: jsNull
- * Signature: ()I
- */
-JNIEXPORT jint JNICALL Java_com_google_gwt_dev_shell_mac_LowLevelSaf_jsNull
- (JNIEnv *, jclass);
-
-/*
- * Class: com_google_gwt_dev_shell_mac_LowLevelSaf
- * Method: jsUndefined
- * Signature: ()I
- */
-JNIEXPORT jint JNICALL Java_com_google_gwt_dev_shell_mac_LowLevelSaf_jsUndefined
- (JNIEnv *, jclass);
-
-/*
- * Class: com_google_gwt_dev_shell_mac_LowLevelSaf
- * Method: _coerceToBoolean
- * Signature: (II[Z)Z
- */
-JNIEXPORT jboolean JNICALL Java_com_google_gwt_dev_shell_mac_LowLevelSaf__1coerceToBoolean
- (JNIEnv *, jclass, jint, jint, jbooleanArray);
-
-/*
- * Class: com_google_gwt_dev_shell_mac_LowLevelSaf
- * Method: _coerceToDouble
- * Signature: (II[D)Z
- */
-JNIEXPORT jboolean JNICALL Java_com_google_gwt_dev_shell_mac_LowLevelSaf__1coerceToDouble
- (JNIEnv *, jclass, jint, jint, jdoubleArray);
-
-/*
- * Class: com_google_gwt_dev_shell_mac_LowLevelSaf
- * Method: _coerceToString
- * Signature: (II[Ljava/lang/String;)Z
- */
-JNIEXPORT jboolean JNICALL Java_com_google_gwt_dev_shell_mac_LowLevelSaf__1coerceToString
- (JNIEnv *, jclass, jint, jint, jobjectArray);
-
-/*
- * Class: com_google_gwt_dev_shell_mac_LowLevelSaf
- * Method: _convertBoolean
- * Signature: (Z[I)Z
- */
-JNIEXPORT jboolean JNICALL Java_com_google_gwt_dev_shell_mac_LowLevelSaf__1convertBoolean
- (JNIEnv *, jclass, jboolean, jintArray);
-
-/*
- * Class: com_google_gwt_dev_shell_mac_LowLevelSaf
- * Method: _convertDouble
- * Signature: (D[I)Z
- */
-JNIEXPORT jboolean JNICALL Java_com_google_gwt_dev_shell_mac_LowLevelSaf__1convertDouble
- (JNIEnv *, jclass, jdouble, jintArray);
-
-/*
- * Class: com_google_gwt_dev_shell_mac_LowLevelSaf
- * Method: _convertString
- * Signature: (Ljava/lang/String;[I)Z
- */
-JNIEXPORT jboolean JNICALL Java_com_google_gwt_dev_shell_mac_LowLevelSaf__1convertString
- (JNIEnv *, jclass, jstring, jintArray);
-
-/*
- * Class: com_google_gwt_dev_shell_mac_LowLevelSaf
- * Method: _executeScript
- * Signature: (ILjava/lang/String;)Z
- */
-JNIEXPORT jboolean JNICALL Java_com_google_gwt_dev_shell_mac_LowLevelSaf__1executeScript
- (JNIEnv *, jclass, jint, jstring);
-
-/*
- * Class: com_google_gwt_dev_shell_mac_LowLevelSaf
- * Method: _executeScriptWithInfo
- * Signature: (ILjava/lang/String;Ljava/lang/String;I)Z
- */
-JNIEXPORT jboolean JNICALL Java_com_google_gwt_dev_shell_mac_LowLevelSaf__1executeScriptWithInfo
- (JNIEnv *, jclass, jint, jstring, jstring, jint);
-
-/*
- * Class: com_google_gwt_dev_shell_mac_LowLevelSaf
- * Method: _gcLock
- * Signature: (I)V
- */
-JNIEXPORT void JNICALL Java_com_google_gwt_dev_shell_mac_LowLevelSaf__1gcLock
- (JNIEnv *, jclass, jint);
-
-/*
- * Class: com_google_gwt_dev_shell_mac_LowLevelSaf
- * Method: _gcUnlock
- * Signature: (ILjava/lang/String;)V
- */
-JNIEXPORT void JNICALL Java_com_google_gwt_dev_shell_mac_LowLevelSaf__1gcUnlock
- (JNIEnv *, jclass, jint, jstring);
-
-/*
- * Class: com_google_gwt_dev_shell_mac_LowLevelSaf
- * Method: _getArgc
- * Signature: ()I
- */
-JNIEXPORT jint JNICALL Java_com_google_gwt_dev_shell_mac_LowLevelSaf__1getArgc
- (JNIEnv *, jclass);
-
-/*
- * Class: com_google_gwt_dev_shell_mac_LowLevelSaf
- * Method: _getArgv
- * Signature: ()Ljava/lang/String;
- */
-JNIEXPORT jstring JNICALL Java_com_google_gwt_dev_shell_mac_LowLevelSaf__1getArgv
- (JNIEnv *, jclass, jint);
-
-/*
- * Class: com_google_gwt_dev_shell_mac_LowLevelSaf
- * Method: _getGlobalExecState
- * Signature: (I[I)Z
- */
-JNIEXPORT jboolean JNICALL Java_com_google_gwt_dev_shell_mac_LowLevelSaf__1getGlobalExecState
- (JNIEnv *, jclass, jint, jintArray);
-
-/*
- * Class: com_google_gwt_dev_shell_mac_LowLevelSaf
- * Method: _initNative
- * Signature: (Ljava/lang/Class;Ljava/lang/Class;)Z
- */
-JNIEXPORT jboolean JNICALL Java_com_google_gwt_dev_shell_mac_LowLevelSaf__1initNative
- (JNIEnv *, jclass, jclass, jclass);
-
-/*
- * Class: com_google_gwt_dev_shell_mac_LowLevelSaf
- * Method: _invoke
- * Signature: (IILjava/lang/String;II[I[I)Z
- */
-JNIEXPORT jboolean JNICALL Java_com_google_gwt_dev_shell_mac_LowLevelSaf__1invoke
- (JNIEnv *, jclass, jint, jint, jstring, jint, jint, jintArray, jintArray);
-
-/*
- * Class: com_google_gwt_dev_shell_mac_LowLevelSaf
- * Method: _isObject
- * Signature: (I)Z
- */
-JNIEXPORT jboolean JNICALL Java_com_google_gwt_dev_shell_mac_LowLevelSaf__1isObject
- (JNIEnv *, jclass, jint);
-
-/*
- * Class: com_google_gwt_dev_shell_mac_LowLevelSaf
- * Method: _isString
- * Signature: (I)Z
- */
-JNIEXPORT jboolean JNICALL Java_com_google_gwt_dev_shell_mac_LowLevelSaf__1isString
- (JNIEnv *, jclass, jint);
-
-/*
- * Class: com_google_gwt_dev_shell_mac_LowLevelSaf
- * Method: _isWrappedDispatch
- * Signature: (I[Z)Z
- */
-JNIEXPORT jboolean JNICALL Java_com_google_gwt_dev_shell_mac_LowLevelSaf__1isWrappedDispatch
- (JNIEnv *, jclass, jint, jbooleanArray);
-
-/*
- * Class: com_google_gwt_dev_shell_mac_LowLevelSaf
- * Method: _jsLock
- * Signature: ()V
- */
-JNIEXPORT void JNICALL Java_com_google_gwt_dev_shell_mac_LowLevelSaf__1jsLock
- (JNIEnv *, jclass);
-
-/*
- * Class: com_google_gwt_dev_shell_mac_LowLevelSaf
- * Method: _jsUnlock
- * Signature: ()V
- */
-JNIEXPORT void JNICALL Java_com_google_gwt_dev_shell_mac_LowLevelSaf__1jsUnlock
- (JNIEnv *, jclass);
-
-/*
- * Class: com_google_gwt_dev_shell_mac_LowLevelSaf
- * Method: _raiseJavaScriptException
- * Signature: (II)Z
- */
-JNIEXPORT jboolean JNICALL Java_com_google_gwt_dev_shell_mac_LowLevelSaf__1raiseJavaScriptException
- (JNIEnv *, jclass, jint, jint);
-
-/*
- * Class: com_google_gwt_dev_shell_mac_LowLevelSaf
- * Method: _unwrapDispatch
- * Signature: (I[Lcom/google/gwt/dev/shell/mac/LowLevelSaf/DispatchObject;)Z
- */
-JNIEXPORT jboolean JNICALL Java_com_google_gwt_dev_shell_mac_LowLevelSaf__1unwrapDispatch
- (JNIEnv *, jclass, jint, jobjectArray);
-
-/*
- * Class: com_google_gwt_dev_shell_mac_LowLevelSaf
- * Method: _wrapDispatch
- * Signature: (Lcom/google/gwt/dev/shell/mac/LowLevelSaf/DispatchObject;[I)Z
- */
-JNIEXPORT jboolean JNICALL Java_com_google_gwt_dev_shell_mac_LowLevelSaf__1wrapDispatch
- (JNIEnv *, jclass, jobject, jintArray);
-
-/*
- * Class: com_google_gwt_dev_shell_mac_LowLevelSaf
- * Method: _wrapFunction
- * Signature: (Ljava/lang/String;Lcom/google/gwt/dev/shell/mac/LowLevelSaf/DispatchMethod;[I)Z
- */
-JNIEXPORT jboolean JNICALL Java_com_google_gwt_dev_shell_mac_LowLevelSaf__1wrapFunction
- (JNIEnv *, jclass, jstring, jobject, jintArray);
-
-#ifdef __cplusplus
-}
-#endif
-#endif
diff --git a/jni/mac/10.4/gwt-webkit.cpp b/jni/mac/10.4/gwt-webkit.cpp
deleted file mode 100644
index 800033c..0000000
--- a/jni/mac/10.4/gwt-webkit.cpp
+++ /dev/null
@@ -1,893 +0,0 @@
-/*
- * Copyright 2007 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-#include "gwt-ll.h"
-#include "DispWrapper.h"
-#include "FuncWrapper.h"
-
-JNIEnv* gEnv;
-jclass gClass;
-jclass gDispObjCls;
-jclass gDispMethCls;
-jmethodID gGetFieldMeth;
-jmethodID gSetFieldMeth;
-jmethodID gInvokeMeth;
-jmethodID gToStringMeth;
-
-using namespace KJS;
-
-/*
- * Print a JSValue in human-readable form.
- *
- * val JSValue* to print
- * prefix a string to print before the value
- */
-void PrintJSValue(JSValue* val, char* prefix) {
- static const char* typeStrings[]={
- "unspecified",
- "number",
- "boolean",
- "undefined",
- "null",
- "string",
- "object",
- "getter/setter",
- };
- char buf[256];
- snprintf(buf, sizeof(buf), "%s{%08x}:", prefix, unsigned(val));
- TRACE(buf);
- JSType type = val->type();
- const char* typeString=typeStrings[type];
- char* p = buf;
- p += snprintf(p, sizeof(buf)-(p-buf), " %s: ", typeString);
- //p += snprintf(p, sizeof(buf)-(p-buf), "%s{%08x} %s: ", prefix,
- // unsigned(val), typeString);
- if (val->isNumber()) {
- p += snprintf(p, sizeof(buf)-(p-buf), "%lf", val->getNumber());
- } else if(val->isString()) {
- CString str(val->getString().UTF8String());
- p += snprintf(p, sizeof(buf)-(p-buf), "%.*s", (int)str.size(),
- str.c_str());
- } else if(val->isObject()) {
- const JSObject* obj = val->getObject();
- const ClassInfo* cinfo = obj->classInfo();
- const char* cname = cinfo ? cinfo->className : "js object";
- p += snprintf(p, sizeof(buf)-(p-buf), "%s @ %08x", cname, unsigned(obj));
- } else if(val->isBoolean()) {
- p += snprintf(p, sizeof(buf)-(p-buf), "%s", val->getBoolean() ? "true" : "false");
- }
- TRACE(buf);
-}
-
-/*
- * Called for each gcProtect, only if TRACING is enabled.
- *
- * val JSValue* to be protected
- */
-void gcProtectHook(JSValue* val) {
- PrintJSValue(val, "gcProtect: val=");
-}
-
-/*
- * Called for each gcUnprotect, only if TRACING is enabled.
- *
- * val JSValue* to be protected
- * trace string containing trace information for the creation site, or null
- * if not available
- */
-void gcUnprotectHook(JSValue* val, const char* trace) {
- if (trace) {
- TRACE("gcUnprotect - value created at:");
- TRACE(trace);
- }
- PrintJSValue(val, "gcUnprotect: val=");
-}
-
-/*
- * Class: com_google_gwt_dev_shell_mac_LowLevelSaf
- * Method: isNull
- * Signature: (I)Z
- */
-JNIEXPORT jboolean JNICALL Java_com_google_gwt_dev_shell_mac_LowLevelSaf_isNull
- (JNIEnv *env, jclass, jint jsval)
-{
- TRACE("ENTER LowLevelSaf__isNull");
-
- JSValue* val = (JSValue*)jsval;
- if (!val) {
- return JNI_FALSE;
- }
-
- TRACE("SUCCESS LowLevelSaf__isNull");
- return val->isNull();
-}
-
-/*
- * Class: com_google_gwt_dev_shell_mac_LowLevelSaf
- * Method: isUndefined
- * Signature: (I)Z
- */
-extern "C" JNIEXPORT jboolean JNICALL
-Java_com_google_gwt_dev_shell_mac_LowLevelSaf_isUndefined
- (JNIEnv *env, jclass, jint jsval)
-{
- TRACE("ENTER LowLevelSaf__isUndefined");
- JSValue* val = (JSValue*)jsval;
- if (!val) {
- return JNI_FALSE;
- }
-
- TRACE("SUCCESS LowLevelSaf__isUndefined");
- return val->isUndefined();
-}
-
-/*
- * Class: com_google_gwt_dev_shell_mac_LowLevelSaf
- * Method: jsNull
- * Signature: ()I
- */
-extern "C" JNIEXPORT jint JNICALL
-Java_com_google_gwt_dev_shell_mac_LowLevelSaf_jsNull
- (JNIEnv *, jclass)
-{
- return reinterpret_cast<jint>(jsNull());
-}
-
-/*
- * Class: com_google_gwt_dev_shell_mac_LowLevelSaf
- * Method: getTypeString
- * Signature: (I)Ljava/lang/String;
- */
-extern "C" JNIEXPORT jstring JNICALL
-Java_com_google_gwt_dev_shell_mac_LowLevelSaf_getTypeString
- (JNIEnv *env, jclass, jint jsval)
-{
- static const char* typeStrings[]={
- "unspecified",
- "number",
- "boolean",
- "undefined",
- "null",
- "string",
- "object",
- "getter/setter",
- };
- JSValue* val = (JSValue*)jsval;
- if (!val) {
- return 0;
- }
- JSType type = val->type();
- const char* typeString=typeStrings[type];
- if (type == ObjectType) {
- if (val->isObject(&DispWrapper::info)) {
- typeString = "Java object";
- } else {
- typeString = "JS object";
- }
- }
- return env->NewStringUTF(typeString);
-}
-
-/*
- * Class: com_google_gwt_dev_shell_mac_LowLevelSaf
- * Method: jsUndefined
- * Signature: ()I
- */
-JNIEXPORT jint JNICALL Java_com_google_gwt_dev_shell_mac_LowLevelSaf_jsUndefined
- (JNIEnv *env, jclass)
-{
- return reinterpret_cast<jint>(jsUndefined());
-}
-
-/*
- * Class: com_google_gwt_dev_shell_mac_LowLevelSaf
- * Method: _coerceToBoolean
- * Signature: (II[Z)Z
- */
-JNIEXPORT jboolean JNICALL
-Java_com_google_gwt_dev_shell_mac_LowLevelSaf__1coerceToBoolean
- (JNIEnv * env, jclass, jint execState, jint jsval, jbooleanArray rval)
-{
- TRACE("ENTER LowLevelSaf__1coerceToBoolean");
-
- if (!execState || !jsval) {
- return JNI_FALSE;
- }
-
- jboolean result = ((JSValue*)jsval)->toBoolean((ExecState*)execState);
- env->SetBooleanArrayRegion(rval, 0, 1, &result);
- if (env->ExceptionCheck()) {
- return JNI_FALSE;
- }
-
- TRACE("SUCCESS LowLevelSaf__1coerceToBoolean");
- return JNI_TRUE;
-}
-
-/*
- * Class: com_google_gwt_dev_shell_mac_LowLevelSaf
- * Method: _coerceToDouble
- * Signature: (II[D)Z
- */
-JNIEXPORT jboolean JNICALL
-Java_com_google_gwt_dev_shell_mac_LowLevelSaf__1coerceToDouble
- (JNIEnv *env, jclass, jint execState, jint jsval, jdoubleArray rval)
-{
- TRACE("ENTER LowLevelSaf__1coerceToDouble");
-
- if (!execState || !jsval) {
- return JNI_FALSE;
- }
-
- jdouble result = ((JSValue*)jsval)->toNumber((ExecState*)execState);
- env->SetDoubleArrayRegion(rval, 0, 1, &result);
- if (env->ExceptionCheck()) {
- return JNI_FALSE;
- }
-
- TRACE("SUCCESS LowLevelSaf__1coerceToDouble");
- return JNI_TRUE;
-}
-
-/*
- * Class: com_google_gwt_dev_shell_mac_LowLevelSaf
- * Method: _coerceToString
- * Signature: (II[Ljava/lang/String;)Z
- */
-JNIEXPORT jboolean JNICALL
-Java_com_google_gwt_dev_shell_mac_LowLevelSaf__1coerceToString
- (JNIEnv *env, jclass, jint execState, jint jsval, jobjectArray rval)
-{
- TRACE("ENTER LowLevelSaf__1coerceToString");
-
- JSValue *val = (JSValue*)jsval;
- if (!execState || !val) {
- return JNI_FALSE;
- }
-
- /*
- * Convert all objects to their string representation, EXCEPT
- * null and undefined which will be returned as a true NULL.
- */
- jstring result = NULL;
- if (!val->isNull() && !val->isUndefined()) {
- UString str = val->toString((ExecState*)execState);
- result = env->NewString((const jchar*)str.data(), str.size());
- if (env->ExceptionCheck())
- return JNI_FALSE;
- }
-
- env->SetObjectArrayElement(rval,0,result);
- if (env->ExceptionCheck()) {
- return JNI_FALSE;
- }
-
- TRACE("SUCCESS LowLevelSaf__1coerceToString");
- return JNI_TRUE;
-}
-
-/*
- * Class: com_google_gwt_dev_shell_mac_LowLevelSaf
- * Method: _convertBoolean
- * Signature: (IZ[I)Z
- */
-JNIEXPORT jboolean JNICALL
-Java_com_google_gwt_dev_shell_mac_LowLevelSaf__1convertBoolean
- (JNIEnv *env, jclass, jboolean jval, jintArray rval)
-{
- TRACE("ENTER LowLevelSaf__1convertBoolean");
-#ifdef ENABLE_TRACING
- char buf[256];
- snprintf(buf, sizeof(buf), " val=%s", jval ? "true" : "false");
- TRACE(buf);
-#endif
-
- JSValue *jsval = (jval == JNI_FALSE) ? jsBoolean(false) : jsBoolean(true);
-
- /*
- * Since we know this is a boolean primitive, the protect is a no-op, but
- * it is useful to have it for the trace log.
- */
- gwtGCProtect(jsval);
-
- if (!jsval) {
- return JNI_FALSE;
- }
-
- env->SetIntArrayRegion(rval,0,1,(const jint*)&jsval);
- if (env->ExceptionCheck()) {
- return JNI_FALSE;
- }
-
- TRACE("SUCCESS LowLevelSaf__1convertBoolean");
- return JNI_TRUE;
-}
-
-/*
- * Class: com_google_gwt_dev_shell_mac_LowLevelSaf
- * Method: _convertDouble
- * Signature: (ID[I)Z
- */
-JNIEXPORT jboolean JNICALL Java_com_google_gwt_dev_shell_mac_LowLevelSaf__1convertDouble
- (JNIEnv *env, jclass, jdouble jval, jintArray rval)
-{
- TRACE("ENTER LowLevelSaf__1convertDouble");
-#ifdef ENABLE_TRACING
- char buf[256];
- snprintf(buf, sizeof(buf), " val=%lf", jval);
- TRACE(buf);
-#endif
-
- JSValue *jsval = jsNumber(jval);
- gwtGCProtect(jsval);
- if (!jsval) {
- return JNI_FALSE;
- }
-
- env->SetIntArrayRegion(rval,0,1,(const jint*)&jsval);
- if (env->ExceptionCheck()) {
- return JNI_FALSE;
- }
-
- TRACE("SUCCESS LowLevelSaf__1convertDouble");
- return JNI_TRUE;
-}
-
-/*
- * Class: com_google_gwt_dev_shell_mac_LowLevelSaf
- * Method: _convertString
- * Signature: (ILjava/lang/String;[I)Z
- */
-JNIEXPORT jboolean JNICALL Java_com_google_gwt_dev_shell_mac_LowLevelSaf__1convertString
- (JNIEnv *env, jclass, jstring jval, jintArray rval)
-{
- TRACE("ENTER LowLevelSaf__1convertString");
-
- JStringWrap jstr(env, jval);
- if (!jstr.jstr()) {
- return JNI_FALSE;
- }
-#ifdef ENABLE_TRACING
- char buf[256];
- snprintf(buf, sizeof(buf), " val=%s", jstr.str());
- TRACE(buf);
-#endif
-
- JSValue *jsval = jsString(UString((const UChar*)jstr.jstr(), jstr.length()));
-
- gwtGCProtect(jsval);
- if (!jsval) {
- return JNI_FALSE;
- }
-
- env->SetIntArrayRegion(rval,0,1,(const jint*)&jsval);
- if (env->ExceptionCheck()) {
- return JNI_FALSE;
- }
-
- TRACE("SUCCESS LowLevelSaf__1convertString");
- return JNI_TRUE;
-}
-
-/*
- * Class: com_google_gwt_dev_shell_mac_LowLevelSaf
- * Method: _executeScript
- * Signature: (ILjava/lang/String;)Z
- */
-JNIEXPORT jboolean JNICALL Java_com_google_gwt_dev_shell_mac_LowLevelSaf__1executeScript
- (JNIEnv* env, jclass, jint execState, jstring code)
-{
- TRACE("ENTER LowLevelSaf__1executeScript");
- if (!execState || !code) {
- return JNI_FALSE;
- }
-
- JStringWrap jcode(env, code);
- if (!jcode.jstr()) {
- return JNI_FALSE;
- }
-
-#ifdef ENABLE_TRACING
- char buf[1024];
- snprintf(buf, sizeof(buf), " code=%s", jcode.str());
- TRACE(buf);
-#endif
-
- Interpreter* interp = ((ExecState*)execState)->dynamicInterpreter();
- if (!interp) {
- return JNI_FALSE;
- }
-
- interp->evaluate(UString(), 0, (const UChar*)jcode.jstr(), jcode.length());
- TRACE("SUCCESS LowLevelSaf__1executeScript");
- return JNI_TRUE;
-}
-
-/*
- * Class: com_google_gwt_dev_shell_mac_LowLevelSaf
- * Method: _executeScriptWithInfo
- * Signature: (ILjava/lang/String;Ljava/lang/String;I)Z
- */
-JNIEXPORT jboolean JNICALL
-Java_com_google_gwt_dev_shell_mac_LowLevelSaf__1executeScriptWithInfo
- (JNIEnv* env, jclass, jint execState, jstring code, jstring file, jint line)
-{
- TRACE("ENTER LowLevelSaf__1executeScriptWithInfo");
- if (!execState || !code || !file) {
- return JNI_FALSE;
- }
-
- JStringWrap jcode(env, code);
- if (!jcode.jstr()) {
- return JNI_FALSE;
- }
-
- JStringWrap jfile(env, file);
- if (!jcode.jstr()) {
- return JNI_FALSE;
- }
-
-#ifdef ENABLE_TRACING
- char buf[1024];
- snprintf(buf, sizeof(buf), " code=%s, file=%s, line=%d", jcode.str(),
- jfile.str(), static_cast<int>(line));
- TRACE(buf);
-#endif
-
- Interpreter* interp = ((ExecState*)execState)->dynamicInterpreter();
- if (!interp) {
- return JNI_FALSE;
- }
-
- interp->evaluate(UString((const UChar*)jfile.jstr(), jfile.length()), line,
- (const UChar*)jcode.jstr(), jcode.length());
- TRACE("SUCCESS LowLevelSaf__1executeScriptWithInfo");
- return JNI_TRUE;
-}
-
-/*
- * Class: com_google_gwt_dev_shell_mac_LowLevelSaf
- * Method: _gcLock
- * Signature: (I)V
- */
-JNIEXPORT void JNICALL Java_com_google_gwt_dev_shell_mac_LowLevelSaf__1gcLock
- (JNIEnv *, jclass, jint jsval)
-{
- gwtGCProtect(reinterpret_cast<JSValue*>(jsval));
-}
-
-/*
- * Class: com_google_gwt_dev_shell_mac_LowLevelSaf
- * Method: _gcUnlock
- * Signature: (ILjava/lang/String;)V
- */
-JNIEXPORT void JNICALL Java_com_google_gwt_dev_shell_mac_LowLevelSaf__1gcUnlock
- (JNIEnv* jniEnv, jclass, jint jsval, jstring creationDesc)
-{
- JStringWrap creationStr(jniEnv, creationDesc);
- gwtGCUnprotect(reinterpret_cast<JSValue*>(jsval),
- creationDesc ? creationStr.str() : 0);
-}
-
-/*
- * Class: com_google_gwt_dev_shell_mac_LowLevelSaf
- * Method: _getGlobalExecState
- * Signature: (I[I)Z
- */
-JNIEXPORT jboolean JNICALL
-Java_com_google_gwt_dev_shell_mac_LowLevelSaf__1getGlobalExecState
- (JNIEnv *env, jclass, jint scriptObject, jintArray rval)
-{
- TRACE("ENTER LowLevelSaf__1getGlobalExecState");
-
- if (!scriptObject || !((JSValue*)scriptObject)->isObject()) {
- return JNI_FALSE;
- }
-
- Interpreter* interp
- = Interpreter::interpreterWithGlobalObject((JSObject*)scriptObject);
- if (!interp) {
- return JNI_FALSE;
- }
-
- ExecState* execState = interp->globalExec();
- env->SetIntArrayRegion(rval, 0, 1, (jint*)&execState);
- if (env->ExceptionCheck()) {
- return JNI_FALSE;
- }
- TRACE("SUCCESS LowLevelSaf__1getGlobalExecState");
- return JNI_TRUE;
-}
-
-/*
- * Class: com_google_gwt_dev_shell_mac_LowLevelSaf
- * Method: _initNative
- * Signature: (Ljava/lang/Class;Ljava/lang/Class;)Z
- */
-JNIEXPORT jboolean JNICALL
-Java_com_google_gwt_dev_shell_mac_LowLevelSaf__1initNative
- (JNIEnv* env, jclass llClass, jclass dispObjCls, jclass dispMethCls)
-{
- Interpreter::setShouldPrintExceptions(true);
- gEnv = env;
- gClass = static_cast<jclass>(env->NewGlobalRef(llClass));
- gDispObjCls = static_cast<jclass>(env->NewGlobalRef(dispObjCls));
- gDispMethCls = static_cast<jclass>(env->NewGlobalRef(dispMethCls));
- if (!gClass || !gDispObjCls || !gDispMethCls || env->ExceptionCheck()) {
- return false;
- }
-
- gGetFieldMeth
- = env->GetMethodID(gDispObjCls, "getField", "(Ljava/lang/String;)I");
- gSetFieldMeth
- = env->GetMethodID(gDispObjCls, "setField", "(Ljava/lang/String;I)V");
- gInvokeMeth = env->GetMethodID(gDispMethCls, "invoke", "(II[I)I");
- gToStringMeth
- = env->GetMethodID(gDispObjCls, "toString", "()Ljava/lang/String;");
- if (!gGetFieldMeth || !gSetFieldMeth || !gInvokeMeth || !gToStringMeth
- || env->ExceptionCheck())
- {
- return false;
- }
-
-#ifdef FILETRACE
- gout = fopen("/tmp/gwt-ll.log", "w");
- filetrace("LOG STARTED");
-#endif // FILETRACE
-
-#ifdef JAVATRACE
- gTraceMethod = env->GetStaticMethodID(gClass, "trace", "(Ljava/lang/String;)V");
- if (!gTraceMethod || env->ExceptionCheck()) {
- return false;
- }
-#endif // JAVATRACE
-
- return true;
-}
-
-/*
- * Class: com_google_gwt_dev_shell_mac_LowLevelSaf
- * Method: _invoke
- * Signature: (IILjava/lang/String;II[I[I)Z
- */
-JNIEXPORT jboolean JNICALL
-Java_com_google_gwt_dev_shell_mac_LowLevelSaf__1invoke
- (JNIEnv* env, jclass, jint jsexecState, jint jsScriptObject, jstring method,
- jint jsthis, jint argc, jintArray argv, jintArray rval)
-{
- TRACE("ENTER LowLevelSaf__1invoke");
-
- if (!jsexecState || !jsScriptObject || !method || !rval) {
- return JNI_FALSE;
- }
- JStringWrap jmethod(env, method);
-#ifdef ENABLE_TRACING
- char buf[256];
- snprintf(buf, sizeof(buf), "scriptObject=%08x, method=%s, argc=%d",
- static_cast<unsigned>(jsScriptObject), jmethod.str(),
- static_cast<unsigned>(argc));
- TRACE(buf);
- PrintJSValue((JSValue*)jsthis, " jsthis=");
-#endif
- ExecState* execState = (ExecState*)jsexecState;
-
- JSObject* scriptObj = (JSObject*)jsScriptObject;
- if (!scriptObj->isObject()) {
- return JNI_FALSE;
- }
-
- if (!jmethod.jstr()) {
- return JNI_FALSE;
- }
-
- JSObject* thisObj = (JSObject*)jsthis;
- if (!thisObj || thisObj->isNull() || thisObj->isUndefined()) {
- thisObj = scriptObj;
- }
- if (!thisObj->isObject()) {
- return JNI_FALSE;
- }
-
- JSValue* maybeFunc = scriptObj->get(execState,
- Identifier((const UChar*)jmethod.jstr(), jmethod.length()));
- if (!maybeFunc || !maybeFunc->isObject()) {
- return JNI_FALSE;
- }
-
- JSObject* func = (JSObject*)maybeFunc;
- if (!func->implementsCall()) {
- return JNI_FALSE;
- }
-
- List args;
- for (int i = 0; i < argc; ++i) {
- jint argi;
- env->GetIntArrayRegion(argv, i, 1, &argi);
- if (env->ExceptionCheck()) {
- return JNI_FALSE;
- }
-#ifdef ENABLE_TRACING
- snprintf(buf, sizeof(buf), " arg[%d]=", i);
- TRACE(buf);
- PrintJSValue((JSValue*)argi, buf);
-#endif
- if (argi) {
- args.append((JSValue*)argi);
- } else {
- args.append(jsNull());
- }
- }
-
- JSValue* result = func->call(execState, thisObj, args);
- gwtGCProtect(result);
- env->SetIntArrayRegion(rval, 0, 1, (jint*)&result);
- if (env->ExceptionCheck()) {
- return JNI_FALSE;
- }
-
- TRACE("SUCCESS LowLevelSaf__1invoke");
- return JNI_TRUE;
-}
-
-/*
- * Class: com_google_gwt_dev_shell_mac_LowLevelSaf
- * Method: isBoolean
- * Signature: (I)Z
- */
-extern "C" JNIEXPORT jboolean JNICALL
-Java_com_google_gwt_dev_shell_mac_LowLevelSaf_isBoolean
- (JNIEnv *, jclass, jint jsval)
-{
- if (!jsval) {
- return JNI_FALSE;
- }
- return reinterpret_cast<JSValue*>(jsval)->isBoolean() ? JNI_TRUE : JNI_FALSE;
-}
-
-/*
- * Class: com_google_gwt_dev_shell_mac_LowLevelSaf
- * Method: isNumber
- * Signature: (I)Z
- */
-extern "C" JNIEXPORT jboolean JNICALL
-Java_com_google_gwt_dev_shell_mac_LowLevelSaf_isNumber
- (JNIEnv *, jclass, jint jsval)
-{
- if (!jsval) {
- return JNI_FALSE;
- }
- return reinterpret_cast<JSValue*>(jsval)->isNumber() ? JNI_TRUE : JNI_FALSE;
-}
-
-/*
- * Class: com_google_gwt_dev_shell_mac_LowLevelSaf
- * Method: _isString
- * Signature: (I)Z
- *
- * Must return true for JavaScript String objects as well as string primitives.
- */
-JNIEXPORT jboolean JNICALL
-Java_com_google_gwt_dev_shell_mac_LowLevelSaf__1isString
- (JNIEnv *, jclass, jint jsval)
-{
- if (!jsval) {
- return JNI_FALSE;
- }
- JSValue* jsValue = reinterpret_cast<JSValue*>(jsval);
- if(jsValue->isString()) return JNI_TRUE;
- // check for JavaScript String objects
- if(jsValue->isObject()) {
- const JSObject* obj = jsValue->getObject();
- const ClassInfo* cinfo = obj->classInfo();
- if (cinfo && !strcmp(cinfo->className, "String")) {
- return JNI_TRUE;
- }
- }
- return JNI_FALSE;
-}
-
-/*
- * Class: com_google_gwt_dev_shell_mac_LowLevelSaf
- * Method: _isObject
- * Signature: (I)Z
- */
-JNIEXPORT jboolean JNICALL Java_com_google_gwt_dev_shell_mac_LowLevelSaf__1isObject
- (JNIEnv *, jclass, jint jsval)
-{
- if (!jsval) {
- return JNI_FALSE;
- }
- return reinterpret_cast<JSValue*>(jsval)->isObject() ? JNI_TRUE : JNI_FALSE;
-}
-
-/*
- * Class: com_google_gwt_dev_shell_mac_LowLevelSaf
- * Method: _isWrappedDispatch
- * Signature: (I[Z)Z
- */
-JNIEXPORT jboolean JNICALL Java_com_google_gwt_dev_shell_mac_LowLevelSaf__1isWrappedDispatch
- (JNIEnv* env, jclass, jint jsval, jbooleanArray rval)
-{
- TRACE("ENTER LowLevelSaf__1isWrappedDispatch");
- if (!jsval) {
- return JNI_FALSE;
- }
-
- JSValue* val = (JSValue*)jsval;
- jboolean result = val->isObject(&DispWrapper::info) ? JNI_TRUE : JNI_FALSE;
-
- env->SetBooleanArrayRegion(rval, 0, 1, &result);
- if (env->ExceptionCheck()) {
- return JNI_FALSE;
- }
-
- TRACE("SUCCESS LowLevelSaf__1isWrappedDispatch");
- return JNI_TRUE;
-}
-
-/*
- * Class: com_google_gwt_dev_shell_mac_LowLevelSaf
- * Method: _jsLock
- * Signature: ()V
- */
-JNIEXPORT void JNICALL Java_com_google_gwt_dev_shell_mac_LowLevelSaf__1jsLock
- (JNIEnv *, jclass)
-{
- JSLock::lock();
-}
-
-/*
- * Class: com_google_gwt_dev_shell_mac_LowLevelSaf
- * Method: _jsUnlock
- * Signature: ()V
- */
-JNIEXPORT void JNICALL Java_com_google_gwt_dev_shell_mac_LowLevelSaf__1jsUnlock
- (JNIEnv *, jclass)
-{
- JSLock::unlock();
-}
-
-/*
- * Class: com_google_gwt_dev_shell_mac_LowLevelSaf
- * Method: _raiseJavaScriptException
- * Signature: (II)Z
- */
-JNIEXPORT jboolean JNICALL Java_com_google_gwt_dev_shell_mac_LowLevelSaf__1raiseJavaScriptException
- (JNIEnv *env, jclass, jint execState, jint jsval)
-{
- TRACE("ENTER LowLevelSaf__1raiseJavaScriptException");
-
- if (!execState || !jsval) {
- return JNI_FALSE;
- }
-
- reinterpret_cast<ExecState*>(execState)->setException(
- reinterpret_cast<JSValue*>(jsval));
- TRACE("SUCCESS LowLevelSaf__1raiseJavaScriptException");
- return JNI_TRUE;
-}
-
-/*
- * Class: com_google_gwt_dev_shell_mac_LowLevelSaf
- * Method: _unwrapDispatch
- * Signature: (I[Lcom/google/gwt/dev/shell/mac/LowLevelSaf/DispatchObject;)Z
- */
-JNIEXPORT jboolean JNICALL Java_com_google_gwt_dev_shell_mac_LowLevelSaf__1unwrapDispatch
- (JNIEnv* env, jclass, jint jsval, jobjectArray rval)
-{
- TRACE("ENTER LowLevelSaf__1unwrapDispatch");
- if (!jsval) {
- return JNI_FALSE;
- }
-
- JSValue* val = reinterpret_cast<JSValue*>(jsval);
- if (!val->isObject(&DispWrapper::info)) {
- return JNI_FALSE;
- }
-
- DispWrapper* wrapper = static_cast<DispWrapper*>(val);
- env->SetObjectArrayElement(rval, 0, wrapper->getDispObj());
- if (env->ExceptionCheck()) {
- return JNI_FALSE;
- }
-
- TRACE("SUCCESS LowLevelSaf__1unwrapDispatch");
- return JNI_TRUE;
-}
-
-/*
- * Class: com_google_gwt_dev_shell_mac_LowLevelSaf
- * Method: _wrapDispatch
- * Signature: (Lcom/google/gwt/dev/shell/mac/LowLevelSaf/DispatchObject;[I)Z
- */
-JNIEXPORT jboolean JNICALL
-Java_com_google_gwt_dev_shell_mac_LowLevelSaf__1wrapDispatch
- (JNIEnv* env, jclass, jobject dispObj, jintArray rval)
-{
- TRACE("ENTER LowLevelSaf__1wrapDispatch");
- jobject dispObjRef = env->NewGlobalRef(dispObj);
- if (!dispObjRef || env->ExceptionCheck()) {
- return JNI_FALSE;
- }
-
- DispWrapper* wrapper = new DispWrapper(dispObjRef);
-
- gwtGCProtect(wrapper);
-
- env->SetIntArrayRegion(rval, 0, 1, (jint*)&wrapper);
- if (env->ExceptionCheck()) {
- return JNI_FALSE;
- }
-
- TRACE("SUCCESS LowLevelSaf__1wrapDispatch");
- return JNI_TRUE;
-}
-
-/*
- * Class: com_google_gwt_dev_shell_mac_LowLevelSaf
- * Method: _wrapFunction
- * Signature: (Ljava/lang/String;Lcom/google/gwt/dev/shell/mac/LowLevelSaf/DispatchMethod;[I)Z
- */
-JNIEXPORT jboolean JNICALL
-Java_com_google_gwt_dev_shell_mac_LowLevelSaf__1wrapFunction
- (JNIEnv* env, jclass, jstring name, jobject dispMeth, jintArray rval)
-{
- TRACE("ENTER LowLevelSaf__1wrapFunction");
-
- jobject dispMethRef = env->NewGlobalRef(dispMeth);
- if (!dispMethRef || env->ExceptionCheck()) {
- return JNI_FALSE;
- }
-
- JStringWrap jname(env, name);
- if (!jname.jstr()) {
- return JNI_FALSE;
- }
-
- FuncWrapper* wrapper = new FuncWrapper(UString((const UChar*)jname.jstr(),
- jname.length()), dispMethRef);
-
- gwtGCProtect(wrapper);
- env->SetIntArrayRegion(rval, 0, 1, (jint*)&wrapper);
- if (env->ExceptionCheck()) {
- return JNI_FALSE;
- }
-
- TRACE("SUCCESS LowLevelSaf__1wrapFunction");
- return JNI_TRUE;
-}
-
-#ifdef FILETRACE
-FILE* gout = 0;
-void filetrace(const char* s) {
- fprintf(gout, s);
- fprintf(gout, "\n");
- fflush(gout);
-}
-#endif // FILETRACE
-
-#ifdef JAVATRACE
-jmethodID gTraceMethod = 0;
-void javatrace(const char* s) {
- if (!gEnv->ExceptionCheck()) {
- jstring out = gEnv->NewStringUTF(s);
- if (!gEnv->ExceptionCheck()) {
- gEnv->CallStaticVoidMethod(gClass, gTraceMethod, out);
- } else {
- gEnv->ExceptionClear();
- }
- }
-}
-#endif // JAVATRACE
diff --git a/jni/mac/10.4/gwt-webkit.h b/jni/mac/10.4/gwt-webkit.h
deleted file mode 100644
index ae1216a..0000000
--- a/jni/mac/10.4/gwt-webkit.h
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Copyright 2007 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-#ifndef GWT_WEBKIT_H
-#define GWT_WEBKIT_H
-
-#include <jni.h>
-#include <kjs/object.h>
-#include "JStringWrap.h"
-
-extern JNIEnv* gEnv;
-extern jclass gClass;
-extern jclass gDispObjCls;
-extern jclass gDispMethCls;
-extern jmethodID gSetFieldMeth;
-extern jmethodID gGetFieldMeth;
-extern jmethodID gInvokeMeth;
-extern jmethodID gToStringMeth;
-
-//#define FILETRACE
-//#define JAVATRACE
-
-#if defined(FILETRACE) || defined(JAVATRACE)
-#define ENABLE_TRACING
-#endif
-
-#if defined(FILETRACE) && defined(JAVATRACE)
-#define TRACE(s) filetrace(s),javatrace(s)
-#elif defined(FILETRACE)
-#define TRACE(s) filetrace(s)
-#elif defined(JAVATRACE)
-#define TRACE(s) javatrace(s)
-#else
-#define TRACE(s) ((void)0)
-#endif
-
-#ifdef FILETRACE
-extern FILE* gout;
-void filetrace(const char* s);
-#endif // FILETRACE
-
-#ifdef JAVATRACE
-extern jmethodID gTraceMethod;
-void javatrace(const char* s);
-#endif // JAVATRACE
-
-void PrintJSValue(KJS::JSValue*, char* prefix="");
-void gcProtectHook(KJS::JSValue*);
-void gcUnprotectHook(KJS::JSValue*, const char* trace);
-
-/*
- * Lock KJS GC and protect the supplied value.
- *
- * value JSValue* to protect from GC
- */
-inline void gwtGCProtect(KJS::JSValue* value) {
- KJS::JSLock lock;
- gcProtectNullTolerant(value);
-#ifdef ENABLE_TRACING
- gcProtectHook(value);
-#endif
-}
-
-/*
- * Lock KJS GC and unprotect the supplied value.
- *
- * value JSValue* to unprotect from GC
- * trace human-readable string describing object creation location
- */
-inline void gwtGCUnprotect(KJS::JSValue* value, const char* trace) {
- KJS::JSLock lock;
-#ifdef ENABLE_TRACING
- gcUnprotectHook(value, trace);
-#endif
- gcUnprotectNullTolerant(value);
-}
-
-#endif
diff --git a/jni/mac/10.4/localize-framework-install-names.rb b/jni/mac/10.4/localize-framework-install-names.rb
deleted file mode 100644
index 65a256d..0000000
--- a/jni/mac/10.4/localize-framework-install-names.rb
+++ /dev/null
@@ -1,84 +0,0 @@
-#!/usr/bin/env ruby
-require 'ostruct';
-
-$CONFIG = OpenStruct.new
-$CONFIG.root = File.dirname(__FILE__)
-$CONFIG.frameworks = "#{$CONFIG.root}/Frameworks"
-
-class Framework
- attr_reader :libs,:id
- def initialize(framework)
- @path = "#{$CONFIG.frameworks}/#{framework}.framework/Versions/Current/#{framework}"
- reload
- puts @libs.inspect
- end
-
- def id=(name)
- system(
- "install_name_tool",
- "-id",
- name,
- @path)
- reload
- end
-
- def get_install_name(lib)
- return @libs[lib]
- end
-
- def set_install_name(lib,val)
- puts "lib=#{lib}/#{@libs[lib]}, val=#{val}"
- system(
- "install_name_tool",
- "-change",
- @libs[lib],
- val,
- @path)
- reload
- end
-
- private
- def reload
- @libs = IO.popen("otool -L '#{@path}'") { |fh|
- fh.readline
- if fh.readline =~ /([^(]*)/
- @id = $1.strip
- else
- raise "Unable to read otool of framework (#{@path})"
- end
- fh.inject({}) { |coll,line|
- if line =~ /(\w+)\.framework/
- name = $1
- if line =~ /([^(]*)/
- coll.update(name => $1.strip)
- else
- raise "Unable to read otool of framework (#{@path})"
- end
- end
- coll
- }
- }.freeze
- end
-end
-
-def create_frameworks
- ["WebKit","WebCore","JavaScriptCore"].map { |name|
- Framework.new(name)
- }
-end
-
-def localize_install_names
- wk_fr, wc_fr, js_fr = create_frameworks
- wk_id, wc_id, js_id = "gwt/WebKit.framework", "gwt/WebCore.framework", "gwt/JavaScriptCore.framework"
-
- js_fr.id = js_id
-
- wc_fr.id = wc_id
- wc_fr.set_install_name "JavaScriptCore", js_id
-
- wk_fr.id = wk_id
- wk_fr.set_install_name "JavaScriptCore", js_id
- wk_fr.set_install_name "WebCore", wc_id
-end
-
-localize_install_names
diff --git a/jni/mac/10.4/org.eclipse.swt/make_macosx.mak b/jni/mac/10.4/org.eclipse.swt/make_macosx.mak
deleted file mode 100644
index 25fdf55..0000000
--- a/jni/mac/10.4/org.eclipse.swt/make_macosx.mak
+++ /dev/null
@@ -1,66 +0,0 @@
-#*******************************************************************************
-# Copyright (c) 2000, 2006 IBM Corporation and others.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Eclipse Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/epl-v10.html
-#
-# Contributors:
-# IBM Corporation - initial API and implementation
-#*******************************************************************************
-
-# Makefile for SWT libraries on Carbon/Mac
-
-include make_common.mak
-
-SWT_PREFIX=swt
-SWTPI_PREFIX=swt-pi
-SWTWEBKIT_PREFIX=swt-webkit
-SWTAGL_PREFIX=swt-agl
-WS_PREFIX=carbon
-SWT_VERSION=$(maj_ver)$(min_ver)
-SWT_LIB=lib$(SWT_PREFIX)-$(WS_PREFIX)-$(SWT_VERSION).jnilib
-SWTPI_LIB=lib$(SWTPI_PREFIX)-$(WS_PREFIX)-$(SWT_VERSION).jnilib
-WEBKIT_LIB=lib$(SWTWEBKIT_PREFIX)-$(WS_PREFIX)-$(SWT_VERSION).jnilib
-AGL_LIB=lib$(SWTAGL_PREFIX)-$(WS_PREFIX)-$(SWT_VERSION).jnilib
-
-# Uncomment for Native Stats tool
-#NATIVE_STATS = -DNATIVE_STATS
-
-#SWT_DEBUG = -g
-ARCHS = -arch i386 -arch ppc
-CFLAGS = -c $(ARCHS) -DSWT_VERSION=$(SWT_VERSION) $(NATIVE_STATS) $(SWT_DEBUG) -DCARBON -I /System/Library/Frameworks/JavaVM.framework/Headers
-LFLAGS = -bundle $(ARCHS) -framework JavaVM -framework Carbon
-WEBKITCFLAGS = -c $(ARCHS) -xobjective-c -I /System/Library/Frameworks/JavaVM.framework/Headers -I /System/Library/Frameworks/Cocoa.framework/Headers -I /System/Library/Frameworks/WebKit.framework/Headers
-WEBKITLFLAGS = $(LFLAGS) -framework WebKit -framework Cocoa -framework WebCore -framework JavaScriptCore -F../Frameworks
-AGLLFLAGS = $(LFLAGS) -framework OpenGL -framework AGL
-SWT_OBJECTS = swt.o callback.o
-SWTPI_OBJECTS = swt.o os.o os_custom.o os_structs.o os_stats.o
-WEBKIT_OBJECTS = webkit.o
-AGL_OBJECTS = agl.o agl_stats.o
-
-all: $(SWT_LIB) $(SWTPI_LIB) $(WEBKIT_LIB) $(AGL_LIB)
-
-.c.o:
- cc $(CFLAGS) $*.c
-
-$(SWT_LIB): $(SWT_OBJECTS)
- cc -o $(SWT_LIB) $(LFLAGS) $(SWT_OBJECTS)
-
-$(SWTPI_LIB): $(SWTPI_OBJECTS)
- cc -o $(SWTPI_LIB) $(LFLAGS) $(SWTPI_OBJECTS)
-
-webkit.o: webkit.c
- cc $(WEBKITCFLAGS) webkit.c
-
-$(WEBKIT_LIB): $(WEBKIT_OBJECTS)
- cc -o $(WEBKIT_LIB) $(WEBKITLFLAGS) $(WEBKIT_OBJECTS)
-
-$(AGL_LIB): $(AGL_OBJECTS)
- cc -o $(AGL_LIB) $(AGLLFLAGS) $(AGL_OBJECTS)
-
-install: all
- cp *.jnilib $(OUTPUT_DIR)
-
-clean:
- rm -f *.jnilib *.o
diff --git a/jni/mac/10.4/prebuilt/libgwt-ll.jnilib b/jni/mac/10.4/prebuilt/libgwt-ll.jnilib
deleted file mode 100755
index 2d036c6..0000000
--- a/jni/mac/10.4/prebuilt/libgwt-ll.jnilib
+++ /dev/null
Binary files differ
diff --git a/jni/mac/10.4/prebuilt/libgwt-webkit.jnilib b/jni/mac/10.4/prebuilt/libgwt-webkit.jnilib
deleted file mode 100755
index 6fe1a8d..0000000
--- a/jni/mac/10.4/prebuilt/libgwt-webkit.jnilib
+++ /dev/null
Binary files differ
diff --git a/jni/mac/10.5/DispWrapper.cpp b/jni/mac/10.5/DispWrapper.cpp
deleted file mode 100644
index cc84c92..0000000
--- a/jni/mac/10.5/DispWrapper.cpp
+++ /dev/null
@@ -1,159 +0,0 @@
-/*
- * Copyright 2007 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-#include "DispWrapper.h"
-#include "FunctionObject.h"
-
-using namespace KJS;
-
-const ClassInfo DispWrapper::info = {"DispWrapper", 0, 0};
-
-JSValue *DispWrapper::getter(ExecState* exec, JSObject* thisObj,
- const Identifier& propertyName, const PropertySlot& slot)
-{
- TRACE("ENTER DispWrapper::getter");
- if (propertyName.ustring() == "toString") {
- return new ToStringFunction();
- }
- if (thisObj->classInfo() == &DispWrapper::info) {
- DispWrapper* dispWrap = static_cast<DispWrapper*>(thisObj);
- jobject dispObj = dispWrap->dispObj;
- jstring jpropName = gEnv->NewString((const jchar*)propertyName.data(),
- propertyName.size());
- if (!jpropName || gEnv->ExceptionCheck()) {
- gEnv->ExceptionClear();
- return jsUndefined();
- }
- jint result = gEnv->CallIntMethod(dispObj, gGetFieldMeth, jpropName);
- if (!result || gEnv->ExceptionCheck()) {
- gEnv->ExceptionClear();
- return jsUndefined();
- }
- TRACE("SUCCESS DispWrapper::getter");
- return (JSValue*)result;
- }
- return jsUndefined();
-}
-
-/*
- * Construct a JavaScript wrapper around a WebKitDispatchAdapter object.
- *
- * dispObj a GlobalRef to the Java object to wrap
- */
-DispWrapper::DispWrapper(jobject dispObj): dispObj(dispObj) { }
-
-/*
- * Free GlobalRef on the underlying WebKitDispatchAdapter object.
- */
-DispWrapper::~DispWrapper() {
- gEnv->DeleteGlobalRef(dispObj);
-}
-
-bool DispWrapper::getOwnPropertySlot(ExecState *exec,
- const Identifier& propertyName, PropertySlot& slot)
-{
- slot.setCustom(this, getter);
- return true;
-}
-
-/*
- * Tells JavaScript that we can store properties into this object.
- * Note that we do not verify the property exists, so we
- *
- * exec JS execution state
- * proeprtyName the property to be updated
- */
-bool DispWrapper::canPut(ExecState *exec, const Identifier &propertyName)
- const
-{
- return true;
-}
-
-/*
- * Store a value into a field on a Java object.
- *
- * exec JS execution state
- * propertyName the name of the field
- * value the JS value to store in the field
- * attr unused attributes of the property
- *
- * Silently catches any Java exceptions in WebKitDispatchAdapter.setField(),
- * including undefined fields, so updates to undefined fields in Java objects
- * will be silently ignored. TODO: is that the desired behavior?
- */
-void DispWrapper::put(ExecState *exec, const Identifier &propertyName,
- JSValue *value, int attr)
-{
- TRACE("ENTER DispWrapper::put");
- jstring jpropName = gEnv->NewString((const jchar*)propertyName.data(),
- propertyName.size());
- if (!jpropName || gEnv->ExceptionCheck()) {
- gEnv->ExceptionClear();
- return;
- }
- gwtGCProtect(value); // Java will take ownership of this value
- gEnv->CallVoidMethod(dispObj, gSetFieldMeth, jpropName, (jint)value);
- if (gEnv->ExceptionCheck()) {
- gEnv->ExceptionClear();
- return;
- }
- TRACE("SUCCESS DispWrapper::put");
-}
-
-/*
- * Prevent JavaScript from deleting fields from a Java object.
- */
-bool DispWrapper::deleteProperty(ExecState *exec,
- const Identifier &propertyName)
-{
- return false;
-}
-
-/*
- * Return a string representation of the Java object.
- * Calls obj.toString() on the Java object.
- *
- * exec JS execution state
- * hint unused
- *
- * Returns undefined if toString() failed, or the string returned (which may
- * be null).
- */
-JSValue *DispWrapper::defaultValue(ExecState *exec, JSType hint) const {
- jstring result = (jstring)gEnv->CallObjectMethod(dispObj, gToStringMeth);
- if (gEnv->ExceptionCheck()) {
- return jsUndefined();
- } else if (!result) {
- return jsNull();
- } else {
- JStringWrap jresult(gEnv, result);
- return jsString(UString((const UChar*)jresult.jstr(), jresult.length()));
- }
-}
-
-/*
- * Tell JavaScript that this object does not implement call functionality.
- */
-bool DispWrapper::implementsCall() const {
- return false;
-}
-
-/*
- * Prevent JavaScript from calling the WebKitDispatchAdapter object
- * as if it were a function.
- */
-JSValue *DispWrapper::callAsFunction(ExecState *, JSObject *, const List &) {
- return jsUndefined();
-}
diff --git a/jni/mac/10.5/DispWrapper.h b/jni/mac/10.5/DispWrapper.h
deleted file mode 100644
index f752659..0000000
--- a/jni/mac/10.5/DispWrapper.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright 2007 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-#ifndef DISP_WRAPPER_H
-#define DISP_WRAPPER_H
-
-#include "gwt-webkit.h"
-#include <kjs/object.h>
-
-/*
- * This class wraps Java WebKitDispatchAdapter objects.
- */
-class DispWrapper : public KJS::JSObject {
-public:
- // dispObj MUST be a global ref
- DispWrapper(jobject dispObj);
- virtual ~DispWrapper();
- jobject getDispObj();
-
-public:
- // implementations of JSObject methods
- const KJS::ClassInfo *classInfo() const { return &info; }
-
- virtual bool getOwnPropertySlot(KJS::ExecState*, const KJS::Identifier&,
- KJS::PropertySlot&);
- virtual bool canPut(KJS::ExecState*, const KJS::Identifier&) const;
- virtual void put(KJS::ExecState*, const KJS::Identifier&, KJS::JSValue*, int);
- virtual bool deleteProperty(KJS::ExecState*, const KJS::Identifier&);
- virtual KJS::JSValue *defaultValue(KJS::ExecState*, KJS::JSType) const;
- virtual bool implementsCall() const;
- virtual KJS::JSValue *callAsFunction(KJS::ExecState*, KJS::JSObject*,
- const KJS::List&);
-
- static const KJS::ClassInfo info;
-
-private:
- static KJS::JSValue* getter(KJS::ExecState*, KJS::JSObject*,
- const KJS::Identifier&, const KJS::PropertySlot&);
-
-private:
- jobject dispObj;
-};
-
-inline jobject DispWrapper::getDispObj() {
- return dispObj;
-}
-
-#endif
diff --git a/jni/mac/10.5/FuncWrapper.cpp b/jni/mac/10.5/FuncWrapper.cpp
deleted file mode 100644
index 207705f..0000000
--- a/jni/mac/10.5/FuncWrapper.cpp
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * Copyright 2007 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-#include "FuncWrapper.h"
-#include <kjs/array_object.h>
-
-using namespace KJS;
-
-/*
- * Constructor for FuncWrapper.
- *
- * name JavaScript name of the function
- * funcObj a GlobalRef of the Java MethodDispatch object (to be freed in
- * the destructor, so the caller no longer has ownership)
- */
-FuncWrapper::FuncWrapper(const UString& name, jobject funcObj)
- : FunctionObject(name), funcObj(funcObj) { }
-
-/*
- * Destructor for FuncWrapper.
- *
- * Frees the GlobalRef for the Java MethodDispatch object.
- */
-FuncWrapper::~FuncWrapper() {
- gEnv->DeleteGlobalRef(funcObj);
-}
-
-/*
- * Call a Java MethodDispatch interface from JavaScript.
- * All JSValue* values passed to Java must be GC-protected, since Java
- * will take ownership of them and eventually unprotect them.
- *
- * execState the KJS execution state to run in
- * thisObj the JavaScript object wrapper for the Java object this method
- * is defined on
- * args the argument list
- *
- * Returns the JSValue returned from the Java method.
- */
-JSValue *FuncWrapper::callAsFunction(ExecState* execState, JSObject* thisObj,
- const List& args)
-{
- TRACE("ENTER FuncWrapper::callAsFunction");
-
- // create the array of JSValue* (passed as integers to Java)
- int argc = args.size();
- jintArray jsargs = gEnv->NewIntArray(argc);
- if (!jsargs || gEnv->ExceptionCheck()) {
- TRACE("FAIL FuncWrapper::callAsFunction: NewIntArray");
- return jsUndefined();
- }
-
- // protect the JSValue* values and store them in the array
- for (int i = 0; i < argc; ++i) {
- JSValue* arg = args[i];
- gwtGCProtect(arg);
- gEnv->SetIntArrayRegion(jsargs, i, 1, reinterpret_cast<jint*>(&arg));
- if (gEnv->ExceptionCheck()) {
- TRACE("FAIL FuncWrapper::callAsFunction: SetIntArrayRegion");
- return jsUndefined();
- }
- }
-
- // protect the "this" object, as Java will eventually unprotect it
- gwtGCProtect(thisObj);
- jint result = gEnv->CallIntMethod(funcObj, gInvokeMeth, execState,
- thisObj, jsargs);
- if (gEnv->ExceptionCheck()) {
- TRACE("FAIL FuncWrapper::callAsFunction: java exception is active");
- return jsUndefined();
- }
-
- if (execState->hadException()) {
- TRACE("FAIL FuncWrapper::callAsFunction: js exception is active");
- return jsUndefined();
- }
-
- TRACE("SUCCESS FuncWrapper::callAsFunction");
- return reinterpret_cast<JSValue*>(result);
-}
diff --git a/jni/mac/10.5/FuncWrapper.h b/jni/mac/10.5/FuncWrapper.h
deleted file mode 100644
index c827814..0000000
--- a/jni/mac/10.5/FuncWrapper.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright 2007 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-#ifndef FUNC_WRAPPER_H
-#define FUNC_WRAPPER_H
-
-#include "FunctionObject.h"
-#include <jni.h>
-
-/*
- * Wraps Java methods (MethodDispatch)
- */
-class FuncWrapper : public FunctionObject {
-public:
- // funcObj MUST be a global ref
- FuncWrapper(const KJS::UString& name, jobject funcObj);
- virtual ~FuncWrapper();
- jobject getFuncObj();
-
-public:
- virtual KJS::JSValue *callAsFunction(KJS::ExecState*, KJS::JSObject*,
- const KJS::List&);
-
-private:
- jobject funcObj;
-};
-
-inline jobject FuncWrapper::getFuncObj() {
- return funcObj;
-}
-
-#endif
diff --git a/jni/mac/10.5/FunctionObject.cpp b/jni/mac/10.5/FunctionObject.cpp
deleted file mode 100644
index 4085925..0000000
--- a/jni/mac/10.5/FunctionObject.cpp
+++ /dev/null
@@ -1,166 +0,0 @@
-/*
- * Copyright 2007 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-#include "FunctionObject.h"
-#include <kjs/array_object.h>
-
-using namespace KJS;
-
-const ClassInfo FunctionObject::info = {"Function", 0, 0};
-
-class CallFunction : public FunctionObject {
-public:
- CallFunction(): FunctionObject("call") {
- }
-
- virtual JSValue *callAsFunction(ExecState *exec, JSObject *thisObj,
- const List &args)
- {
- // Copied from FunctionProtoFunc::callAsFunction()
- JSValue *thisArg = args[0];
- JSObject *func = thisObj;
-
- if (!func->implementsCall()) {
- return throwError(exec, TypeError);
- }
-
- JSObject *callThis;
- if (thisArg->isUndefinedOrNull()) {
- callThis = exec->dynamicGlobalObject();
- } else {
- callThis = thisArg->toObject(exec);
- }
-
- List tail;
- args.getSlice(1, tail);
- return func->call(exec, callThis, tail);
- }
-};
-
-class ApplyFunction : public FunctionObject {
-public:
- ApplyFunction(): FunctionObject("apply") {
- }
-
- virtual JSValue *callAsFunction(ExecState *exec, JSObject *thisObj,
- const List &args)
- {
- // Copied from FunctionProtoFunc::callAsFunction()
- JSObject *func = thisObj;
- if (!func->implementsCall()) {
- return throwError(exec, TypeError);
- }
-
- JSValue *thisArg = args[0];
- JSObject *applyThis;
- if (thisArg->isUndefinedOrNull()) {
- applyThis = exec->dynamicGlobalObject();
- } else {
- applyThis = thisArg->toObject(exec);
- }
-
- JSValue *argArray = args[1];
- List applyArgs;
- if (!argArray->isUndefinedOrNull()) {
- if (!argArray->isObject(&ArrayInstance::info)) {
- return throwError(exec, TypeError);
- }
-
- JSObject *argArrayObj = static_cast<JSObject *>(argArray);
- unsigned int length = argArrayObj->get(exec, exec->propertyNames().length)->toUInt32(exec);
- for (unsigned int i = 0; i < length; ++i) {
- applyArgs.append(argArrayObj->get(exec,i));
- }
- }
- return func->call(exec, applyThis, applyArgs);
- }
-};
-
-
-static UString makeFunctionString(const UString& name) {
- return "\nfunction " + name + "() {\n [native code]\n}\n";
-}
-
-JSValue *FunctionObject::getter(ExecState* exec, JSObject* obj,
- const Identifier& propertyName, const PropertySlot& slot)
-{
- if (propertyName.ustring() == "toString") {
- return new ToStringFunction();
- } else if (propertyName.ustring() == "call") {
- return new CallFunction();
- } else if (propertyName.ustring() == "apply") {
- return new ApplyFunction();
- }
- return jsUndefined();
-}
-
-FunctionObject::FunctionObject(const UString& name): name(name) {
-}
-
-bool FunctionObject::getOwnPropertySlot(ExecState *exec,
- const Identifier& propertyName, PropertySlot& slot)
-{
- if (propertyName.ustring() == "toString") {
- slot.setCustom(this, getter);
- return true;
- }
- if (propertyName.ustring() == "call") {
- slot.setCustom(this, getter);
- return true;
- }
- if (propertyName.ustring() == "apply") {
- slot.setCustom(this, getter);
- return true;
- }
- return false;
-}
-
-bool FunctionObject::canPut(ExecState *exec, const Identifier &propertyName)
- const
-{
- return false;
-}
-
-void FunctionObject::put(ExecState *exec, const Identifier &propertyName,
- JSValue *value, int attr)
-{
-}
-
-bool FunctionObject::deleteProperty(ExecState *exec,
- const Identifier &propertyName)
-{
- return false;
-}
-
-JSValue *FunctionObject::defaultValue(ExecState *exec, JSType hint) const {
- return jsString(makeFunctionString(name));
-}
-
-bool FunctionObject::implementsCall() const {
- return true;
-}
-
-// ToStringFunction
-ToStringFunction::ToStringFunction(): FunctionObject("toString") {
-}
-
-JSValue *ToStringFunction::callAsFunction(ExecState *exec, JSObject *thisObj,
- const List &args)
-{
- if (!thisObj) {
- return throwError(exec, TypeError);
- }
- return jsString(thisObj->toString(exec));
-}
diff --git a/jni/mac/10.5/FunctionObject.h b/jni/mac/10.5/FunctionObject.h
deleted file mode 100644
index 4f8e908..0000000
--- a/jni/mac/10.5/FunctionObject.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright 2007 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-#ifndef FUNCTION_OBJECT_H
-#define FUNCTION_OBJECT_H
-
-#include "gwt-webkit.h"
-#include <kjs/object.h>
-
-class FunctionObject : public KJS::JSObject {
-protected:
- FunctionObject(const KJS::UString& name);
-
-public:
- const KJS::ClassInfo *classInfo() const { return &info; }
-
- // shared implementations of JSObject methods
- virtual bool getOwnPropertySlot(KJS::ExecState*, const KJS::Identifier&,
- KJS::PropertySlot&);
- virtual bool canPut(KJS::ExecState*, const KJS::Identifier&) const;
- virtual void put(KJS::ExecState*, const KJS::Identifier&, KJS::JSValue*, int);
- virtual bool deleteProperty(KJS::ExecState*, const KJS::Identifier&);
- virtual KJS::JSValue *defaultValue(KJS::ExecState*, KJS::JSType) const;
- virtual bool implementsCall() const;
-
- // subclasses must implement
- virtual KJS::JSValue *callAsFunction(KJS::ExecState*, KJS::JSObject*,
- const KJS::List&) = 0;
-
- static const KJS::ClassInfo info;
-
-private:
- static KJS::JSValue* getter(KJS::ExecState*, KJS::JSObject*,
- const KJS::Identifier&, const KJS::PropertySlot&);
-
-private:
- KJS::UString name;
-};
-
-class ToStringFunction : public FunctionObject {
-public:
- ToStringFunction();
- virtual KJS::JSValue *callAsFunction(KJS::ExecState*, KJS::JSObject*,
- const KJS::List&);
-};
-
-#endif
diff --git a/jni/mac/10.5/JStringWrap.h b/jni/mac/10.5/JStringWrap.h
deleted file mode 100644
index e17981f..0000000
--- a/jni/mac/10.5/JStringWrap.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright 2007 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-#ifndef JSTRINGWRAP_H
-#define JSTRINGWRAP_H
-
-#include <jni.h>
-
-/*
- * Wrap a Java String and automatically clean up temporary storage allocated
- * for accessing its contents.
- */
-struct JStringWrap
-{
- JStringWrap(JNIEnv* env, jstring str): env(env), s(str), p(0), jp(0) { }
- ~JStringWrap() {
- if (p) env->ReleaseStringUTFChars(s, p);
- if (jp) env->ReleaseStringChars(s, jp);
- }
- const char* str() { if (!p) p = env->GetStringUTFChars(s, 0); return p; }
- const jchar* jstr() { if (!jp) jp = env->GetStringChars(s, 0); return jp; }
- jsize length() { return env->GetStringLength(s); }
-private:
- JNIEnv* env;
- jstring s;
- const char* p;
- const jchar* jp;
-};
-
-#endif
diff --git a/jni/mac/10.5/Makefile b/jni/mac/10.5/Makefile
deleted file mode 100644
index b25908d..0000000
--- a/jni/mac/10.5/Makefile
+++ /dev/null
@@ -1,147 +0,0 @@
-# Copyright 2007 Google Inc.
-#
-# Licensed under the Apache License, Version 2.0 (the "License"); you may not
-# use this file except in compliance with the License. You may obtain a copy of
-# the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations under
-# the License.
-
-##
-# Try a GWT_TOOLS default if it isn't set
-##
-GWT_TOOLS ?= ../../../../tools
-
-##
-# External WebKit products.
-##
-WEBKIT_REDIST=$(GWT_TOOLS)/redist/webkit/WebKit-525-10.5.tar.gz
-WEBKIT_INCLUDE=$(GWT_TOOLS)/sdk/WebKit-525
-
-##
-# External SWT products.
-##
-SWT_ORIGINAL_SRC = $(GWT_TOOLS)/lib/eclipse/org.eclipse.swt.carbon-macosx-3.2.1.src.zip
-SWT_PATCH_DIR = ./swt-build
-SWT_LIBS=$(SWT_PATCH_DIR)/libswt-webkit-carbon-3235.jnilib \
- $(SWT_PATCH_DIR)/libswt-agl-carbon-3235.jnilib \
- $(SWT_PATCH_DIR)/libswt-carbon-3235.jnilib \
- $(SWT_PATCH_DIR)/libswt-pi-carbon-3235.jnilib
-
-
-##
-# Built products.
-##
-GWT_LL_LIB=libgwt-ll.jnilib
-GWT_WEBKIT_LIB=libgwt-webkit.jnilib
-
-##
-# Tools.
-##
-CC = g++
-TAR = tar
-SHELL = /bin/sh
-FIX_INSTALL_NAME = $(SHELL) ./fix-install-name.sh
-LOCALIZE_FRAMEWORK_INSTALL_NAMES = /usr/bin/env ruby ./localize-framework-install-names.rb
-
-##
-# Compile configuration.
-##
-ARCHS = -arch i386 -arch ppc
-CFLAGS = -Wall -c $(ARCHS) -DCARBON -I/System/Library/Frameworks/JavaVM.framework/Headers -fno-exceptions -fno-rtti
-LFLAGS = -bundle $(ARCHS)
-
-##
-# JavaScriptCore options.
-##
-JSCORE_CFLAGS = $(CFLAGS) -I$(WEBKIT_INCLUDE)/JavaScriptCore
-JSCORE_LFLAGS = $(LFLAGS) -framework JavaScriptCore -F./Frameworks
-JSCORE_INSTALL_NAME = "@loader_path/Frameworks/JavaScriptCore.framework/Versions/A/JavaScriptCore"
-WEBCORE_INSTALL_NAME = "@loader_path/Frameworks/WebCore.framework/Versions/A/WebCore"
-WEBKIT_INSTALL_NAME = "@loader_path/Frameworks/WebKit.framework/Versions/A/WebKit"
-
-##
-# Intermediates
-##
-GWT_LL_OBJECTS = gwt-ll.o gwt-args.o
-GWT_WEBKIT_OBJECTS = gwt-webkit.o DispWrapper.o FuncWrapper.o FunctionObject.o
-
-#-------------------------------------------------------------------------------
-# Rules
-#-------------------------------------------------------------------------------
-
-##
-# Default rule.
-##
-all: $(GWT_LL_LIB) $(GWT_WEBKIT_LIB) $(SWT_LIBS)
-
-staging: all
- cp libgwt-*.jnilib ../../build/staging/gwt-mac-0.0.0/
-
-##
-# Copy WebKit binary frameworks locally.
-##
-Frameworks: $(WEBKIT_REDIST)
- $(TAR) -zxvf $(WEBKIT_REDIST)
- $(LOCALIZE_FRAMEWORK_INSTALL_NAMES)
-
-##
-# Rule for cpp files.
-##
-%.o: %.cpp
- $(CC) -c -o $@ $< $(JSCORE_CFLAGS)
-
-##
-# Rule for gwt-ll objects.
-##
-gwt-ll.o: ../../core/gwt-ll.cpp
- $(CC) -c -o gwt-ll.o $(CFLAGS) ../../core/gwt-ll.cpp
-
-gwt-args.o: gwt-args.cpp
- $(CC) -c -o gwt-args.o $(CFLAGS) gwt-args.cpp
-
-gwt-webkit.o: gwt-webkit.h
-
-##
-# Rule for final lib for gwt-ll.
-##
-$(GWT_LL_LIB): $(GWT_LL_OBJECTS)
- $(CC) -o $(GWT_LL_LIB) $(LFLAGS) $(GWT_LL_OBJECTS)
-
-##
-# Rule for final lib for gwt-webkit.
-##
-$(GWT_WEBKIT_LIB): Frameworks $(GWT_WEBKIT_OBJECTS)
- $(CC) -o $(GWT_WEBKIT_LIB) -framework JavaVM $(JSCORE_LFLAGS) $(GWT_WEBKIT_OBJECTS)
- $(FIX_INSTALL_NAME) JavaScriptCore $(JSCORE_INSTALL_NAME) $(GWT_WEBKIT_LIB)
-
-install: $(GWT_LL_LIB) $(GWT_WEBKIT_LIB)
- cp $(GWT_LL_LIB) $(GWT_WEBKIT_LIB) prebuilt/
-
-##
-# Unpack and patch SWT source.
-##
-$(SWT_PATCH_DIR): $(SWT_ORIGINAL_SRC) ./org.eclipse.swt/webkit.c ./org.eclipse.swt/make_macosx.mak
- unzip $(SWT_ORIGINAL_SRC) -d $(SWT_PATCH_DIR)
- cp ./org.eclipse.swt/webkit.c ./org.eclipse.swt/make_macosx.mak $(SWT_PATCH_DIR)
-
-##
-# Build SWT.
-##
-$(SWT_LIBS):$(SWT_PATCH_DIR) Frameworks
- make -C $(SWT_PATCH_DIR) -f make_macosx.mak
- $(FIX_INSTALL_NAME) WebKit $(WEBKIT_INSTALL_NAME) $(SWT_PATCH_DIR)/libswt-webkit-carbon-3235.jnilib
- $(FIX_INSTALL_NAME) WebCore $(WEBCORE_INSTALL_NAME) $(SWT_PATCH_DIR)/libswt-webkit-carbon-3235.jnilib
- $(FIX_INSTALL_NAME) JavaScriptCore $(JSCORE_INSTALL_NAME) $(SWT_PATCH_DIR)/libswt-webkit-carbon-3235.jnilib
-
-##
-# Clean rule.
-##
-clean:
- @-rm -f $(GWT_LL_LIB) $(GWT_WEBKIT_LIB) *.o
- @-rm -rf ./Frameworks $(SWT_PATCH_DIR)
diff --git a/jni/mac/10.5/build.xml b/jni/mac/10.5/build.xml
deleted file mode 100755
index 2bb1631..0000000
--- a/jni/mac/10.5/build.xml
+++ /dev/null
@@ -1,18 +0,0 @@
-<project name="jni-mac" default="build" basedir=".">
- <property name="gwt.root" location="../.." />
- <property name="project.tail" value="jni/mac" />
- <import file="${gwt.root}/common.ant.xml" />
-
- <target name="build" description="Builds a JNI lib">
- <mkdir dir="${project.jni}" />
- <!-- TODO: Actually build this from source! -->
- <copy todir="${project.jni}">
- <fileset dir="prebuilt" />
- </copy>
- </target>
-
- <target name="clean" description="Cleans this project's intermediate and output files">
- <delete dir="${project.build}" failonerror="false" />
- <delete dir="${project.jni}" failonerror="false" />
- </target>
-</project>
diff --git a/jni/mac/10.5/fix-install-name.sh b/jni/mac/10.5/fix-install-name.sh
deleted file mode 100644
index 9ccfaaf..0000000
--- a/jni/mac/10.5/fix-install-name.sh
+++ /dev/null
@@ -1,37 +0,0 @@
-#!/bin/sh
-# Copyright 2006 Google Inc.
-#
-# Licensed under the Apache License, Version 2.0 (the "License"); you may not
-# use this file except in compliance with the License. You may obtain a copy of
-# the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations under
-# the License.
-
-
-if [ $# -ne 3 ]; then
- echo 1>&2 "usage: fix-install-path framework_name new_install_path jnilib"
- exit 1
-fi
-
-FRAMEWORK="./Frameworks/${1}.framework/Versions/A/${1}"
-INSTALL_NAME=$2
-JNILIB=$3
-
-if [ ! -f ${JNILIB} ]; then
- echo 1>&2 "Unable to locate: ${JNILIB}"
- exit 1
-fi
-
-if [ ! -f ${FRAMEWORK} ]; then
- echo 1>&2 "Unable to locate: ${FRAMEWORK}"
- exit 1
-fi
-
-CURRENT_NAME=`otool -D ${FRAMEWORK} | tail -n 1`
-install_name_tool -change "${CURRENT_NAME}" "${INSTALL_NAME}" ${JNILIB}
diff --git a/jni/mac/10.5/gwt-args.cpp b/jni/mac/10.5/gwt-args.cpp
deleted file mode 100644
index 12b6eee..0000000
--- a/jni/mac/10.5/gwt-args.cpp
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright 2007 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-#include "gwt-ll.h"
-#include "JStringWrap.h"
-
-// http://unixjunkie.blogspot.com/2006/07/access-argc-and-argv-from-anywhere.html
-extern "C" int *_NSGetArgc(void);
-extern "C" char ***_NSGetArgv(void);
-
-/*
- * Class: com_google_gwt_dev_shell_mac_LowLevelSaf
- * Method: _getArgc
- * Signature: ()I
- */
-JNIEXPORT jint JNICALL Java_com_google_gwt_dev_shell_mac_LowLevelSaf__1getArgc
- (JNIEnv* env , jclass) {
- return *_NSGetArgc();
-}
-
-/*
- * Class: com_google_gwt_dev_shell_mac_LowLevelSaf
- * Method: _getArgv
- * Signature: ()Ljava/lang/String;
- */
-JNIEXPORT jstring JNICALL
-Java_com_google_gwt_dev_shell_mac_LowLevelSaf__1getArgv
- (JNIEnv* env, jclass, jint i)
-{
- int argc = *_NSGetArgc();
- if (i < 0 || i >= argc) {
- return 0;
- }
- char **argv = *_NSGetArgv();
- return env->NewStringUTF(argv[i]);
-}
diff --git a/jni/mac/10.5/gwt-ll.h b/jni/mac/10.5/gwt-ll.h
deleted file mode 100644
index a1e2212..0000000
--- a/jni/mac/10.5/gwt-ll.h
+++ /dev/null
@@ -1,237 +0,0 @@
-/* DO NOT EDIT THIS FILE - it is machine generated */
-#include <jni.h>
-/* Header for class com_google_gwt_dev_shell_mac_LowLevelSaf */
-
-#ifndef _Included_com_google_gwt_dev_shell_mac_LowLevelSaf
-#define _Included_com_google_gwt_dev_shell_mac_LowLevelSaf
-#ifdef __cplusplus
-extern "C" {
-#endif
-/*
- * Class: com_google_gwt_dev_shell_mac_LowLevelSaf
- * Method: isNull
- * Signature: (I)Z
- */
-JNIEXPORT jboolean JNICALL Java_com_google_gwt_dev_shell_mac_LowLevelSaf_isNull
- (JNIEnv *, jclass, jint);
-
-/*
- * Class: com_google_gwt_dev_shell_mac_LowLevelSaf
- * Method: isUndefined
- * Signature: (I)Z
- */
-JNIEXPORT jboolean JNICALL Java_com_google_gwt_dev_shell_mac_LowLevelSaf_isUndefined
- (JNIEnv *, jclass, jint);
-
-/*
- * Class: com_google_gwt_dev_shell_mac_LowLevelSaf
- * Method: jsNull
- * Signature: ()I
- */
-JNIEXPORT jint JNICALL Java_com_google_gwt_dev_shell_mac_LowLevelSaf_jsNull
- (JNIEnv *, jclass);
-
-/*
- * Class: com_google_gwt_dev_shell_mac_LowLevelSaf
- * Method: jsUndefined
- * Signature: ()I
- */
-JNIEXPORT jint JNICALL Java_com_google_gwt_dev_shell_mac_LowLevelSaf_jsUndefined
- (JNIEnv *, jclass);
-
-/*
- * Class: com_google_gwt_dev_shell_mac_LowLevelSaf
- * Method: _coerceToBoolean
- * Signature: (II[Z)Z
- */
-JNIEXPORT jboolean JNICALL Java_com_google_gwt_dev_shell_mac_LowLevelSaf__1coerceToBoolean
- (JNIEnv *, jclass, jint, jint, jbooleanArray);
-
-/*
- * Class: com_google_gwt_dev_shell_mac_LowLevelSaf
- * Method: _coerceToDouble
- * Signature: (II[D)Z
- */
-JNIEXPORT jboolean JNICALL Java_com_google_gwt_dev_shell_mac_LowLevelSaf__1coerceToDouble
- (JNIEnv *, jclass, jint, jint, jdoubleArray);
-
-/*
- * Class: com_google_gwt_dev_shell_mac_LowLevelSaf
- * Method: _coerceToString
- * Signature: (II[Ljava/lang/String;)Z
- */
-JNIEXPORT jboolean JNICALL Java_com_google_gwt_dev_shell_mac_LowLevelSaf__1coerceToString
- (JNIEnv *, jclass, jint, jint, jobjectArray);
-
-/*
- * Class: com_google_gwt_dev_shell_mac_LowLevelSaf
- * Method: _convertBoolean
- * Signature: (Z[I)Z
- */
-JNIEXPORT jboolean JNICALL Java_com_google_gwt_dev_shell_mac_LowLevelSaf__1convertBoolean
- (JNIEnv *, jclass, jboolean, jintArray);
-
-/*
- * Class: com_google_gwt_dev_shell_mac_LowLevelSaf
- * Method: _convertDouble
- * Signature: (D[I)Z
- */
-JNIEXPORT jboolean JNICALL Java_com_google_gwt_dev_shell_mac_LowLevelSaf__1convertDouble
- (JNIEnv *, jclass, jdouble, jintArray);
-
-/*
- * Class: com_google_gwt_dev_shell_mac_LowLevelSaf
- * Method: _convertString
- * Signature: (Ljava/lang/String;[I)Z
- */
-JNIEXPORT jboolean JNICALL Java_com_google_gwt_dev_shell_mac_LowLevelSaf__1convertString
- (JNIEnv *, jclass, jstring, jintArray);
-
-/*
- * Class: com_google_gwt_dev_shell_mac_LowLevelSaf
- * Method: _executeScript
- * Signature: (ILjava/lang/String;)Z
- */
-JNIEXPORT jboolean JNICALL Java_com_google_gwt_dev_shell_mac_LowLevelSaf__1executeScript
- (JNIEnv *, jclass, jint, jstring);
-
-/*
- * Class: com_google_gwt_dev_shell_mac_LowLevelSaf
- * Method: _executeScriptWithInfo
- * Signature: (ILjava/lang/String;Ljava/lang/String;I)Z
- */
-JNIEXPORT jboolean JNICALL Java_com_google_gwt_dev_shell_mac_LowLevelSaf__1executeScriptWithInfo
- (JNIEnv *, jclass, jint, jstring, jstring, jint);
-
-/*
- * Class: com_google_gwt_dev_shell_mac_LowLevelSaf
- * Method: _gcLock
- * Signature: (I)V
- */
-JNIEXPORT void JNICALL Java_com_google_gwt_dev_shell_mac_LowLevelSaf__1gcLock
- (JNIEnv *, jclass, jint);
-
-/*
- * Class: com_google_gwt_dev_shell_mac_LowLevelSaf
- * Method: _gcUnlock
- * Signature: (ILjava/lang/String;)V
- */
-JNIEXPORT void JNICALL Java_com_google_gwt_dev_shell_mac_LowLevelSaf__1gcUnlock
- (JNIEnv *, jclass, jint, jstring);
-
-/*
- * Class: com_google_gwt_dev_shell_mac_LowLevelSaf
- * Method: _getArgc
- * Signature: ()I
- */
-JNIEXPORT jint JNICALL Java_com_google_gwt_dev_shell_mac_LowLevelSaf__1getArgc
- (JNIEnv *, jclass);
-
-/*
- * Class: com_google_gwt_dev_shell_mac_LowLevelSaf
- * Method: _getArgv
- * Signature: ()Ljava/lang/String;
- */
-JNIEXPORT jstring JNICALL Java_com_google_gwt_dev_shell_mac_LowLevelSaf__1getArgv
- (JNIEnv *, jclass, jint);
-
-/*
- * Class: com_google_gwt_dev_shell_mac_LowLevelSaf
- * Method: _getGlobalExecState
- * Signature: (I[I)Z
- */
-JNIEXPORT jboolean JNICALL Java_com_google_gwt_dev_shell_mac_LowLevelSaf__1getGlobalExecState
- (JNIEnv *, jclass, jint, jintArray);
-
-/*
- * Class: com_google_gwt_dev_shell_mac_LowLevelSaf
- * Method: _initNative
- * Signature: (Ljava/lang/Class;Ljava/lang/Class;)Z
- */
-JNIEXPORT jboolean JNICALL Java_com_google_gwt_dev_shell_mac_LowLevelSaf__1initNative
- (JNIEnv *, jclass, jclass, jclass);
-
-/*
- * Class: com_google_gwt_dev_shell_mac_LowLevelSaf
- * Method: _invoke
- * Signature: (IILjava/lang/String;II[I[I)Z
- */
-JNIEXPORT jboolean JNICALL Java_com_google_gwt_dev_shell_mac_LowLevelSaf__1invoke
- (JNIEnv *, jclass, jint, jint, jstring, jint, jint, jintArray, jintArray);
-
-/*
- * Class: com_google_gwt_dev_shell_mac_LowLevelSaf
- * Method: _isObject
- * Signature: (I)Z
- */
-JNIEXPORT jboolean JNICALL Java_com_google_gwt_dev_shell_mac_LowLevelSaf__1isObject
- (JNIEnv *, jclass, jint);
-
-/*
- * Class: com_google_gwt_dev_shell_mac_LowLevelSaf
- * Method: _isString
- * Signature: (I)Z
- */
-JNIEXPORT jboolean JNICALL Java_com_google_gwt_dev_shell_mac_LowLevelSaf__1isString
- (JNIEnv *, jclass, jint);
-
-/*
- * Class: com_google_gwt_dev_shell_mac_LowLevelSaf
- * Method: _isWrappedDispatch
- * Signature: (I[Z)Z
- */
-JNIEXPORT jboolean JNICALL Java_com_google_gwt_dev_shell_mac_LowLevelSaf__1isWrappedDispatch
- (JNIEnv *, jclass, jint, jbooleanArray);
-
-/*
- * Class: com_google_gwt_dev_shell_mac_LowLevelSaf
- * Method: _jsLock
- * Signature: ()V
- */
-JNIEXPORT void JNICALL Java_com_google_gwt_dev_shell_mac_LowLevelSaf__1jsLock
- (JNIEnv *, jclass);
-
-/*
- * Class: com_google_gwt_dev_shell_mac_LowLevelSaf
- * Method: _jsUnlock
- * Signature: ()V
- */
-JNIEXPORT void JNICALL Java_com_google_gwt_dev_shell_mac_LowLevelSaf__1jsUnlock
- (JNIEnv *, jclass);
-
-/*
- * Class: com_google_gwt_dev_shell_mac_LowLevelSaf
- * Method: _raiseJavaScriptException
- * Signature: (II)Z
- */
-JNIEXPORT jboolean JNICALL Java_com_google_gwt_dev_shell_mac_LowLevelSaf__1raiseJavaScriptException
- (JNIEnv *, jclass, jint, jint);
-
-/*
- * Class: com_google_gwt_dev_shell_mac_LowLevelSaf
- * Method: _unwrapDispatch
- * Signature: (I[Lcom/google/gwt/dev/shell/mac/LowLevelSaf/DispatchObject;)Z
- */
-JNIEXPORT jboolean JNICALL Java_com_google_gwt_dev_shell_mac_LowLevelSaf__1unwrapDispatch
- (JNIEnv *, jclass, jint, jobjectArray);
-
-/*
- * Class: com_google_gwt_dev_shell_mac_LowLevelSaf
- * Method: _wrapDispatch
- * Signature: (Lcom/google/gwt/dev/shell/mac/LowLevelSaf/DispatchObject;[I)Z
- */
-JNIEXPORT jboolean JNICALL Java_com_google_gwt_dev_shell_mac_LowLevelSaf__1wrapDispatch
- (JNIEnv *, jclass, jobject, jintArray);
-
-/*
- * Class: com_google_gwt_dev_shell_mac_LowLevelSaf
- * Method: _wrapFunction
- * Signature: (Ljava/lang/String;Lcom/google/gwt/dev/shell/mac/LowLevelSaf/DispatchMethod;[I)Z
- */
-JNIEXPORT jboolean JNICALL Java_com_google_gwt_dev_shell_mac_LowLevelSaf__1wrapFunction
- (JNIEnv *, jclass, jstring, jobject, jintArray);
-
-#ifdef __cplusplus
-}
-#endif
-#endif
diff --git a/jni/mac/10.5/gwt-webkit.cpp b/jni/mac/10.5/gwt-webkit.cpp
deleted file mode 100644
index cf2ac36..0000000
--- a/jni/mac/10.5/gwt-webkit.cpp
+++ /dev/null
@@ -1,895 +0,0 @@
-/*
- * Copyright 2007 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-#include "gwt-ll.h"
-#include "DispWrapper.h"
-#include "FuncWrapper.h"
-
-JNIEnv* gEnv;
-jclass gClass;
-jclass gDispObjCls;
-jclass gDispMethCls;
-jmethodID gGetFieldMeth;
-jmethodID gSetFieldMeth;
-jmethodID gInvokeMeth;
-jmethodID gToStringMeth;
-
-using namespace KJS;
-
-/*
- * Print a JSValue in human-readable form.
- *
- * val JSValue* to print
- * prefix a string to print before the value
- */
-void PrintJSValue(JSValue* val, char* prefix) {
- static const char* typeStrings[]={
- "unspecified",
- "number",
- "boolean",
- "undefined",
- "null",
- "string",
- "object",
- "getter/setter",
- };
- char buf[256];
- snprintf(buf, sizeof(buf), "%s{%08x}:", prefix, unsigned(val));
- TRACE(buf);
- JSType type = val->type();
- const char* typeString=typeStrings[type];
- char* p = buf;
- p += snprintf(p, sizeof(buf)-(p-buf), " %s: ", typeString);
- //p += snprintf(p, sizeof(buf)-(p-buf), "%s{%08x} %s: ", prefix,
- // unsigned(val), typeString);
- if (val->isNumber()) {
- p += snprintf(p, sizeof(buf)-(p-buf), "%lf", val->getNumber());
- } else if(val->isString()) {
- CString str(val->getString().UTF8String());
- p += snprintf(p, sizeof(buf)-(p-buf), "%.*s", (int)str.size(),
- str.c_str());
- } else if(val->isObject()) {
- const JSObject* obj = val->getObject();
- const ClassInfo* cinfo = obj->classInfo();
- const char* cname = cinfo ? cinfo->className : "js object";
- p += snprintf(p, sizeof(buf)-(p-buf), "%s @ %08x", cname, unsigned(obj));
- } else if(val->isBoolean()) {
- p += snprintf(p, sizeof(buf)-(p-buf), "%s", val->getBoolean() ? "true" : "false");
- }
- TRACE(buf);
-}
-
-/*
- * Called for each gcProtect, only if TRACING is enabled.
- *
- * val JSValue* to be protected
- */
-void gcProtectHook(JSValue* val) {
- PrintJSValue(val, "gcProtect: val=");
-}
-
-/*
- * Called for each gcUnprotect, only if TRACING is enabled.
- *
- * val JSValue* to be protected
- * trace string containing trace information for the creation site, or null
- * if not available
- */
-void gcUnprotectHook(JSValue* val, const char* trace) {
- if (trace) {
- TRACE("gcUnprotect - value created at:");
- TRACE(trace);
- }
- PrintJSValue(val, "gcUnprotect: val=");
-}
-
-/*
- * Class: com_google_gwt_dev_shell_mac_LowLevelSaf
- * Method: isNull
- * Signature: (I)Z
- */
-JNIEXPORT jboolean JNICALL Java_com_google_gwt_dev_shell_mac_LowLevelSaf_isNull
- (JNIEnv *env, jclass, jint jsval)
-{
- TRACE("ENTER LowLevelSaf__isNull");
-
- JSValue* val = (JSValue*)jsval;
- if (!val) {
- return JNI_FALSE;
- }
-
- TRACE("SUCCESS LowLevelSaf__isNull");
- return val->isNull();
-}
-
-/*
- * Class: com_google_gwt_dev_shell_mac_LowLevelSaf
- * Method: isUndefined
- * Signature: (I)Z
- */
-extern "C" JNIEXPORT jboolean JNICALL
-Java_com_google_gwt_dev_shell_mac_LowLevelSaf_isUndefined
- (JNIEnv *env, jclass, jint jsval)
-{
- TRACE("ENTER LowLevelSaf__isUndefined");
- JSValue* val = (JSValue*)jsval;
- if (!val) {
- return JNI_FALSE;
- }
-
- TRACE("SUCCESS LowLevelSaf__isUndefined");
- return val->isUndefined();
-}
-
-/*
- * Class: com_google_gwt_dev_shell_mac_LowLevelSaf
- * Method: jsNull
- * Signature: ()I
- */
-extern "C" JNIEXPORT jint JNICALL
-Java_com_google_gwt_dev_shell_mac_LowLevelSaf_jsNull
- (JNIEnv *, jclass)
-{
- return reinterpret_cast<jint>(jsNull());
-}
-
-/*
- * Class: com_google_gwt_dev_shell_mac_LowLevelSaf
- * Method: getTypeString
- * Signature: (I)Ljava/lang/String;
- */
-extern "C" JNIEXPORT jstring JNICALL
-Java_com_google_gwt_dev_shell_mac_LowLevelSaf_getTypeString
- (JNIEnv *env, jclass, jint jsval)
-{
- static const char* typeStrings[]={
- "unspecified",
- "number",
- "boolean",
- "undefined",
- "null",
- "string",
- "object",
- "getter/setter",
- };
- JSValue* val = (JSValue*)jsval;
- if (!val) {
- return 0;
- }
- JSType type = val->type();
- const char* typeString=typeStrings[type];
- if (type == ObjectType) {
- if (val->isObject(&DispWrapper::info)) {
- typeString = "Java object";
- } else {
- typeString = "JS object";
- }
- }
- return env->NewStringUTF(typeString);
-}
-
-/*
- * Class: com_google_gwt_dev_shell_mac_LowLevelSaf
- * Method: jsUndefined
- * Signature: ()I
- */
-JNIEXPORT jint JNICALL Java_com_google_gwt_dev_shell_mac_LowLevelSaf_jsUndefined
- (JNIEnv *env, jclass)
-{
- return reinterpret_cast<jint>(jsUndefined());
-}
-
-/*
- * Class: com_google_gwt_dev_shell_mac_LowLevelSaf
- * Method: _coerceToBoolean
- * Signature: (II[Z)Z
- */
-JNIEXPORT jboolean JNICALL
-Java_com_google_gwt_dev_shell_mac_LowLevelSaf__1coerceToBoolean
- (JNIEnv * env, jclass, jint execState, jint jsval, jbooleanArray rval)
-{
- TRACE("ENTER LowLevelSaf__1coerceToBoolean");
-
- if (!execState || !jsval) {
- return JNI_FALSE;
- }
-
- jboolean result = ((JSValue*)jsval)->toBoolean((ExecState*)execState);
- env->SetBooleanArrayRegion(rval, 0, 1, &result);
- if (env->ExceptionCheck()) {
- return JNI_FALSE;
- }
-
- TRACE("SUCCESS LowLevelSaf__1coerceToBoolean");
- return JNI_TRUE;
-}
-
-/*
- * Class: com_google_gwt_dev_shell_mac_LowLevelSaf
- * Method: _coerceToDouble
- * Signature: (II[D)Z
- */
-JNIEXPORT jboolean JNICALL
-Java_com_google_gwt_dev_shell_mac_LowLevelSaf__1coerceToDouble
- (JNIEnv *env, jclass, jint execState, jint jsval, jdoubleArray rval)
-{
- TRACE("ENTER LowLevelSaf__1coerceToDouble");
-
- if (!execState || !jsval) {
- return JNI_FALSE;
- }
-
- jdouble result = ((JSValue*)jsval)->toNumber((ExecState*)execState);
- env->SetDoubleArrayRegion(rval, 0, 1, &result);
- if (env->ExceptionCheck()) {
- return JNI_FALSE;
- }
-
- TRACE("SUCCESS LowLevelSaf__1coerceToDouble");
- return JNI_TRUE;
-}
-
-/*
- * Class: com_google_gwt_dev_shell_mac_LowLevelSaf
- * Method: _coerceToString
- * Signature: (II[Ljava/lang/String;)Z
- */
-JNIEXPORT jboolean JNICALL
-Java_com_google_gwt_dev_shell_mac_LowLevelSaf__1coerceToString
- (JNIEnv *env, jclass, jint execState, jint jsval, jobjectArray rval)
-{
- TRACE("ENTER LowLevelSaf__1coerceToString");
-
- JSValue *val = (JSValue*)jsval;
- if (!execState || !val) {
- return JNI_FALSE;
- }
-
- /*
- * Convert all objects to their string representation, EXCEPT
- * null and undefined which will be returned as a true NULL.
- */
- jstring result = NULL;
- if (!val->isNull() && !val->isUndefined()) {
- UString str = val->toString((ExecState*)execState);
- result = env->NewString((const jchar*)str.data(), str.size());
- if (env->ExceptionCheck())
- return JNI_FALSE;
- }
-
- env->SetObjectArrayElement(rval,0,result);
- if (env->ExceptionCheck()) {
- return JNI_FALSE;
- }
-
- TRACE("SUCCESS LowLevelSaf__1coerceToString");
- return JNI_TRUE;
-}
-
-/*
- * Class: com_google_gwt_dev_shell_mac_LowLevelSaf
- * Method: _convertBoolean
- * Signature: (IZ[I)Z
- */
-JNIEXPORT jboolean JNICALL
-Java_com_google_gwt_dev_shell_mac_LowLevelSaf__1convertBoolean
- (JNIEnv *env, jclass, jboolean jval, jintArray rval)
-{
- TRACE("ENTER LowLevelSaf__1convertBoolean");
-#ifdef ENABLE_TRACING
- char buf[256];
- snprintf(buf, sizeof(buf), " val=%s", jval ? "true" : "false");
- TRACE(buf);
-#endif
-
- JSValue *jsval = (jval == JNI_FALSE) ? jsBoolean(false) : jsBoolean(true);
-
- /*
- * Since we know this is a boolean primitive, the protect is a no-op, but
- * it is useful to have it for the trace log.
- */
- gwtGCProtect(jsval);
-
- if (!jsval) {
- return JNI_FALSE;
- }
-
- env->SetIntArrayRegion(rval,0,1,(const jint*)&jsval);
- if (env->ExceptionCheck()) {
- return JNI_FALSE;
- }
-
- TRACE("SUCCESS LowLevelSaf__1convertBoolean");
- return JNI_TRUE;
-}
-
-/*
- * Class: com_google_gwt_dev_shell_mac_LowLevelSaf
- * Method: _convertDouble
- * Signature: (ID[I)Z
- */
-JNIEXPORT jboolean JNICALL Java_com_google_gwt_dev_shell_mac_LowLevelSaf__1convertDouble
- (JNIEnv *env, jclass, jdouble jval, jintArray rval)
-{
- TRACE("ENTER LowLevelSaf__1convertDouble");
-#ifdef ENABLE_TRACING
- char buf[256];
- snprintf(buf, sizeof(buf), " val=%lf", jval);
- TRACE(buf);
-#endif
-
- JSValue *jsval = jsNumber(jval);
- gwtGCProtect(jsval);
- if (!jsval) {
- return JNI_FALSE;
- }
-
- env->SetIntArrayRegion(rval,0,1,(const jint*)&jsval);
- if (env->ExceptionCheck()) {
- return JNI_FALSE;
- }
-
- TRACE("SUCCESS LowLevelSaf__1convertDouble");
- return JNI_TRUE;
-}
-
-/*
- * Class: com_google_gwt_dev_shell_mac_LowLevelSaf
- * Method: _convertString
- * Signature: (ILjava/lang/String;[I)Z
- */
-JNIEXPORT jboolean JNICALL Java_com_google_gwt_dev_shell_mac_LowLevelSaf__1convertString
- (JNIEnv *env, jclass, jstring jval, jintArray rval)
-{
- TRACE("ENTER LowLevelSaf__1convertString");
-
- JStringWrap jstr(env, jval);
- if (!jstr.jstr()) {
- return JNI_FALSE;
- }
-#ifdef ENABLE_TRACING
- char buf[256];
- snprintf(buf, sizeof(buf), " val=%s", jstr.str());
- TRACE(buf);
-#endif
-
- JSValue *jsval = jsString(UString((const UChar*)jstr.jstr(), jstr.length()));
-
- gwtGCProtect(jsval);
- if (!jsval) {
- return JNI_FALSE;
- }
-
- env->SetIntArrayRegion(rval,0,1,(const jint*)&jsval);
- if (env->ExceptionCheck()) {
- return JNI_FALSE;
- }
-
- TRACE("SUCCESS LowLevelSaf__1convertString");
- return JNI_TRUE;
-}
-
-/*
- * Class: com_google_gwt_dev_shell_mac_LowLevelSaf
- * Method: _executeScript
- * Signature: (ILjava/lang/String;)Z
- */
-JNIEXPORT jboolean JNICALL Java_com_google_gwt_dev_shell_mac_LowLevelSaf__1executeScript
- (JNIEnv* env, jclass, jint execState, jstring code)
-{
- TRACE("ENTER LowLevelSaf__1executeScript");
- if (!execState || !code) {
- return JNI_FALSE;
- }
-
- JStringWrap jcode(env, code);
- if (!jcode.jstr()) {
- return JNI_FALSE;
- }
-
-#ifdef ENABLE_TRACING
- char buf[1024];
- snprintf(buf, sizeof(buf), " code=%s", jcode.str());
- TRACE(buf);
-#endif
-
- Completion comp = Interpreter::evaluate((ExecState*) execState,
- NULL, 0, (const UChar*)jcode.jstr(),
- jcode.length());
- switch (comp.complType()) {
- case Normal:
- case ReturnValue:
- TRACE("SUCCESS LowLevelSaf__1executeScript");
- return JNI_TRUE;
- default:
- return JNI_FALSE;
- }
-}
-
-/*
- * Class: com_google_gwt_dev_shell_mac_LowLevelSaf
- * Method: _executeScriptWithInfo
- * Signature: (ILjava/lang/String;Ljava/lang/String;I)Z
- */
-JNIEXPORT jboolean JNICALL
-Java_com_google_gwt_dev_shell_mac_LowLevelSaf__1executeScriptWithInfo
- (JNIEnv* env, jclass, jint execState, jstring code, jstring file, jint line)
-{
- TRACE("ENTER LowLevelSaf__1executeScriptWithInfo");
- if (!execState || !code || !file) {
- return JNI_FALSE;
- }
-
- JStringWrap jcode(env, code);
- if (!jcode.jstr()) {
- return JNI_FALSE;
- }
-
- JStringWrap jfile(env, file);
- if (!jcode.jstr()) {
- return JNI_FALSE;
- }
-
-#ifdef ENABLE_TRACING
- char buf[1024];
- snprintf(buf, sizeof(buf), " code=%s, file=%s, line=%d", jcode.str(),
- jfile.str(), static_cast<int>(line));
- TRACE(buf);
-#endif
-
- UString uStrFile = UString((const UChar*) jfile.jstr(), jfile.length());
- Completion comp = Interpreter::evaluate((ExecState*) execState,
- uStrFile, (int)line, (const UChar*) jcode.jstr(),
- jcode.length());
- switch (comp.complType()) {
- case Normal:
- case ReturnValue:
- TRACE("SUCCESS LowLevelSaf__1executeScript");
- return JNI_TRUE;
- default:
- return JNI_FALSE;
- }
-
-}
-
-/*
- * Class: com_google_gwt_dev_shell_mac_LowLevelSaf
- * Method: _gcLock
- * Signature: (I)V
- */
-JNIEXPORT void JNICALL Java_com_google_gwt_dev_shell_mac_LowLevelSaf__1gcLock
- (JNIEnv *, jclass, jint jsval)
-{
- gwtGCProtect(reinterpret_cast<JSValue*>(jsval));
-}
-
-/*
- * Class: com_google_gwt_dev_shell_mac_LowLevelSaf
- * Method: _gcUnlock
- * Signature: (ILjava/lang/String;)V
- */
-JNIEXPORT void JNICALL Java_com_google_gwt_dev_shell_mac_LowLevelSaf__1gcUnlock
- (JNIEnv* jniEnv, jclass, jint jsval, jstring creationDesc)
-{
- JStringWrap creationStr(jniEnv, creationDesc);
- gwtGCUnprotect(reinterpret_cast<JSValue*>(jsval),
- creationDesc ? creationStr.str() : 0);
-}
-
-/*
- * Class: com_google_gwt_dev_shell_mac_LowLevelSaf
- * Method: _getGlobalExecState
- * Signature: (I[I)Z
- */
-JNIEXPORT jboolean JNICALL
-Java_com_google_gwt_dev_shell_mac_LowLevelSaf__1getGlobalExecState
- (JNIEnv *env, jclass, jint scriptObject, jintArray rval)
-{
- TRACE("ENTER LowLevelSaf__1getGlobalExecState");
-
- if (!scriptObject || !((JSValue*)scriptObject)->isObject()) {
- return JNI_FALSE;
- }
-
- JSGlobalObject *globalObject = reinterpret_cast<JSGlobalObject*>(scriptObject);
- ExecState* execState = globalObject->globalExec();
- env->SetIntArrayRegion(rval, 0, 1, (jint*)&execState);
- if (env->ExceptionCheck()) {
- return JNI_FALSE;
- }
- TRACE("SUCCESS LowLevelSaf__1getGlobalExecState");
- return JNI_TRUE;
-}
-
-/*
- * Class: com_google_gwt_dev_shell_mac_LowLevelSaf
- * Method: _initNative
- * Signature: (Ljava/lang/Class;Ljava/lang/Class;)Z
- */
-JNIEXPORT jboolean JNICALL
-Java_com_google_gwt_dev_shell_mac_LowLevelSaf__1initNative
- (JNIEnv* env, jclass llClass, jclass dispObjCls, jclass dispMethCls)
-{
- Interpreter::setShouldPrintExceptions(true);
- gEnv = env;
- gClass = static_cast<jclass>(env->NewGlobalRef(llClass));
- gDispObjCls = static_cast<jclass>(env->NewGlobalRef(dispObjCls));
- gDispMethCls = static_cast<jclass>(env->NewGlobalRef(dispMethCls));
- if (!gClass || !gDispObjCls || !gDispMethCls || env->ExceptionCheck()) {
- return false;
- }
-
- gGetFieldMeth
- = env->GetMethodID(gDispObjCls, "getField", "(Ljava/lang/String;)I");
- gSetFieldMeth
- = env->GetMethodID(gDispObjCls, "setField", "(Ljava/lang/String;I)V");
- gInvokeMeth = env->GetMethodID(gDispMethCls, "invoke", "(II[I)I");
- gToStringMeth
- = env->GetMethodID(gDispObjCls, "toString", "()Ljava/lang/String;");
- if (!gGetFieldMeth || !gSetFieldMeth || !gInvokeMeth || !gToStringMeth
- || env->ExceptionCheck())
- {
- return false;
- }
-
-#ifdef FILETRACE
- gout = fopen("/tmp/gwt-ll.log", "w");
- filetrace("LOG STARTED");
-#endif // FILETRACE
-
-#ifdef JAVATRACE
- gTraceMethod = env->GetStaticMethodID(gClass, "trace", "(Ljava/lang/String;)V");
- if (!gTraceMethod || env->ExceptionCheck()) {
- return false;
- }
-#endif // JAVATRACE
-
- return true;
-}
-
-/*
- * Class: com_google_gwt_dev_shell_mac_LowLevelSaf
- * Method: _invoke
- * Signature: (IILjava/lang/String;II[I[I)Z
- */
-JNIEXPORT jboolean JNICALL
-Java_com_google_gwt_dev_shell_mac_LowLevelSaf__1invoke
- (JNIEnv* env, jclass, jint jsexecState, jint jsScriptObject, jstring method,
- jint jsthis, jint argc, jintArray argv, jintArray rval)
-{
- TRACE("ENTER LowLevelSaf__1invoke");
-
- if (!jsexecState || !jsScriptObject || !method || !rval) {
- return JNI_FALSE;
- }
- JStringWrap jmethod(env, method);
-#ifdef ENABLE_TRACING
- char buf[256];
- snprintf(buf, sizeof(buf), "scriptObject=%08x, method=%s, argc=%d",
- static_cast<unsigned>(jsScriptObject), jmethod.str(),
- static_cast<unsigned>(argc));
- TRACE(buf);
- PrintJSValue((JSValue*)jsthis, " jsthis=");
-#endif
- ExecState* execState = (ExecState*)jsexecState;
-
- JSObject* scriptObj = (JSObject*)jsScriptObject;
- if (!scriptObj->isObject()) {
- return JNI_FALSE;
- }
-
- if (!jmethod.jstr()) {
- return JNI_FALSE;
- }
-
- JSObject* thisObj = (JSObject*)jsthis;
- if (!thisObj || thisObj->isNull() || thisObj->isUndefined()) {
- thisObj = scriptObj;
- }
- if (!thisObj->isObject()) {
- return JNI_FALSE;
- }
-
- JSValue* maybeFunc = scriptObj->get(execState,
- Identifier((const UChar*)jmethod.jstr(), jmethod.length()));
- if (!maybeFunc || !maybeFunc->isObject()) {
- return JNI_FALSE;
- }
-
- JSObject* func = (JSObject*)maybeFunc;
- if (!func->implementsCall()) {
- return JNI_FALSE;
- }
-
- List args;
- for (int i = 0; i < argc; ++i) {
- jint argi;
- env->GetIntArrayRegion(argv, i, 1, &argi);
- if (env->ExceptionCheck()) {
- return JNI_FALSE;
- }
-#ifdef ENABLE_TRACING
- snprintf(buf, sizeof(buf), " arg[%d]=", i);
- TRACE(buf);
- PrintJSValue((JSValue*)argi, buf);
-#endif
- if (argi) {
- args.append((JSValue*)argi);
- } else {
- args.append(jsNull());
- }
- }
-
- JSValue* result = func->call(execState, thisObj, args);
- gwtGCProtect(result);
- env->SetIntArrayRegion(rval, 0, 1, (jint*)&result);
- if (env->ExceptionCheck()) {
- return JNI_FALSE;
- }
-
- TRACE("SUCCESS LowLevelSaf__1invoke");
- return JNI_TRUE;
-}
-
-/*
- * Class: com_google_gwt_dev_shell_mac_LowLevelSaf
- * Method: isBoolean
- * Signature: (I)Z
- */
-extern "C" JNIEXPORT jboolean JNICALL
-Java_com_google_gwt_dev_shell_mac_LowLevelSaf_isBoolean
- (JNIEnv *, jclass, jint jsval)
-{
- if (!jsval) {
- return JNI_FALSE;
- }
- return reinterpret_cast<JSValue*>(jsval)->isBoolean() ? JNI_TRUE : JNI_FALSE;
-}
-
-/*
- * Class: com_google_gwt_dev_shell_mac_LowLevelSaf
- * Method: isNumber
- * Signature: (I)Z
- */
-extern "C" JNIEXPORT jboolean JNICALL
-Java_com_google_gwt_dev_shell_mac_LowLevelSaf_isNumber
- (JNIEnv *, jclass, jint jsval)
-{
- if (!jsval) {
- return JNI_FALSE;
- }
- return reinterpret_cast<JSValue*>(jsval)->isNumber() ? JNI_TRUE : JNI_FALSE;
-}
-
-/*
- * Class: com_google_gwt_dev_shell_mac_LowLevelSaf
- * Method: _isString
- * Signature: (I)Z
- *
- * Must return true for JavaScript String objects as well as string primitives.
- */
-JNIEXPORT jboolean JNICALL
-Java_com_google_gwt_dev_shell_mac_LowLevelSaf__1isString
- (JNIEnv *, jclass, jint jsval)
-{
- if (!jsval) {
- return JNI_FALSE;
- }
- JSValue* jsValue = reinterpret_cast<JSValue*>(jsval);
- if(jsValue->isString()) return JNI_TRUE;
- // check for JavaScript String objects
- if(jsValue->isObject()) {
- const JSObject* obj = jsValue->getObject();
- const ClassInfo* cinfo = obj->classInfo();
- if (cinfo && !strcmp(cinfo->className, "String")) {
- return JNI_TRUE;
- }
- }
- return JNI_FALSE;
-}
-
-/*
- * Class: com_google_gwt_dev_shell_mac_LowLevelSaf
- * Method: _isObject
- * Signature: (I)Z
- */
-JNIEXPORT jboolean JNICALL Java_com_google_gwt_dev_shell_mac_LowLevelSaf__1isObject
- (JNIEnv *, jclass, jint jsval)
-{
- if (!jsval) {
- return JNI_FALSE;
- }
- return reinterpret_cast<JSValue*>(jsval)->isObject() ? JNI_TRUE : JNI_FALSE;
-}
-
-/*
- * Class: com_google_gwt_dev_shell_mac_LowLevelSaf
- * Method: _isWrappedDispatch
- * Signature: (I[Z)Z
- */
-JNIEXPORT jboolean JNICALL Java_com_google_gwt_dev_shell_mac_LowLevelSaf__1isWrappedDispatch
- (JNIEnv* env, jclass, jint jsval, jbooleanArray rval)
-{
- TRACE("ENTER LowLevelSaf__1isWrappedDispatch");
- if (!jsval) {
- return JNI_FALSE;
- }
-
- JSValue* val = (JSValue*)jsval;
- jboolean result = val->isObject(&DispWrapper::info) ? JNI_TRUE : JNI_FALSE;
-
- env->SetBooleanArrayRegion(rval, 0, 1, &result);
- if (env->ExceptionCheck()) {
- return JNI_FALSE;
- }
-
- TRACE("SUCCESS LowLevelSaf__1isWrappedDispatch");
- return JNI_TRUE;
-}
-
-/*
- * Class: com_google_gwt_dev_shell_mac_LowLevelSaf
- * Method: _jsLock
- * Signature: ()V
- */
-JNIEXPORT void JNICALL Java_com_google_gwt_dev_shell_mac_LowLevelSaf__1jsLock
- (JNIEnv *, jclass)
-{
- JSLock::lock();
-}
-
-/*
- * Class: com_google_gwt_dev_shell_mac_LowLevelSaf
- * Method: _jsUnlock
- * Signature: ()V
- */
-JNIEXPORT void JNICALL Java_com_google_gwt_dev_shell_mac_LowLevelSaf__1jsUnlock
- (JNIEnv *, jclass)
-{
- JSLock::unlock();
-}
-
-/*
- * Class: com_google_gwt_dev_shell_mac_LowLevelSaf
- * Method: _raiseJavaScriptException
- * Signature: (II)Z
- */
-JNIEXPORT jboolean JNICALL Java_com_google_gwt_dev_shell_mac_LowLevelSaf__1raiseJavaScriptException
- (JNIEnv *env, jclass, jint execState, jint jsval)
-{
- TRACE("ENTER LowLevelSaf__1raiseJavaScriptException");
-
- if (!execState || !jsval) {
- return JNI_FALSE;
- }
-
- reinterpret_cast<ExecState*>(execState)->setException(
- reinterpret_cast<JSValue*>(jsval));
- TRACE("SUCCESS LowLevelSaf__1raiseJavaScriptException");
- return JNI_TRUE;
-}
-
-/*
- * Class: com_google_gwt_dev_shell_mac_LowLevelSaf
- * Method: _unwrapDispatch
- * Signature: (I[Lcom/google/gwt/dev/shell/mac/LowLevelSaf/DispatchObject;)Z
- */
-JNIEXPORT jboolean JNICALL Java_com_google_gwt_dev_shell_mac_LowLevelSaf__1unwrapDispatch
- (JNIEnv* env, jclass, jint jsval, jobjectArray rval)
-{
- TRACE("ENTER LowLevelSaf__1unwrapDispatch");
- if (!jsval) {
- return JNI_FALSE;
- }
-
- JSValue* val = reinterpret_cast<JSValue*>(jsval);
- if (!val->isObject(&DispWrapper::info)) {
- return JNI_FALSE;
- }
-
- DispWrapper* wrapper = static_cast<DispWrapper*>(val);
- env->SetObjectArrayElement(rval, 0, wrapper->getDispObj());
- if (env->ExceptionCheck()) {
- return JNI_FALSE;
- }
-
- TRACE("SUCCESS LowLevelSaf__1unwrapDispatch");
- return JNI_TRUE;
-}
-
-/*
- * Class: com_google_gwt_dev_shell_mac_LowLevelSaf
- * Method: _wrapDispatch
- * Signature: (Lcom/google/gwt/dev/shell/mac/LowLevelSaf/DispatchObject;[I)Z
- */
-JNIEXPORT jboolean JNICALL
-Java_com_google_gwt_dev_shell_mac_LowLevelSaf__1wrapDispatch
- (JNIEnv* env, jclass, jobject dispObj, jintArray rval)
-{
- TRACE("ENTER LowLevelSaf__1wrapDispatch");
- jobject dispObjRef = env->NewGlobalRef(dispObj);
- if (!dispObjRef || env->ExceptionCheck()) {
- return JNI_FALSE;
- }
-
- DispWrapper* wrapper = new DispWrapper(dispObjRef);
-
- gwtGCProtect(wrapper);
-
- env->SetIntArrayRegion(rval, 0, 1, (jint*)&wrapper);
- if (env->ExceptionCheck()) {
- return JNI_FALSE;
- }
-
- TRACE("SUCCESS LowLevelSaf__1wrapDispatch");
- return JNI_TRUE;
-}
-
-/*
- * Class: com_google_gwt_dev_shell_mac_LowLevelSaf
- * Method: _wrapFunction
- * Signature: (Ljava/lang/String;Lcom/google/gwt/dev/shell/mac/LowLevelSaf/DispatchMethod;[I)Z
- */
-JNIEXPORT jboolean JNICALL
-Java_com_google_gwt_dev_shell_mac_LowLevelSaf__1wrapFunction
- (JNIEnv* env, jclass, jstring name, jobject dispMeth, jintArray rval)
-{
- TRACE("ENTER LowLevelSaf__1wrapFunction");
-
- jobject dispMethRef = env->NewGlobalRef(dispMeth);
- if (!dispMethRef || env->ExceptionCheck()) {
- return JNI_FALSE;
- }
-
- JStringWrap jname(env, name);
- if (!jname.jstr()) {
- return JNI_FALSE;
- }
-
- FuncWrapper* wrapper = new FuncWrapper(UString((const UChar*)jname.jstr(),
- jname.length()), dispMethRef);
-
- gwtGCProtect(wrapper);
- env->SetIntArrayRegion(rval, 0, 1, (jint*)&wrapper);
- if (env->ExceptionCheck()) {
- return JNI_FALSE;
- }
-
- TRACE("SUCCESS LowLevelSaf__1wrapFunction");
- return JNI_TRUE;
-}
-
-#ifdef FILETRACE
-FILE* gout = 0;
-void filetrace(const char* s) {
- fprintf(gout, s);
- fprintf(gout, "\n");
- fflush(gout);
-}
-#endif // FILETRACE
-
-#ifdef JAVATRACE
-jmethodID gTraceMethod = 0;
-void javatrace(const char* s) {
- if (!gEnv->ExceptionCheck()) {
- jstring out = gEnv->NewStringUTF(s);
- if (!gEnv->ExceptionCheck()) {
- gEnv->CallStaticVoidMethod(gClass, gTraceMethod, out);
- } else {
- gEnv->ExceptionClear();
- }
- }
-}
-#endif // JAVATRACE
diff --git a/jni/mac/10.5/gwt-webkit.h b/jni/mac/10.5/gwt-webkit.h
deleted file mode 100644
index 573e49b..0000000
--- a/jni/mac/10.5/gwt-webkit.h
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Copyright 2007 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-#ifndef GWT_WEBKIT_H
-#define GWT_WEBKIT_H
-
-#include <jni.h>
-#include <kjs/object.h>
-#include <kjs/internal.h>
-#include <kjs/interpreter.h>
-#include <kjs/JSGlobalObject.h>
-#include "JStringWrap.h"
-
-extern JNIEnv* gEnv;
-extern jclass gClass;
-extern jclass gDispObjCls;
-extern jclass gDispMethCls;
-extern jmethodID gSetFieldMeth;
-extern jmethodID gGetFieldMeth;
-extern jmethodID gInvokeMeth;
-extern jmethodID gToStringMeth;
-
-//#define FILETRACE
-//#define JAVATRACE
-
-#if defined(FILETRACE) || defined(JAVATRACE)
-#define ENABLE_TRACING
-#endif
-
-#if defined(FILETRACE) && defined(JAVATRACE)
-#define TRACE(s) filetrace(s),javatrace(s)
-#elif defined(FILETRACE)
-#define TRACE(s) filetrace(s)
-#elif defined(JAVATRACE)
-#define TRACE(s) javatrace(s)
-#else
-#define TRACE(s) ((void)0)
-#endif
-
-#ifdef FILETRACE
-extern FILE* gout;
-void filetrace(const char* s);
-#endif // FILETRACE
-
-#ifdef JAVATRACE
-extern jmethodID gTraceMethod;
-void javatrace(const char* s);
-#endif // JAVATRACE
-
-void PrintJSValue(KJS::JSValue*, char* prefix="");
-void gcProtectHook(KJS::JSValue*);
-void gcUnprotectHook(KJS::JSValue*, const char* trace);
-
-/*
- * Lock KJS GC and protect the supplied value.
- *
- * value JSValue* to protect from GC
- */
-inline void gwtGCProtect(KJS::JSValue* value) {
- KJS::JSLock lock;
- gcProtectNullTolerant(value);
-#ifdef ENABLE_TRACING
- gcProtectHook(value);
-#endif
-}
-
-/*
- * Lock KJS GC and unprotect the supplied value.
- *
- * value JSValue* to unprotect from GC
- * trace human-readable string describing object creation location
- */
-inline void gwtGCUnprotect(KJS::JSValue* value, const char* trace) {
- KJS::JSLock lock;
-#ifdef ENABLE_TRACING
- gcUnprotectHook(value, trace);
-#endif
- gcUnprotectNullTolerant(value);
-}
-
-#endif
diff --git a/jni/mac/10.5/localize-framework-install-names.rb b/jni/mac/10.5/localize-framework-install-names.rb
deleted file mode 100644
index b00f1e9..0000000
--- a/jni/mac/10.5/localize-framework-install-names.rb
+++ /dev/null
@@ -1,93 +0,0 @@
-#!/usr/bin/env ruby
-require 'ostruct';
-require 'pathname';
-
-$CONFIG = OpenStruct.new
-$CONFIG.root = File.dirname(__FILE__)
-$CONFIG.frameworks = "#{$CONFIG.root}/Frameworks"
-
-class Framework
- attr_reader :libs,:id
- def initialize(framework)
- @path = "#{$CONFIG.frameworks}/#{framework}.framework/Versions/Current/#{framework}"
- reload
- puts @libs.inspect
- end
-
- def id=(name)
- system(
- "install_name_tool",
- "-id",
- name,
- @path)
- reload
- end
-
- def get_install_name(lib)
- return @libs[lib]
- end
-
- def set_install_name(lib,val)
- puts "lib=#{lib}/#{@libs[lib]}, val=#{val}"
- system(
- "install_name_tool",
- "-change",
- @libs[lib],
- val,
- @path)
- reload
- end
-
- private
- def reload
- @libs = IO.popen("otool -L '#{@path}'") { |fh|
- fh.readline
- if fh.readline =~ /([^(]*)/
- @id = $1.strip
- else
- raise "Unable to read otool of framework (#{@path})"
- end
- fh.inject({}) { |coll,line|
- if line =~ /(\w+)\.framework/
- name = $1
- if line =~ /([^(]*)/
- coll.update(name => $1.strip)
- else
- raise "Unable to read otool of framework (#{@path})"
- end
- end
- coll
- }
- }.freeze
- end
-end
-
-def create_frameworks
- ["WebKit","WebCore","JavaScriptCore"].map { |name|
- Framework.new(name)
- }
-end
-
-def create_framework_ids
- path = Pathname.new(File.dirname(__FILE__)).realpath
- ["WebKit", "WebCore", "JavaScriptCore"].map { |name|
- "#{path}/Frameworks/#{name}.framework/Versions/A/#{name}"
- }
-end
-
-def localize_install_names
- wk_fr, wc_fr, js_fr = create_frameworks
- #wk_id, wc_id, js_id = "gwt/WebKit.framework", "gwt/WebCore.framework", "gwt/JavaScriptCore.framework"
- wk_id, wc_id, js_id = create_framework_ids
-
- js_fr.id = js_id
-
- wc_fr.id = wc_id
- wc_fr.set_install_name "JavaScriptCore", js_id
-
- wk_fr.id = wk_id
- wk_fr.set_install_name "JavaScriptCore", js_id
- wk_fr.set_install_name "WebCore", wc_id
-end
-
-localize_install_names
diff --git a/jni/mac/10.5/org.eclipse.swt/make_macosx.mak b/jni/mac/10.5/org.eclipse.swt/make_macosx.mak
deleted file mode 100644
index 55eb481..0000000
--- a/jni/mac/10.5/org.eclipse.swt/make_macosx.mak
+++ /dev/null
@@ -1,66 +0,0 @@
-#*******************************************************************************
-# Copyright (c) 2000, 2006 IBM Corporation and others.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Eclipse Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/epl-v10.html
-#
-# Contributors:
-# IBM Corporation - initial API and implementation
-#*******************************************************************************
-
-# Makefile for SWT libraries on Carbon/Mac
-
-include make_common.mak
-
-SWT_PREFIX=swt
-SWTPI_PREFIX=swt-pi
-SWTWEBKIT_PREFIX=swt-webkit
-SWTAGL_PREFIX=swt-agl
-WS_PREFIX=carbon
-SWT_VERSION=$(maj_ver)$(min_ver)
-SWT_LIB=lib$(SWT_PREFIX)-$(WS_PREFIX)-$(SWT_VERSION).jnilib
-SWTPI_LIB=lib$(SWTPI_PREFIX)-$(WS_PREFIX)-$(SWT_VERSION).jnilib
-WEBKIT_LIB=lib$(SWTWEBKIT_PREFIX)-$(WS_PREFIX)-$(SWT_VERSION).jnilib
-AGL_LIB=lib$(SWTAGL_PREFIX)-$(WS_PREFIX)-$(SWT_VERSION).jnilib
-
-# Uncomment for Native Stats tool
-#NATIVE_STATS = -DNATIVE_STATS
-
-#SWT_DEBUG = -g
-ARCHS = -arch i386 -arch ppc
-CFLAGS = -c $(ARCHS) -DSWT_VERSION=$(SWT_VERSION) $(NATIVE_STATS) $(SWT_DEBUG) -DCARBON -I /System/Library/Frameworks/JavaVM.framework/Headers
-LFLAGS = -bundle $(ARCHS) -framework JavaVM -framework Carbon
-WEBKITCFLAGS = -c $(ARCHS) -xobjective-c -I /System/Library/Frameworks/JavaVM.framework/Headers -I /System/Library/Frameworks/Cocoa.framework/Headers -I /System/Library/Frameworks/WebKit.framework/Headers
-WEBKITLFLAGS = $(LFLAGS) -framework WebKit -framework Cocoa -F../Frameworks
-AGLLFLAGS = $(LFLAGS) -framework OpenGL -framework AGL
-SWT_OBJECTS = swt.o callback.o
-SWTPI_OBJECTS = swt.o os.o os_custom.o os_structs.o os_stats.o
-WEBKIT_OBJECTS = webkit.o
-AGL_OBJECTS = agl.o agl_stats.o
-
-all: $(SWT_LIB) $(SWTPI_LIB) $(WEBKIT_LIB) $(AGL_LIB)
-
-.c.o:
- cc $(CFLAGS) $*.c
-
-$(SWT_LIB): $(SWT_OBJECTS)
- cc -o $(SWT_LIB) $(LFLAGS) $(SWT_OBJECTS)
-
-$(SWTPI_LIB): $(SWTPI_OBJECTS)
- cc -o $(SWTPI_LIB) $(LFLAGS) $(SWTPI_OBJECTS)
-
-webkit.o: webkit.c
- cc $(WEBKITCFLAGS) webkit.c
-
-$(WEBKIT_LIB): $(WEBKIT_OBJECTS)
- cc -o $(WEBKIT_LIB) $(WEBKITLFLAGS) $(WEBKIT_OBJECTS)
-
-$(AGL_LIB): $(AGL_OBJECTS)
- cc -o $(AGL_LIB) $(AGLLFLAGS) $(AGL_OBJECTS)
-
-install: all
- cp *.jnilib $(OUTPUT_DIR)
-
-clean:
- rm -f *.jnilib *.o
diff --git a/jni/mac/10.5/org.eclipse.swt/webkit.c b/jni/mac/10.5/org.eclipse.swt/webkit.c
deleted file mode 100644
index 3b704ec..0000000
--- a/jni/mac/10.5/org.eclipse.swt/webkit.c
+++ /dev/null
@@ -1,250 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-// Modified by Google
-#include <Carbon/Carbon.h>
-#include <WebKit/WebKit.h>
-#include <WebKit/HIWebView.h>
-
-#include "jni.h"
-
-JNIEXPORT void JNICALL Java_org_eclipse_swt_browser_WebKit_WebInitForCarbon(JNIEnv *env, jclass zz) {
- WebInitForCarbon();
-}
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_browser_WebKit_HIWebViewCreate(JNIEnv *env, jclass zz, jintArray outView) {
- jint *a = (*env)->GetIntArrayElements(env, outView, NULL);
- jint status = (jint) HIWebViewCreate((HIViewRef *)a);
- (*env)->ReleaseIntArrayElements(env, outView, a, 0);
- return status;
-}
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_browser_WebKit_HIWebViewGetWebView(JNIEnv *env, jclass zz, jint viewRef) {
- return (jint) HIWebViewGetWebView((HIViewRef)viewRef);
-}
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_browser_WebKit_objc_1msgSend__II(JNIEnv *env, jclass zz, jint obj, jint sel) {
- return (jint) objc_msgSend((void *)obj, (void *)sel);
-}
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_browser_WebKit_objc_1msgSend__III(JNIEnv *env, jclass zz, jint obj, jint sel, jint arg0) {
- return (jint) objc_msgSend((void *)obj, (void *)sel, (void *)arg0);
-}
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_browser_WebKit_objc_1msgSend__IIII(JNIEnv *env, jclass zz, jint obj, jint sel, jint arg0, jint arg1) {
- return (jint) objc_msgSend((void *)obj, (void *)sel, (void *)arg0, (void *)arg1);
-}
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_browser_WebKit_objc_1msgSend__IIIII(JNIEnv *env, jclass zz, jint obj, jint sel, jint arg0, jint arg1, jint arg2) {
- return (jint) objc_msgSend((void *)obj, (void *)sel, (void *)arg0, (void *)arg1, (void *)arg2);
-}
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_browser_WebKit_objc_1msgSend__IIIIII(JNIEnv *env, jclass zz, jint obj, jint sel, jint arg0, jint arg1, jint arg2, jint arg3) {
- return (jint) objc_msgSend((void *)obj, (void *)sel, (void *)arg0, (void *)arg1, (void *)arg2, (void *)arg3);
-}
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_browser_WebKit_objc_1getClass(JNIEnv *env, jclass zz, jbyteArray name) {
- jbyte *a = (*env)->GetByteArrayElements(env, name, NULL);
- jint id = (jint) objc_getClass((const char *)a);
- (*env)->ReleaseByteArrayElements(env, name, a, 0);
- return id;
-}
-
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_browser_WebKit_sel_1registerName(JNIEnv *env, jclass zz, jbyteArray name) {
- jbyte *a= (*env)->GetByteArrayElements(env, name, NULL);
- jint sel= (jint) sel_registerName((const char *)a);
- (*env)->ReleaseByteArrayElements(env, name, a, 0);
- return sel;
-}
-
-@interface WebKitDelegate : NSObject
-{
- int user_data;
- int (*proc) (int sender, int user_data, int selector, int arg0, int arg1, int arg2, int arg3);
-}
-@end
-
-@implementation WebKitDelegate
-
-- (id)initWithProc:(id)prc user_data:(int)data
-{
- [super init];
- proc= (void *) prc;
- user_data = data;
- return self;
-}
-
-/* WebFrameLoadDelegate */
-
-- (void)webView:(WebView *)sender didFailProvisionalLoadWithError:(NSError *)error forFrame:(WebFrame *)frame
-{
- proc((int)sender, user_data, 1, (int)error, (int)frame, 0, 0);
-}
-
-- (void)webView:(WebView *)sender didFinishLoadForFrame:(WebFrame *)frame
-{
- proc((int)sender, user_data, 2, (int)frame, 0, 0, 0);
-}
-
-- (void)webView:(WebView *)sender didReceiveTitle:(NSString *)title forFrame:(WebFrame *)frame
-{
- proc((int)sender, user_data, 3, (int)title, (int)frame, 0, 0);
-}
-
-- (void)webView:(WebView *)sender didStartProvisionalLoadForFrame:(WebFrame *)frame
-{
- proc((int)sender, user_data, 4, (int)frame, 0, 0, 0);
-}
-
-- (void)webView:(WebView *)sender didCommitLoadForFrame:(WebFrame *)frame
-{
- proc((int)sender, user_data, 10, (int)frame, 0, 0, 0);
-}
-
-/* WebResourceLoadDelegate */
-
-- (void)webView:(WebView *)sender resource:(id)identifier didFinishLoadingFromDataSource:(WebDataSource *)dataSource
-{
- proc((int)sender, user_data, 5, (int)identifier, (int)dataSource, 0, 0);
-}
-
-- (void)webView:(WebView *)sender resource:(id)identifier didFailLoadingWithError:(NSError *)error fromDataSource:(WebDataSource *)dataSource
-{
- proc((int)sender, user_data, 6, (int)identifier, (int)error, (int)dataSource, 0);
-}
-
-- (id)webView:(WebView *)sender identifierForInitialRequest:(NSURLRequest *)request fromDataSource:(WebDataSource *)dataSource
-{
- return (id) proc((int)sender, user_data, 7, (int)request, (int)dataSource, 0, 0);
-}
-
-- (NSURLRequest *)webView:(WebView *)sender resource:(id)identifier willSendRequest:(NSURLRequest *)request redirectResponse:(NSURLResponse *)redirectResponse fromDataSource:(WebDataSource *)dataSource
-{
- return (NSURLRequest *) proc((int)sender, user_data, 8, (int)identifier, (int)request, (int)redirectResponse, (int)dataSource);
-}
-
-/* handleNotification */
-
-- (void)handleNotification:(NSNotification *)notification
-{
- proc((int)[notification object], user_data, 9, (int)notification, 0, 0, 0);
-}
-
-/* UIDelegate */
-
-- (WebView *)webView:(WebView *)sender createWebViewWithRequest:(NSURLRequest *)request
-{
- return (WebView *) proc((int)sender, user_data, 11, (int)request, 0, 0, 0);
-}
-
-- (void)webViewShow:(WebView *)sender
-{
- proc((int)sender, user_data, 12, 0, 0, 0, 0);
-}
-
-- (void)webView:(WebView *)sender setFrame:(NSRect)frame
-{
- proc((int)sender, user_data, 13, (int)&frame, 0, 0, 0);
-}
-
-- (void)webViewClose:(WebView *)sender
-{
- proc((int)sender, user_data, 14, 0, 0, 0, 0);
-}
-
-- (NSArray *)webView:(WebView *)sender contextMenuItemsForElement:(NSDictionary *)element defaultMenuItems:(NSArray *)defaultMenuItems
-{
- return (NSArray *)proc((int)sender, user_data, 15, (int)element, (int)defaultMenuItems, 0, 0);
-}
-
-- (void)webView:(WebView *)sender setStatusBarVisible:(BOOL)visible
-{
- proc((int)sender, user_data, 16, (int)visible, 0, 0, 0);
-}
-
-- (void)webView:(WebView *)sender setResizable:(BOOL)resizable
-{
- proc((int)sender, user_data, 17, (int)resizable, 0, 0, 0);
-}
-
-- (void)webView:(WebView *)sender setToolbarsVisible:(BOOL)visible
-{
- proc((int)sender, user_data, 18, (int)visible, 0, 0, 0);
-}
-
-- (void)webView:(WebView *)sender setStatusText:(NSString *)text
-{
- proc((int)sender, user_data, 23, (int)text, 0, 0, 0);
-}
-
-- (void)webViewFocus:(WebView *)sender
-{
- proc((int)sender, user_data, 24, 0, 0, 0, 0);
-}
-
-- (void)webViewUnfocus:(WebView *)sender
-{
- proc((int)sender, user_data, 25, 0, 0, 0, 0);
-}
-
-- (void)webView:(WebView *)sender runJavaScriptAlertPanelWithMessage:(NSString *)message
-{
- proc((int)sender, user_data, 26, (int)message, 0, 0, 0);
-}
-
-- (BOOL)webView:(WebView *)sender runJavaScriptConfirmPanelWithMessage:(NSString *)message
-{
- return (BOOL) proc((int)sender, user_data, 27, (int)message, 0, 0, 0);
-}
-
-- (void)webView:(WebView *)sender runOpenPanelForFileButtonWithResultListener:(id<WebOpenPanelResultListener>)resultListener
-{
- proc((int)sender, user_data, 28, (int)resultListener, 0, 0, 0);
-}
-
-/* WebPolicyDelegate */
-- (void)webView:(WebView *)sender decidePolicyForMIMEType:(NSString *)type request:(NSURLRequest *)request frame:(WebFrame*)frame decisionListener:(id<WebPolicyDecisionListener>)listener
-{
- proc((int)sender, user_data, 19, (int)type, (int)request, (int)frame, (int)listener);
-}
-
-- (void)webView:(WebView *)sender decidePolicyForNavigationAction:(NSDictionary *)actionInformation request:(NSURLRequest *)request frame:(WebFrame *)frame decisionListener:(id<WebPolicyDecisionListener>)listener
-{
- proc((int)sender, user_data, 20, (int)actionInformation, (int)request, (int)frame, (int)listener);
-}
-
-
-- (void)webView:(WebView *)sender decidePolicyForNewWindowAction:(NSDictionary *)actionInformation request:(NSURLRequest *)request newFrameName:(NSString *)frameName decisionListener:(id<WebPolicyDecisionListener>)listener
-{
- proc((int)sender, user_data, 21, (int)actionInformation, (int)request, (int)frameName, (int)listener);
-}
-
-
-- (void)webView:(WebView *)sender unableToImplementPolicyWithError:(NSError *)error frame:(WebFrame *)frame
-{
- proc((int)sender, user_data, 22, (int)error, (int)frame, 0, 0);
-}
-
-/* WebDownload */
-
-- (void)download:(NSURLDownload *)download decideDestinationWithSuggestedFilename:(NSString *)filename
-{
- proc((int)download, user_data, 29, (int)download, (int)filename, 0, 0);
-}
-
-// GOOGLE: we need a notification when the window object is available so we can
-// setup our own hooks before any JavaScript runs.
-- (void)webView:(WebView *)sender windowScriptObjectAvailable:(WebScriptObject *)windowScriptObject
-{
- proc((int)sender, user_data, 99, (int)windowScriptObject, 0, 0, 0);
-}
-
-@end
-
diff --git a/jni/mac/10.5/prebuilt/libgwt-ll.jnilib b/jni/mac/10.5/prebuilt/libgwt-ll.jnilib
deleted file mode 100755
index 01db6a1..0000000
--- a/jni/mac/10.5/prebuilt/libgwt-ll.jnilib
+++ /dev/null
Binary files differ
diff --git a/jni/mac/10.5/prebuilt/libgwt-webkit.jnilib b/jni/mac/10.5/prebuilt/libgwt-webkit.jnilib
deleted file mode 100755
index 879c831..0000000
--- a/jni/mac/10.5/prebuilt/libgwt-webkit.jnilib
+++ /dev/null
Binary files differ
diff --git a/jni/mac/10.4/JStringWrap.h b/jni/mac/JStringWrap.h
similarity index 100%
rename from jni/mac/10.4/JStringWrap.h
rename to jni/mac/JStringWrap.h
diff --git a/jni/mac/Makefile b/jni/mac/Makefile
new file mode 100644
index 0000000..867b511
--- /dev/null
+++ b/jni/mac/Makefile
@@ -0,0 +1,89 @@
+# Copyright 2008 Google Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may not
+# use this file except in compliance with the License. You may obtain a copy of
+# the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations under
+# the License.
+
+CC = g++
+JAVAH = javah
+
+##
+# Try a GWT_TOOLS default if it isn't set
+##
+GWT_TOOLS ?= ../../../tools
+GWT_ROOT ?= ../..
+
+##
+# The location to get .class files for javah
+##
+CLASSDIR := $(GWT_ROOT)/build/out/dev/mac/bin
+
+##
+# External SWT products.
+##
+SWT_ORIGINAL_SRC = $(GWT_TOOLS)/lib/eclipse/org.eclipse.swt.carbon-macosx-3.2.1.src.zip
+SWT_PATCH_DIR = ./swt-build
+SWT_LIBS=$(SWT_PATCH_DIR)/libswt-webkit-carbon-3235.jnilib \
+ $(SWT_PATCH_DIR)/libswt-agl-carbon-3235.jnilib \
+ $(SWT_PATCH_DIR)/libswt-carbon-3235.jnilib \
+ $(SWT_PATCH_DIR)/libswt-pi-carbon-3235.jnilib
+
+GWT_LL_LIB = libgwt-ll.jnilib
+GWT_LL_OBJS = gwt-ll.o java-dispatch.o gwt-webkit.o trace.o
+GWT_LL_JNI = gwt-webkit.h
+
+TARGETS = $(GWT_LL_LIB) $(SWT_LIBS)
+ARCHS = -arch i386 -arch ppc
+CFLAGS = -I/System/Library/Frameworks/JavaScriptCore.framework/Headers -I/System/Library/Frameworks/JavaVM.framework/Headers
+LFLAGS = -bundle -framework JavaScriptCore
+
+ALL : $(TARGETS)
+
+##
+# Unpack and patch SWT source.
+##
+$(SWT_PATCH_DIR): $(SWT_ORIGINAL_SRC) ./org.eclipse.swt/webkit.c
+ unzip $(SWT_ORIGINAL_SRC) -d $(SWT_PATCH_DIR)
+ cp ./org.eclipse.swt/webkit.c $(SWT_PATCH_DIR)
+
+##
+# Build SWT.
+##
+$(SWT_LIBS):$(SWT_PATCH_DIR)
+ make -C $(SWT_PATCH_DIR) -f make_macosx.mak
+
+##
+# Build core gwt-ll object.
+##
+gwt-ll.o : ../core/gwt-ll.cpp
+ $(CC) -c -Wall -o $@ $(ARCHS) $(CFLAGS) $<
+
+##
+# General coff target.
+##
+%.o : %.cpp
+ $(CC) -c -Wall -o $@ $(ARCHS) $(CFLAGS) $<
+
+##
+# Generate JNI Header
+##
+gwt-webkit.h : $(CLASSDIR)/com/google/gwt/dev/shell/mac/LowLevelSaf.class
+ $(JAVAH) -classpath $(CLASSDIR) -o gwt-webkit.h com.google.gwt.dev.shell.mac.LowLevelSaf
+
+##
+# Build gwt-ll library.
+##
+$(GWT_LL_LIB) : $(GWT_LL_JNI) $(GWT_LL_OBJS)
+ $(CC) -Wall -o $@ $(ARCHS) $(LFLAGS) $(GWT_LL_OBJS)
+
+clean:
+ rm -f $(GWT_LL_JNI) $(GWT_LL_OBJS) $(TARGETS)
+ rm -rf $(SWT_PATCH_DIR)
diff --git a/jni/mac/build.xml b/jni/mac/build.xml
index 3fd4572..2bb1631 100755
--- a/jni/mac/build.xml
+++ b/jni/mac/build.xml
@@ -3,21 +3,11 @@
<property name="project.tail" value="jni/mac" />
<import file="${gwt.root}/common.ant.xml" />
- <target name="build" depends="build_10.4, build_10.5">
- </target>
-
- <target name="build_10.4" description="Builds a JNI lib">
- <mkdir dir="${project.jni}_10.4" />
+ <target name="build" description="Builds a JNI lib">
+ <mkdir dir="${project.jni}" />
<!-- TODO: Actually build this from source! -->
- <copy todir="${project.jni}_10.4">
- <fileset dir="10.4/prebuilt" />
- </copy>
- </target>
- <target name="build_10.5" description="Builds a JNI lib">
- <mkdir dir="${project.jni}_10.5" />
- <!-- TODO: Actually build this from source! -->
- <copy todir="${project.jni}_10.5">
- <fileset dir="10.5/prebuilt" />
+ <copy todir="${project.jni}">
+ <fileset dir="prebuilt" />
</copy>
</target>
diff --git a/jni/mac/gwt-webkit.cpp b/jni/mac/gwt-webkit.cpp
new file mode 100644
index 0000000..293a2bc
--- /dev/null
+++ b/jni/mac/gwt-webkit.cpp
@@ -0,0 +1,886 @@
+/*
+ * Copyright 2008 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+#include <iostream>
+#include <JavaScriptCore/JavaScriptCore.h>
+#include "gwt-webkit.h"
+#include "JStringWrap.h"
+#include "java-dispatch.h"
+#include "trace.h"
+
+
+// http://unixjunkie.blogspot.com/2006/07/access-argc-and-argv-from-anywhere.html
+extern "C" int *_NSGetArgc(void);
+extern "C" char ***_NSGetArgv(void);
+
+/*
+ *
+ */
+JSContextRef ToJSContextRef(jint context) {
+ return reinterpret_cast<JSContextRef>(context);
+}
+
+/*
+ *
+ */
+JSValueRef ToJSValueRef(jint value) {
+ return reinterpret_cast<JSValueRef>(value);
+}
+
+/*
+ *
+ */
+JSObjectRef ToJSObjectRef(JSContextRef jsContext, jint object,
+ JSValueRef* jsException) {
+ JSValueRef jsValue = reinterpret_cast<JSValueRef>(object);
+ if (!jsValue || !JSValueIsObject(jsContext, jsValue)) {
+ return NULL;
+ }
+ return JSValueToObject(jsContext, jsValue, jsException);
+}
+
+/*
+ *
+ */
+JSObjectRef ToJSObjectRef(JSContextRef jsContext, JSValueRef jsValue,
+ JSValueRef* jsException) {
+ if (!jsValue || !JSValueIsObject(jsContext, jsValue)) {
+ return NULL;
+ }
+ return JSValueToObject(jsContext, jsValue, jsException);
+}
+
+/*
+ *
+ */
+JSObjectRef GetStringConstructor(JSContextRef jsContext,
+ JSValueRef* jsException) {
+ // This could only be cached relative to jsContext.
+ JSStringRef script = JSStringCreateWithUTF8CString("(String)");
+ JSValueRef ctorVal = JSEvaluateScript(jsContext, script, NULL, NULL, 0, jsException);
+ JSStringRelease(script);
+ return ToJSObjectRef(jsContext, ctorVal, jsException);
+}
+
+/*
+ *
+ */
+bool IsObjectOfStringConstructor(JSContextRef jsContext, JSValueRef jsValue,
+ JSValueRef* jsException) {
+ JSObjectRef jsObject = ToJSObjectRef(jsContext, jsValue, jsException);
+ if (!jsObject) {
+ return false;
+ }
+ JSObjectRef stringCtor = GetStringConstructor(jsContext, jsException);
+ if (!stringCtor) {
+ return false;
+ }
+ return JSValueIsInstanceOfConstructor(jsContext, jsObject, stringCtor,
+ jsException);
+}
+
+#if 0 // For debugging purposes only.
+void PrintJSString(JSStringRef jsString)
+{
+ size_t length = JSStringGetMaximumUTF8CStringSize(jsString);
+ char* buffer = new char[length];
+ JSStringGetUTF8CString(jsString, buffer, length);
+ std::cerr << "JSString: " << buffer << std::endl;
+ delete[] buffer;
+}
+
+void PrintJSValue(JSContextRef jsContext, JSValueRef jsValue)
+{
+ JSValueRef jsException = NULL;
+ JSStringRef jsResult = JSValueToStringCopy(jsContext, jsValue,
+ &jsException);
+ if (!jsException && jsValue) {
+ PrintJSString(jsResult);
+ } else {
+ std::cerr << "Could not convert the value to string." << std::endl;
+ }
+}
+#endif
+
+/*
+ *
+ */
+JSStringRef ToJSStringRef(JNIEnv* env, jstring jstr) {
+ if (!jstr) {
+ return NULL;
+ }
+
+ JStringWrap jstrw(env, jstr);
+ if (!jstrw.jstr()) {
+ return NULL;
+ }
+
+ return JSStringCreateWithCharacters(static_cast<const JSChar*>(jstrw.jstr()),
+ static_cast<size_t>(jstrw.length()));
+}
+
+/*
+ *
+ */
+JNIEXPORT jboolean JNICALL Java_com_google_gwt_dev_shell_mac_LowLevelSaf_isJsNull
+ (JNIEnv *env, jclass klass, jint context, jint value) {
+ TR_ENTER();
+ JSContextRef jsContext = ToJSContextRef(context);
+ JSValueRef jsValue = ToJSValueRef(value);
+ if (!jsContext || !jsValue) {
+ TR_FAIL();
+ return JNI_FALSE;
+ }
+ TR_LEAVE();
+ return static_cast<jboolean>(JSValueIsNull(jsContext, jsValue));
+}
+
+/*
+ *
+ */
+JNIEXPORT jboolean JNICALL Java_com_google_gwt_dev_shell_mac_LowLevelSaf_isJsUndefined
+ (JNIEnv *env, jclass klass, jint context, jint value) {
+ TR_ENTER();
+ JSContextRef jsContext = ToJSContextRef(context);
+ JSValueRef jsValue = ToJSValueRef(value);
+ if (!jsContext || !jsValue) {
+ TR_FAIL();
+ return JNI_FALSE;
+ }
+ TR_LEAVE();
+ return static_cast<jboolean>(JSValueIsUndefined(jsContext, jsValue));
+}
+
+/*
+ *
+ */
+JNIEXPORT jint JNICALL Java_com_google_gwt_dev_shell_mac_LowLevelSaf_getJsUndefined
+ (JNIEnv *env, jclass klass, jint context) {
+ TR_ENTER();
+ JSContextRef jsContext = ToJSContextRef(context);
+ if (!jsContext) {
+ return static_cast<jint>(NULL);
+ }
+
+ JSValueRef jsUndefined = JSValueMakeUndefined(jsContext);
+ JSValueProtectChecked(jsContext, jsUndefined);
+ TR_LEAVE();
+ return reinterpret_cast<jint>(jsUndefined);
+}
+
+/*
+ *
+ */
+JNIEXPORT jint JNICALL Java_com_google_gwt_dev_shell_mac_LowLevelSaf_getJsNull
+ (JNIEnv *env, jclass klass, jint context) {
+ TR_ENTER();
+ JSContextRef jsContext = ToJSContextRef(context);
+ if (!jsContext) {
+ return static_cast<jint>(NULL);
+ }
+ JSValueRef jsNull = JSValueMakeNull(jsContext);
+ JSValueProtectChecked(jsContext, jsNull);
+ TR_LEAVE();
+ return reinterpret_cast<jint>(jsNull);
+}
+
+/*
+ *
+ */
+JNIEXPORT jboolean JNICALL Java_com_google_gwt_dev_shell_mac_LowLevelSaf_isJsBoolean
+ (JNIEnv *env, jclass klass, jint context, jint value) {
+ TR_ENTER();
+ JSContextRef jsContext = ToJSContextRef(context);
+ JSValueRef jsValue = ToJSValueRef(value);
+ if (!jsContext || !jsValue) {
+ TR_FAIL();
+ return JNI_FALSE;
+ }
+ TR_LEAVE();
+ return static_cast<jboolean>(JSValueIsBoolean(jsContext, jsValue));
+}
+
+/*
+ *
+ */
+JNIEXPORT jboolean JNICALL Java_com_google_gwt_dev_shell_mac_LowLevelSaf_isJsNumber
+ (JNIEnv *env, jclass klass, jint context, jint value) {
+ TR_ENTER();
+ JSContextRef jsContext = ToJSContextRef(context);
+ JSValueRef jsValue = ToJSValueRef(value);
+ if (!jsContext || !jsValue) {
+ TR_FAIL();
+ return JNI_FALSE;
+ }
+ TR_LEAVE();
+ return static_cast<jboolean>(JSValueIsNumber(jsContext, jsValue));
+}
+
+/*
+ *
+ */
+JNIEXPORT jboolean JNICALL Java_com_google_gwt_dev_shell_mac_LowLevelSaf_toJsBooleanImpl
+ (JNIEnv *env, jclass klass, jint context, jboolean jValue, jintArray rval) {
+ TR_ENTER();
+ JSContextRef jsContext = ToJSContextRef(context);
+ if (!jsContext) {
+ TR_FAIL();
+ return JNI_FALSE;
+ }
+
+ JSValueRef jsValue = JSValueMakeBoolean(jsContext, static_cast<bool>(jValue));
+
+ env->SetIntArrayRegion(rval, 0, 1, reinterpret_cast<const jint*>(&jsValue));
+ if (env->ExceptionCheck()) {
+ TR_FAIL();
+ return JNI_FALSE;
+ }
+ JSValueProtectChecked(jsContext, jsValue);
+
+ TR_LEAVE();
+ return JNI_TRUE;
+}
+
+/*
+ *
+ */
+JNIEXPORT void JNICALL Java_com_google_gwt_dev_shell_mac_LowLevelSaf_gcUnprotect
+ (JNIEnv *env, jclass klass, jint context, jint value) {
+ TR_ENTER();
+ JSContextRef jsContext = ToJSContextRef(context);
+ JSValueRef jsValue = ToJSValueRef(value);
+ if (!jsContext || !jsValue) {
+ return;
+ }
+ JSValueUnprotectChecked(jsContext, jsValue);
+ TR_LEAVE();
+}
+
+/*
+ *
+ */
+JNIEXPORT jboolean JNICALL Java_com_google_gwt_dev_shell_mac_LowLevelSaf_toJsNumberImpl
+ (JNIEnv *env, jclass klass, jint context, jdouble jValue, jintArray rval) {
+ TR_ENTER();
+ JSContextRef jsContext = ToJSContextRef(context);
+ if (!jsContext) {
+ TR_FAIL();
+ return JNI_FALSE;
+ }
+
+ JSValueRef jsValue = JSValueMakeNumber(jsContext, static_cast<jdouble>(jValue));
+
+ env->SetIntArrayRegion(rval, 0, 1, reinterpret_cast<const jint*>(&jsValue));
+ if (env->ExceptionCheck()) {
+ TR_FAIL();
+ return JNI_FALSE;
+ }
+
+ JSValueProtectChecked(jsContext, jsValue);
+
+ TR_LEAVE();
+ return JNI_TRUE;
+}
+
+/*
+ *
+ */
+JNIEXPORT jboolean JNICALL Java_com_google_gwt_dev_shell_mac_LowLevelSaf_executeScriptWithInfoImpl
+ (JNIEnv *env, jclass klass, jint context, jstring jScript, jstring jUrl,
+ jint jLine, jintArray rval) {
+ TR_ENTER();
+ JSValueRef jsException = NULL;
+
+ JSContextRef jsContext = ToJSContextRef(context);
+ if (!jsContext) {
+ TR_FAIL();
+ return JNI_FALSE;
+ }
+
+ JSStringRef jsScript = ToJSStringRef(env, jScript);
+ if (!jsScript) {
+ TR_FAIL();
+ return JNI_FALSE;
+ }
+
+ JSStringRef jsUrl = ToJSStringRef(env, jUrl);
+
+ // Evaluate will set this to global object.
+ JSValueRef jsResult = JSEvaluateScript(jsContext, jsScript, NULL, jsUrl,
+ static_cast<int>(jLine), &jsException);
+ if (jsException) {
+ TR_FAIL();
+ return JNI_FALSE;
+ }
+
+ JSStringRelease(jsScript);
+ if (jsUrl) {
+ JSStringRelease(jsUrl);
+ }
+
+ env->SetIntArrayRegion(rval, 0, 1, reinterpret_cast<const jint*>(&jsResult));
+ if (env->ExceptionCheck()) {
+ TR_FAIL();
+ return JNI_FALSE;
+ }
+
+ JSValueProtectChecked(jsContext, jsResult);
+
+ TR_LEAVE();
+ return JNI_TRUE;
+}
+
+/*
+ *
+ */
+JNIEXPORT jboolean JNICALL Java_com_google_gwt_dev_shell_mac_LowLevelSaf_toJsStringImpl
+ (JNIEnv *env, jclass klass, jint context, jstring jValue, jintArray rval) {
+ TR_ENTER();
+ JSContextRef jsContext = ToJSContextRef(context);
+ if (!jsContext) {
+ TR_FAIL();
+ return JNI_FALSE;
+ }
+
+ JSStringRef jsString = ToJSStringRef(env, jValue);
+ if (!jsString) {
+ TR_FAIL();
+ return JNI_FALSE;
+ }
+
+ JSValueRef jsValue = JSValueMakeString(jsContext, jsString);
+ JSStringRelease(jsString);
+
+ env->SetIntArrayRegion(rval, 0, 1, reinterpret_cast<const jint*>(&jsValue));
+ if (env->ExceptionCheck()) {
+ TR_FAIL();
+ return JNI_FALSE;
+ }
+
+ JSValueProtectChecked(jsContext, jsValue);
+
+ TR_LEAVE();
+ return JNI_TRUE;
+}
+
+/*
+ *
+ */
+JNIEXPORT jboolean JNICALL Java_com_google_gwt_dev_shell_mac_LowLevelSaf_isJsStringImpl
+ (JNIEnv *env, jclass klass, jint context, jint value, jbooleanArray rval) {
+ TR_ENTER();
+ JSContextRef jsContext = ToJSContextRef(context);
+ JSValueRef jsValue = ToJSValueRef(value);
+ if (!jsContext || !jsValue) {
+ TR_FAIL();
+ return JNI_FALSE;
+ }
+
+ bool isString = JSValueIsString(jsContext, jsValue);
+ if (!isString) {
+ JSValueRef jsException = NULL;
+ isString = IsObjectOfStringConstructor(jsContext, jsValue, &jsException);
+ if (jsException) {
+ TR_FAIL();
+ return JNI_FALSE;
+ }
+ }
+
+ jboolean jIsString = static_cast<jboolean>(isString);
+ env->SetBooleanArrayRegion(rval, 0, 1, &jIsString);
+ if (env->ExceptionCheck()) {
+ TR_FAIL();
+ return JNI_FALSE;
+ }
+
+ TR_LEAVE();
+ return JNI_TRUE;
+}
+
+/*
+ *
+ */
+JNIEXPORT jboolean JNICALL Java_com_google_gwt_dev_shell_mac_LowLevelSaf_invokeImpl
+ (JNIEnv *env, jclass klass, jint context, jint scriptValue,
+ jstring jMethodName, jint thisVal, jintArray jArgs, jint jArgsLength,
+ jintArray rval) {
+ TR_ENTER();
+
+ JSContextRef jsContext = ToJSContextRef(context);
+ if (!jsContext) {
+ TR_FAIL();
+ return JNI_FALSE;
+ }
+
+ JSObjectRef jsScriptObj = ToJSObjectRef(jsContext, scriptValue, NULL);
+ if (!jsScriptObj) {
+ TR_FAIL();
+ return JNI_FALSE;
+ }
+
+ JSValueRef jsThisVal = ToJSValueRef(thisVal);
+ JSObjectRef jsThisObj = NULL;
+ // If thisVal is null, jsNull, or jsUndefined use the script object
+ // as this.
+ if (!jsThisVal || JSValueIsNull(jsContext, jsThisVal)
+ || JSValueIsUndefined(jsContext, jsThisVal)) {
+ jsThisObj = jsScriptObj;
+ } else {
+ // If we are given a value, ensure that it is an object.
+ jsThisObj = ToJSObjectRef(jsContext, jsThisVal, NULL);
+ if (!jsThisObj) {
+ TR_FAIL();
+ return JNI_FALSE;
+ }
+ }
+
+ JSStringRef jsMethodName = ToJSStringRef(env, jMethodName);
+ if (!jsMethodName) {
+ TR_FAIL();
+ return JNI_FALSE;
+ }
+
+ JSObjectRef jsMethod = ToJSObjectRef(jsContext, JSObjectGetProperty(jsContext,
+ jsScriptObj, jsMethodName, NULL), NULL);
+ if (!jsMethod || !JSObjectIsFunction(jsContext, jsMethod)) {
+ TR_FAIL();
+ return JNI_FALSE;
+ }
+
+ JSStringRelease(jsMethodName);
+
+ // NOTE (knorton): Fix for 64-bit.
+ JSValueRef* jsArgs = new JSValueRef[static_cast<size_t>(jArgsLength)];
+ env->GetIntArrayRegion(jArgs, 0, jArgsLength,
+ reinterpret_cast<jint*>(jsArgs));
+ if (env->ExceptionCheck()) {
+ TR_FAIL();
+ delete[] jsArgs;
+ return JNI_FALSE;
+ }
+
+ JSValueRef jsException = NULL;
+ JSValueRef jsResult = JSObjectCallAsFunction(jsContext, jsMethod, jsThisObj,
+ static_cast<size_t>(jArgsLength), jsArgs, &jsException);
+ if (jsException) {
+ TR_FAIL();
+ delete[] jsArgs;
+ return JNI_FALSE;
+ }
+ delete[] jsArgs;
+
+ env->SetIntArrayRegion(rval, 0, 1, reinterpret_cast<const jint*>(&jsResult));
+ if (env->ExceptionCheck()) {
+ TR_FAIL();
+ return JNI_FALSE;
+ }
+
+ JSValueProtectChecked(jsContext, jsResult);
+
+ TR_LEAVE();
+ return JNI_TRUE;
+}
+
+/*
+ *
+ */
+JNIEXPORT jboolean JNICALL Java_com_google_gwt_dev_shell_mac_LowLevelSaf_isJsObject
+ (JNIEnv *env, jclass klass, jint context, jint value) {
+ TR_ENTER();
+ JSContextRef jsContext = ToJSContextRef(context);
+ JSValueRef jsValue = ToJSValueRef(value);
+ if (!jsContext || !jsValue) {
+ TR_FAIL();
+ return JNI_FALSE;
+ }
+
+ TR_LEAVE();
+ return static_cast<jboolean>(JSValueIsObject(jsContext, jsValue));
+}
+
+JNIEXPORT jboolean JNICALL Java_com_google_gwt_dev_shell_mac_LowLevelSaf_toBooleanImpl
+ (JNIEnv *env, jclass klass, jint context, jint value, jbooleanArray rval) {
+ TR_ENTER();
+ JSContextRef jsContext = ToJSContextRef(context);
+ JSValueRef jsValue = ToJSValueRef(value);
+ if (!jsContext || !jsValue) {
+ TR_FAIL();
+ return JNI_FALSE;
+ }
+
+ jboolean jResult = static_cast<jboolean>(JSValueToBoolean(jsContext, jsValue));
+ env->SetBooleanArrayRegion(rval, 0, 1, &jResult);
+ if (env->ExceptionCheck()) {
+ TR_FAIL();
+ return JNI_FALSE;
+ }
+
+ TR_LEAVE();
+ return JNI_TRUE;
+}
+
+/*
+ *
+ */
+JNIEXPORT jboolean JNICALL Java_com_google_gwt_dev_shell_mac_LowLevelSaf_toDoubleImpl
+ (JNIEnv *env, jclass klass, jint context, jint value, jdoubleArray rval) {
+ TR_ENTER();
+ JSContextRef jsContext = ToJSContextRef(context);
+ JSValueRef jsValue = ToJSValueRef(value);
+ if (!jsContext || !jsValue) {
+ TR_FAIL();
+ return JNI_FALSE;
+ }
+
+ JSValueRef jsException = NULL;
+ double result = JSValueToNumber(jsContext, jsValue, &jsException);
+ if (jsException) {
+ TR_FAIL();
+ return JNI_FALSE;
+ }
+
+ env->SetDoubleArrayRegion(rval, 0, 1, static_cast<jdouble*>(&result));
+ if (env->ExceptionCheck()) {
+ TR_FAIL();
+ return JNI_FALSE;
+ }
+
+ TR_LEAVE();
+ return JNI_TRUE;
+}
+
+/*
+ *
+ */
+JNIEXPORT jboolean JNICALL Java_com_google_gwt_dev_shell_mac_LowLevelSaf_toStringImpl
+ (JNIEnv *env, jclass klass, jint context, jint value, jobjectArray rval) {
+ TR_ENTER();
+ JSValueRef jsException = NULL;
+ JSContextRef jsContext = ToJSContextRef(context);
+ JSValueRef jsValue = ToJSValueRef(value);
+ if (!jsContext || !jsValue) {
+ TR_FAIL();
+ return JNI_FALSE;
+ }
+
+ jstring jResult = NULL;
+ // Convert all objects to their string representation, EXCEPT
+ // null and undefined which will be returned as a true NULL.
+ if (!JSValueIsNull(jsContext, jsValue) &&
+ !JSValueIsUndefined(jsContext, jsValue)) {
+ JSStringRef jsResult = JSValueToStringCopy(jsContext, jsValue, &jsException);
+ if (jsException) {
+ TR_FAIL();
+ return JNI_FALSE;
+ }
+
+ jResult = env->NewString(
+ static_cast<const jchar*>(JSStringGetCharactersPtr(jsResult)),
+ static_cast<jsize>(JSStringGetLength(jsResult)));
+ if (env->ExceptionCheck()) {
+ TR_FAIL();
+ return JNI_FALSE;
+ }
+
+ JSStringRelease(jsResult);
+ }
+
+ env->SetObjectArrayElement(rval, 0, jResult);
+ if (env->ExceptionCheck()) {
+ TR_FAIL();
+ return JNI_FALSE;
+ }
+
+ TR_LEAVE();
+ return JNI_TRUE;
+}
+
+/*
+ *
+ */
+JNIEXPORT jboolean JNICALL Java_com_google_gwt_dev_shell_mac_LowLevelSaf_wrapDispatchObjectImpl
+ (JNIEnv *env, jclass klass, jint context, jobject dispatch, jintArray rval) {
+ TR_ENTER();
+ JSContextRef jsContext = ToJSContextRef(context);
+ if (!jsContext) {
+ TR_FAIL();
+ return JNI_FALSE;
+ }
+
+ JSObjectRef jsDispatch = gwt::DispatchObjectCreate(jsContext, dispatch);
+ if (!jsDispatch || env->ExceptionCheck()) {
+ TR_FAIL();
+ return JNI_FALSE;
+ }
+
+ env->SetIntArrayRegion(rval, 0, 1, reinterpret_cast<jint*>(&jsDispatch));
+ if (env->ExceptionCheck()) {
+ TR_FAIL();
+ return JNI_FALSE;
+ }
+
+ JSValueProtectChecked(jsContext, jsDispatch);
+
+ TR_LEAVE();
+ return JNI_TRUE;
+}
+
+/*
+ *
+ */
+JNIEXPORT jboolean JNICALL Java_com_google_gwt_dev_shell_mac_LowLevelSaf_unwrapDispatchObjectImpl
+ (JNIEnv *env, jclass klass, jint context, jint value, jobjectArray rval) {
+ TR_ENTER();
+ JSContextRef jsContext = ToJSContextRef(context);
+ JSValueRef jsValue = ToJSValueRef(value);
+ if (!jsContext || !jsValue) {
+ TR_FAIL();
+ return JNI_FALSE;
+ }
+
+ if (!JSValueIsObjectOfClass(jsContext, jsValue, gwt::GetDispatchObjectClass())) {
+ TR_FAIL();
+ return JNI_FALSE;
+ }
+
+ JSObjectRef jsObject = ToJSObjectRef(jsContext, jsValue, NULL);
+ if (!jsObject) {
+ TR_FAIL();
+ return JNI_FALSE;
+ }
+
+ env->SetObjectArrayElement(rval, 0, reinterpret_cast<jobject>(JSObjectGetPrivate(jsObject)));
+ if (env->ExceptionCheck()) {
+ TR_FAIL();
+ return JNI_FALSE;
+ }
+
+ TR_LEAVE();
+ return JNI_TRUE;
+}
+
+/*
+ *
+ */
+JNIEXPORT jboolean JNICALL Java_com_google_gwt_dev_shell_mac_LowLevelSaf_initImpl
+ (JNIEnv *env, jclass klass, jclass dispatchObjectClass,
+ jclass dispatchMethodClass) {
+ TR_ENTER();
+ TR_LEAVE();
+ return static_cast<jboolean>(gwt::Initialize(env, dispatchObjectClass, dispatchMethodClass));
+}
+
+/*
+ *
+ */
+JNIEXPORT jboolean JNICALL Java_com_google_gwt_dev_shell_mac_LowLevelSaf_wrapDispatchMethodImpl
+ (JNIEnv *env, jclass klass, jint context, jstring name, jobject jDispatch,
+ jintArray rval) {
+ TR_ENTER();
+ JSContextRef jsContext = ToJSContextRef(context);
+ if (!jsContext) {
+ TR_FAIL();
+ return JNI_FALSE;
+ }
+
+ JStringWrap nameWrap(env, name);
+ std::string nameStr(nameWrap.str());
+ JSObjectRef jsDispatch = gwt::DispatchMethodCreate(jsContext, nameStr,
+ jDispatch);
+ if (!jsDispatch || env->ExceptionCheck()) {
+ TR_FAIL();
+ return JNI_FALSE;
+ }
+
+ env->SetIntArrayRegion(rval, 0, 1, reinterpret_cast<jint*>(&jsDispatch));
+ if (env->ExceptionCheck()) {
+ TR_FAIL();
+ return JNI_FALSE;
+ }
+
+ JSValueProtectChecked(jsContext, jsDispatch);
+
+ TR_LEAVE();
+ return JNI_TRUE;
+}
+
+/*
+ *
+ */
+JNIEXPORT jstring JNICALL Java_com_google_gwt_dev_shell_mac_LowLevelSaf_getTypeString
+ (JNIEnv *env, jclass klass, jint context, jint value) {
+ TR_ENTER();
+ JSContextRef jsContext = ToJSContextRef(context);
+ JSValueRef jsValue = ToJSValueRef(value);
+ if (!jsContext || !jsValue) {
+ return NULL;
+ }
+
+ switch (JSValueGetType(jsContext, jsValue)) {
+ case kJSTypeUndefined:
+ return env->NewStringUTF("undefined");
+ case kJSTypeNull:
+ return env->NewStringUTF("null");
+ case kJSTypeBoolean:
+ return env->NewStringUTF("boolean");
+ case kJSTypeNumber:
+ return env->NewStringUTF("number");
+ case kJSTypeString:
+ return env->NewStringUTF("string");
+ case kJSTypeObject:
+ return (JSValueIsObjectOfClass(jsContext, jsValue, gwt::GetDispatchObjectClass()))
+ ? env->NewStringUTF("Java object") : env->NewStringUTF("JavaScript object");
+ default:
+ return env->NewStringUTF("unknown");
+ }
+}
+
+/*
+ *
+ */
+JNIEXPORT jboolean JNICALL Java_com_google_gwt_dev_shell_mac_LowLevelSaf_isDispatchObjectImpl
+ (JNIEnv *env, jclass klass, jint context, jint value, jbooleanArray rval) {
+ TR_ENTER();
+ JSContextRef jsContext = ToJSContextRef(context);
+ JSValueRef jsValue = ToJSValueRef(value);
+ if (!jsContext || !jsValue) {
+ TR_FAIL();
+ return JNI_FALSE;
+ }
+
+ jboolean jIsDispatchObject = static_cast<jboolean>(JSValueIsObjectOfClass(
+ jsContext, jsValue, gwt::GetDispatchObjectClass()));
+ env->SetBooleanArrayRegion(rval, 0, 1, &jIsDispatchObject);
+ if (env->ExceptionCheck()) {
+ TR_FAIL();
+ return JNI_FALSE;
+ }
+
+ TR_LEAVE();
+ return JNI_TRUE;
+}
+
+/*
+ *
+ */
+JNIEXPORT jint JNICALL Java_com_google_gwt_dev_shell_mac_LowLevelSaf_getArgc
+ (JNIEnv *env, jclass klass) {
+ return *_NSGetArgc();
+}
+
+/*
+ *
+ */
+JNIEXPORT jstring JNICALL Java_com_google_gwt_dev_shell_mac_LowLevelSaf_getArgv
+ (JNIEnv *env, jclass klass, jint index) {
+ int argc = *_NSGetArgc();
+ if (index < 0 || index >= argc) {
+ return 0;
+ }
+ char **argv = *_NSGetArgv();
+ return env->NewStringUTF(argv[index]);
+}
+
+/*
+ *
+ */
+JNIEXPORT jboolean JNICALL Java_com_google_gwt_dev_shell_mac_LowLevelSaf_getGlobalJsObjectImpl
+ (JNIEnv *env, jclass klass, jint context, jintArray rval) {
+ TR_ENTER();
+
+ JSContextRef jsContext = ToJSContextRef(context);
+ if (!jsContext) {
+ TR_FAIL();
+ return JNI_FALSE;
+ }
+
+ JSObjectRef jsGlobalObject = JSContextGetGlobalObject(jsContext);
+ env->SetIntArrayRegion(rval, 0, 1, reinterpret_cast<jint*>(&jsGlobalObject));
+ if (env->ExceptionCheck()) {
+ TR_FAIL();
+ return JNI_FALSE;
+ }
+
+ JSValueProtectChecked(jsContext, jsGlobalObject);
+
+ TR_LEAVE();
+ return JNI_TRUE;
+}
+
+/*
+ *
+ */
+JNIEXPORT void JNICALL Java_com_google_gwt_dev_shell_mac_LowLevelSaf_gcProtect
+ (JNIEnv *env, jclass klass, jint context, jint value) {
+ TR_ENTER();
+
+ JSContextRef jsContext = ToJSContextRef(context);
+ JSValueRef jsValue = ToJSValueRef(value);
+ if (!jsContext || !jsValue) {
+ return;
+ }
+
+ JSValueProtectChecked(jsContext, jsValue);
+ TR_LEAVE();
+}
+
+/*
+ *
+ */
+JNIEXPORT void JNICALL Java_com_google_gwt_dev_shell_mac_LowLevelSaf_retainJsGlobalContext
+ (JNIEnv *env, jclass klass, jint context) {
+ TR_ENTER();
+ JSGlobalContextRef jsContext = reinterpret_cast<JSGlobalContextRef>(context);
+ if (!jsContext) {
+ TR_FAIL();
+ return;
+ }
+ JSGlobalContextRetain(jsContext);
+ TR_LEAVE();
+}
+
+/*
+ *
+ */
+JNIEXPORT void JNICALL Java_com_google_gwt_dev_shell_mac_LowLevelSaf_releaseJsGlobalContext
+ (JNIEnv *env, jclass klass, jint context) {
+ TR_ENTER();
+ JSGlobalContextRef jsContext = reinterpret_cast<JSGlobalContextRef>(context);
+ if (!jsContext) {
+ TR_FAIL();
+ return;
+ }
+ JSGlobalContextRelease(jsContext);
+ TR_LEAVE();
+}
+
+/*
+ *
+ */
+JNIEXPORT jboolean JNICALL Java_com_google_gwt_dev_shell_mac_LowLevelSaf_isGcProtected
+ (JNIEnv *env, jclass klass, jint value) {
+ JSValueRef jsValue = ToJSValueRef(value);
+ TR_ENTER();
+ TR_LEAVE();
+ return static_cast<jboolean>(JSValueIsProtected(jsValue));
+}
+
+JNIEXPORT jboolean JNICALL Java_com_google_gwt_dev_shell_mac_LowLevelSaf_isJsValueProtectionCheckingEnabledImpl
+ (JNIEnv *env, jclass klass) {
+ TR_ENTER();
+ TR_LEAVE();
+ return static_cast<jboolean>(JSValueProtectCheckingIsEnabled());
+}
diff --git a/jni/mac/java-dispatch.cpp b/jni/mac/java-dispatch.cpp
new file mode 100644
index 0000000..60ec10a
--- /dev/null
+++ b/jni/mac/java-dispatch.cpp
@@ -0,0 +1,478 @@
+/*
+ * Copyright 2008 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+#include <string>
+#include <sstream>
+#include "jni.h"
+#include "java-dispatch.h"
+#include "trace.h"
+#include "JStringWrap.h"
+
+namespace gwt {
+
+ /*
+ * Declarations for private functions.
+ */
+ JSClassRef DispatchObjectClassCreate();
+
+ JSClassRef DispatchMethodClassCreate();
+
+ JSValueRef DispatchObjectGetProperty(JSContextRef, JSObjectRef, JSStringRef,
+ JSValueRef*);
+
+ JSValueRef DispatchObjectToString(JSContextRef, JSObjectRef, JSObjectRef,
+ size_t, const JSValueRef*, JSValueRef*);
+
+ bool DispatchObjectSetProperty(JSContextRef, JSObjectRef, JSStringRef,
+ JSValueRef, JSValueRef*);
+
+ void DispatchObjectFinalize(JSObjectRef);
+
+ JSValueRef DispatchMethodCallAsFunction(JSContextRef, JSObjectRef,
+ JSObjectRef, size_t,
+ const JSValueRef*, JSValueRef*);
+
+ JSValueRef DispatchMethodGetToString(JSContextRef, JSObjectRef, JSStringRef,
+ JSValueRef*);
+
+ JSValueRef DispatchMethodToString(JSContextRef, JSObjectRef, JSObjectRef,
+ size_t, const JSValueRef*, JSValueRef*);
+
+ void DispatchMethodFinalize(JSObjectRef);
+
+ /*
+ * The class definition stuct for DispatchObjects.
+ */
+ static JSClassDefinition _dispatchObjectClassDef = { 0,
+ kJSClassAttributeNone, "DispatchObject", 0, 0, 0, 0,
+ DispatchObjectFinalize, 0, DispatchObjectGetProperty,
+ DispatchObjectSetProperty, 0, 0, 0, 0, 0, 0 };
+
+ /*
+ * The class definition structs for DispatchMethods.
+ */
+ static JSStaticValue _dispatchMethodStaticValues[] = {
+ { "toString", DispatchMethodGetToString, 0, kJSPropertyAttributeNone },
+ { 0, 0, 0, 0 }
+ };
+ static JSClassDefinition _dispatchMethodClassDef = { 0,
+ kJSClassAttributeNoAutomaticPrototype, "DispatchMethod", 0,
+ _dispatchMethodStaticValues, 0, 0, DispatchMethodFinalize, 0, 0, 0, 0,
+ 0, DispatchMethodCallAsFunction, 0, 0, 0 };
+
+ /*
+ * The classes used to create DispatchObjects and DispatchMethods.
+ */
+ static JSClassRef _dispatchObjectClass = DispatchObjectClassCreate();
+ static JSClassRef _dispatchMethodClass = DispatchMethodClassCreate();
+
+ /*
+ * Java class and method references needed to do delegation.
+ */
+ static JNIEnv* _javaEnv;
+ static jclass _javaDispatchObjectClass;
+ static jclass _javaDispatchMethodClass;
+ static jmethodID _javaDispatchObjectSetFieldMethod;
+ static jmethodID _javaDispatchObjectGetFieldMethod;
+ static jmethodID _javaDispatchMethodInvokeMethod;
+ static jmethodID _javaDispatchObjectToStringMethod;
+
+ /*
+ * Structure to hold DispatchMethod private data.
+ *
+ * NOTE: utf8Name is defensively copied.
+ */
+ class DispatchMethodData {
+ public:
+ DispatchMethodData(jobject jObject, std::string& utf8Name)
+ : _jObject(jObject), _utf8Name(utf8Name) { }
+ ~DispatchMethodData() {
+ _javaEnv->DeleteGlobalRef(_jObject);
+ }
+ jobject _jObject;
+ std::string _utf8Name;
+ };
+
+/*
+ * The following takes the prototype from the Function constructor, this allows
+ * us to easily support call and apply on our objects that support CallAsFunction.
+ *
+ * NOTE: The return value is not protected.
+ */
+JSValueRef GetFunctionPrototype(JSContextRef jsContext, JSValueRef* exception) {
+ TR_ENTER();
+ JSObjectRef globalObject = JSContextGetGlobalObject(jsContext);
+ JSStringRef fnPropName= JSStringCreateWithUTF8CString("Function");
+ JSValueRef fnCtorValue = JSObjectGetProperty(jsContext, globalObject,
+ fnPropName, exception);
+ JSStringRelease(fnPropName);
+ if (!fnCtorValue) {
+ return JSValueMakeUndefined(jsContext);
+ }
+
+ JSObjectRef fnCtorObject = JSValueToObject(jsContext, fnCtorValue, exception);
+ if (!fnCtorObject) {
+ return JSValueMakeUndefined(jsContext);
+ }
+
+ JSStringRef protoPropName = JSStringCreateWithUTF8CString("prototype");
+ JSValueRef fnPrototype = JSObjectGetProperty(jsContext, fnCtorObject,
+ protoPropName, exception);
+ JSStringRelease(protoPropName);
+ if (!fnPrototype) {
+ return JSValueMakeUndefined(jsContext);
+ }
+
+ TR_LEAVE();
+ return fnPrototype;
+}
+
+/*
+ *
+ */
+JSClassRef GetDispatchObjectClass() {
+ TR_ENTER();
+ TR_LEAVE();
+ return _dispatchObjectClass;
+}
+
+/*
+ *
+ */
+JSClassRef GetDispatchMethodClass() {
+ TR_ENTER();
+ TR_LEAVE();
+ return _dispatchMethodClass;
+}
+
+/*
+ *
+ */
+JSClassRef DispatchObjectClassCreate() {
+ TR_ENTER();
+ JSClassRef dispClass = JSClassCreate(&_dispatchObjectClassDef);
+ JSClassRetain(dispClass);
+ TR_LEAVE();
+ return dispClass;
+}
+
+/*
+ *
+ */
+JSClassRef DispatchMethodClassCreate() {
+ TR_ENTER();
+ JSClassRef dispClass = JSClassCreate(&_dispatchMethodClassDef);
+ JSClassRetain(dispClass);
+ TR_LEAVE();
+ return dispClass;
+}
+
+/*
+ * NOTE: The object returned from this function is not protected.
+ */
+JSObjectRef DispatchObjectCreate(JSContextRef jsContext, jobject jObject) {
+ TR_ENTER();
+ JSObjectRef dispInst = JSObjectMake(jsContext, _dispatchObjectClass,
+ _javaEnv->NewGlobalRef(jObject));
+ TR_LEAVE();
+ return dispInst;
+}
+
+/*
+ * NOTE: The object returned from this function is not protected.
+ */
+JSObjectRef DispatchMethodCreate(JSContextRef jsContext, std::string& name,
+ jobject jObject) {
+ TR_ENTER();
+
+ JSObjectRef dispInst = JSObjectMake(jsContext, _dispatchMethodClass,
+ new DispatchMethodData(_javaEnv->NewGlobalRef(jObject), name));
+
+ // This could only be cached relative to jsContext.
+ JSValueRef fnProtoValue = GetFunctionPrototype(jsContext, NULL);
+ JSObjectSetPrototype(jsContext, dispInst, fnProtoValue);
+ TR_LEAVE();
+ return dispInst;
+}
+
+/*
+ * NOTE: The value returned from this function is not protected, but all
+ * JSValues that are passed into Java are protected before the invocation.
+ */
+JSValueRef DispatchObjectGetProperty(JSContextRef jsContext,
+ JSObjectRef jsObject, JSStringRef jsPropertyName,
+ JSValueRef* jsException) {
+ TR_ENTER();
+
+ // If you call toString on a DispatchObject, you should get the results
+ // of the java object's toString invcation.
+ if (JSStringIsEqualToUTF8CString(jsPropertyName, "toString")) {
+ JSObjectRef jsFunction = JSObjectMakeFunctionWithCallback(jsContext,
+ jsPropertyName, DispatchObjectToString);
+ return jsFunction;
+ }
+
+ // The class check is omitted because it should not be possible to tear off
+ // a getter.
+ jobject jObject = reinterpret_cast<jobject>(JSObjectGetPrivate(jsObject));
+
+ jstring jPropertyName = _javaEnv->NewString(
+ static_cast<const jchar*>(JSStringGetCharactersPtr(jsPropertyName)),
+ static_cast<jsize>(JSStringGetLength(jsPropertyName)));
+ if (!jObject || !jPropertyName || _javaEnv->ExceptionCheck()) {
+ TR_FAIL();
+ _javaEnv->ExceptionClear();
+ return JSValueMakeUndefined(jsContext);
+ }
+
+ JSValueRef jsResult = reinterpret_cast<JSValueRef>(
+ _javaEnv->CallIntMethod(jObject, _javaDispatchObjectGetFieldMethod,
+ reinterpret_cast<jint>(jsContext),
+ jPropertyName));
+ if (!jsResult || _javaEnv->ExceptionCheck()) {
+ TR_FAIL();
+ _javaEnv->ExceptionClear();
+ return JSValueMakeUndefined(jsContext);
+ }
+
+ // Java left us an extra reference to eat.
+ JSValueUnprotectChecked(jsContext, jsResult);
+ TR_LEAVE();
+ return jsResult;
+}
+
+/*
+ *
+ */
+bool DispatchObjectSetProperty(JSContextRef jsContext, JSObjectRef jsObject,
+ JSStringRef jsPropertyName, JSValueRef jsValue, JSValueRef* jsException) {
+ TR_ENTER();
+
+ // The class check is omitted because it should not be possible to tear off
+ // a getter.
+ jobject jObject = reinterpret_cast<jobject>(JSObjectGetPrivate(jsObject));
+
+ jstring jPropertyName = _javaEnv->NewString(
+ static_cast<const jchar*>(JSStringGetCharactersPtr(jsPropertyName)),
+ static_cast<jsize>(JSStringGetLength(jsPropertyName)));
+ if (!jObject || !jPropertyName || _javaEnv->ExceptionCheck()) {
+ _javaEnv->ExceptionClear();
+ return false;
+ }
+
+ JSValueProtectChecked(jsContext, jsValue);
+
+ _javaEnv->CallIntMethod(jObject, _javaDispatchObjectSetFieldMethod,
+ reinterpret_cast<jint>(jsContext), jPropertyName,
+ reinterpret_cast<jint>(jsValue));
+ if (_javaEnv->ExceptionCheck()) {
+ _javaEnv->ExceptionClear();
+ return false;
+ }
+
+ TR_LEAVE();
+ return true;
+}
+
+/*
+ *
+ */
+void DispatchObjectFinalize(JSObjectRef jsObject) {
+ TR_ENTER();
+ jobject jObject = reinterpret_cast<jobject>(JSObjectGetPrivate(jsObject));
+ _javaEnv->DeleteGlobalRef(jObject);
+ TR_LEAVE();
+}
+
+/*
+ *
+ */
+void DispatchMethodFinalize(JSObjectRef jsObject) {
+ TR_ENTER();
+ DispatchMethodData* data = reinterpret_cast<DispatchMethodData*>(
+ JSObjectGetPrivate(jsObject));
+ delete data;
+ TR_LEAVE();
+}
+
+/*
+ * NOTE: The value returned from this function is not protected.
+ */
+JSValueRef DispatchObjectToString(JSContextRef jsContext, JSObjectRef,
+ JSObjectRef jsThis, size_t, const JSValueRef*, JSValueRef*) {
+ TR_ENTER();
+
+ // This function cannot be torn off and applied to any JSValue. If this does
+ // not reference a DispatchObject, return undefined.
+ if (!JSValueIsObjectOfClass(jsContext, jsThis, GetDispatchObjectClass())) {
+ return JSValueMakeUndefined(jsContext);
+ }
+
+ jobject jObject = reinterpret_cast<jobject>(JSObjectGetPrivate(jsThis));
+ jstring jResult = reinterpret_cast<jstring>(
+ _javaEnv->CallObjectMethod(jObject, _javaDispatchObjectToStringMethod));
+ if (_javaEnv->ExceptionCheck()) {
+ return JSValueMakeUndefined(jsContext);
+ } else if (!jResult) {
+ return JSValueMakeNull(jsContext);
+ } else {
+ JStringWrap result(_javaEnv, jResult);
+ JSStringRef resultString = JSStringCreateWithCharacters(
+ static_cast<const JSChar*>(result.jstr()),
+ static_cast<size_t>(result.length()));
+ JSValueRef jsResultString = JSValueMakeString(jsContext, resultString);
+ JSStringRelease(resultString);
+ return jsResultString;
+ }
+ TR_LEAVE();
+}
+
+/*
+ *
+ */
+JSValueRef DispatchMethodCallAsFunction(JSContextRef jsContext,
+ JSObjectRef jsFunction, JSObjectRef jsThis, size_t argumentCount,
+ const JSValueRef arguments[], JSValueRef* exception) {
+ TR_ENTER();
+
+ // We don't need to check the class here because we take the private
+ // data from jsFunction and not jsThis.
+
+ DispatchMethodData* data = reinterpret_cast<DispatchMethodData*>(
+ JSObjectGetPrivate(jsFunction));
+ jobject jObject = data->_jObject;
+
+ jintArray jArguments = _javaEnv->NewIntArray(argumentCount);
+ if (!jArguments || _javaEnv->ExceptionCheck()) {
+ return JSValueMakeUndefined(jsContext);
+ }
+
+ // This single element int array will be passed into the java call to allow the
+ // called java method to raise an exception. We will check for a non-null value
+ // after the call is dispatched.
+ jintArray jException = _javaEnv->NewIntArray(1);
+ if (!jException || _javaEnv->ExceptionCheck()) {
+ return JNI_FALSE;
+ }
+
+ for (size_t i = 0; i < argumentCount; ++i) {
+ JSValueRef arg = arguments[i];
+ // Java will take ownership of the arguments.
+ JSValueProtectChecked(jsContext, arg);
+ _javaEnv->SetIntArrayRegion(jArguments, i, 1, reinterpret_cast<jint*>(&arg));
+ if (_javaEnv->ExceptionCheck()) {
+ return JSValueMakeUndefined(jsContext);
+ }
+ }
+
+ // Java will take ownership of this.
+ JSValueProtectChecked(jsContext, jsThis);
+
+ JSValueRef jsResult = reinterpret_cast<JSValueRef>(_javaEnv->CallIntMethod(jObject,
+ _javaDispatchMethodInvokeMethod, reinterpret_cast<jint>(jsContext),
+ reinterpret_cast<jint>(jsThis), jArguments, jException));
+ if (_javaEnv->ExceptionCheck()) {
+ return JSValueMakeUndefined(jsContext);
+ }
+
+ JSValueRef jsException = NULL;
+ _javaEnv->GetIntArrayRegion(jException, 0, 1, reinterpret_cast<jint*>(&jsException));
+ if (!_javaEnv->ExceptionCheck() && jsException) {
+ // If the java dispatch set an exception, then we pass it back to our caller.
+ if (exception) {
+ *exception = jsException;
+ }
+ // Java left us an extra reference to eat.
+ JSValueUnprotectChecked(jsContext, jsException);
+ }
+
+ // Java left us an extra reference to eat.
+ JSValueUnprotectChecked(jsContext, jsResult);
+ TR_LEAVE();
+ return jsResult;
+}
+
+/*
+ * NOTE: The object returned from this function is not protected.
+ */
+JSValueRef DispatchMethodToString(JSContextRef jsContext, JSObjectRef,
+ JSObjectRef thisObject, size_t, const JSValueRef*, JSValueRef*) {
+ TR_ENTER();
+
+ // This function cannot be torn off and applied to any JSValue. If this does
+ // not reference a DispatchMethod, return undefined.
+ if (!JSValueIsObjectOfClass(jsContext, thisObject, GetDispatchMethodClass())) {
+ return JSValueMakeUndefined(jsContext);
+ }
+
+ std::ostringstream ss;
+ DispatchMethodData* data = reinterpret_cast<DispatchMethodData*>(
+ JSObjectGetPrivate(thisObject));
+ ss << "function " << data->_utf8Name << "() {\n [native code]\n}\n";
+ JSStringRef stringRep = JSStringCreateWithUTF8CString(ss.str().c_str());
+ JSValueRef jsStringRep = JSValueMakeString(jsContext, stringRep);
+ JSStringRelease(stringRep);
+ TR_LEAVE();
+ return jsStringRep;
+}
+
+/*
+ * NOTE: The object returned from this function is not protected.
+ */
+JSValueRef DispatchMethodGetToString(JSContextRef jsContext,
+ JSObjectRef jsObject, JSStringRef jsPropertyName, JSValueRef* jsException) {
+ TR_ENTER();
+ JSObjectRef toStringFn = JSObjectMakeFunctionWithCallback(jsContext,
+ jsPropertyName, DispatchMethodToString);
+ TR_LEAVE();
+ return toStringFn;
+}
+
+/*
+ *
+ */
+bool Initialize(JNIEnv* javaEnv, jclass javaDispatchObjectClass,
+ jclass javaDispatchMethodClass) {
+ TR_ENTER();
+ if (!javaEnv || !javaDispatchObjectClass || !javaDispatchMethodClass) {
+ return false;
+ }
+
+ _javaEnv = javaEnv;
+ _javaDispatchObjectClass = static_cast<jclass>(
+ javaEnv->NewGlobalRef(javaDispatchObjectClass));
+ _javaDispatchMethodClass = static_cast<jclass>(
+ javaEnv->NewGlobalRef(javaDispatchMethodClass));
+ _javaDispatchObjectSetFieldMethod = javaEnv->GetMethodID(
+ javaDispatchObjectClass, "setField", "(ILjava/lang/String;I)V");
+ _javaDispatchObjectGetFieldMethod = javaEnv->GetMethodID(
+ javaDispatchObjectClass, "getField", "(ILjava/lang/String;)I");
+ _javaDispatchMethodInvokeMethod = javaEnv->GetMethodID(
+ javaDispatchMethodClass, "invoke", "(II[I[I)I");
+ _javaDispatchObjectToStringMethod = javaEnv->GetMethodID(
+ javaDispatchObjectClass, "toString", "()Ljava/lang/String;");
+
+ if (!_javaDispatchObjectSetFieldMethod || !_javaDispatchObjectGetFieldMethod
+ || !_javaDispatchMethodInvokeMethod || !_javaDispatchObjectToStringMethod
+ || javaEnv->ExceptionCheck()) {
+ return false;
+ }
+
+ TR_LEAVE();
+ return true;
+}
+
+} // namespace gwt
diff --git a/jni/mac/java-dispatch.h b/jni/mac/java-dispatch.h
new file mode 100644
index 0000000..4ff15c9
--- /dev/null
+++ b/jni/mac/java-dispatch.h
@@ -0,0 +1,65 @@
+/*
+ * Copyright 2008 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+#ifndef JAVA_DISPATCHER_H__
+#define JAVA_DISPATCHER_H__
+#include <iostream>
+#include <JavaScriptCore/JavaScriptCore.h>
+#include <jni.h>
+
+namespace gwt {
+
+/*
+ * Initializes static members needed by DispatchObjects and DispatchMethods.
+ * This should be called before before calling either DispatchMethodCreate or
+ * DispatchObjectCreate.
+ */
+bool Initialize(JNIEnv*, jclass, jclass);
+
+/*
+ * Returns a shared reference to the DispatchObject class
+ */
+JSClassRef GetDispatchObjectClass();
+
+/*
+ * Constructs a new DispatchObject.
+ *
+ * jContext - the JavaScript context
+ * jObject - the java instance of DispatchObject to which
+ * this instance will dispatch calls
+ */
+JSObjectRef DispatchObjectCreate(JSContextRef jContext, jobject jObject);
+
+/*
+ * Returns a shared reference to the DispatchMethod class
+ */
+JSClassRef GetDispatchMethodClass();
+
+/*
+ * Constructs a new DispatchMethod object.
+ *
+ * jsContext - the JavaScript context
+ * name - the name of the method (used in toString)
+ * jObject - the java instance of DispatchMethod to which this object will
+ * delegate calls.
+ */
+JSObjectRef DispatchMethodCreate(JSContextRef jsContext, std::string& name,
+ jobject jObject);
+
+
+} // namespace gwt
+
+#endif // JAVA_DISPATCHER_H__
diff --git a/jni/mac/10.4/org.eclipse.swt/webkit.c b/jni/mac/org.eclipse.swt/webkit.c
similarity index 100%
rename from jni/mac/10.4/org.eclipse.swt/webkit.c
rename to jni/mac/org.eclipse.swt/webkit.c
diff --git a/jni/mac/prebuilt/libgwt-ll.jnilib b/jni/mac/prebuilt/libgwt-ll.jnilib
new file mode 100755
index 0000000..4f62d3d
--- /dev/null
+++ b/jni/mac/prebuilt/libgwt-ll.jnilib
Binary files differ
diff --git a/jni/mac/trace.cpp b/jni/mac/trace.cpp
new file mode 100644
index 0000000..2127351
--- /dev/null
+++ b/jni/mac/trace.cpp
@@ -0,0 +1,68 @@
+/*
+ * Copyright 2008 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+#include <iostream>
+#include <map>
+#include <JavaScriptCore/JavaScriptCore.h>
+#include "trace.h"
+
+#ifdef ENABLE_JSVALUE_PROTECTION_CHECKING
+static std::map<JSValueRef, int> _protectMap;
+#endif
+
+/*
+ *
+ */
+void JSValueProtectChecked(JSContextRef jsContext, JSValueRef jsValue) {
+ JSValueProtect(jsContext, jsValue);
+#ifdef ENABLE_JSVALUE_PROTECTION_CHECKING
+ _protectMap[jsValue]++;
+#endif
+}
+
+/*
+ *
+ */
+void JSValueUnprotectChecked(JSContextRef jsContext, JSValueRef jsValue) {
+#ifdef ENABLE_JSVALUE_PROTECTION_CHECKING
+ // Unrecord in a hash_map
+ unsigned count = _protectMap[jsValue];
+ if (count == 0) {
+ std::cerr << "[WARNING] JSValueUnprotect called on unprotected JSValueRef (0x"
+ << std::hex << ((unsigned)jsValue) << ")" << std::endl;
+ return;
+ }
+ _protectMap[jsValue] = count - 1;
+#else
+ JSValueUnprotect(jsContext, jsValue);
+#endif
+}
+
+bool JSValueIsProtected(JSValueRef jsValue) {
+#ifdef ENABLE_JSVALUE_PROTECTION_CHECKING
+ return _protectMap[jsValue] > 0;
+#else
+ return true;
+#endif
+}
+
+bool JSValueProtectCheckingIsEnabled() {
+#ifdef ENABLE_JSVALUE_PROTECTION_CHECKING
+ return true;
+#else
+ return false;
+#endif
+}
diff --git a/jni/mac/trace.h b/jni/mac/trace.h
new file mode 100644
index 0000000..e58ca96
--- /dev/null
+++ b/jni/mac/trace.h
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2008 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+#ifndef TRACE_H__
+#define TRACE_H__
+#include <iostream>
+#include <map>
+
+// Uncomment to trace enter, exit and fail for all native calls.
+// #define ENABLE_CALL_TRACE
+
+// Uncomment to double check that JSValueRef's are protected and
+// unprotected properly.
+// #define ENABLE_JSVALUE_PROTECTION_CHECKING
+
+#ifdef ENABLE_CALL_TRACE
+#define TR_ENTER() std::cout << "ENTER " << __PRETTY_FUNCTION__ << std::endl
+#define TR_LEAVE() std::cout << "LEAVE " << __PRETTY_FUNCTION__ << std::endl
+#define TR_FAIL() std::cout << "FAIL " << __FILE__ << "@" << __LINE__ \
+ << std::endl;
+#else
+#define TR_ENTER()
+#define TR_LEAVE()
+#define TR_FAIL()
+#endif // ENABLE_CALL_TRACE
+
+void JSValueUnprotectChecked(JSContextRef, JSValueRef);
+void JSValueProtectChecked(JSContextRef, JSValueRef);
+bool JSValueIsProtected(JSValueRef jsValue);
+bool JSValueProtectCheckingIsEnabled();
+
+#endif // TRACE_H__