mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-14 20:22:00 +00:00
This checkin verifies that loading documents over HTTP works as
expected. M src_moz/Makefile.in - added WindowWatcher to compilation M src_moz/NativeBrowserControl.cpp - turn on our WindowWatcher. Still need to flesh this out, but it seemed to be necessary for http to work. M src_moz/WindowCreator.cpp M src_moz/WindowCreator.h - return to compilation M src_moz/WrapperFactoryImpl.cpp - hack to workaround bug posted to n.p.m.e by me today regarding nsIOService::SetOffline(TRUE) being called. The workaround is to manually call nsIOService::SetOffline(FALSE) *after* the point in time where the "TRUE" call is made. M test/automated/src/classes/org/mozilla/util/THTTPD.java - tweaks to make this suitable for JUnit testing. M test/automated/src/classes/org/mozilla/webclient/NavigationTest.java - all navigation tests work.
This commit is contained in:
parent
a6bbd20c9c
commit
62ba5ac0a3
@ -94,9 +94,9 @@ REQUIRES = xpcom \
|
||||
# ISupportsPeer.cpp \
|
||||
# NativeEventThreadActionEvents.cpp \
|
||||
# WindowControlActionEvents.cpp \
|
||||
# WindowCreator.cpp \
|
||||
|
||||
CPPSRCS = \
|
||||
WindowCreator.cpp \
|
||||
nsActions.cpp \
|
||||
NavigationActionEvents.cpp \
|
||||
InputStreamShim.cpp \
|
||||
|
@ -29,8 +29,10 @@
|
||||
#include "nsIEventQueueService.h" // for PLEventQueue
|
||||
#include "nsIServiceManager.h" // for do_GetService
|
||||
#include "nsEmbedAPI.h" // for NS_HandleEmbeddingEvent
|
||||
#include <nsIWindowWatcher.h> // 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<nsIWindowCreator> windowCreator;
|
||||
windowCreator = NS_STATIC_CAST(nsIWindowCreator *, creator);
|
||||
|
||||
// Attach it via the watcher service
|
||||
nsCOMPtr<nsIWindowWatcher> watcher = do_GetService(NS_WINDOWWATCHER_CONTRACTID);
|
||||
if (watcher) {
|
||||
watcher->SetWindowCreator(windowCreator);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -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<nsIWebBrowserChrome> webChrome(do_QueryInterface(gNewWindowInitContext->browserContainer));
|
||||
nsCOMPtr<nsIWebBrowserChrome> 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;
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -31,6 +31,8 @@
|
||||
#include "ns_util.h"
|
||||
#include "nsCRT.h" // for nsCRT::strcmp
|
||||
|
||||
#include <nsIIOService.h> // PENDING(edburns): remove when the offline issue is resolved
|
||||
|
||||
#include <nsWidgetsCID.h> // for NS_APPSHELL_CID
|
||||
#include <nsIComponentManager.h> // for do_CreateInstance
|
||||
#include <nsILocalFile.h>
|
||||
@ -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<nsIIOService> 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"));
|
||||
|
||||
|
@ -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 {
|
||||
|
@ -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) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user