2000-03-04 04:37:20 +03:00
|
|
|
/* -*- 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): Kirk Baker <kbaker@eb.com>
|
|
|
|
* Ian Wilkinson <iw@ennoble.com>
|
|
|
|
* Mark Lin <mark.lin@eng.sun.com>
|
|
|
|
* Mark Goddard
|
|
|
|
* Ed Burns <edburns@acm.org>
|
|
|
|
* Ann Sunhachawee
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "NavigationImpl.h"
|
|
|
|
|
|
|
|
#include "jni_util.h"
|
|
|
|
|
|
|
|
#include "nsActions.h"
|
|
|
|
|
|
|
|
JNIEXPORT void JNICALL Java_org_mozilla_webclient_wrapper_1native_NavigationImpl_nativeLoadURL
|
|
|
|
(JNIEnv *env, jobject obj, jint webShellPtr, jstring urlString)
|
|
|
|
{
|
|
|
|
jobject jobj = obj;
|
bug: http://bugzilla.mozilla.org/show_bug.cgi?id=34665
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
2000-04-06 01:38:27 +04:00
|
|
|
|
|
|
|
#if DEBUG_RAPTOR_CANVAS
|
2000-03-17 02:07:03 +03:00
|
|
|
const char * urlChars = (char *) ::util_GetStringUTFChars(env,
|
|
|
|
urlString);
|
bug: http://bugzilla.mozilla.org/show_bug.cgi?id=34665
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
2000-04-06 01:38:27 +04:00
|
|
|
if (prLogModuleInfo) {
|
|
|
|
PR_LOG(prLogModuleInfo, 3,
|
|
|
|
("Native URL = \"%s\"\n", urlChars));
|
|
|
|
}
|
2000-03-17 02:07:03 +03:00
|
|
|
::util_ReleaseStringUTFChars(env, urlString, urlChars);
|
bug: http://bugzilla.mozilla.org/show_bug.cgi?id=34665
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
2000-04-06 01:38:27 +04:00
|
|
|
#endif
|
2000-03-04 04:37:20 +03:00
|
|
|
|
2000-03-17 02:07:03 +03:00
|
|
|
PRUnichar * urlStringChars = (PRUnichar *) ::util_GetStringChars(env,
|
|
|
|
urlString);
|
2000-03-04 04:37:20 +03:00
|
|
|
|
2000-03-17 02:07:03 +03:00
|
|
|
if (::util_ExceptionOccurred(env)) {
|
2000-03-04 04:37:20 +03:00
|
|
|
::util_ThrowExceptionToJava(env, "raptorWebShellLoadURL Exception: unable to extract Java string");
|
2000-03-09 08:12:42 +03:00
|
|
|
if (urlStringChars != nsnull)
|
2000-03-17 02:07:03 +03:00
|
|
|
::util_ReleaseStringChars(env, urlString, urlStringChars);
|
2000-03-04 04:37:20 +03:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
WebShellInitContext* initContext = (WebShellInitContext *) webShellPtr;
|
|
|
|
|
|
|
|
if (initContext == nsnull) {
|
|
|
|
::util_ThrowExceptionToJava(env, "Exception: null webShellPtr passed to raptorWebShellLoadURL");
|
2000-03-09 08:12:42 +03:00
|
|
|
if (urlStringChars != nsnull)
|
2000-03-17 02:07:03 +03:00
|
|
|
::util_ReleaseStringChars(env, urlString, urlStringChars);
|
2000-03-04 04:37:20 +03:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (initContext->initComplete) {
|
|
|
|
wsLoadURLEvent * actionEvent = new wsLoadURLEvent(initContext->webShell, urlStringChars);
|
|
|
|
PLEvent * event = (PLEvent*) *actionEvent;
|
|
|
|
|
|
|
|
::util_PostEvent(initContext, event);
|
|
|
|
}
|
|
|
|
|
2000-03-17 02:07:03 +03:00
|
|
|
::util_ReleaseStringChars(env, urlString, urlStringChars);
|
2000-03-04 04:37:20 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
JNIEXPORT void JNICALL Java_org_mozilla_webclient_wrapper_1native_NavigationImpl_nativeRefresh
|
|
|
|
(JNIEnv *env, jobject obj, jint webShellPtr, jlong loadFlags)
|
|
|
|
{
|
|
|
|
JNIEnv * pEnv = env;
|
|
|
|
jobject jobj = obj;
|
|
|
|
void * voidResult = nsnull;
|
|
|
|
|
|
|
|
WebShellInitContext* initContext = (WebShellInitContext *) webShellPtr;
|
|
|
|
|
|
|
|
if (initContext == nsnull) {
|
|
|
|
::util_ThrowExceptionToJava(env, "Exception: null webShellPtr passed to raptorWebShellRefresh");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (initContext->initComplete) {
|
|
|
|
wsRefreshEvent * actionEvent = new wsRefreshEvent(initContext->webShell, (long) loadFlags);
|
|
|
|
PLEvent * event = (PLEvent*) *actionEvent;
|
|
|
|
|
|
|
|
voidResult = ::util_PostSynchronousEvent(initContext, event);
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
JNIEXPORT void JNICALL Java_org_mozilla_webclient_wrapper_1native_NavigationImpl_nativeStop
|
|
|
|
(JNIEnv *env, jobject obj, jint webShellPtr)
|
|
|
|
{
|
|
|
|
JNIEnv * pEnv = env;
|
|
|
|
jobject jobj = obj;
|
|
|
|
|
|
|
|
WebShellInitContext* initContext = (WebShellInitContext *) webShellPtr;
|
|
|
|
|
|
|
|
if (initContext == nsnull) {
|
|
|
|
::util_ThrowExceptionToJava(env, "Exception: null webShellPtr passed to raptorWebShellStop");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (initContext->initComplete) {
|
|
|
|
wsStopEvent * actionEvent = new wsStopEvent(initContext->webShell);
|
|
|
|
PLEvent * event = (PLEvent*) *actionEvent;
|
|
|
|
|
|
|
|
::util_PostEvent(initContext, event);
|
|
|
|
}
|
|
|
|
}
|