Revision: 6309 Author: [email protected] Date: Tue Oct 6 18:21:18 2009 Log: Changed the plugin code, in response to changes in HtmlUnit's internal Api in htmlunit 2.6+
Patch by: kjin Review (and suggestions) by: amitmanjhi http://code.google.com/p/google-web-toolkit/source/detail?r=6309 Modified: /branches/farewellSwt/dev/oophm/src/com/google/gwt/dev/shell/HostedModePluginObject.java /branches/farewellSwt/dev/oophm/src/com/google/gwt/dev/shell/HtmlUnitSessionHandler.java /branches/farewellSwt/user/src/com/google/gwt/junit/RunStyleHtmlUnit.java ======================================= --- /branches/farewellSwt/dev/oophm/src/com/google/gwt/dev/shell/HostedModePluginObject.java Tue Sep 29 11:27:01 2009 +++ /branches/farewellSwt/dev/oophm/src/com/google/gwt/dev/shell/HostedModePluginObject.java Tue Oct 6 18:21:18 2009 @@ -15,6 +15,7 @@ */ package com.google.gwt.dev.shell; +import com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine; import com.gargoylesoftware.htmlunit.javascript.host.Window; import net.sourceforge.htmlunit.corejs.javascript.Context; @@ -140,8 +141,18 @@ private Scriptable disconnectMethod; private Scriptable initMethod; private Window window; + private JavaScriptEngine jsEngine; private BrowserChannelClient browserChannelClient; + + /** + * Creates a HostedModePluginObject with the passed-in JavaScriptEngine. + * + * @param jsEngine The JavaScriptEngine. + */ + public HostedModePluginObject(JavaScriptEngine jsEngine) { + this.jsEngine = jsEngine; + } /** * Initiate a hosted mode connection to the requested port and load the @@ -166,10 +177,10 @@ + version + "), window=" + System.identityHashCode(window) + ")"); try { - HtmlUnitSessionHandler htmlUnitSessionHandler = new HtmlUnitSessionHandler(window); - browserChannelClient = new BrowserChannelClient( - addressParts, url, sessionKey, module, version, - htmlUnitSessionHandler); + HtmlUnitSessionHandler htmlUnitSessionHandler = new HtmlUnitSessionHandler( + window, jsEngine); + browserChannelClient = new BrowserChannelClient(addressParts, url, + sessionKey, module, version, htmlUnitSessionHandler); htmlUnitSessionHandler.setSessionData(new SessionData( htmlUnitSessionHandler, browserChannelClient)); return browserChannelClient.process(); ======================================= --- /branches/farewellSwt/dev/oophm/src/com/google/gwt/dev/shell/HtmlUnitSessionHandler.java Wed Sep 30 09:31:26 2009 +++ /branches/farewellSwt/dev/oophm/src/com/google/gwt/dev/shell/HtmlUnitSessionHandler.java Tue Oct 6 18:21:18 2009 @@ -107,10 +107,10 @@ private final Window window; - HtmlUnitSessionHandler(Window window) { + HtmlUnitSessionHandler(Window window, JavaScriptEngine jsEngine) { this.window = window; logger.setMaxDetail(TreeLogger.ERROR); - jsEngine = this.window.getJavaScriptEngine(); + this.jsEngine = jsEngine; htmlPage = (HtmlPage) this.window.getWebWindow().getEnclosedPage(); logger.log(TreeLogger.INFO, "jsEngine = " + jsEngine + ", HtmlPage = " + htmlPage); ======================================= --- /branches/farewellSwt/user/src/com/google/gwt/junit/RunStyleHtmlUnit.java Sun Sep 20 12:33:31 2009 +++ /branches/farewellSwt/user/src/com/google/gwt/junit/RunStyleHtmlUnit.java Tue Oct 6 18:21:18 2009 @@ -122,7 +122,7 @@ webClient.setJavaScriptEngine(hostedEngine); } } -} + } /** * JavaScriptEngine subclass that provides a hook of initializing the @@ -143,7 +143,7 @@ super.initialize(webWindow); Window window = (Window) webWindow.getScriptObject(); window.defineProperty("__gwt_HostedModePlugin", - new HostedModePluginObject(), ScriptableObject.READONLY); + new HostedModePluginObject(this), ScriptableObject.READONLY); } } @@ -184,7 +184,7 @@ public RunStyleHtmlUnit(JUnitShell shell) { super(shell); } - + @Override public boolean initialize(String args) { if (args == null || args.length() == 0) { @@ -203,7 +203,7 @@ browsers = Collections.unmodifiableSet(browserSet); return true; } - + @Override public void launchModule(String moduleName) { for (BrowserVersion browser : browsers) { --~--~---------~--~----~------------~-------~--~----~ http://groups.google.com/group/Google-Web-Toolkit-Contributors -~----------~----~----~----~------~----~------~--~---
