This change replaces all printfs in src_moz with calls to PR_LOG.  No
printfs should appear in src_moz anymore.

You won't see any console output from native code unless you define

NSPR_LOG_MODULES=webclient:3

in your environment.  Furthermore, if you want PR_LOG statements in
webclient to go to a file instead, define

WEBCLIENT_LOG_FILE=C:\VALIDDIR\filename.txt

in your environment.  This file will get created fresh each time, since
PR_LOG uses fopen(filename, "w").

New Files:

I've created ns_globals.h, included from jni_util.h.  ns_globals.h holds
an extern * to a struct used in the PR_LOG calls.

Significant changes:

WrapperFactoryImpl.cpp

nativeAppInitialize(){

Added:

#if DEBUG_RAPTOR_CANVAS
    prLogModuleInfo = PR_NewLogModule("webclient");
    const char *webclientLogFile = PR_GetEnv("WEBCLIENT_LOG_FILE");
    if (nsnull != webclientLogFile) {
        PR_SetLogFile(webclientLogFile);
        // If this fails, it just goes to stdout/stderr
    }
#endif
}

All the other files in this checkin follow the this pattern:

Before checkin:

       printf("InitMozillaStuff(%lx): Create the Event Queue for the UI thread...\n",
               initContext);

After checkin:

    if (prLogModuleInfo) {
        PR_LOG(prLogModuleInfo, 3,
               ("InitMozillaStuff(%lx): Create the Event Queue for the UI thread...\n",
               initContext));
    }

See http://lxr.mozilla.org/mozilla/source/nsprpub/pr/include/prlog.h#190

for the definition of PR_LOG
This commit is contained in:
edburns%acm.org 2000-04-05 21:38:27 +00:00
Родитель f1fef2ea55
Коммит 383322dfbb
14 изменённых файлов: 311 добавлений и 193 удалений

Просмотреть файл

@ -64,7 +64,6 @@ Java_org_mozilla_webclient_wrapper_1native_BookmarksImpl_nativeNewRDFNode
const char *url = ::util_GetStringUTFChars(env, urlString);
uri.Append("#$");
uri.Append(url);
printf("debug: edburns: nativeNewRDFNode: url: %s\n", url);
rv = gRDF->GetUnicodeResource(uri.GetUnicode(), getter_AddRefs(newNode));
::util_ReleaseStringUTFChars(env, urlString, url);

Просмотреть файл

@ -147,7 +147,12 @@ NS_IMETHODIMP DocumentLoaderObserverImpl::OnStartDocumentLoad(nsIDocumentLoader*
nsIURI* aURL,
const char* aCommand)
{
printf("DocumentLoaderObserverImpl.cpp: OnStartDocumentLoad\n");
#if DEBUG_RAPTOR_CANVAS
if (prLogModuleInfo) {
PR_LOG(prLogModuleInfo, 3,
("DocumentLoaderObserverImpl.cpp: OnStartDocumentLoad\n"));
}
#endif
util_SendEventToJava(mInitContext->env,
mInitContext->nativeEventThread, mTarget,
maskValues[START_DOCUMENT_LOAD_EVENT_MASK]);
@ -159,7 +164,12 @@ NS_IMETHODIMP DocumentLoaderObserverImpl::OnEndDocumentLoad(nsIDocumentLoader* l
nsIChannel* channel,
nsresult aStatus)
{
printf("!!DocumentLoaderObserverImpl.cpp: OnEndDocumentLoad\n");
#if DEBUG_RAPTOR_CANVAS
if (prLogModuleInfo) {
PR_LOG(prLogModuleInfo, 3,
("!!DocumentLoaderObserverImpl.cpp: OnEndDocumentLoad\n"));
}
#endif
util_SendEventToJava(mInitContext->env,
mInitContext->nativeEventThread, mTarget,
@ -170,7 +180,12 @@ NS_IMETHODIMP DocumentLoaderObserverImpl::OnEndDocumentLoad(nsIDocumentLoader* l
NS_IMETHODIMP DocumentLoaderObserverImpl::OnStartURLLoad(nsIDocumentLoader* loader,
nsIChannel* channel)
{
printf("!DocumentLoaderObserverImpl: OnStartURLLoad\n");
#if DEBUG_RAPTOR_CANVAS
if (prLogModuleInfo) {
PR_LOG(prLogModuleInfo, 3,
("!DocumentLoaderObserverImpl: OnStartURLLoad\n"));
}
#endif
util_SendEventToJava(mInitContext->env, mInitContext->nativeEventThread, mTarget,
maskValues[START_URL_LOAD_EVENT_MASK]);
@ -182,7 +197,12 @@ NS_IMETHODIMP DocumentLoaderObserverImpl::OnProgressURLLoad(nsIDocumentLoader* l
PRUint32 aProgress,
PRUint32 aProgressMax)
{
printf("!DocumentLoaderObserverImpl: OnProgressURLLoad\n");
#if DEBUG_RAPTOR_CANVAS
if (prLogModuleInfo) {
PR_LOG(prLogModuleInfo, 3,
("!DocumentLoaderObserverImpl: OnProgressURLLoad\n"));
}
#endif
util_SendEventToJava(mInitContext->env, mInitContext->nativeEventThread, mTarget,
maskValues[PROGRESS_URL_LOAD_EVENT_MASK]);
@ -194,7 +214,12 @@ NS_IMETHODIMP DocumentLoaderObserverImpl::OnStatusURLLoad(nsIDocumentLoader* loa
nsIChannel* channel,
nsString& aMsg)
{
printf("!DocumentLoaderObserverImpl: OnStatusURLLoad\n");
#if DEBUG_RAPTOR_CANVAS
if (prLogModuleInfo) {
PR_LOG(prLogModuleInfo, 3,
("!DocumentLoaderObserverImpl: OnStatusURLLoad\n"));
}
#endif
util_SendEventToJava(mInitContext->env, mInitContext->nativeEventThread, mTarget,
maskValues[STATUS_URL_LOAD_EVENT_MASK]);
@ -206,7 +231,12 @@ NS_IMETHODIMP DocumentLoaderObserverImpl::OnEndURLLoad(nsIDocumentLoader* loader
nsIChannel* channel,
nsresult aStatus)
{
printf("!DocumentLoaderObserverImpl: OnEndURLLoad\n");
#if DEBUG_RAPTOR_CANVAS
if (prLogModuleInfo) {
PR_LOG(prLogModuleInfo, 3,
("!DocumentLoaderObserverImpl: OnEndURLLoad\n"));
}
#endif
util_SendEventToJava(mInitContext->env, mInitContext->nativeEventThread, mTarget,
maskValues[END_URL_LOAD_EVENT_MASK]);
@ -218,7 +248,12 @@ NS_IMETHODIMP DocumentLoaderObserverImpl::HandleUnknownContentType(nsIDocumentLo
const char *aContentType,
const char *aCommand)
{
printf("!DocumentLoaderObserverImpl: HandleUnknownContentType\n");
#if DEBUG_RAPTOR_CANVAS
if (prLogModuleInfo) {
PR_LOG(prLogModuleInfo, 3,
("!DocumentLoaderObserverImpl: HandleUnknownContentType\n"));
}
#endif
util_SendEventToJava(mInitContext->env, mInitContext->nativeEventThread, mTarget,
maskValues[UNKNOWN_CONTENT_EVENT_MASK]);

Просмотреть файл

@ -50,23 +50,6 @@ Java_org_mozilla_webclient_wrapper_1native_HistoryImpl_nativeBack
new wsBackEvent(initContext->sessionHistory, initContext->webShell);
PLEvent * event = (PLEvent*) *actionEvent;
#ifdef XP_PC
// debug: edburns:
DWORD nativeThreadID = GetCurrentThreadId();
printf("debug: edburns: HistoryImpl_nativeBack() nativeThreadID: %d\n",
nativeThreadID);
#endif
char *currentThreadName = nsnull;
if (nsnull != (currentThreadName = util_GetCurrentThreadName(env))) {
printf("debug: edburns: HistoryImpl_nativeBack() java threadName: %s\n",
currentThreadName);
delete currentThreadName;
}
::util_PostSynchronousEvent(initContext, event);
}

Просмотреть файл

@ -313,12 +313,17 @@ static void event_processor_callback(gpointer data,
gint source,
GdkInputCondition condition) {
#if DEBUG_RAPTOR_CANVAS
printf("EventHandler: event_processor_callback()\n");
if (prLogModuleInfo) {
PR_LOG(prLogModuleInfo, 3,
"EventHandler: event_processor_callback()\n");
}
#endif
nsIEventQueue *eventQueue = (nsIEventQueue*)data;
eventQueue->ProcessPendingEvents();
#if DEBUG_RAPTOR_CANVAS
printf("EventHandler: Done processing pending events\n");
if (prLogModuleInfo) {
PR_LOG(prLogModuleInfo, 3, "EventHandler: Done processing pending events\n");
}
#endif
}
#endif
@ -333,7 +338,11 @@ nsresult InitMozillaStuff (WebShellInitContext * initContext)
//TODO Add tracing from nspr.
#if DEBUG_RAPTOR_CANVAS
printf("InitMozillaStuff(%lx): Create the Event Queue for the UI thread...\n", initContext);
if (prLogModuleInfo) {
PR_LOG(prLogModuleInfo, 3,
("InitMozillaStuff(%lx): Create the Event Queue for the UI thread...\n",
initContext));
}
#endif
// Create the Event Queue for the UI thread...
@ -355,11 +364,15 @@ nsresult InitMozillaStuff (WebShellInitContext * initContext)
if (initContext->embeddedThread) {
#if DEBUG_RAPTOR_CANVAS
printf("InitMozillaStuff(%lx): embeddedThread != nsnull\n", initContext);
if (prLogModuleInfo) {
PR_LOG(prLogModuleInfo, 3, ("InitMozillaStuff(%lx): embeddedThread != nsnull\n", initContext));
}
#endif
if (initContext->actionQueue == nsnull) {
#if DEBUG_RAPTOR_CANVAS
printf("InitMozillaStuff(%lx): Create the action queue\n", initContext);
if (prLogModuleInfo) {
PR_LOG(prLogModuleInfo, 3, ("InitMozillaStuff(%lx): Create the action queue\n", initContext));
}
#endif
// We need to do something different for Unix
nsIEventQueue * EQueue = nsnull;
@ -390,7 +403,10 @@ nsresult InitMozillaStuff (WebShellInitContext * initContext)
}
#if DEBUG_RAPTOR_CANVAS
printf("InitMozillaStuff(%lx): Create the WebShell...\n", initContext);
if (prLogModuleInfo) {
PR_LOG(prLogModuleInfo, 3,
("InitMozillaStuff(%lx): Create the WebShell...\n", initContext));
}
#endif
// Create the WebShell.
rv = nsRepository::CreateInstance(kWebShellCID, nsnull, kIWebShellIID, getter_AddRefs(initContext->webShell));
@ -400,7 +416,10 @@ nsresult InitMozillaStuff (WebShellInitContext * initContext)
}
#if DEBUG_RAPTOR_CANVAS
printf("InitMozillaStuff(%lx): Init the WebShell...\n", initContext);
if (prLogModuleInfo) {
PR_LOG(prLogModuleInfo, 3,
("InitMozillaStuff(%lx): Init the WebShell...\n", initContext));
}
#endif
#ifdef XP_UNIX
@ -420,7 +439,10 @@ nsresult InitMozillaStuff (WebShellInitContext * initContext)
}
#if DEBUG_RAPTOR_CANVAS
printf("InitMozillaStuff(%lx): Install Prefs in the Webshell...\n", initContext);
if (prLogModuleInfo) {
PR_LOG(prLogModuleInfo, 3,
("InitMozillaStuff(%lx): Install Prefs in the Webshell...\n", initContext));
}
#endif
nsIPref *prefs;
@ -451,7 +473,10 @@ nsresult InitMozillaStuff (WebShellInitContext * initContext)
initContext->sessionHistory = gHistory;
#if DEBUG_RAPTOR_CANVAS
printf("InitMozillaStuff(%lx): Show the WebShell...\n", initContext);
if (prLogModuleInfo) {
PR_LOG(prLogModuleInfo, 3,
("InitMozillaStuff(%lx): Show the WebShell...\n", initContext));
}
#endif
nsCOMPtr<nsIBaseWindow> baseWindow;
@ -482,7 +507,10 @@ nsresult InitMozillaStuff (WebShellInitContext * initContext)
initContext->initComplete = TRUE;
#if DEBUG_RAPTOR_CANVAS
printf("InitMozillaStuff(%lx): enter event loop\n", initContext);
if (prLogModuleInfo) {
PR_LOG(prLogModuleInfo, 3,
("InitMozillaStuff(%lx): enter event loop\n", initContext));
}
#endif
// Just need to loop once to clear out events before returning

Просмотреть файл

@ -35,11 +35,16 @@ JNIEXPORT void JNICALL Java_org_mozilla_webclient_wrapper_1native_NavigationImpl
(JNIEnv *env, jobject obj, jint webShellPtr, jstring urlString)
{
jobject jobj = obj;
#if DEBUG_RAPTOR_CANVAS
const char * urlChars = (char *) ::util_GetStringUTFChars(env,
urlString);
printf("Native URL = \"%s\"\n", urlChars);
if (prLogModuleInfo) {
PR_LOG(prLogModuleInfo, 3,
("Native URL = \"%s\"\n", urlChars));
}
::util_ReleaseStringUTFChars(env, urlString, urlChars);
#endif
PRUnichar * urlStringChars = (PRUnichar *) ::util_GetStringChars(env,
urlString);

Просмотреть файл

@ -100,7 +100,10 @@ Java_org_mozilla_webclient_wrapper_1native_RDFEnumeration_nativeNextElement
rv = enumerator->GetNext(getter_AddRefs(supportsResult));
if (NS_FAILED(rv)) {
printf("Exception: nativeNextElement: Can't get next from enumerator.\n");
if (prLogModuleInfo) {
PR_LOG(prLogModuleInfo, 3,
("Exception: nativeNextElement: Can't get next from enumerator.\n"));
}
return result;
}
@ -108,7 +111,10 @@ Java_org_mozilla_webclient_wrapper_1native_RDFEnumeration_nativeNextElement
rv = supportsResult->QueryInterface(NS_GET_IID(nsIRDFNode),
getter_AddRefs(nodeResult));
if (NS_FAILED(rv)) {
printf("Exception: nativeNextElement: next from enumerator is not an nsIRDFNode.\n");
if (prLogModuleInfo) {
PR_LOG(prLogModuleInfo, 3,
("Exception: nativeNextElement: next from enumerator is not an nsIRDFNode.\n"));
}
return result;
}
@ -126,7 +132,10 @@ Java_org_mozilla_webclient_wrapper_1native_RDFEnumeration_nativeFinalize
// release the nsISimpleEnumerator
if (-1 == (nativeEnum =
::util_GetIntValueFromInstance(env, obj, "nativeEnum"))) {
printf("nativeFinalize: Can't get fieldID for nativeEnum.\n");
if (prLogModuleInfo) {
PR_LOG(prLogModuleInfo, 3,
("nativeFinalize: Can't get fieldID for nativeEnum.\n"));
}
return;
}
nsCOMPtr<nsISimpleEnumerator> enumerator =
@ -136,7 +145,10 @@ Java_org_mozilla_webclient_wrapper_1native_RDFEnumeration_nativeFinalize
// release the nsIRDFContainer
if (-1 == (nativeContainer =
::util_GetIntValueFromInstance(env, obj, "nativeContainer"))) {
printf("nativeFinalize: Can't get fieldID for nativeContainerFieldID.\n");
if (prLogModuleInfo) {
PR_LOG(prLogModuleInfo, 3,
("nativeFinalize: Can't get fieldID for nativeContainerFieldID.\n"));
}
return;
}
nsCOMPtr<nsIRDFContainer> container =
@ -174,7 +186,10 @@ jint getNativeEnumFromJava(JNIEnv *env, jobject obj, jint nativeRDFNode)
rv = node->QueryInterface(NS_GET_IID(nsIRDFResource),
getter_AddRefs(nodeResource));
if (NS_FAILED(rv)) {
printf("getNativeEnumFromJava: Argument nativeRDFNode isn't an nsIRDFResource.\n");
if (prLogModuleInfo) {
PR_LOG(prLogModuleInfo, 3,
("getNativeEnumFromJava: Argument nativeRDFNode isn't an nsIRDFResource.\n"));
}
return -1;
}
@ -184,19 +199,28 @@ jint getNativeEnumFromJava(JNIEnv *env, jobject obj, jint nativeRDFNode)
NS_GET_IID(nsIRDFContainer),
getter_AddRefs(container));
if (NS_FAILED(rv)) {
printf("recursiveResourceTraversal: can't get a new container\n");
if (prLogModuleInfo) {
PR_LOG(prLogModuleInfo, 3,
("recursiveResourceTraversal: can't get a new container\n"));
}
return -1;
}
rv = container->Init(gBookmarksDataSource, nodeResource);
if (NS_FAILED(rv)) {
printf("getNativeEnumFromJava: Can't Init container.\n");
if (prLogModuleInfo) {
PR_LOG(prLogModuleInfo, 3,
("getNativeEnumFromJava: Can't Init container.\n"));
}
return -1;
}
rv = container->GetElements(getter_AddRefs(enumerator));
if (NS_FAILED(rv)) {
printf("getNativeEnumFromJava: Can't get enumeration from container.\n");
if (prLogModuleInfo) {
PR_LOG(prLogModuleInfo, 3,
("getNativeEnumFromJava: Can't get enumeration from container.\n"));
}
return -1;
}

Просмотреть файл

@ -174,7 +174,10 @@ Java_org_mozilla_webclient_wrapper_1native_RDFTreeNode_nativeToString
rv = literal->GetValueConst(&textForNode);
}
else {
printf("nativeToString: node is not an nsIRDFLiteral.\n");
if (prLogModuleInfo) {
PR_LOG(prLogModuleInfo, 3,
("nativeToString: node is not an nsIRDFLiteral.\n"));
}
}
}
}
@ -197,17 +200,26 @@ Java_org_mozilla_webclient_wrapper_1native_RDFTreeNode_nativeToString
// get the value of the literal
rv = literal->GetValueConst(&textForNode);
if (NS_FAILED(rv)) {
printf("nativeToString: node doesn't have a value.\n");
if (prLogModuleInfo) {
PR_LOG(prLogModuleInfo, 3,
("nativeToString: node doesn't have a value.\n"));
}
}
}
else {
rdf_printArcLabels(currentResource);
printf("nativeToString: node is not an nsIRDFLiteral.\n");
if (prLogModuleInfo) {
PR_LOG(prLogModuleInfo, 3,
("nativeToString: node is not an nsIRDFLiteral.\n"));
}
}
}
else {
rdf_printArcLabels(currentResource);
printf("nativeToString: node doesn't have a URL.\n");
if (prLogModuleInfo) {
PR_LOG(prLogModuleInfo, 3,
("nativeToString: node doesn't have a URL.\n"));
}
}
}

Просмотреть файл

@ -33,6 +33,8 @@
#include "nsAppShellCIDs.h" // for NS_SESSIONHISTORY_CID
#include "nsCRT.h" // for nsCRT::strcmp
#include "prenv.h"
static NS_DEFINE_CID(kSessionHistoryCID, NS_SESSIONHISTORY_CID);
#ifdef XP_PC
@ -64,6 +66,8 @@ static NS_DEFINE_CID(kSessionHistoryCID, NS_SESSIONHISTORY_CID);
static nsFileSpec gBinDir;
PRLogModuleInfo *prLogModuleInfo = NULL; // declared in jni_util.h
const char *gImplementedInterfaces[] = {
"webclient.WindowControl",
"webclient.Navigation",
@ -91,6 +95,13 @@ Java_org_mozilla_webclient_wrapper_1native_WrapperFactoryImpl_nativeAppInitializ
NS_InitXPCOM(nsnull, &gBinDir);
NS_SetupRegistry();
prLogModuleInfo = PR_NewLogModule("webclient");
const char *webclientLogFile = PR_GetEnv("WEBCLIENT_LOG_FILE");
if (nsnull != webclientLogFile) {
PR_SetLogFile(webclientLogFile);
// If this fails, it just goes to stdout/stderr
}
nsComponentManager::RegisterComponentLib(kSessionHistoryCID, nsnull,
nsnull, APPSHELL_DLL,
PR_FALSE, PR_FALSE);

Просмотреть файл

@ -27,7 +27,8 @@
#include "jni_util.h"
JavaVM *gVm = nsnull;
JavaVM *gVm = nsnull; // declared in ns_globals.h, which is included in
// jni_util.h
void util_ThrowExceptionToJava (JNIEnv * env, const char * message)
{
@ -113,7 +114,10 @@ void util_SendEventToJava(JNIEnv *yourEnv, jobject nativeEventThread,
env->CallVoidMethod(nativeEventThread, mid, webclientEventListener,
eventType);
} else {
printf("cannot call the Java Method!\n");
if (prLogModuleInfo) {
PR_LOG(prLogModuleInfo, 3,
("cannot call the Java Method!\n"));
}
}
}
@ -293,13 +297,19 @@ jint util_GetIntValueFromInstance(JNIEnv *env, jobject obj,
#else
jclass objClass = env->GetObjectClass(obj);
if (nsnull == objClass) {
printf("util_GetIntValueFromInstance: Can't get object class from instance.\n");
if (prLogModuleInfo) {
PR_LOG(prLogModuleInfo, 3,
("util_GetIntValueFromInstance: Can't get object class from instance.\n"));
}
return result;
}
jfieldID theFieldID = env->GetFieldID(objClass, fieldName, "I");
if (nsnull == theFieldID) {
printf("util_GetIntValueFromInstance: Can't get fieldID for fieldName.\n");
if (prLogModuleInfo) {
PR_LOG(prLogModuleInfo, 3,
("util_GetIntValueFromInstance: Can't get fieldID for fieldName.\n"));
}
return result;
}
@ -315,13 +325,19 @@ void util_SetIntValueForInstance(JNIEnv *env, jobject obj,
#else
jclass objClass = env->GetObjectClass(obj);
if (nsnull == objClass) {
printf("util_SetIntValueForInstance: Can't get object class from instance.\n");
if (prLogModuleInfo) {
PR_LOG(prLogModuleInfo, 3,
("util_SetIntValueForInstance: Can't get object class from instance.\n"));
}
return;
}
jfieldID fieldID = env->GetFieldID(objClass, fieldName, "I");
if (nsnull == fieldID) {
printf("util_SetIntValueForInstance: Can't get fieldID for fieldName.\n");
if (prLogModuleInfo) {
PR_LOG(prLogModuleInfo, 3,
("util_SetIntValueForInstance: Can't get fieldID for fieldName.\n"));
}
return;
}
@ -362,7 +378,6 @@ JNU_CallMethodByNameV(JNIEnv *env,
jmethodID mid;
jvalue result;
const char *p = signature;
printf("jni_util: call method by name if 0");
/* find out the return type */
while (*p && *p != ')')
p++;
@ -372,14 +387,10 @@ JNU_CallMethodByNameV(JNIEnv *env,
if (env->EnsureLocalCapacity(3) < 0)
goto done2;
printf("jni_util: call method by name if 1");
clazz = env->GetObjectClass(obj);
printf("jni_util: call method by name 2");
mid = env->GetMethodID(clazz, name, signature);
printf("jni_util: call method by name 3");
if (mid == 0)
goto done1;
printf("jni_util: call method by name if 4");
switch (*p) {
case 'V':
env->CallVoidMethodV(obj, mid, args);

Просмотреть файл

@ -44,6 +44,8 @@
#include "nsIWebShell.h" // for nsIWebShell
#include "nsIEventQueueService.h" // for PLEventQueue
#include "ns_globals.h"
// Ashu
#ifdef XP_UNIX
#include "nsIWidget.h" // for GTKWidget
@ -91,7 +93,7 @@ enum {
kClipboardWebShellError
};
extern JavaVM *gVm;
extern JavaVM *gVm; // defined in jni_util.cpp
void util_ThrowExceptionToJava (JNIEnv * env, const char * message);

Просмотреть файл

@ -27,6 +27,8 @@
#include "nscore.h" // for nsnull
#include "ns_globals.h" // for prLogModuleInfo
JNIEXPORT const char * JNICALL util_GetStringUTFChars(JNIEnv *env,
jstring inString)
{
@ -101,7 +103,10 @@ JNIEXPORT void JNICALL util_DeleteStringUTF(JNIEnv *env, jstring toDelete)
#ifdef BAL_INTERFACE
util_DeleteString(env, toDelete);
#else
printf("This shouldn't get called in a non-BAL context!\n");
if (prLogModuleInfo) {
PR_LOG(prLogModuleInfo, 3,
("This shouldn't get called in a non-BAL context!\n"));
}
#endif
}
@ -123,7 +128,10 @@ JNIEXPORT void JNICALL util_DeleteString(JNIEnv *env, jstring toDelete)
#ifdef BAL_INTERFACE
bal_jstring_release(toDelete);
#else
printf("This shouldn't get called in a non-BAL context!\n");
if (prLogModuleInfo) {
PR_LOG(prLogModuleInfo, 3,
("This shouldn't get called in a non-BAL context!\n"));
}
#endif
}

Просмотреть файл

@ -99,7 +99,6 @@ wsResizeEvent::handleEvent ()
nsresult rv = NS_ERROR_FAILURE;
if (mWebShell) {
printf("handleEvent(resize(x = %d y = %d w = %d h = %d))\n", mLeft, mBottom, mWidth, mHeight);
nsCOMPtr<nsIBaseWindow> baseWindow;
rv = mWebShell->QueryInterface(NS_GET_IID(nsIBaseWindow),
@ -111,7 +110,6 @@ wsResizeEvent::handleEvent ()
rv = baseWindow->SetPositionAndSize(mLeft, mBottom, mWidth, mHeight,
PR_TRUE);
printf("result = %lx\n", rv);
return (void *) rv;
}
@ -139,11 +137,7 @@ wsLoadURLEvent::handleEvent ()
{
if (mWebShell && mURL) {
printf("handleEvent(loadURL))\n");
nsresult rv = mWebShell->LoadURL(mURL->GetUnicode());
printf("result = %lx\n", rv);
}
return nsnull;
} // handleEvent()
@ -172,12 +166,7 @@ void *
wsStopEvent::handleEvent ()
{
if (mWebShell) {
printf("handleEvent(Stop))\n");
nsresult rv = mWebShell->Stop();
printf("result = %lx\n", rv);
}
return nsnull;
} // handleEvent()
@ -199,9 +188,6 @@ void *
wsShowEvent::handleEvent ()
{
if (mWebShell) {
printf("handleEvent(Show))\n");
nsresult rv;
nsCOMPtr<nsIBaseWindow> baseWindow;
@ -212,8 +198,6 @@ wsShowEvent::handleEvent ()
return nsnull;
}
baseWindow->SetVisibility(PR_TRUE);
printf("result = %lx\n", rv);
}
return nsnull;
} // handleEvent()
@ -235,9 +219,6 @@ void *
wsHideEvent::handleEvent ()
{
if (mWebShell) {
printf("handleEvent(Hide))\n");
nsresult rv;
nsCOMPtr<nsIBaseWindow> baseWindow;
@ -248,8 +229,6 @@ wsHideEvent::handleEvent ()
return nsnull;
}
baseWindow->SetVisibility(PR_FALSE);
printf("result = %lx\n", rv);
}
return nsnull;
} // handleEvent()
@ -273,9 +252,6 @@ void *
wsMoveToEvent::handleEvent ()
{
if (mWebShell) {
printf("handleEvent(MoveTo(%ld, %ld))\n", mX, mY);
nsresult rv;
nsCOMPtr<nsIBaseWindow> baseWindow;
@ -286,8 +262,6 @@ wsMoveToEvent::handleEvent ()
return nsnull;
}
rv = baseWindow->SetPosition(mX, mY);
printf("result = %lx\n", rv);
}
return nsnull;
} // handleEvent()
@ -308,9 +282,6 @@ void *
wsSetFocusEvent::handleEvent ()
{
if (mWebShell) {
printf("handleEvent(SetFocus())\n");
nsresult rv;
nsCOMPtr<nsIBaseWindow> baseWindow;
@ -321,8 +292,6 @@ wsSetFocusEvent::handleEvent ()
return nsnull;
}
rv = baseWindow->SetFocus();
printf("result = %lx\n", rv);
}
return nsnull;
} // handleEvent()
@ -344,12 +313,7 @@ void *
wsRemoveFocusEvent::handleEvent ()
{
if (mWebShell) {
printf("handleEvent(RemoveFocus())\n");
nsresult rv = mWebShell->RemoveFocus();
printf("result = %lx\n", rv);
}
return nsnull;
} // handleEvent()
@ -372,9 +336,6 @@ void *
wsRepaintEvent::handleEvent ()
{
if (mWebShell) {
printf("handleEvent(Repaint(%d))\n", mForceRepaint);
nsresult rv;
nsCOMPtr<nsIBaseWindow> baseWindow;
@ -385,8 +346,6 @@ wsRepaintEvent::handleEvent ()
return nsnull;
}
rv = baseWindow->Repaint(mForceRepaint);
printf("result = %lx\n", rv);
}
return nsnull;
} // handleEvent()
@ -411,7 +370,6 @@ wsCanBackEvent::handleEvent ()
nsresult rv;
PRBool canGoBack;
printf("handleEvent(CanBack()): ");
rv = mHistory->CanGoBack(&canGoBack);
if (NS_FAILED(rv)) {
@ -419,13 +377,6 @@ wsCanBackEvent::handleEvent ()
}
result = (void *)canGoBack;
if (PR_TRUE == canGoBack) {
printf("result: true\n");
}
else {
printf("result: false\n");
}
}
return result;
} // handleEvent()
@ -448,7 +399,6 @@ wsCanForwardEvent::handleEvent ()
nsresult rv;
PRBool canGoForward;
printf("handleEvent(CanForward()): ");
rv = mHistory->CanGoForward(&canGoForward);
if (NS_FAILED(rv)) {
@ -457,12 +407,6 @@ wsCanForwardEvent::handleEvent ()
result = (void *)canGoForward;
if (PR_TRUE == canGoForward) {
printf("result: true\n");
}
else {
printf("result: false\n");
}
}
return result;
} // handleEvent()
@ -485,12 +429,8 @@ wsBackEvent::handleEvent ()
{
void *result = nsnull;
if (mHistory && mWebShell) {
printf("handleEvent(Back())\n");
nsresult rv = mHistory->GoBack(mWebShell);
printf("result = %lx\n", rv);
result = (void *) rv;
}
return result;
@ -516,12 +456,7 @@ wsForwardEvent::handleEvent ()
void *result = nsnull;
if (mHistory && mWebShell) {
printf("handleEvent(Forward())\n");
nsresult rv = mHistory->GoForward(mWebShell);
printf("result = %lx\n", rv);
result = (void *) rv;
}
return result;
@ -546,13 +481,7 @@ wsGoToEvent::handleEvent ()
{
void *result = nsnull;
if (mHistory && mWebShell) {
printf("handleEvent(GoTo(%ld))\n", mHistoryIndex);
nsresult rv = mHistory->Goto(mHistoryIndex, mWebShell, PR_TRUE);
printf("result = %lx\n", rv);
result = (void *) rv;
}
return result;
@ -575,15 +504,9 @@ wsGetHistoryLengthEvent::handleEvent ()
{
void *result = nsnull;
if (mHistory) {
printf("handleEvent(wsGetHistoryLengthEvent())\n");
PRInt32 historyLength = 0;
nsresult rv = mHistory->GetHistoryLength(&historyLength);
printf("result = %lx\n", rv);
result = (void *) historyLength;
}
return result;
@ -606,15 +529,9 @@ wsGetHistoryIndexEvent::handleEvent ()
{
void *result = nsnull;
if (mHistory) {
printf("handleEvent(wsGetHistoryIndexEvent())\n");
PRInt32 historyIndex = 0;
nsresult rv = mHistory->GetCurrentIndex(&historyIndex);
printf("result = %lx\n", rv);
result = (void *) historyIndex;
}
return result;
@ -644,7 +561,6 @@ wsGetURLEvent::handleEvent ()
nsresult rv;
rv = mHistory->GetCurrentIndex(&currentIndex);
printf("handleEvent(wsGetURLEvent(%ld))\n", currentIndex);
if (NS_FAILED(rv)) {
return result;
@ -657,9 +573,6 @@ wsGetURLEvent::handleEvent ()
return result;
}
printf("wsGetURLEvent: currentIndex: %ld, currentURL: %s\n",
currentIndex, currentURL);
result = (void *) currentURL;
}
return result;
@ -684,18 +597,11 @@ wsGetURLForIndexEvent::handleEvent ()
if (mHistory) {
nsresult rv;
char *indexURL = nsnull;
printf("handleEvent(GetURLForIndex(%ld))\n", mHistoryIndex);
rv = mHistory->GetURLForIndex(mHistoryIndex, &indexURL);
if (NS_FAILED(rv)) {
return result;
}
printf("wsGetURLForIndexEvent: index: %ld, indexURL: %s\n",
mHistoryIndex, indexURL);
result = (void *) indexURL;
}
return result;
@ -721,13 +627,7 @@ void *
wsRefreshEvent::handleEvent ()
{
if (mWebShell) {
printf("handleEvent(Refresh())\n");
nsresult rv = mWebShell->Reload(loadFlags);
printf("result = %lx\n", rv);
return (void *) rv;
}
return nsnull;
@ -746,12 +646,8 @@ wsAddDocLoaderObserverEvent::handleEvent ()
void *result = nsnull;
if (mDocShell && mDocObserver) {
printf("handleEvent(AddDocLoaderObserver())\n");
nsresult rv = mDocShell->SetDocLoaderObserver(mDocObserver);
printf("result = %lx\n", rv);
result = (void *) rv;
}
return result;

Просмотреть файл

@ -0,0 +1,37 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (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.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is RaptorCanvas.
*
* The Initial Developer of the Original Code is Kirk Baker and
* Ian Wilkinson. Portions created by Kirk Baker and Ian Wilkinson are
* Copyright (C) 1999 Kirk Baker and Ian Wilkinson. All
* Rights Reserved.
*
* Contributor(s): Ed Burns <edburns@acm.org>
*
*/
/**
* Global data
*/
#ifndef ns_globals_h
#define ns_globals_h
#include "prlog.h"
extern PRLogModuleInfo *prLogModuleInfo; // defined in WrapperFactory.cpp
#endif // ns_globals_h

Просмотреть файл

@ -22,6 +22,8 @@
#include "rdf_util.h"
#include "ns_globals.h" // for prLogModuleInfo
#include "nsIServiceManager.h"
static PRBool rdf_inited = PR_FALSE;
@ -152,7 +154,6 @@ void rdf_recursiveResourceTraversal(nsCOMPtr<nsIRDFResource> currentResource)
if (result) {
// It's a folder
printf("FOLDER:\n");
rdf_printArcLabels(currentResource);
// see if it has a name target
@ -168,15 +169,20 @@ void rdf_recursiveResourceTraversal(nsCOMPtr<nsIRDFResource> currentResource)
getter_AddRefs(literal));
if (NS_SUCCEEDED(rv)) {
rv = literal->GetValueConst(&textForNode);
printf("folder: %S\n", textForNode);
}
else {
printf("recursiveResourceTraversal: node is not an nsIRDFLiteral.\n");
if (prLogModuleInfo) {
PR_LOG(prLogModuleInfo, 3,
("recursiveResourceTraversal: node is not an nsIRDFLiteral.\n"));
}
}
}
else {
printf("recursiveResourceTraversal: can't get name from currentResource.\n");
if (prLogModuleInfo) {
PR_LOG(prLogModuleInfo, 3,
("recursiveResourceTraversal: can't get name from currentResource.\n"));
}
}
// get a container in order to recurr
@ -185,13 +191,19 @@ void rdf_recursiveResourceTraversal(nsCOMPtr<nsIRDFResource> currentResource)
NS_GET_IID(nsIRDFContainer),
getter_AddRefs(container));
if (NS_FAILED(rv)) {
printf("recursiveResourceTraversal: can't get a new container\n");
if (prLogModuleInfo) {
PR_LOG(prLogModuleInfo, 3,
("recursiveResourceTraversal: can't get a new container\n"));
}
return;
}
rv = container->Init(gBookmarksDataSource, currentResource);
if (NS_FAILED(rv)) {
printf("recursiveResourceTraversal: can't init container\n");
if (prLogModuleInfo) {
PR_LOG(prLogModuleInfo, 3,
("recursiveResourceTraversal: can't init container\n"));
}
return;
}
@ -199,20 +211,29 @@ void rdf_recursiveResourceTraversal(nsCOMPtr<nsIRDFResource> currentResource)
rv = container->GetElements(getter_AddRefs(elements));
if (NS_FAILED(rv)) {
printf("recursiveResourceTraversal: can't get elements from folder\n");
if (prLogModuleInfo) {
PR_LOG(prLogModuleInfo, 3,
("recursiveResourceTraversal: can't get elements from folder\n"));
}
return;
}
rv = elements->HasMoreElements(&result);
if (NS_FAILED(rv)) {
printf("recursiveResourceTraversal: folder %s has no children.\n",
textForNode);
if (prLogModuleInfo) {
PR_LOG(prLogModuleInfo, 3,
("recursiveResourceTraversal: folder %s has no children.\n",
textForNode));
}
return;
}
while (result) {
rv = elements->GetNext(getter_AddRefs(supportsResult));
if (NS_FAILED(rv)) {
printf("Exception: Can't get next from enumerator.\n");
if (prLogModuleInfo) {
PR_LOG(prLogModuleInfo, 3,
("Exception: Can't get next from enumerator.\n"));
}
return;
}
@ -220,7 +241,10 @@ void rdf_recursiveResourceTraversal(nsCOMPtr<nsIRDFResource> currentResource)
rv = supportsResult->QueryInterface(NS_GET_IID(nsIRDFResource),
getter_AddRefs(childResource));
if (NS_FAILED(rv)) {
printf("Exception: next from enumerator is not an nsIRDFResource.\n");
if (prLogModuleInfo) {
PR_LOG(prLogModuleInfo, 3,
("Exception: next from enumerator is not an nsIRDFResource.\n"));
}
return;
}
@ -228,14 +252,16 @@ void rdf_recursiveResourceTraversal(nsCOMPtr<nsIRDFResource> currentResource)
rv = elements->HasMoreElements(&result);
if (NS_FAILED(rv)) {
printf("Exception: can't tell if we have more elements.\n");
if (prLogModuleInfo) {
PR_LOG(prLogModuleInfo, 3,
("Exception: can't tell if we have more elements.\n"));
}
return;
}
}
}
else {
// It's a bookmark
printf("BOOKMARK:\n");
rdf_printArcLabels(currentResource);
// see if it has a URL target
@ -245,7 +271,10 @@ void rdf_recursiveResourceTraversal(nsCOMPtr<nsIRDFResource> currentResource)
kNC_URL, PR_TRUE,
getter_AddRefs(node));
if (NS_FAILED(rv)) {
printf("recursiveResourceTraversal: can't get url from currentResource\n");
if (prLogModuleInfo) {
PR_LOG(prLogModuleInfo, 3,
("recursiveResourceTraversal: can't get url from currentResource\n"));
}
return;
}
@ -253,18 +282,29 @@ void rdf_recursiveResourceTraversal(nsCOMPtr<nsIRDFResource> currentResource)
rv = node->QueryInterface(NS_GET_IID(nsIRDFLiteral),
getter_AddRefs(literal));
if (NS_FAILED(rv)) {
printf("recursiveResourceTraversal: node is not an nsIRDFLiteral.\n");
if (prLogModuleInfo) {
PR_LOG(prLogModuleInfo, 3,
("recursiveResourceTraversal: node is not an nsIRDFLiteral.\n"));
}
return;
}
// get the value of the literal
rv = literal->GetValueConst(&textForNode);
if (NS_FAILED(rv)) {
printf("recursiveResourceTraversal: node doesn't have a value.\n");
if (prLogModuleInfo) {
PR_LOG(prLogModuleInfo, 3,
("recursiveResourceTraversal: node doesn't have a value.\n"));
}
return;
}
printf("\turl: %S\n", textForNode);
#if DEBUG_RAPTOR_CANVAS
if (prLogModuleInfo) {
PR_LOG(prLogModuleInfo, 3,
("\turl: %S\n", textForNode));
}
#endif
}
@ -282,30 +322,45 @@ void rdf_printArcLabels(nsCOMPtr<nsIRDFResource> currentResource)
rv = currentResource->GetValueConst(&currentResourceValue);
if (NS_SUCCEEDED(rv)) {
printf("resource: %s\n", currentResourceValue);
if (prLogModuleInfo) {
PR_LOG(prLogModuleInfo, 3,
("resource: %s\n", currentResourceValue));
}
}
else {
printf("printArcLabels: can't get value from current resource.\n");
if (prLogModuleInfo) {
PR_LOG(prLogModuleInfo, 3,
("printArcLabels: can't get value from current resource.\n"));
}
}
rv = gBookmarksDataSource->ArcLabelsOut(currentResource,
getter_AddRefs(labels));
if (NS_FAILED(rv)) {
printf("printArcLabels: currentResource has no outgoing arcs.\n");
if (prLogModuleInfo) {
PR_LOG(prLogModuleInfo, 3,
("printArcLabels: currentResource has no outgoing arcs.\n"));
}
return;
}
rv = labels->HasMoreElements(&result);
if (NS_FAILED(rv)) {
printf("printArcLabels: can't get elements from currentResource's enum.\n");
if (prLogModuleInfo) {
PR_LOG(prLogModuleInfo, 3,
("printArcLabels: can't get elements from currentResource's enum.\n"));
}
return;
}
while (result) {
rv = labels->GetNext(getter_AddRefs(supportsResult));
if (NS_FAILED(rv)) {
printf("printArcLabels: Can't get next arc from enumerator.\n");
if (prLogModuleInfo) {
PR_LOG(prLogModuleInfo, 3,
("printArcLabels: Can't get next arc from enumerator.\n"));
}
return;
}
@ -315,18 +370,30 @@ void rdf_printArcLabels(nsCOMPtr<nsIRDFResource> currentResource)
if (NS_SUCCEEDED(rv)) {
rv = resourceResult->GetValueConst(&arcLabel);
if (NS_SUCCEEDED(rv)) {
printf("\tarc label: %s\n", arcLabel);
if (prLogModuleInfo) {
PR_LOG(prLogModuleInfo, 3,
("\tarc label: %s\n", arcLabel));
}
}
else {
printf("printArcLabels: can't get value from current arc.\n");
if (prLogModuleInfo) {
PR_LOG(prLogModuleInfo, 3,
("printArcLabels: can't get value from current arc.\n"));
}
}
}
else {
printf("printArcLabels: next arc from enumerator is not an nsIRDFResource.\n");
if (prLogModuleInfo) {
PR_LOG(prLogModuleInfo, 3,
("printArcLabels: next arc from enumerator is not an nsIRDFResource.\n"));
}
}
rv = labels->HasMoreElements(&result);
if (NS_FAILED(rv)) {
printf("printArcLabels: can't get elements from currentResource's enum.\n");
if (prLogModuleInfo) {
PR_LOG(prLogModuleInfo, 3,
("printArcLabels: can't get elements from currentResource's enum.\n"));
}
return;
}
}