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/common.ant.xml b/common.ant.xml
index 9fde76c..eae0885 100755
--- a/common.ant.xml
+++ b/common.ant.xml
@@ -74,19 +74,7 @@
 		</and>
 	</condition>
 	<condition property="build.host.platform" value="mac">
-            <isset property="build.host.ismac" />
-	</condition>
-	<condition property="build.host.platform.detail" value="mac_10.5">
-		<and>
-			<isset property="build.host.ismac" />
-			<contains string="${os.version}" substring="10.5." />
-		</and>
-	</condition>
-	<condition property="build.host.platform.detail" value="mac_10.4">
-		<and>
-			<isset property="build.host.ismac" />
-			<contains string="${os.version}" substring="10.4." />
-		</and>
+		<isset property="build.host.ismac" />
 	</condition>
 
 	<condition property="build.host.iswindows">
@@ -97,17 +85,12 @@
 	</condition>
 	<fail unless="build.host.platform" message="Building on ${os.name} is not supported" />
 
-	<!-- for OS's that don't need to set a detail revision 
-             (i.e. as of 3mar08, all but MacOS) -->
-	<property name="build.host.platform.detail" 
-	          value="${build.host.platform}" />
-
 	<condition property="junit.platform.args" value="-XstartOnFirstThread" else="">
 		<isset property="build.host.ismac" />
 	</condition>
 
 	<!-- JUnit support -->
-	<property name="gwt.dev.staging.jar" location="${gwt.build.staging}/gwt-${build.host.platform.detail}-${gwt.version}/gwt-dev-${build.host.platform}.jar" />
+	<property name="gwt.dev.staging.jar" location="${gwt.build.staging}/gwt-${build.host.platform}-${gwt.version}/gwt-dev-${build.host.platform}.jar" />
 	<property name="gwt.junit.port" value="8888" />
 	<property name="gwt.junit.testcase.includes" value="**/*Suite.class"/>
 	
diff --git a/dev/mac/src/com/google/gwt/dev/shell/mac/BrowserWidgetSaf.java b/dev/mac/src/com/google/gwt/dev/shell/mac/BrowserWidgetSaf.java
index 406fc14..4c83fa7 100644
--- a/dev/mac/src/com/google/gwt/dev/shell/mac/BrowserWidgetSaf.java
+++ b/dev/mac/src/com/google/gwt/dev/shell/mac/BrowserWidgetSaf.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2006 Google Inc.
+ * 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
@@ -24,24 +24,28 @@
 import com.google.gwt.dev.shell.mac.LowLevelSaf.DispatchObject;
 
 import org.eclipse.swt.browser.Browser;
-import org.eclipse.swt.browser.WebKit;
 import org.eclipse.swt.widgets.Shell;
 
+import java.util.HashMap;
+import java.util.Map;
+
 /**
  * Represents an individual browser window and all of its controls.
  */
 public class BrowserWidgetSaf extends BrowserWidget {
   private class ExternalObject implements DispatchObject {
 
-    public int getField(String name) {
+    public int getField(int jsContext, String name) {
       if ("gwtonload".equalsIgnoreCase(name)) {
-        return LowLevelSaf.wrapFunction("gwtOnload", new GwtOnLoad());
+        return LowLevelSaf.wrapDispatchMethod(jsContext, "gwtOnload",
+            new GwtOnLoad());
       }
-      return 0;
+      // Native code eats the same ref it gave us.
+      return LowLevelSaf.getJsUndefined(jsContext);
     }
 
     public Object getTarget() {
-      return null;
+      return this;
     }
 
     public boolean gwtOnLoad(int scriptObject, String moduleName) {
@@ -57,8 +61,16 @@
         Integer key = new Integer(scriptObject);
         ModuleSpaceHost msh = getHost().createModuleSpaceHost(
             BrowserWidgetSaf.this, moduleName);
+
+        /*
+         * The global context for each window object is recorded during the
+         * windowScriptObjectAvailable event. Now that we know which window
+         * belongs to this module, we can resolve the correct global context.
+         */
+        final int globalContext = globalContexts.get(scriptObject).intValue();
+
         ModuleSpace moduleSpace = new ModuleSpaceSaf(msh, scriptObject,
-            moduleName, key);
+            globalContext, moduleName, key);
         attachModuleSpace(moduleSpace);
         return true;
       } catch (Throwable e) {
@@ -72,7 +84,14 @@
       }
     }
 
-    public void setField(String name, int value) {
+    public void setField(int jsContext, String name, int value) {
+      try {
+        // TODO (knorton): This should produce an error. The SetProperty
+        // callback on the native side should be changed to pass an exception
+        // array.
+      } finally {
+        LowLevelSaf.gcUnprotect(jsContext, value);
+      }
     }
 
     /**
@@ -88,17 +107,18 @@
       doUnload(key);
     }
   }
+
   private static final class GwtOnLoad implements DispatchMethod {
 
-    public int invoke(int execState, int jsthis, int[] jsargs) {
-      int jsFalse = LowLevelSaf.convertBoolean(false);
-      LowLevelSaf.pushExecState(execState);
+    public int invoke(int jsContext, int jsthis, int[] jsargs, int[] exception) {
+      int jsFalse = LowLevelSaf.toJsBoolean(jsContext, false);
+      LowLevelSaf.pushJsContext(jsContext);
       try {
-        if (!LowLevelSaf.isWrappedDispatch(jsthis)) {
+        if (!LowLevelSaf.isDispatchObject(jsContext, jsthis)) {
           return jsFalse;
         }
 
-        Object thisObj = LowLevelSaf.unwrapDispatch(jsthis);
+        Object thisObj = LowLevelSaf.unwrapDispatchObject(jsContext, jsthis);
         if (!(thisObj instanceof ExternalObject)) {
           return jsFalse;
         }
@@ -107,22 +127,27 @@
           return jsFalse;
         }
 
-        if (!LowLevelSaf.isObject(jsargs[0])) {
+        if (!LowLevelSaf.isJsObject(jsContext, jsargs[0])) {
           return jsFalse;
         }
-        if (!LowLevelSaf.isNull(jsargs[1])
-            && !LowLevelSaf.isString(jsargs[1])) {
+        if (!LowLevelSaf.isJsNull(jsContext, jsargs[1])
+            && !LowLevelSaf.isJsString(jsContext, jsargs[1])) {
           return jsFalse;
         }
-        String moduleName = LowLevelSaf.coerceToString(execState, jsargs[1]);
+        String moduleName = LowLevelSaf.toString(jsContext, jsargs[1]);
 
         boolean result = ((ExternalObject) thisObj).gwtOnLoad(jsargs[0],
             moduleName);
-        return LowLevelSaf.convertBoolean(result);
+        // Native code eats the same ref it gave us.
+        return LowLevelSaf.toJsBoolean(jsContext, result);
       } catch (Throwable e) {
         return jsFalse;
       } finally {
-        LowLevelSaf.popExecState(execState);
+        for (int jsarg : jsargs) {
+          LowLevelSaf.gcUnprotect(jsContext, jsarg);
+        }
+        LowLevelSaf.gcUnprotect(jsContext, jsthis);
+        LowLevelSaf.popJsContext(jsContext);
       }
     }
   }
@@ -133,26 +158,41 @@
     LowLevelSaf.init();
   }
 
+  private final Map<Integer, Integer> globalContexts = new HashMap<Integer, Integer>();
+
   public BrowserWidgetSaf(Shell shell, BrowserWidgetHost host) {
     super(shell, host);
 
     Browser.setWebInspectorEnabled(true);
-    browser.setUserAgentApplicationName("Safari 419.3");
     browser.addWindowScriptObjectListener(new Browser.WindowScriptObjectListener() {
 
       public void windowScriptObjectAvailable(int windowScriptObject) {
-        int sel = WebKit.sel_registerName("_imp");
-        int windowObject = WebKit.objc_msgSend(windowScriptObject, sel);
+        /*
+         * When GwtOnLoad fires we may not be able to get to the JSGlobalContext
+         * that corresponds to our module frame (since the call to GwtOnLoad
+         * could originate in the main page. So as each frame fires a
+         * windowScriptObjectAvailable event, we must store all window,
+         * globalContext pairs in a HashMap so we can later look up the global
+         * context by window object when GwtOnLoad is called.
+         */
+        int jsGlobalContext = browser.getGlobalContextForWindowObject(windowScriptObject);
+        int jsGlobalObject = LowLevelSaf.getGlobalJsObject(jsGlobalContext);
+        LowLevelSaf.pushJsContext(jsGlobalContext);
+
         try {
-          LowLevelSaf.jsLock();
-          final int globalExec = LowLevelSaf.getGlobalExecState(windowObject);
-          int external = LowLevelSaf.wrapDispatch(new ExternalObject());
-          LowLevelSaf.executeScript(globalExec,
+          globalContexts.put(Integer.valueOf(jsGlobalObject),
+              Integer.valueOf(jsGlobalContext));
+
+          int external = LowLevelSaf.wrapDispatchObject(jsGlobalContext,
+              new ExternalObject());
+          LowLevelSaf.executeScript(jsGlobalContext,
               "function __defineExternal(x) {" + "  window.external = x;" + "}");
-          LowLevelSaf.invoke(globalExec, windowObject, "__defineExternal",
-              windowObject, new int[] {external});
+          int ignoredResult = LowLevelSaf.invoke(jsGlobalContext,
+              jsGlobalObject, "__defineExternal", jsGlobalObject,
+              new int[] {external});
+          LowLevelSaf.gcUnprotect(jsGlobalContext, ignoredResult);
         } finally {
-          LowLevelSaf.jsUnlock();
+          LowLevelSaf.popJsContext(jsGlobalContext);
         }
       }
 
diff --git a/dev/mac/src/com/google/gwt/dev/shell/mac/JsValueSaf.java b/dev/mac/src/com/google/gwt/dev/shell/mac/JsValueSaf.java
index 6a0f4c1..36faef1 100644
--- a/dev/mac/src/com/google/gwt/dev/shell/mac/JsValueSaf.java
+++ b/dev/mac/src/com/google/gwt/dev/shell/mac/JsValueSaf.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2007 Google Inc.
+ * 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
@@ -35,7 +35,6 @@
 public class JsValueSaf extends JsValue {
 
   private static class JsCleanupSaf implements JsCleanup {
-    private final Throwable creationStackTrace;
     private final int jsval;
 
     /**
@@ -44,9 +43,8 @@
      * 
      * @param jsval JSValue pointer as an integer
      */
-    public JsCleanupSaf(int jsval, Throwable creationStackTrace) {
+    public JsCleanupSaf(int jsval) {
       this.jsval = jsval;
-      this.creationStackTrace = creationStackTrace;
     }
 
     /*
@@ -55,16 +53,11 @@
      * @see com.google.gwt.dev.shell.JsValue.JsCleanup#doCleanup()
      */
     public void doCleanup() {
-      LowLevelSaf.gcUnlock(jsval, creationStackTrace);
+      LowLevelSaf.gcUnprotect(LowLevelSaf.getCurrentJsContext(), jsval);
     }
   }
 
   /*
-   * Stores a stack trace of the creation site for debugging.
-   */
-  private Throwable creationStackTrace;
-
-  /*
    * Underlying JSValue* as an integer.
    */
   private int jsval;
@@ -73,7 +66,7 @@
    * Create a Java wrapper around an undefined JSValue.
    */
   public JsValueSaf() {
-    init(LowLevelSaf.jsUndefined());
+    init(LowLevelSaf.getJsUndefined(LowLevelSaf.getCurrentJsContext()));
   }
 
   /**
@@ -87,14 +80,14 @@
 
   @Override
   public boolean getBoolean() {
-    int curExecState = LowLevelSaf.getExecState();
-    return LowLevelSaf.coerceToBoolean(curExecState, jsval);
+    int curJsContext = LowLevelSaf.getCurrentJsContext();
+    return LowLevelSaf.toBoolean(curJsContext, jsval);
   }
 
   @Override
   public int getInt() {
-    int curExecState = LowLevelSaf.getExecState();
-    return LowLevelSaf.coerceToInt(curExecState, jsval);
+    int currentJsContext = LowLevelSaf.getCurrentJsContext();
+    return LowLevelSaf.toInt(currentJsContext, jsval);
   }
 
   @Override
@@ -112,30 +105,31 @@
 
   @Override
   public double getNumber() {
-    int curExecState = LowLevelSaf.getExecState();
-    return LowLevelSaf.coerceToDouble(curExecState, jsval);
+    int currentJsContext = LowLevelSaf.getCurrentJsContext();
+    return LowLevelSaf.toDouble(currentJsContext, jsval);
   }
 
   @Override
   public String getString() {
-    int curExecState = LowLevelSaf.getExecState();
-    return LowLevelSaf.coerceToString(curExecState, jsval);
+    final int currentJsContext = LowLevelSaf.getCurrentJsContext();
+    return LowLevelSaf.toString(currentJsContext, jsval);
   }
 
   @Override
   public String getTypeString() {
-    return LowLevelSaf.getTypeString(jsval);
+    return LowLevelSaf.getTypeString(LowLevelSaf.getCurrentJsContext(), jsval);
   }
 
   @Override
   public Object getWrappedJavaObject() {
-    DispatchObject obj = LowLevelSaf.unwrapDispatch(jsval);
+    DispatchObject obj = LowLevelSaf.unwrapDispatchObject(
+        LowLevelSaf.getCurrentJsContext(), jsval);
     return obj.getTarget();
   }
 
   @Override
   public boolean isBoolean() {
-    return LowLevelSaf.isBoolean(jsval);
+    return LowLevelSaf.isJsBoolean(LowLevelSaf.getCurrentJsContext(), jsval);
   }
 
   @Override
@@ -146,61 +140,60 @@
 
   @Override
   public boolean isJavaScriptObject() {
-    return LowLevelSaf.isObject(jsval) && !LowLevelSaf.isWrappedDispatch(jsval);
+    final int currentJsContext = LowLevelSaf.getCurrentJsContext();
+    return LowLevelSaf.isJsObject(currentJsContext, jsval)
+        && !LowLevelSaf.isDispatchObject(currentJsContext, jsval);
   }
 
   @Override
   public boolean isNull() {
-    return LowLevelSaf.isNull(jsval);
+    return LowLevelSaf.isJsNull(LowLevelSaf.getCurrentJsContext(), jsval);
   }
 
   @Override
   public boolean isNumber() {
-    return LowLevelSaf.isNumber(jsval);
-  }
-
-  public boolean isObject() {
-    return LowLevelSaf.isObject(jsval);
+    return LowLevelSaf.isJsNumber(LowLevelSaf.getCurrentJsContext(), jsval);
   }
 
   @Override
   public boolean isString() {
-    return LowLevelSaf.isString(jsval);
+    return LowLevelSaf.isJsString(LowLevelSaf.getCurrentJsContext(), jsval);
   }
 
   @Override
   public boolean isUndefined() {
-    return LowLevelSaf.isUndefined(jsval);
+    return LowLevelSaf.isJsUndefined(LowLevelSaf.getCurrentJsContext(), jsval);
   }
 
   @Override
   public boolean isWrappedJavaObject() {
-    return LowLevelSaf.isWrappedDispatch(jsval);
+    return LowLevelSaf.isDispatchObject(LowLevelSaf.getCurrentJsContext(),
+        jsval);
   }
 
   @Override
   public void setBoolean(boolean val) {
-    setJsVal(LowLevelSaf.convertBoolean(val));
+    setJsVal(LowLevelSaf.toJsBoolean(LowLevelSaf.getCurrentJsContext(), val));
   }
 
   @Override
   public void setByte(byte val) {
-    setJsVal(LowLevelSaf.convertDouble(val));
+    setJsVal(LowLevelSaf.toJsNumber(LowLevelSaf.getCurrentJsContext(), val));
   }
 
   @Override
   public void setChar(char val) {
-    setJsVal(LowLevelSaf.convertDouble(val));
+    setJsVal(LowLevelSaf.toJsNumber(LowLevelSaf.getCurrentJsContext(), val));
   }
 
   @Override
   public void setDouble(double val) {
-    setJsVal(LowLevelSaf.convertDouble(val));
+    setJsVal(LowLevelSaf.toJsNumber(LowLevelSaf.getCurrentJsContext(), val));
   }
 
   @Override
   public void setInt(int val) {
-    setJsVal(LowLevelSaf.convertDouble(val));
+    setJsVal(LowLevelSaf.toJsNumber(LowLevelSaf.getCurrentJsContext(), val));
   }
 
   /**
@@ -210,28 +203,28 @@
    * @param jsval the new value to set
    */
   public void setJsVal(int jsval) {
-    LowLevelSaf.gcUnlock(this.jsval, creationStackTrace);
+    LowLevelSaf.gcUnprotect(LowLevelSaf.getCurrentJsContext(), this.jsval);
     init(jsval);
   }
 
   @Override
   public void setNull() {
-    setJsVal(LowLevelSaf.jsNull());
+    setJsVal(LowLevelSaf.getJsNull(LowLevelSaf.getCurrentJsContext()));
   }
 
   @Override
   public void setShort(short val) {
-    setJsVal(LowLevelSaf.convertDouble(val));
+    setJsVal(LowLevelSaf.toJsNumber(LowLevelSaf.getCurrentJsContext(), val));
   }
 
   @Override
   public void setString(String val) {
-    setJsVal(LowLevelSaf.convertString(val));
+    setJsVal(LowLevelSaf.toJsString(LowLevelSaf.getCurrentJsContext(), val));
   }
 
   @Override
   public void setUndefined() {
-    setJsVal(LowLevelSaf.jsUndefined());
+    setJsVal(LowLevelSaf.getJsUndefined(LowLevelSaf.getCurrentJsContext()));
   }
 
   @Override
@@ -241,7 +234,7 @@
      * Add another lock to this jsval, since both the other object and this one
      * will eventually release it.
      */
-    LowLevelSaf.gcLock(jsvalOther);
+    LowLevelSaf.gcProtect(LowLevelSaf.getCurrentJsContext(), jsvalOther);
     setJsVal(jsvalOther);
   }
 
@@ -256,12 +249,13 @@
     } else {
       dispObj = new WebKitDispatchAdapter(cl, val);
     }
-    setJsVal(LowLevelSaf.wrapDispatch(dispObj));
+    setJsVal(LowLevelSaf.wrapDispatchObject(LowLevelSaf.getCurrentJsContext(),
+        dispObj));
   }
 
   @Override
   protected JsCleanup createCleanupObject() {
-    return new JsCleanupSaf(jsval, creationStackTrace);
+    return new JsCleanupSaf(jsval);
   }
 
   /**
@@ -272,12 +266,14 @@
   private void init(int jsval) {
     this.jsval = jsval;
 
-    // only create and fill in the stack trace if we are debugging
-    if (LowLevelSaf.debugObjectCreation) {
-      this.creationStackTrace = new Throwable();
-      this.creationStackTrace.fillInStackTrace();
-    } else {
-      this.creationStackTrace = null;
+    // If protection checking is enabled, we check to see if the value we are
+    // accepting is protected as it should be.
+    if (LowLevelSaf.isJsValueProtectionCheckingEnabled()
+        && !LowLevelSaf.isGcProtected(jsval)) {
+      throw new RuntimeException("Cannot accepted unprotected JSValue ("
+          + Integer.toHexString(jsval) + ", "
+          + LowLevelSaf.getTypeString(LowLevelSaf.getCurrentJsContext(), jsval)
+          + ")");
     }
   }
 
diff --git a/dev/mac/src/com/google/gwt/dev/shell/mac/LowLevelSaf.java b/dev/mac/src/com/google/gwt/dev/shell/mac/LowLevelSaf.java
index 7912d15..82825ae 100644
--- a/dev/mac/src/com/google/gwt/dev/shell/mac/LowLevelSaf.java
+++ b/dev/mac/src/com/google/gwt/dev/shell/mac/LowLevelSaf.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2007 Google Inc.
+ * 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
@@ -16,525 +16,341 @@
 package com.google.gwt.dev.shell.mac;
 
 import com.google.gwt.dev.shell.LowLevel;
-import com.google.gwt.util.tools.Utility;
 
-import java.io.File;
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.io.StringWriter;
 import java.util.Stack;
 
 /**
- * Various low-level helper methods for dealing with Safari.
+ * Implements all native / low-level functions for Mac/Safari hosted mode.
  * 
- * The basic rule is that any JSValue passed to Java code from native code will
- * always be GC-protected in the native code and Java will always unprotect it
- * when the value is finalized. It should always be stored in a JsValue object
- * immediately to make sure it is cleaned up properly when it is no longer
- * needed. This approach is required to avoid a race condition where the value
- * is allocated in JNI code but could be garbage collected before Java takes
- * ownership of the value. Java values passed into JavaScript store a GlobalRef
- * of a WebKitDispatchAdapter or MethodDispatch objects, which are freed when
- * the JS value is finalized.
+ * TODO (knorton): Consider changing the APIs to not have to take a jsContext;
+ * instead the context could always be pulled from top-of-stack in the wrapper
+ * functions and passed into the native functions.
  */
 public class LowLevelSaf {
-  /**
-   * Flag to enable tracking of object creation sites. Package-protected to
-   * allow JsValueSaf to use it as well.
-   */
-  static final boolean debugObjectCreation = false;
 
   /**
-   * Provides interface for methods to be exposed on JavaScript side.
+   * Interface by which the native code interacts with a Java Method.
    */
   public interface DispatchMethod {
-    int invoke(int execState, int jsthis, int[] jsargs);
+    int invoke(int jsContext, int jsthis, int[] jsargs, int[] exception);
   }
 
   /**
-   * Provides interface for objects to be exposed on JavaScript side.
+   * Interface by which the native code interacts with a Java Object.
+   * 
+   * TODO (knorton): Add additional argument for an exception array (like in
+   * {@link DispatchMethod#invoke(int, int, int[], int[])}). An example of
+   * where this would be immediately helpful is in {@link BrowserWidgetSaf}.
    */
   public interface DispatchObject {
-    int getField(String name);
+    int getField(int jsContext, String name);
 
     Object getTarget();
 
-    void setField(String name, int value);
+    void setField(int jsContext, String name, int value);
   }
 
-  private static boolean sInitialized = false;
+  private static boolean jsValueProtectionCheckingEnabled;
 
-  private static ThreadLocal<Stack<Integer>> stateStack = new ThreadLocal<Stack<Integer>>();
+  private static boolean initialized = false;
 
-  public static boolean coerceToBoolean(int execState, int jsval) {
+  private static final ThreadLocal<Stack<Integer>> jsContextStack = new ThreadLocal<Stack<Integer>>();
+
+  public static int executeScript(int jsContext, String script) {
+    final int[] rval = new int[1];
+    if (!executeScriptWithInfoImpl(jsContext, script, null, 0, rval)) {
+      throw new RuntimeException("Failed to execute script: " + script);
+    }
+    return rval[0];
+  }
+
+  public static int executeScriptWithInfo(int jsContext, String script,
+      String url, int line) {
+    final int[] rval = new int[1];
+    if (!executeScriptWithInfoImpl(jsContext, script, url, line, rval)) {
+      throw new RuntimeException(url + "(" + line
+          + "): Failed to execute script: " + script);
+    }
+    return rval[0];
+  }
+
+  public static native void gcProtect(int jsContext, int jsValue);
+
+  public static native void gcUnprotect(int jsContext, int jsValue);
+
+  public static native int getArgc();
+
+  public static native String getArgv(int ix);
+
+  public static int getCurrentJsContext() {
+    Stack<Integer> stack = jsContextStack.get();
+    if (stack == null) {
+      throw new RuntimeException("No JSContext stack on this thread.");
+    }
+    return stack.peek().intValue();
+  }
+
+  public static int getGlobalJsObject(int jsContext) {
+    final int rval[] = new int[1];
+    if (!getGlobalJsObjectImpl(jsContext, rval)) {
+      throw new RuntimeException("Unable to get JavaScript global object.");
+    }
+    return rval[0];
+  }
+
+  public static native int getJsNull(int jsContext);
+
+  public static native int getJsUndefined(int jsContext);
+
+  public static String[] getProcessArgs() {
+    int argc = getArgc();
+    String[] result = new String[argc];
+    for (int i = 0; i < argc; ++i) {
+      result[i] = getArgv(i);
+    }
+    return result;
+  }
+
+  public static native String getTypeString(int jsContext, int jsValue);
+
+  public static synchronized void init() {
+    if (initialized) {
+      return;
+    }
+
+    LowLevel.init();
+    if (!initImpl(DispatchObject.class, DispatchMethod.class)) {
+      throw new RuntimeException("Unable to initialize LowLevelSaf");
+    }
+
+    jsValueProtectionCheckingEnabled = isJsValueProtectionCheckingEnabledImpl();
+
+    initialized = true;
+  }
+
+  public static int invoke(int jsContext, int jsScriptObject,
+      String methodName, int thisObj, int[] args) {
+
+    final int[] rval = new int[1];
+    if (!invokeImpl(jsContext, jsScriptObject, methodName, thisObj, args,
+        args.length, rval)) {
+      throw new RuntimeException("Failed to invoke native method: "
+          + methodName + " with " + args.length + " arguments.");
+    }
+    return rval[0];
+  }
+
+  public static boolean isDispatchObject(int jsContext, int jsValue) {
+    final boolean[] rval = new boolean[1];
+    if (!isDispatchObjectImpl(jsContext, jsValue, rval)) {
+      throw new RuntimeException("Failed isDispatchObject.");
+    }
+    return rval[0];
+  }
+
+  public static native boolean isJsBoolean(int jsContext, int jsValue);
+
+  public static native boolean isJsNull(int jsContext, int jsValue);
+
+  public static native boolean isJsNumber(int jsContext, int jsValue);
+
+  public static native boolean isJsObject(int jsContext, int jsValue);
+
+  public static boolean isJsString(int jsContext, int jsValue) {
+    final boolean rval[] = new boolean[1];
+    if (!isJsStringImpl(jsContext, jsValue, rval)) {
+      throw new RuntimeException("Failed isJsString.");
+    }
+    return rval[0];
+  }
+
+  public static native boolean isJsUndefined(int jsContext, int jsValue);
+
+  public static void popJsContext(int expectedJsContext) {
+    final Stack<Integer> stack = jsContextStack.get();
+    if (stack == null) {
+      throw new RuntimeException("No JSContext stack on this thread.");
+    }
+    if (stack.pop().intValue() != expectedJsContext) {
+      throw new RuntimeException(
+          "Popping JSContext returned an unxpected value.");
+    }
+  }
+
+  public static void pushJsContext(int jsContext) {
+    Stack<Integer> stack = jsContextStack.get();
+    if (stack == null) {
+      stack = new Stack<Integer>();
+      jsContextStack.set(stack);
+    }
+    stack.push(Integer.valueOf(jsContext));
+  }
+
+  public static native void releaseJsGlobalContext(int jsContext);
+
+  public static native void retainJsGlobalContext(int jsContext);
+
+  public static boolean toBoolean(int jsContext, int jsValue) {
     boolean[] rval = new boolean[1];
-    if (!_coerceToBoolean(execState, jsval, rval)) {
+    if (!toBooleanImpl(jsContext, jsValue, rval)) {
       throw new RuntimeException("Failed to coerce to boolean value.");
     }
     return rval[0];
   }
 
-  public static byte coerceToByte(int execState, int jsval) {
-    double[] rval = new double[1];
-    if (!_coerceToDouble(execState, jsval, rval)) {
-      throw new RuntimeException("Failed to coerce to byte value");
-    }
-    return (byte) rval[0];
+  public static byte toByte(int jsContext, int jsValue) {
+    return (byte) toNumber(jsContext, jsValue, "byte");
   }
 
-  public static char coerceToChar(int execState, int jsval) {
-    double[] rval = new double[1];
-    if (!_coerceToDouble(execState, jsval, rval)) {
-      throw new RuntimeException("Failed to coerce to char value");
-    }
-    return (char) rval[0];
+  public static char toChar(int jsContext, int jsValue) {
+    return (char) toNumber(jsContext, jsValue, "char");
   }
 
-  public static double coerceToDouble(int execState, int jsval) {
-    double[] rval = new double[1];
-    if (!_coerceToDouble(execState, jsval, rval)) {
-      throw new RuntimeException("Failed to coerce to double value");
+  public static double toDouble(int jsContext, int jsValue) {
+    return toNumber(jsContext, jsValue, "double");
+  }
+
+  public static float toFloat(int jsContext, int jsValue) {
+    return (float) toNumber(jsContext, jsValue, "float");
+  }
+
+  public static int toInt(int jsContext, int jsValue) {
+    return (int) toNumber(jsContext, jsValue, "int");
+  }
+
+  public static int toJsBoolean(int jsContext, boolean value) {
+    final int[] rval = new int[1];
+    if (!toJsBooleanImpl(jsContext, value, rval)) {
+      throw new RuntimeException("Failed to convert Boolean value: "
+          + String.valueOf(value));
     }
     return rval[0];
   }
 
-  public static float coerceToFloat(int execState, int jsval) {
-    double[] rval = new double[1];
-    if (!_coerceToDouble(execState, jsval, rval)) {
-      throw new RuntimeException("Failed to coerce to double value");
+  public static int toJsNumber(int jsContext, double value) {
+    final int[] rval = new int[1];
+    if (!toJsNumberImpl(jsContext, value, rval)) {
+      throw new RuntimeException("Failed to convert Double value: "
+          + String.valueOf(value));
     }
-    return (float) rval[0];
+    return rval[0];
   }
 
-  public static int coerceToInt(int execState, int jsval) {
-    double[] rval = new double[1];
-    if (!_coerceToDouble(execState, jsval, rval)) {
-      throw new RuntimeException("Failed to coerce to int value");
+  public static int toJsString(int jsContext, String value) {
+    final int[] rval = new int[1];
+    if (!toJsStringImpl(jsContext, value, rval)) {
+      throw new RuntimeException("Failed to convert String value: "
+          + String.valueOf(value));
     }
-    return (int) rval[0];
+    return rval[0];
   }
 
-  public static long coerceToLong(int execState, int jsval) {
-    double[] rval = new double[1];
-    if (!_coerceToDouble(execState, jsval, rval)) {
-      throw new RuntimeException("Failed to coerce to long value");
-    }
-    return (long) rval[0];
+  public static long toLong(int jsContext, int jsValue) {
+    return (long) toNumber(jsContext, jsValue, "long");
   }
 
-  public static short coerceToShort(int execState, int jsval) {
-    double[] rval = new double[1];
-    if (!_coerceToDouble(execState, jsval, rval)) {
-      throw new RuntimeException("Failed to coerce to short value");
-    }
-    return (short) rval[0];
+  public static short toShort(int jsContext, int jsValue) {
+    return (short) toNumber(jsContext, jsValue, "short");
   }
 
-  public static String coerceToString(int execState, int jsval) {
-    String[] rval = new String[1];
-    if (!_coerceToString(execState, jsval, rval)) {
+  public static String toString(int jsContext, int jsValue) {
+    final String[] rval = new String[1];
+    if (!toStringImpl(jsContext, jsValue, rval)) {
       throw new RuntimeException("Failed to coerce to String value");
     }
     return rval[0];
   }
 
-  public static int convertBoolean(boolean v) {
-    int[] rval = new int[1];
-    if (!_convertBoolean(v, rval)) {
-      throw new RuntimeException("Failed to convert Boolean value: "
-          + String.valueOf(v));
+  public static DispatchObject unwrapDispatchObject(int jsContext, int jsValue) {
+    final DispatchObject[] rval = new DispatchObject[1];
+    if (!unwrapDispatchObjectImpl(jsContext, jsValue, rval)) {
+      throw new RuntimeException("Failed to unwrap DispatchObject.");
     }
     return rval[0];
   }
 
-  public static int convertDouble(double v) {
-    int[] rval = new int[1];
-    if (!_convertDouble(v, rval)) {
-      throw new RuntimeException("Failed to convert Double value: "
-          + String.valueOf(v));
+  public static int wrapDispatchMethod(int jsContext, String name,
+      DispatchMethod dispatch) {
+    final int[] rval = new int[1];
+    if (!wrapDispatchMethodImpl(jsContext, name, dispatch, rval)) {
+      throw new RuntimeException("Failed to wrap DispatchMethod.");
     }
     return rval[0];
   }
 
-  public static int convertString(String v) {
-    int[] rval = new int[1];
-    if (!_convertString(v, rval)) {
-      throw new RuntimeException("Failed to convert String value: "
-          + String.valueOf(v));
+  public static int wrapDispatchObject(int jsContext, DispatchObject dispatcher) {
+    final int[] rval = new int[1];
+    if (!wrapDispatchObjectImpl(jsContext, dispatcher, rval)) {
+      throw new RuntimeException("Failed to wrap DispatchObject.");
     }
     return rval[0];
   }
 
+  static native boolean isGcProtected(int jsValue);
+
   /**
-   * Executes JavaScript code.
+   * Enables checking of JSValueRef protect/unprotect calls to ensure calls are
+   * properly matched. See ENABLE_JSVALUE_PROTECTION_CHECKING in trace.h to
+   * enable this feature.
    * 
-   * @param execState An opaque handle to the script frame window
-   * @param code The JavaScript code to execute
+   * @return whether JSValue protection checking is enabled
    */
-  public static void executeScript(int execState, String code) {
-    if (!_executeScript(execState, code)) {
-      throw new RuntimeException("Failed to execute script: " + code);
-    }
+  static boolean isJsValueProtectionCheckingEnabled() {
+    return jsValueProtectionCheckingEnabled;
   }
 
-  /**
-   * Executes JavaScript code, retaining file and line information.
-   * 
-   * @param execState An opaque handle to the script frame window
-   * @param code The JavaScript code to execute
-   * @param file A file name associated with the code
-   * @param line A line number associated with the code.
-   */
-  public static void executeScriptWithInfo(int execState, String code,
-      String file, int line) {
-    if (!_executeScriptWithInfo(execState, code, file, line)) {
-      throw new RuntimeException(file + "(" + line
-          + "): Failed to execute script: " + code);
-    }
-  }
+  private static native boolean executeScriptWithInfoImpl(int jsContext,
+      String script, String url, int line, int[] rval);
 
-  public static void gcLock(int jsval) {
-    _gcLock(jsval);
-  }
+  private static native boolean getGlobalJsObjectImpl(int jsContext, int[] rval);
 
-  public static void gcUnlock(int jsval, Throwable creationStackTrace) {
-    String str = null;
-    if (debugObjectCreation) {
-      if (creationStackTrace == null) {
-        creationStackTrace = new Throwable();
-        creationStackTrace.fillInStackTrace();
-      }
-      StringWriter sWriter = new StringWriter();
-      PrintWriter pWriter = new PrintWriter(sWriter);
-      creationStackTrace.printStackTrace(pWriter);
-      str = sWriter.toString();
-      // remove the header line, keep the first 5 lines of the stack trace
-      int begin = str.indexOf("\n") + 1;
-      int nextNL = begin - 1;
-      // loop precondition: nextNL points to a newline or 0 if there is none
-      for (int i = 0; i < 5; ++i) {
-        nextNL = str.indexOf("\n", nextNL + 1);
-        if (nextNL < 0) {
-          break;
-        }
-      }
-      // loop postcondition: nextNL points to the fifth newline or is -1
-      //   if there are not 5 newlines
-      if (nextNL < 0) {
-        str = str.substring(begin);
-      } else {
-        str = str.substring(begin, nextNL);
-      }
-    }
-    _gcUnlock(jsval, str);
-  }
+  private static native boolean initImpl(
+      Class<DispatchObject> dispatchObjectClass,
+      Class<DispatchMethod> dispatchMethodClass);
 
-  public static int getExecState() {
-    Stack<Integer> stack = stateStack.get();
-    if (stack == null) {
-      throw new RuntimeException("No thread local execState stack!");
-    }
-    Integer top = stack.peek();
-    return top.intValue();
-  }
+  private static native boolean invokeImpl(int jsContext, int jsScriptObject,
+      String methodName, int thisObj, int[] args, int argsLength, int[] rval);
 
-  public static int getGlobalExecState(int scriptObject) {
-    int[] rval = new int[1];
-    if (!_getGlobalExecState(scriptObject, rval)) {
-      throw new RuntimeException("Failed to getGlobalExecState.");
-    }
-    return rval[0];
-  }
+  private static native boolean isDispatchObjectImpl(int jsContext,
+      int jsValue, boolean[] rval);
 
-  public static String[] getProcessArgs() {
-    int argc = _getArgc();
-    String[] result = new String[argc];
-    for (int i = 0; i < argc; ++i) {
-      result[i] = _getArgv(i);
-    }
-    return result;
-  }
-
-  public static native String getTypeString(int jsval);
-
-  public static synchronized void init() {
-    // Force LowLevel initialization to load gwt-ll
-    LowLevel.init();
-    String libName = "gwt-webkit";
-    if (!sInitialized) {
-      try {
-        String installPath = Utility.getInstallPath();
-        try {
-          // try to make absolute
-          installPath = new File(installPath).getCanonicalPath();
-        } catch (IOException e) {
-          // ignore problems, failures will occur when the libs try to load
-        }
-
-        System.load(installPath + '/' + System.mapLibraryName(libName));
-        if (!_initNative(DispatchObject.class, DispatchMethod.class)) {
-          throw new RuntimeException("Unable to initialize " + libName);
-        }
-      } catch (UnsatisfiedLinkError e) {
-        StringBuffer sb = new StringBuffer();
-        sb.append("Unable to load required native library '" + libName + "'");
-        sb.append("\n\tYour GWT installation may be corrupt");
-        System.err.println(sb.toString());
-        throw new UnsatisfiedLinkError(sb.toString());
-      }
-      sInitialized = true;
-    }
-  }
-
-  /**
-   * Invokes a method implemented in JavaScript.
-   * 
-   * @param execState an opaque handle to the script frame window
-   * @param methodName the method name on jsthis to call
-   * @param jsthis a wrapped java object as a jsval
-   * @param jsargs the arguments to pass to the method
-   * @return the result of the invocation
-   */
-  public static int invoke(int execState, int scriptObject, String methodName,
-      int jsthis, int[] jsargs) {
-    int[] rval = new int[1];
-    if (!_invoke(execState, scriptObject, methodName, jsthis, jsargs.length,
-        jsargs, rval)) {
-      throw new RuntimeException("Failed to invoke native method: "
-          + methodName + " with " + jsargs.length + " arguments.");
-    }
-    return rval[0];
-  }
-
-  /**
-   * @param jsval the js value in question
-   * @return <code>true</code> if the value is a boolean value
-   */
-  public static native boolean isBoolean(int jsval);
-
-  /**
-   * @param jsval the js value in question
-   * @return <code>true</code> if the value is the null value
-   */
-  public static native boolean isNull(int jsval);
-
-  /**
-   * @param jsval the js value in question
-   * @return <code>true</code> if the value is a boolean value
-   */
-  public static native boolean isNumber(int jsval);
-
-  /**
-   * Is the jsval a JSObject?
-   * 
-   * @param jsval the value
-   * @return true if jsval is a JSObject
-   */
-  public static boolean isObject(int jsval) {
-    return _isObject(jsval);
-  }
-
-  /**
-   * Is the jsval a string primitive?
-   * 
-   * @param jsval the value
-   * @return true if the jsval is a string primitive
-   */
-  public static boolean isString(int jsval) {
-    return _isString(jsval);
-  }
-
-  /**
-   * @param jsval the js value in question
-   * @return <code>true</code> if the value is the undefined value
-   */
-  public static native boolean isUndefined(int jsval);
-
-  /**
-   * Is the jsval JSObject a wrapped DispatchObject?
-   * 
-   * @param jsval the value
-   * @return true if the JSObject is a wrapped DispatchObject
-   */
-  public static boolean isWrappedDispatch(int jsval) {
-    boolean[] rval = new boolean[1];
-    if (!_isWrappedDispatch(jsval, rval)) {
-      throw new RuntimeException("Failed isWrappedDispatch.");
-    }
-    return rval[0];
-  }
-
-  /**
-   * Locks the JavaScript interpreter into this thread; prevents the garbage
-   * collector from running. DON'T CALL THIS THREAD WITHOUT PUTTING A CALL TO
-   * JSUNLOCK INSIDE OF A FINALLY BLOCK OR YOU WILL LOCK THE BROWSER.
-   */
-  public static void jsLock() {
-    _jsLock();
-  }
-
-  /**
-   * @return the null value
-   */
-  public static native int jsNull();
-
-  /**
-   * @return the undefined value
-   */
-  public static native int jsUndefined();
-
-  /**
-   * Unlocks the JavaScript interpreter. Call this method from a finally block
-   * whenever you call jsLock.
-   */
-  public static void jsUnlock() {
-    _jsUnlock();
-  }
-
-  public static void popExecState(int execState) {
-    Stack<Integer> stack = stateStack.get();
-    if (stack == null) {
-      throw new RuntimeException("No thread local execState stack!");
-    }
-    Integer old = stack.pop();
-    if (old.intValue() != execState) {
-      throw new RuntimeException("The wrong execState was popped.");
-    }
-  }
-
-  public static void pushExecState(int execState) {
-    Stack<Integer> stack = stateStack.get();
-    if (stack == null) {
-      stack = new Stack<Integer>();
-      stateStack.set(stack);
-    }
-    stack.push(new Integer(execState));
-  }
-
-  /**
-   * Call this to raise an exception in JavaScript before returning control.
-   * 
-   * @param execState An opaque handle to the script frame window
-   */
-  public static void raiseJavaScriptException(int execState, int jsval) {
-    if (!_raiseJavaScriptException(execState, jsval)) {
-      throw new RuntimeException(
-          "Failed to raise Java Exception into JavaScript.");
-    }
-  }
-
-  /**
-   * Unwraps a wrapped DispatchObject.
-   * 
-   * @param jsval a value previously returned from wrapDispatch
-   * @return the original DispatchObject
-   */
-  public static DispatchObject unwrapDispatch(int jsval) {
-    DispatchObject[] rval = new DispatchObject[1];
-    if (!_unwrapDispatch(jsval, rval)) {
-      throw new RuntimeException("Failed to unwrapDispatch.");
-    }
-    return rval[0];
-  }
-
-  /**
-   * @param dispObj the DispatchObject to wrap
-   * @return the wrapped object as a jsval JSObject
-   */
-  public static int wrapDispatch(DispatchObject dispObj) {
-    int[] rval = new int[1];
-    if (!_wrapDispatch(dispObj, rval)) {
-      throw new RuntimeException("Failed to wrapDispatch.");
-    }
-    return rval[0];
-  }
-
-  /**
-   * @param name method name.
-   * @param dispMeth the DispatchMethod to wrap
-   * @return the wrapped method as a jsval JSObject
-   */
-  public static int wrapFunction(String name, DispatchMethod dispMeth) {
-    int[] rval = new int[1];
-    if (!_wrapFunction(name, dispMeth, rval)) {
-      throw new RuntimeException("Failed to wrapFunction.");
-    }
-    return rval[0];
-  }
-
-  /**
-   * Called from native code to do tracing.
-   * 
-   * @param s the string to trace
-   */
-  protected static void trace(String s) {
-    System.out.println(s);
-    System.out.flush();
-  }
-
-  // CHECKSTYLE_NAMING_OFF
-  private static native boolean _coerceToBoolean(int execState, int jsval,
+  private static native boolean isJsStringImpl(int jsContext, int jsValue,
       boolean[] rval);
 
-  private static native boolean _coerceToDouble(int execState, int jsval,
+  private static native boolean isJsValueProtectionCheckingEnabledImpl();
+
+  private static native boolean toBooleanImpl(int jsContext, int jsValue,
+      boolean[] rval);
+
+  private static native boolean toDoubleImpl(int jsContext, int jsValue,
       double[] rval);
 
-  private static native boolean _coerceToString(int execState, int jsval,
-      String[] rval);
+  private static native boolean toJsBooleanImpl(int jsContext, boolean value,
+      int[] rval);
 
-  private static native boolean _convertBoolean(boolean v, int[] rval);
+  private static native boolean toJsNumberImpl(int jsContext, double value,
+      int[] rval);
 
-  private static native boolean _convertDouble(double v, int[] rval);
+  private static native boolean toJsStringImpl(int jsContext, String value,
+      int[] rval);
 
-  private static native boolean _convertString(String v, int[] rval);
-
-  private static native boolean _executeScript(int execState, String code);
-
-  private static native boolean _executeScriptWithInfo(int execState,
-      String newScript, String file, int line);
-
-  private static native void _gcLock(int jsval);
-
-  private static native void _gcUnlock(int jsval, String trace);
-
-  private static native int _getArgc();
-
-  private static native String _getArgv(int i);
-
-  private static native boolean _getGlobalExecState(int scriptObject, int[] rval);
-
-  private static native boolean _initNative(Class<DispatchObject> dispObjClass,
-      Class<DispatchMethod> dispMethClass);
-
-  private static native boolean _invoke(int execState, int scriptObject,
-      String methodName, int jsthis, int jsargCount, int[] jsargs, int[] rval);
-
-  private static native boolean _isObject(int jsval);
-
-  private static native boolean _isString(int jsval);
-
-  private static native boolean _isWrappedDispatch(int jsval, boolean[] rval);
-
-  private static native void _jsLock();
-
-  private static native void _jsUnlock();
-
-  private static native boolean _raiseJavaScriptException(int execState,
-      int jsval);
-
-  private static native boolean _unwrapDispatch(int jsval, DispatchObject[] rval);
-
-  private static native boolean _wrapDispatch(DispatchObject dispObj, int[] rval);
-
-  private static native boolean _wrapFunction(String name,
-      DispatchMethod dispMeth, int[] rval);
-
-  // CHECKSTYLE_NAMING_OFF
-
-  /**
-   * Not instantiable.
-   */
-  private LowLevelSaf() {
+  private static double toNumber(int jsContext, int jsValue, String typeName) {
+    double[] rval = new double[1];
+    if (!toDoubleImpl(jsContext, jsValue, rval)) {
+      throw new RuntimeException("Failed to coerce to " + typeName + " value");
+    }
+    return rval[0];
   }
 
+  private static native boolean toStringImpl(int jsContext, int jsValue,
+      String[] rval);
+
+  private static native boolean unwrapDispatchObjectImpl(int jsContext,
+      int jsValue, DispatchObject[] rval);
+
+  private static native boolean wrapDispatchMethodImpl(int jsContext,
+      String name, DispatchMethod dispatch, int[] rval);
+
+  private static native boolean wrapDispatchObjectImpl(int jsContext,
+      DispatchObject obj, int[] rval);
 }
diff --git a/dev/mac/src/com/google/gwt/dev/shell/mac/MethodDispatch.java b/dev/mac/src/com/google/gwt/dev/shell/mac/MethodDispatch.java
index 67ee68c..f8bf37e 100644
--- a/dev/mac/src/com/google/gwt/dev/shell/mac/MethodDispatch.java
+++ b/dev/mac/src/com/google/gwt/dev/shell/mac/MethodDispatch.java
@@ -39,8 +39,9 @@
     this.method = method;
   }
 
-  public int invoke(int execState, int jsthisInt, int[] jsargsInt) {
-    LowLevelSaf.pushExecState(execState);
+  public int invoke(int jsContext, int jsthisInt, int[] jsargsInt,
+      int[] exception) {
+    LowLevelSaf.pushJsContext(jsContext);
     JsValue jsthis = new JsValueSaf(jsthisInt);
     JsValue jsargs[] = new JsValue[jsargsInt.length];
     for (int i = 0; i < jsargsInt.length; ++i) {
@@ -51,7 +52,7 @@
       Class<?>[] paramTypes = method.getParameterTypes();
       int argc = paramTypes.length;
       Object args[] = new Object[argc];
-      // too many arguments are ok: the extra will be silently ignored      
+      // too many arguments are ok: the extra will be silently ignored
       if (jsargs.length < argc) {
         throw new RuntimeException("Not enough arguments to " + method);
       }
@@ -75,23 +76,30 @@
         }
         JsValueGlue.set(returnValue, classLoader, method.getReturnType(),
             result);
-        return returnValue.getJsValue();
+        int jsResult = returnValue.getJsValue();
+        // Native code will eat an extra ref.
+        LowLevelSaf.gcProtect(jsContext, jsResult);
+        return jsResult;
       } catch (InstantiationException e) {
         // If we get here, it means an exception is being thrown from
         // Java back into JavaScript
         ModuleSpace.setThrownJavaException(e.getCause());
-        LowLevelSaf.raiseJavaScriptException(execState, LowLevelSaf.jsNull());
-        return LowLevelSaf.jsUndefined();
+        // Native code eats the same ref it gave us.
+        exception[0] = LowLevelSaf.getJsNull(jsContext);
+        // Native code eats the same ref it gave us.
+        return LowLevelSaf.getJsUndefined(jsContext);
       } catch (InvocationTargetException e) {
         // If we get here, it means an exception is being thrown from
         // Java back into JavaScript
         Throwable t = e.getTargetException();
         ModuleSpace.setThrownJavaException(t);
-        LowLevelSaf.raiseJavaScriptException(execState, LowLevelSaf.jsNull());
-        return LowLevelSaf.jsUndefined();
+        // Native code eats the same ref it gave us.
+        exception[0] = LowLevelSaf.getJsNull(jsContext);
+        // Native code eats the same ref it gave us.
+        return LowLevelSaf.getJsUndefined(jsContext);
       }
     } finally {
-      LowLevelSaf.popExecState(execState);
+      LowLevelSaf.popJsContext(jsContext);
     }
   }
 }
diff --git a/dev/mac/src/com/google/gwt/dev/shell/mac/ModuleSpaceSaf.java b/dev/mac/src/com/google/gwt/dev/shell/mac/ModuleSpaceSaf.java
index 22d6754..b8a8b11 100644
--- a/dev/mac/src/com/google/gwt/dev/shell/mac/ModuleSpaceSaf.java
+++ b/dev/mac/src/com/google/gwt/dev/shell/mac/ModuleSpaceSaf.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2007 Google Inc.
+ * 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
@@ -27,7 +27,9 @@
  */
 public class ModuleSpaceSaf extends ModuleSpace {
 
-  private final int window;
+  private final int globalObject;
+
+  private final int globalContext;
 
   /**
    * Constructs a browser interface for use with a global window object.
@@ -36,13 +38,15 @@
    * @param key unique key for this instance of the module
    */
   public ModuleSpaceSaf(ModuleSpaceHost host, int scriptGlobalObject,
-      String moduleName, Object key) {
+      int scriptGlobalContext, String moduleName, Object key) {
     super(host, moduleName, key);
 
     // Hang on to the global execution state.
     //
-    this.window = scriptGlobalObject;
-    LowLevelSaf.gcLock(scriptGlobalObject);
+    this.globalObject = scriptGlobalObject;
+    this.globalContext = scriptGlobalContext;
+    LowLevelSaf.gcProtect(LowLevelSaf.getCurrentJsContext(), scriptGlobalObject);
+    LowLevelSaf.retainJsGlobalContext(scriptGlobalContext);
   }
 
   public void createNative(String file, int line, String jsniSignature,
@@ -51,13 +55,13 @@
     // a new top-level function.
     //
     String newScript = createNativeMethodInjector(jsniSignature, paramNames, js);
-    LowLevelSaf.executeScriptWithInfo(LowLevelSaf.getGlobalExecState(window),
-        newScript, file, line);
+    LowLevelSaf.executeScriptWithInfo(globalContext, newScript, file, line);
   }
 
   @Override
   public void dispose() {
-    LowLevelSaf.gcUnlock(window, null);
+    LowLevelSaf.gcUnprotect(LowLevelSaf.getCurrentJsContext(), globalObject);
+    LowLevelSaf.releaseJsGlobalContext(globalContext);
     super.dispose();
   }
 
@@ -81,15 +85,19 @@
     int jsthis = jsValueThis.getJsValue();
 
     int argc = args.length;
-    int argv[] = new int[argc];
+    int[] argv = new int[argc];
+    // GC protect passed arguments on the Java stack for call duration.
+    JsValueSaf[] jsValueArgs = new JsValueSaf[argc]; 
     for (int i = 0; i < argc; ++i) {
-      JsValueSaf jsValue = new JsValueSaf();
+      JsValueSaf jsValue = jsValueArgs[i] = new JsValueSaf();
       JsValueGlue.set(jsValue, isolatedClassLoader, types[i], args[i]);
       argv[i] = jsValue.getJsValue();
     }
 
-    int curExecState = LowLevelSaf.getExecState();
-    int result = LowLevelSaf.invoke(curExecState, window, name, jsthis, argv);
+    final int curJsContext = LowLevelSaf.getCurrentJsContext();
+
+    int result = LowLevelSaf.invoke(curJsContext, globalObject, name, jsthis,
+        argv);
     return new JsValueSaf(result);
   }
 
@@ -100,7 +108,7 @@
 
   protected int wrapObjectAsJSObject(Object o) {
     if (o == null) {
-      return LowLevelSaf.jsNull();
+      return LowLevelSaf.getJsNull(LowLevelSaf.getCurrentJsContext());
     }
 
     DispatchObject dispObj;
@@ -109,6 +117,7 @@
     } else {
       dispObj = new WebKitDispatchAdapter(getIsolatedClassLoader(), o);
     }
-    return LowLevelSaf.wrapDispatch(dispObj);
+    return LowLevelSaf.wrapDispatchObject(LowLevelSaf.getCurrentJsContext(),
+        dispObj);
   }
 }
diff --git a/dev/mac/src/com/google/gwt/dev/shell/mac/WebKitDispatchAdapter.java b/dev/mac/src/com/google/gwt/dev/shell/mac/WebKitDispatchAdapter.java
index d1cb4de..bc25905 100644
--- a/dev/mac/src/com/google/gwt/dev/shell/mac/WebKitDispatchAdapter.java
+++ b/dev/mac/src/com/google/gwt/dev/shell/mac/WebKitDispatchAdapter.java
@@ -61,26 +61,35 @@
     this.classLoader = cl;
   }
 
-  public int getField(String name) {
-    int dispId = classLoader.getDispId(name);
-    if (dispId < 0) {
-      return LowLevelSaf.jsUndefined();
-    }
-    if (javaDispatch.isField(dispId)) {
-      Field field = javaDispatch.getField(dispId);
-      JsValueSaf jsValue = new JsValueSaf();
-      JsValueGlue.set(jsValue, classLoader, field.getType(),
-          javaDispatch.getFieldValue(dispId));
-      int jsval = jsValue.getJsValue();
-      return jsval;
-    } else {
-      MethodAdaptor method = javaDispatch.getMethod(dispId);
-      DispatchMethod dispMethod = (DispatchMethod) classLoader.getMethodDispatch(method);
-      if (dispMethod == null) {
-        dispMethod = new MethodDispatch(classLoader, method);
-        classLoader.putMethodDispatch(method, dispMethod);
+  public int getField(int jsContext, String name) {
+    LowLevelSaf.pushJsContext(jsContext);
+    try {
+      int dispId = classLoader.getDispId(name);
+      if (dispId < 0) {
+        return LowLevelSaf.getJsUndefined(jsContext);
       }
-      return LowLevelSaf.wrapFunction(method.toString(), dispMethod);
+      if (javaDispatch.isField(dispId)) {
+        Field field = javaDispatch.getField(dispId);
+        JsValueSaf jsValue = new JsValueSaf();
+        JsValueGlue.set(jsValue, classLoader, field.getType(),
+            javaDispatch.getFieldValue(dispId));
+        int jsval = jsValue.getJsValue();
+        // Native code will eat an extra ref.
+        LowLevelSaf.gcProtect(jsContext, jsval);
+        return jsval;
+      } else {
+        MethodAdaptor method = javaDispatch.getMethod(dispId);
+        DispatchMethod dispMethod = (DispatchMethod) classLoader.getMethodDispatch(method);
+        if (dispMethod == null) {
+          dispMethod = new MethodDispatch(classLoader, method);
+          classLoader.putMethodDispatch(method, dispMethod);
+        }
+        // Native code eats the same ref it gave us.
+        return LowLevelSaf.wrapDispatchMethod(jsContext, method.toString(),
+            dispMethod);
+      }
+    } finally {
+      LowLevelSaf.popJsContext(jsContext);
     }
   }
 
@@ -88,20 +97,25 @@
     return javaDispatch.getTarget();
   }
 
-  public void setField(String name, int value) {
-    JsValue jsValue = new JsValueSaf(value);
-    int dispId = classLoader.getDispId(name);
-    if (dispId < 0) {
-      // TODO: expandos?
-      throw new RuntimeException("No such field " + name);
+  public void setField(int jsContext, String name, int value) {
+    LowLevelSaf.pushJsContext(jsContext);
+    try {
+      JsValue jsValue = new JsValueSaf(value);
+      int dispId = classLoader.getDispId(name);
+      if (dispId < 0) {
+        // TODO (knorton): We could allow expandos, but should we?
+        throw new RuntimeException("No such field " + name);
+      }
+      if (javaDispatch.isMethod(dispId)) {
+        throw new RuntimeException("Cannot reassign method " + name);
+      }
+      Field field = javaDispatch.getField(dispId);
+      Object val = JsValueGlue.get(jsValue, classLoader, field.getType(),
+          "setField");
+      javaDispatch.setFieldValue(dispId, val);
+    } finally {
+      LowLevelSaf.popJsContext(jsContext);
     }
-    if (javaDispatch.isMethod(dispId)) {
-      throw new RuntimeException("Cannot reassign method " + name);
-    }
-    Field field = javaDispatch.getField(dispId);
-    Object val = JsValueGlue.get(jsValue, classLoader, field.getType(),
-        "setField");
-    javaDispatch.setFieldValue(dispId, val);
   }
 
   @Override
diff --git a/dev/mac/src/org/eclipse/swt/browser/Browser.java b/dev/mac/src/org/eclipse/swt/browser/Browser.java
index 89c66ea..21ca0e3 100644
--- a/dev/mac/src/org/eclipse/swt/browser/Browser.java
+++ b/dev/mac/src/org/eclipse/swt/browser/Browser.java
@@ -1896,21 +1896,6 @@
 	}
 }
 
-public void setUserAgentApplicationName(String userAgent) {
-	char[] chars = userAgent.toCharArray();
-	int webView = WebKit.HIWebViewGetWebView(webViewHandle);
-	if (webView == 0) return;
-	int sel = WebKit.sel_registerName("setApplicationNameForUserAgent:");
-	if (sel == 0) return;
-	int userAgentStr = OS.CFStringCreateWithCharacters(0, chars, chars.length);
-	if (userAgentStr == 0) return;
-	try {
-		WebKit.objc_msgSend(webView, sel, userAgentStr);
-	} finally {
-		OS.CFRelease(userAgentStr);
-	}
-}
-
 public void setNeedsDisplay(boolean value) {
 	int webView = WebKit.HIWebViewGetWebView(webViewHandle);
 	if (webView == 0) return;
@@ -1919,6 +1904,48 @@
 	WebKit.objc_msgSend(webView, sel, (value)?1:0);
 }
 
+private static int getGlobalContextForWindowObject(int frame,
+    int windowObject, int childFramesSel, int countSel, int windowObjectSel,
+    int objectAtIndexSel) {
+  int frameWindowObject = WebKit.objc_msgSend(frame, windowObjectSel);
+  if (frameWindowObject == 0) return 0;
+  if (frameWindowObject == windowObject) return frame;
+
+  int childFrames = WebKit.objc_msgSend(frame, childFramesSel);
+  int count = WebKit.objc_msgSend(childFrames, countSel);
+  for (int i = 0; i < count; ++i) {
+    int child = WebKit.objc_msgSend(childFrames, objectAtIndexSel, i);
+    if (child == 0) continue;
+    int foundFrame = getGlobalContextForWindowObject(child, windowObject,
+        childFramesSel, countSel, windowObjectSel, objectAtIndexSel);
+    if (foundFrame != 0)  return foundFrame;
+  }
+  return 0;
+}
+
+// Finds a JSGlobalContextRef by searching the WebFrame tree for
+// a particular WebScriptObject (objective-c wrapper around the
+// global object).
+public int getGlobalContextForWindowObject(int windowObject) {
+  int childFramesSel = WebKit.sel_registerName("childFrames");
+  int countSel = WebKit.sel_registerName("count");
+  int windowObjectSel = WebKit.sel_registerName("windowObject");
+  int objectAtIndexSel = WebKit.sel_registerName("objectAtIndex:");
+  int mainFrameSel = WebKit.sel_registerName("mainFrame");
+  int globalContextSel = WebKit.sel_registerName("globalContext");
+  if (childFramesSel == 0 || countSel == 0 || windowObjectSel == 0
+      || objectAtIndexSel == 0 || mainFrameSel == 0 || globalContextSel == 0)
+    return 0;
+  int webViewRef = WebKit.HIWebViewGetWebView(webViewHandle);
+  if (webViewRef == 0) return 0;
+  int mainFrame = WebKit.objc_msgSend(webViewRef, mainFrameSel);
+  if (mainFrame == 0) return 0;
+  int frame = getGlobalContextForWindowObject(mainFrame, windowObject, childFramesSel,
+      countSel, windowObjectSel, objectAtIndexSel);
+  if (frame == 0) return 0;
+  return WebKit.objc_msgSend(frame, globalContextSel);
+}
+
 WindowScriptObjectListener[] windowScriptObjectListeners = new WindowScriptObjectListener[0];
 // end GOOGLE
 }
diff --git a/distro-source/common.ant.xml b/distro-source/common.ant.xml
index 661e610..e5904f5 100755
--- a/distro-source/common.ant.xml
+++ b/distro-source/common.ant.xml
@@ -3,7 +3,7 @@
 	<property name="project.tail" value="distro-source/${dist.platform}" />
 	<import file="${gwt.root}/common.ant.xml" />
 
-	<property name="project.distname" value="gwt-${dist.platform.detail}-${gwt.version}" />
+	<property name="project.distname" value="gwt-${dist.platform}-${gwt.version}" />
 	<property name="project.staging" location="${gwt.build.staging}/${project.distname}" />
 
 	<patternset id="chmod.executables">
diff --git a/distro-source/linux/build.xml b/distro-source/linux/build.xml
index fc10736..fe67786 100755
--- a/distro-source/linux/build.xml
+++ b/distro-source/linux/build.xml
@@ -1,6 +1,5 @@
 <project name="dist-linux" default="build" basedir=".">
 	<property name="dist.platform" value="linux" />
-	<property name="dist.platform.detail" value="linux" />
 	<import file="../common.ant.xml" />
 	<property name="project.dist" location="${gwt.build.dist}/${project.distname}.tar.bz2" />
 
diff --git a/distro-source/mac/10.4/libswt-webkit-carbon-3235.jnilib b/distro-source/mac/10.4/libswt-webkit-carbon-3235.jnilib
deleted file mode 100644
index 6eb30e4..0000000
--- a/distro-source/mac/10.4/libswt-webkit-carbon-3235.jnilib
+++ /dev/null
Binary files differ
diff --git a/distro-source/mac/build.xml b/distro-source/mac/build.xml
index 0e93298..37250c5 100755
--- a/distro-source/mac/build.xml
+++ b/distro-source/mac/build.xml
@@ -1,69 +1,42 @@
 <project name="dist-mac" default="build" basedir=".">
-	<!-- TODO: Either split this into top-level mac-10.4 and mac-10.5 targets
-		or merge these back together with OOPHM. -->
-        <!-- distro doesn't use the top-level common.ant.xml, nor properties
-             defined there. -->
 	<property name="dist.platform" value="mac" />
 	<import file="../common.ant.xml" />
-	<condition property="dist.platform.detail" value="mac_10.5" else="mac_10.4">
-		<contains string="${os.version}" substring="10.5." />
-	</condition>
+	<property name="project.dist" location="${gwt.build.dist}/${project.distname}.tar.gz" />
 
-	<property name="project.distname_10.4" value="gwt-mac_10.4-${gwt.version}" />
-	<property name="project.distname_10.5" value="gwt-mac_10.5-${gwt.version}" />
-
-	<condition property="webkitrev" value="525-10.5" else="418.9">
-		<equals arg1="mac_10.5" arg2="${build.host.platform.detail}" />
-	</condition>
-	<property name="project_10_4.dist" location="${gwt.build.dist}/gwt-mac_10.4-${gwt.version}.tar.gz" />
-	<property name="project_10_5.dist" location="${gwt.build.dist}/gwt-mac_10.5-${gwt.version}.tar.gz" />
-
-
-	<target name="build" depends="filter, build_10.4, build_10.5" 
-		description="Packages the distro">
-	</target> 
-
-	<target name="build_10.4" depends="filter" 
-	        description="Packages the MacOS 10.4 distro">
+	<target name="build" depends="filter" description="Packages the distro">
 		<!-- TODO: figure out how to share most of this across platforms -->
 		<mkdir dir="${gwt.build.dist}" />
-		<gwt.tgz.cat destfile="${project_10_4.dist}">
+		<gwt.tgz.cat destfile="${project.dist}">
 			<!-- jars -->
-			<tarfileset file="${gwt.build.lib}/gwt-dev-${dist.platform}.jar" prefix="${project.distname_10.4}" />
-			<tarfileset file="${gwt.build.lib}/gwt-user.jar" prefix="${project.distname_10.4}" />
-			<tarfileset file="${gwt.build.lib}/gwt-servlet.jar" prefix="${project.distname_10.4}" />
-                        <tarfileset file="${gwt.build.lib}/gwt-benchmark-viewer.jar" prefix="${project.distname_10.4}" />
+			<tarfileset file="${gwt.build.lib}/gwt-dev-${dist.platform}.jar" prefix="${project.distname}" />
+			<tarfileset file="${gwt.build.lib}/gwt-user.jar" prefix="${project.distname}" />
+			<tarfileset file="${gwt.build.lib}/gwt-servlet.jar" prefix="${project.distname}" />
+                        <tarfileset file="${gwt.build.lib}/gwt-benchmark-viewer.jar" prefix="${project.distname}" />
 
 			<!-- jni libs-->
-			<tarfileset dir="${gwt.build.jni}/mac_10.4" prefix="${project.distname_10.4}" />
-			<tarfileset dir="${gwt.tools.lib}/eclipse" prefix="${project.distname_10.4}">
+			<tarfileset dir="${gwt.build.jni}/${dist.platform}" prefix="${project.distname}" />
+			<tarfileset dir="${gwt.tools.lib}/eclipse" prefix="${project.distname}">
 				<include name="libswt-*carbon-3235.jnilib" />
-				<!-- User our modified version instead of this stock version -->
+				<!-- Use our modified version instead of this stock version -->
 				<exclude name="libswt-webkit-carbon-3235.jnilib" />
 			</tarfileset>
 
 			<!-- raw files -->
-			<tarfileset dir="${project.build}" prefix="${project.distname_10.4}" mode="755">
+			<tarfileset dir="${project.build}" prefix="${project.distname}" mode="755">
 				<patternset refid="chmod.executables" />
 			</tarfileset>
-			<tarfileset dir="${project.build}" prefix="${project.distname_10.4}">
+			<tarfileset dir="${project.build}" prefix="${project.distname}">
 				<patternset refid="chmod.not.executables" />
 			</tarfileset>
-			<tarfileset dir="src" prefix="${project.distname_10.4}" mode="755">
+			<tarfileset dir="src" prefix="${project.distname}" mode="755">
 				<patternset refid="chmod.executables" />
 			</tarfileset>
-			<tarfileset dir="10.4" prefix="${project.distname_10.4}" mode="755">
-				<patternset refid="chmod.executables" />
-			</tarfileset>
-			<tarfileset dir="src" prefix="${project.distname_10.4}">
-				<patternset refid="chmod.not.executables" />
-			</tarfileset>
-			<tarfileset dir="10.4" prefix="${project.distname_10.4}">
+			<tarfileset dir="src" prefix="${project.distname}">
 				<patternset refid="chmod.not.executables" />
 			</tarfileset>
 
 			<!-- doc -->
-			<tarfileset dir="${gwt.build.out}" prefix="${project.distname_10.4}">
+			<tarfileset dir="${gwt.build.out}" prefix="${project.distname}">
 				<include name="doc" />
 				<include name="doc/html/**" />
 				<include name="doc/css/**" />
@@ -71,19 +44,17 @@
 			</tarfileset>
 
 			<!-- samples -->
-			<tarfileset dir="${gwt.build.out}" prefix="${project.distname_10.4}">
+			<tarfileset dir="${gwt.build.out}" prefix="${project.distname}">
 				<include name="samples" />
 				<include name="samples/*" />
 				<include name="samples/*/src/**" />
 				<include name="samples/*/bin/**" />
 				<include name="samples/*/www/**" />
 			</tarfileset>
-			<tarfileset dir="${gwt.build.out}/samples-scripts/${dist.platform}" mode="755" prefix="${project.distname_10.4}/samples">
+			<tarfileset dir="${gwt.build.out}/samples-scripts/${dist.platform}" mode="755" prefix="${project.distname}/samples">
 				<include name="*/*-compile" />
 				<include name="*/*-shell" />
 			</tarfileset>
-
-			<includetar src="${gwt.tools.redist}/webkit/WebKit-418.9.tar.gz" compression="gzip" prefix="${project.distname_10.4}" />
 		</gwt.tgz.cat>
 
 		<if>
@@ -96,88 +67,7 @@
 				<mkdir dir="${gwt.build.staging}" />
 				<exec executable="tar">
 					<arg value="-xpzf" />
-					<arg file="${project_10_4.dist}" />
-					<arg value="-C" />
-					<arg file="${gwt.build.staging}" />
-				</exec>
-			</then>
-		</if>
-	</target>
-
-	<target name="build_10.5" depends="filter" 
-	        description="Packages the MacOS 10.5 distro">
-		<!-- TODO: figure out how to share most of this across platforms -->
-		<mkdir dir="${gwt.build.dist}" />
-		<gwt.tgz.cat destfile="${project_10_5.dist}">
-			<!-- jars -->
-			<tarfileset file="${gwt.build.lib}/gwt-dev-${dist.platform}.jar" prefix="${project.distname_10.5}" />
-			<tarfileset file="${gwt.build.lib}/gwt-user.jar" prefix="${project.distname_10.5}" />
-			<tarfileset file="${gwt.build.lib}/gwt-servlet.jar" prefix="${project.distname_10.5}" />
-                        <tarfileset file="${gwt.build.lib}/gwt-benchmark-viewer.jar" prefix="${project.distname_10.5}" />
-
-			<!-- jni libs-->
-			<tarfileset dir="${gwt.build.jni}/mac_10.5" prefix="${project.distname_10.5}" />
-			<tarfileset dir="${gwt.tools.lib}/eclipse" prefix="${project.distname_10.5}">
-				<include name="libswt-*carbon-3235.jnilib" />
-				<!-- User our modified version instead of this stock version -->
-				<exclude name="libswt-webkit-carbon-3235.jnilib" />
-			</tarfileset>
-
-			<!-- raw files -->
-			<tarfileset dir="${project.build}" prefix="${project.distname_10.5}" mode="755">
-				<patternset refid="chmod.executables" />
-			</tarfileset>
-			<tarfileset dir="${project.build}" prefix="${project.distname_10.5}">
-				<patternset refid="chmod.not.executables" />
-			</tarfileset>
-			<tarfileset dir="src" prefix="${project.distname_10.5}" mode="755">
-				<patternset refid="chmod.executables" />
-			</tarfileset>
-			<tarfileset dir="10.4" prefix="${project.distname_10.5}" mode="755">
-				<patternset refid="chmod.executables" />
-			</tarfileset>
-			<tarfileset dir="src" prefix="${project.distname_10.5}">
-				<patternset refid="chmod.not.executables" />
-			</tarfileset>
-			<tarfileset dir="10.4" prefix="${project.distname_10.5}">
-				<patternset refid="chmod.not.executables" />
-			</tarfileset>
-
-			<!-- doc -->
-			<tarfileset dir="${gwt.build.out}" prefix="${project.distname_10.5}">
-				<include name="doc" />
-				<include name="doc/html/**" />
-				<include name="doc/css/**" />
-				<include name="doc/javadoc/**" />
-			</tarfileset>
-
-			<!-- samples -->
-			<tarfileset dir="${gwt.build.out}" prefix="${project.distname_10.5}">
-				<include name="samples" />
-				<include name="samples/*" />
-				<include name="samples/*/src/**" />
-				<include name="samples/*/bin/**" />
-				<include name="samples/*/www/**" />
-			</tarfileset>
-			<tarfileset dir="${gwt.build.out}/samples-scripts/${dist.platform}" mode="755" prefix="${project.distname_10.5}/samples">
-				<include name="*/*-compile" />
-				<include name="*/*-shell" />
-			</tarfileset>
-
-			<includetar src="${gwt.tools.redist}/webkit/WebKit-525-10.5.tar.gz" compression="gzip" prefix="${project.distname_10.5}" />
-		</gwt.tgz.cat>
-
-		<if>
-			<isset property="build.host.ismac" />
-			<then>
-				<!--
-					Untar distro into the staging directory.  Must use GNU tar
-					to handle permissions and symlinks correctly.
-				-->
-				<mkdir dir="${gwt.build.staging}" />
-				<exec executable="tar">
-					<arg value="-xpzf" />
-					<arg file="${project_10_5.dist}" />
+					<arg file="${project.dist}" />
 					<arg value="-C" />
 					<arg file="${gwt.build.staging}" />
 				</exec>
diff --git a/distro-source/mac/10.5/libswt-webkit-carbon-3235.jnilib b/distro-source/mac/src/libswt-webkit-carbon-3235.jnilib
similarity index 94%
rename from distro-source/mac/10.5/libswt-webkit-carbon-3235.jnilib
rename to distro-source/mac/src/libswt-webkit-carbon-3235.jnilib
index e61e653..204c3bd 100755
--- a/distro-source/mac/10.5/libswt-webkit-carbon-3235.jnilib
+++ b/distro-source/mac/src/libswt-webkit-carbon-3235.jnilib
Binary files differ
diff --git a/distro-source/windows/build.xml b/distro-source/windows/build.xml
index 87f9c22..8fce756 100755
--- a/distro-source/windows/build.xml
+++ b/distro-source/windows/build.xml
@@ -1,6 +1,5 @@
 <project name="dist-windows" default="build" basedir=".">
 	<property name="dist.platform" value="windows" />
-	<property name="dist.platform.detail" value="windows" />
 	<import file="../common.ant.xml" />
 	<property name="project.dist" location="${gwt.build.dist}/${project.distname}.zip" />
 
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__