diff --git a/mozilla/java/webclient/src_moz/Makefile.in b/mozilla/java/webclient/src_moz/Makefile.in index a0a7344b533..e4b0c76a34b 100644 --- a/mozilla/java/webclient/src_moz/Makefile.in +++ b/mozilla/java/webclient/src_moz/Makefile.in @@ -94,9 +94,9 @@ REQUIRES = xpcom \ # ISupportsPeer.cpp \ # NativeEventThreadActionEvents.cpp \ # WindowControlActionEvents.cpp \ -# WindowCreator.cpp \ CPPSRCS = \ + WindowCreator.cpp \ nsActions.cpp \ NavigationActionEvents.cpp \ InputStreamShim.cpp \ diff --git a/mozilla/java/webclient/src_moz/NativeBrowserControl.cpp b/mozilla/java/webclient/src_moz/NativeBrowserControl.cpp index c90a676b474..32109b466d5 100644 --- a/mozilla/java/webclient/src_moz/NativeBrowserControl.cpp +++ b/mozilla/java/webclient/src_moz/NativeBrowserControl.cpp @@ -29,8 +29,10 @@ #include "nsIEventQueueService.h" // for PLEventQueue #include "nsIServiceManager.h" // for do_GetService #include "nsEmbedAPI.h" // for NS_HandleEmbeddingEvent +#include // for initializing our window watcher service #include "EmbedWindow.h" +#include "WindowCreator.h" #include "EmbedProgress.h" #include "NativeBrowserControl.h" #include "ns_util.h" @@ -91,9 +93,15 @@ NativeBrowserControl::Init() // // create the WindowCreator: see - // NativeEventThread->InitializeWindowCreator - // + WindowCreator *creator = new WindowCreator(this); + nsCOMPtr windowCreator; + windowCreator = NS_STATIC_CAST(nsIWindowCreator *, creator); + // Attach it via the watcher service + nsCOMPtr watcher = do_GetService(NS_WINDOWWATCHER_CONTRACTID); + if (watcher) { + watcher->SetWindowCreator(windowCreator); + } return NS_OK; } diff --git a/mozilla/java/webclient/src_moz/WindowCreator.cpp b/mozilla/java/webclient/src_moz/WindowCreator.cpp index 59d84308dc8..f2db98f7c93 100644 --- a/mozilla/java/webclient/src_moz/WindowCreator.cpp +++ b/mozilla/java/webclient/src_moz/WindowCreator.cpp @@ -23,13 +23,13 @@ #include "nsIWebBrowserChrome.h" #include "WindowCreator.h" -int processEventLoop(NativeBrowserControl * initContext); +NativeBrowserControl* gNewWindowNativeBCPtr; -NativeBrowserControl* gNewWindowInitContext; +NS_IMPL_ISUPPORTS2(WindowCreator, nsIWindowCreator, nsIWindowCreator2) -WindowCreator::WindowCreator(NativeBrowserControl *yourInitContext) +WindowCreator::WindowCreator(NativeBrowserControl *yourNativeBCPtr) { - mInitContext = yourInitContext; + mNativeBCPtr = yourNativeBCPtr; mTarget = 0; } @@ -37,8 +37,6 @@ WindowCreator::~WindowCreator() { } -NS_IMPL_ISUPPORTS1(WindowCreator, nsIWindowCreator) - NS_IMETHODIMP WindowCreator::AddNewWindowListener(jobject target) { if (! mTarget) @@ -55,24 +53,37 @@ WindowCreator::CreateChromeWindow(nsIWebBrowserChrome *parent, if (!mTarget) return NS_OK; - gNewWindowInitContext = nsnull; + gNewWindowNativeBCPtr = nsnull; + + /******** - util_SendEventToJava(mInitContext->env, - mInitContext->nativeEventThread, + util_SendEventToJava(mNativeBCPtr->env, + mNativeBCPtr->nativeEventThread, mTarget, NEW_WINDOW_LISTENER_CLASSNAME, chromeFlags, 0); - // check gNewWindowInitContext to see if the initialization had completed - while (!gNewWindowInitContext) { - processEventLoop(mInitContext); + // check gNewWindowNativeBCPtr to see if the initialization had completed + while (!gNewWindowNativeBCPtr) { + processEventLoop(mNativeBCPtr); ::PR_Sleep(PR_INTERVAL_NO_WAIT); } - nsCOMPtr webChrome(do_QueryInterface(gNewWindowInitContext->browserContainer)); + nsCOMPtr webChrome(do_QueryInterface(gNewWindowNativeBCPtr->browserContainer)); *_retval = webChrome; NS_IF_ADDREF(*_retval); printf ("RET=%x\n", *_retval); + *************/ + return NS_OK; +} + +NS_IMETHODIMP +WindowCreator::CreateChromeWindow2(nsIWebBrowserChrome *parent, + PRUint32 chromeFlags, + PRUint32 contextFlags, + nsIURI *uri, PRBool *cancel, + nsIWebBrowserChrome **_retval) +{ return NS_OK; } diff --git a/mozilla/java/webclient/src_moz/WindowCreator.h b/mozilla/java/webclient/src_moz/WindowCreator.h index e33a7d2b88f..c78f9b1622c 100644 --- a/mozilla/java/webclient/src_moz/WindowCreator.h +++ b/mozilla/java/webclient/src_moz/WindowCreator.h @@ -23,13 +23,13 @@ #ifndef __WindowCreator_h_ #define __WindowCreator_h_ -#include "nsIWindowCreator.h" +#include "nsIWindowCreator2.h" #include "ns_util.h" -class WindowCreator : public nsIWindowCreator +class WindowCreator : public nsIWindowCreator2 { private: - NativeBrowserControl *mInitContext; + NativeBrowserControl *mNativeBCPtr; jobject mTarget; public: @@ -40,6 +40,7 @@ public: NS_DECL_ISUPPORTS NS_DECL_NSIWINDOWCREATOR + NS_DECL_NSIWINDOWCREATOR2 }; #endif diff --git a/mozilla/java/webclient/src_moz/WrapperFactoryImpl.cpp b/mozilla/java/webclient/src_moz/WrapperFactoryImpl.cpp index 34dd47feed2..9366066e7e3 100644 --- a/mozilla/java/webclient/src_moz/WrapperFactoryImpl.cpp +++ b/mozilla/java/webclient/src_moz/WrapperFactoryImpl.cpp @@ -31,6 +31,8 @@ #include "ns_util.h" #include "nsCRT.h" // for nsCRT::strcmp +#include // PENDING(edburns): remove when the offline issue is resolved + #include // for NS_APPSHELL_CID #include // for do_CreateInstance #include @@ -51,7 +53,10 @@ #include "NativeBrowserControl.h" +#include "nsNetCID.h" // for NS_IOSERVICE_CID + static NS_DEFINE_CID(kAppShellCID, NS_APPSHELL_CID); +static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID); // // global data @@ -237,6 +242,18 @@ Java_org_mozilla_webclient_impl_wrapper_1native_WrapperFactoryImpl_nativeAppSetu return; } + nsCOMPtr ioService = do_GetService(kIOServiceCID, &rv); + + if (NS_FAILED(rv)) { + ::util_ThrowExceptionToJava(env, "Can't get IOService."); + return; + } + rv = ioService->SetOffline(PR_FALSE); + if (NS_FAILED(rv)) { + ::util_ThrowExceptionToJava(env, "Can't get IOService."); + return; + } + PR_LOG(prLogModuleInfo, PR_LOG_DEBUG, ("WrapperFactoryImpl_nativeAppSetup: exiting\n")); diff --git a/mozilla/java/webclient/test/automated/src/classes/org/mozilla/util/THTTPD.java b/mozilla/java/webclient/test/automated/src/classes/org/mozilla/util/THTTPD.java index 615fee1cbee..33d3830b2fa 100644 --- a/mozilla/java/webclient/test/automated/src/classes/org/mozilla/util/THTTPD.java +++ b/mozilla/java/webclient/test/automated/src/classes/org/mozilla/util/THTTPD.java @@ -1,5 +1,5 @@ /* - * $Id: THTTPD.java,v 1.1 2004-06-18 13:53:13 edburns%acm.org Exp $ + * $Id: THTTPD.java,v 1.2 2004-06-22 19:23:23 edburns%acm.org Exp $ */ /* @@ -92,8 +92,10 @@ public class THTTPD extends Object { V(); while (keepRunning) { - if ((-1 != maxRequests) && numRequests < maxRequests) { - break; + if (numRequests >= maxRequests) { + if (-1 != maxRequests) { + break; + } } numRequests++; try { diff --git a/mozilla/java/webclient/test/automated/src/classes/org/mozilla/webclient/NavigationTest.java b/mozilla/java/webclient/test/automated/src/classes/org/mozilla/webclient/NavigationTest.java index 305195c606a..d7f5322f4b0 100644 --- a/mozilla/java/webclient/test/automated/src/classes/org/mozilla/webclient/NavigationTest.java +++ b/mozilla/java/webclient/test/automated/src/classes/org/mozilla/webclient/NavigationTest.java @@ -1,5 +1,5 @@ /* - * $Id: NavigationTest.java,v 1.14 2004-06-18 13:53:13 edburns%acm.org Exp $ + * $Id: NavigationTest.java,v 1.15 2004-06-22 19:23:23 edburns%acm.org Exp $ */ /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- @@ -248,8 +248,6 @@ public class NavigationTest extends WebclientTestCase { BrowserControlFactory.deleteBrowserControl(firstBrowserControl); } - /********** - public void testHttpLoad() throws Exception { BrowserControl firstBrowserControl = null; DocumentListener listener = null; @@ -285,7 +283,8 @@ public class NavigationTest extends WebclientTestCase { final THTTPD.ServerThread serverThread = new THTTPD.ServerThread("LocalHTTPD", - new File (getBrowserBinDir()), 1); + new File (getBrowserBinDir() + + "/../../java/webclient/build.test"), 1); serverThread.setSoTimeout(15000); serverThread.start(); serverThread.P(); @@ -303,6 +302,8 @@ public class NavigationTest extends WebclientTestCase { }); String url = "http://localhost:5243/HttpNavigationTest.txt"; + + Thread.currentThread().sleep(3000); nav.loadURL(url); @@ -316,9 +317,6 @@ public class NavigationTest extends WebclientTestCase { BrowserControlFactory.deleteBrowserControl(firstBrowserControl); } - ****************/ - - public static abstract class DocumentListener implements DocumentLoadListener { public void eventDispatched(WebclientEvent event) {