Author: [email protected]
Date: Sun Jul 12 20:01:18 2009
New Revision: 5719

Modified:
     
branches/htmlunit/user/src/com/google/gwt/junit/HostedModePluginObject.java
    branches/htmlunit/user/src/com/google/gwt/junit/RunStyleHtmlUnit.java
     
branches/htmlunit/user/src/com/google/gwt/junit/RunStyleHtmlUnitHosted.java

Log:
Change to not require modification of HTMLUnit.


Modified:  
branches/htmlunit/user/src/com/google/gwt/junit/HostedModePluginObject.java
==============================================================================
---  
branches/htmlunit/user/src/com/google/gwt/junit/HostedModePluginObject.java     
 
(original)
+++  
branches/htmlunit/user/src/com/google/gwt/junit/HostedModePluginObject.java     
 
Sun Jul 12 20:01:18 2009
@@ -97,8 +97,8 @@

    private static final long serialVersionUID = -1815031145376726799L;

-  private Scriptable connectMethod = new ConnectMethod();
-  private Scriptable initMethod = new InitMethod();
+  private Scriptable connectMethod;
+  private Scriptable initMethod;
    private Window window;

    /**
@@ -121,8 +121,14 @@
    @Override
    public Object get(String name, Scriptable start) {
      if ("connect".equals(name)) {
+      if (connectMethod == null) {
+        connectMethod = new ConnectMethod();
+      }
        return connectMethod;
      } else if ("init".equals(name)) {
+      if (initMethod == null) {
+        initMethod = new InitMethod();
+      }
        return initMethod;
      }
      return NOT_FOUND;

Modified:  
branches/htmlunit/user/src/com/google/gwt/junit/RunStyleHtmlUnit.java
==============================================================================
--- branches/htmlunit/user/src/com/google/gwt/junit/RunStyleHtmlUnit.java       
 
(original)
+++ branches/htmlunit/user/src/com/google/gwt/junit/RunStyleHtmlUnit.java       
 
Sun Jul 12 20:01:18 2009
@@ -66,6 +66,10 @@
      }

      public void notify(String message, Object origin) {
+      if ("Obsolete content type  
encountered: 'text/javascript'.".equals(message)) {
+        // silently eat warning about text/javascript MIME type
+        return;
+      }
        shell.getTopLogger().log(TreeLogger.WARN, message);
      }


Modified:  
branches/htmlunit/user/src/com/google/gwt/junit/RunStyleHtmlUnitHosted.java
==============================================================================
---  
branches/htmlunit/user/src/com/google/gwt/junit/RunStyleHtmlUnitHosted.java     
 
(original)
+++  
branches/htmlunit/user/src/com/google/gwt/junit/RunStyleHtmlUnitHosted.java     
 
Sun Jul 12 20:01:18 2009
@@ -23,7 +23,6 @@
  import com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine;
  import com.gargoylesoftware.htmlunit.javascript.host.Window;

-import net.sourceforge.htmlunit.corejs.javascript.Context;
  import net.sourceforge.htmlunit.corejs.javascript.ScriptableObject;


@@ -46,7 +45,10 @@
      }

      @Override
-    protected void initHook(WebWindow webWindow, Context context, Window  
window) {
+    public void initialize(WebWindow webWindow) {
+      // Hook in the hosted-mode plugin after initializing the JS engine.
+      super.initialize(webWindow);
+      Window window = (Window) webWindow.getScriptObject();
        window.defineProperty("__gwt_HostedModePlugin",
            new HostedModePluginObject(), ScriptableObject.READONLY);
      }

--~--~---------~--~----~------------~-------~--~----~
http://groups.google.com/group/Google-Web-Toolkit-Contributors
-~----------~----~----~----~------~----~------~--~---

Reply via email to