pjs/java/webclient/src_share/jni_util.cpp

1069 строки
32 KiB
C++
Исходник Обычный вид История

bug=47357 a=edburns r=ashuk This change creates a new directory, java/webclient/src_share, that contains the code that will be used in both src_moz and src_ie, and any other native browser wrapping implementations. Here are the steps I followed to implement this change. 1. Create a new directory java/webclient/src_share 2. Move all jni_util*.* files from src_moz into src_share 3. Make it so src_share compiles into a new .lib src_share has no netscape dependencies. Any functionality that depended on ns dependencies was kept in src_moz. In this case, we have a function prototype only in src_share, with the implementation in src_moz. We did this for nsHashtable. The other trick was for things in WebShellInitContext that had nothing to do with Netscape. This case was accomodated by creating a new struct, ShareInitContext, that contains all WebShellInitContext members that have nothing to do with Netscape. Currently this is just jobject propertiesClass. I modified the WebShellInitContext struct to contain a ShareContext struct as its last member. There are two new methods in jni_util.h that allow for the initialization and deallocation of the members of the ShareContext struct. 4. Make it so src_moz uses the new .lib to provide the jni_util behavior a. Create ns_util* files that include ../src_share/jni_util* files appropriately. The only tricky part was for things in jni_util.h that Here's the list of files in this change. cvs -z3 -n update (in directory D:\Projects\mozilla\java\webclient) cvs server: Updating . M Makefile.win // added src_share to DIRS M src_moz/BookmarksImpl.cpp // include ns_util instead of jni_util M src_moz/CBrowserContainer.cpp // include ns_util instead of jni_util M src_moz/CBrowserContainer.h // include ns_util instead of jni_util M src_moz/CurrentPageImpl.cpp // include ns_util instead of jni_util M src_moz/HistoryImpl.cpp // include ns_util instead of jni_util M src_moz/Makefile.win // include ns_util instead of jni_util M src_moz/NativeEventThread.cpp // include ns_util instead of jni_util M src_moz/NavigationImpl.cpp // include ns_util instead of jni_util M src_moz/RDFEnumeration.cpp // include ns_util instead of jni_util M src_moz/RDFTreeNode.cpp // include ns_util instead of jni_util M src_moz/WindowControlImpl.cpp // include ns_util instead of jni_util // also use new util_InitShareContext // function M src_moz/WrapperFactoryImpl.cpp // include ns_util instead of jni_util R src_moz/jni_util.cpp // moved to ../src_share R src_moz/jni_util.h // moved to ../src_share R src_moz/jni_util_export.cpp // moved to ../src_share R src_moz/jni_util_export.h // moved to ../src_share M src_moz/nsActions.cpp // include ns_util instead of jni_util // also use new util_DeallocateShareContext M src_moz/nsActions.h // include ns_util instead of jni_util A src_moz/ns_util.cpp // include jni_util.h A src_moz/ns_util.h // include jni_util.h, changes to // WebshellInitContext struct A src_moz/ns_util_export.cpp // provide impls for methods in // jni_util_export.h A src_share/Makefile.win A src_share/bal_util.cpp A src_share/bal_util.h A src_share/jni_util.cpp A src_share/jni_util.h A src_share/jni_util_export.cpp A src_share/jni_util_export.h *****CVS exited normally with code 0*****
2000-08-04 01:32:54 +04: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>
* Ashutosh Kulkarni <ashuk@eng.sun.com>
* Ann Sunhachawee
* Jason Mawdsley <jason@macadamian.com>
* Louis-Philippe Gagnon <louisphilippe@macadamian.com>
bug=47357 a=edburns r=ashuk This change creates a new directory, java/webclient/src_share, that contains the code that will be used in both src_moz and src_ie, and any other native browser wrapping implementations. Here are the steps I followed to implement this change. 1. Create a new directory java/webclient/src_share 2. Move all jni_util*.* files from src_moz into src_share 3. Make it so src_share compiles into a new .lib src_share has no netscape dependencies. Any functionality that depended on ns dependencies was kept in src_moz. In this case, we have a function prototype only in src_share, with the implementation in src_moz. We did this for nsHashtable. The other trick was for things in WebShellInitContext that had nothing to do with Netscape. This case was accomodated by creating a new struct, ShareInitContext, that contains all WebShellInitContext members that have nothing to do with Netscape. Currently this is just jobject propertiesClass. I modified the WebShellInitContext struct to contain a ShareContext struct as its last member. There are two new methods in jni_util.h that allow for the initialization and deallocation of the members of the ShareContext struct. 4. Make it so src_moz uses the new .lib to provide the jni_util behavior a. Create ns_util* files that include ../src_share/jni_util* files appropriately. The only tricky part was for things in jni_util.h that Here's the list of files in this change. cvs -z3 -n update (in directory D:\Projects\mozilla\java\webclient) cvs server: Updating . M Makefile.win // added src_share to DIRS M src_moz/BookmarksImpl.cpp // include ns_util instead of jni_util M src_moz/CBrowserContainer.cpp // include ns_util instead of jni_util M src_moz/CBrowserContainer.h // include ns_util instead of jni_util M src_moz/CurrentPageImpl.cpp // include ns_util instead of jni_util M src_moz/HistoryImpl.cpp // include ns_util instead of jni_util M src_moz/Makefile.win // include ns_util instead of jni_util M src_moz/NativeEventThread.cpp // include ns_util instead of jni_util M src_moz/NavigationImpl.cpp // include ns_util instead of jni_util M src_moz/RDFEnumeration.cpp // include ns_util instead of jni_util M src_moz/RDFTreeNode.cpp // include ns_util instead of jni_util M src_moz/WindowControlImpl.cpp // include ns_util instead of jni_util // also use new util_InitShareContext // function M src_moz/WrapperFactoryImpl.cpp // include ns_util instead of jni_util R src_moz/jni_util.cpp // moved to ../src_share R src_moz/jni_util.h // moved to ../src_share R src_moz/jni_util_export.cpp // moved to ../src_share R src_moz/jni_util_export.h // moved to ../src_share M src_moz/nsActions.cpp // include ns_util instead of jni_util // also use new util_DeallocateShareContext M src_moz/nsActions.h // include ns_util instead of jni_util A src_moz/ns_util.cpp // include jni_util.h A src_moz/ns_util.h // include jni_util.h, changes to // WebshellInitContext struct A src_moz/ns_util_export.cpp // provide impls for methods in // jni_util_export.h A src_share/Makefile.win A src_share/bal_util.cpp A src_share/bal_util.h A src_share/jni_util.cpp A src_share/jni_util.h A src_share/jni_util_export.cpp A src_share/jni_util_export.h *****CVS exited normally with code 0*****
2000-08-04 01:32:54 +04:00
*/
#include "jni_util.h"
#include <string.h>
JavaVM *gVm = nsnull; // declared in ns_globals.h, which is included in
// jni_util.h
//
// Local cache variables of JNI data items
//
static jmethodID gPropertiesInitMethodID = nsnull;
static jmethodID gPropertiesSetPropertyMethodID = nsnull;
static jmethodID gPropertiesGetPropertyMethodID = nsnull;
bug=47357 a=edburns r=ashuk This change creates a new directory, java/webclient/src_share, that contains the code that will be used in both src_moz and src_ie, and any other native browser wrapping implementations. Here are the steps I followed to implement this change. 1. Create a new directory java/webclient/src_share 2. Move all jni_util*.* files from src_moz into src_share 3. Make it so src_share compiles into a new .lib src_share has no netscape dependencies. Any functionality that depended on ns dependencies was kept in src_moz. In this case, we have a function prototype only in src_share, with the implementation in src_moz. We did this for nsHashtable. The other trick was for things in WebShellInitContext that had nothing to do with Netscape. This case was accomodated by creating a new struct, ShareInitContext, that contains all WebShellInitContext members that have nothing to do with Netscape. Currently this is just jobject propertiesClass. I modified the WebShellInitContext struct to contain a ShareContext struct as its last member. There are two new methods in jni_util.h that allow for the initialization and deallocation of the members of the ShareContext struct. 4. Make it so src_moz uses the new .lib to provide the jni_util behavior a. Create ns_util* files that include ../src_share/jni_util* files appropriately. The only tricky part was for things in jni_util.h that Here's the list of files in this change. cvs -z3 -n update (in directory D:\Projects\mozilla\java\webclient) cvs server: Updating . M Makefile.win // added src_share to DIRS M src_moz/BookmarksImpl.cpp // include ns_util instead of jni_util M src_moz/CBrowserContainer.cpp // include ns_util instead of jni_util M src_moz/CBrowserContainer.h // include ns_util instead of jni_util M src_moz/CurrentPageImpl.cpp // include ns_util instead of jni_util M src_moz/HistoryImpl.cpp // include ns_util instead of jni_util M src_moz/Makefile.win // include ns_util instead of jni_util M src_moz/NativeEventThread.cpp // include ns_util instead of jni_util M src_moz/NavigationImpl.cpp // include ns_util instead of jni_util M src_moz/RDFEnumeration.cpp // include ns_util instead of jni_util M src_moz/RDFTreeNode.cpp // include ns_util instead of jni_util M src_moz/WindowControlImpl.cpp // include ns_util instead of jni_util // also use new util_InitShareContext // function M src_moz/WrapperFactoryImpl.cpp // include ns_util instead of jni_util R src_moz/jni_util.cpp // moved to ../src_share R src_moz/jni_util.h // moved to ../src_share R src_moz/jni_util_export.cpp // moved to ../src_share R src_moz/jni_util_export.h // moved to ../src_share M src_moz/nsActions.cpp // include ns_util instead of jni_util // also use new util_DeallocateShareContext M src_moz/nsActions.h // include ns_util instead of jni_util A src_moz/ns_util.cpp // include jni_util.h A src_moz/ns_util.h // include jni_util.h, changes to // WebshellInitContext struct A src_moz/ns_util_export.cpp // provide impls for methods in // jni_util_export.h A src_share/Makefile.win A src_share/bal_util.cpp A src_share/bal_util.h A src_share/jni_util.cpp A src_share/jni_util.h A src_share/jni_util_export.cpp A src_share/jni_util_export.h *****CVS exited normally with code 0*****
2000-08-04 01:32:54 +04:00
static jmethodID gPropertiesClearMethodID = nsnull;
//
// Listener data
//
jboolean STRING_CONSTANTS_INITED = JNI_FALSE;
jobject SCREEN_X_KEY;
jobject SCREEN_Y_KEY;
jobject CLIENT_X_KEY;
jobject CLIENT_Y_KEY;
This checkin enables the KeyListener feature. A webclient/test/automated/src/classes/org/mozilla/webclient/KeyListenerTest.java A webclient/test/automated/src/test/KeyListenerTest1.html M webclient/build-tests.xml - add new testcase M webclient/classes_spec/org/mozilla/webclient/BrowserControlCanvas.java M webclient/classes_spec/org/mozilla/webclient/EventRegistration2.java - allow KeyListeners to be added and removed. M webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/EventRegistrationImpl.java - Lazily create listener lists. - Change the contract of queueEvent() to discard null events silently. - Add createKeyEvent() method. M webclient/src_moz/EmbedEventListener.cpp - new mask names and values, DOMDOMKeyListener_maskNames, DOMKeyListener_maskValues. - flesh out Key*() events. - add addKeyEventDataToProperties. - use eventType to discern how to populate the properties, with either key or mouse data. M webclient/src_moz/EmbedEventListener.h - key event includes and support methods. M webclient/src_moz/EmbedProgress.cpp - honor new last argument to util_InitializeEventMaskValuesFromClass(). M webclient/src_share/jni_util.cpp M webclient/src_share/jni_util.h - new constants +jobject CHAR_CODE; +jobject KEY_CODE; +jstring KEY_LISTENER_CLASSNAME; +char *DOMKeyListener_maskNames[] = { M webclient/src_share/jni_util_export.cpp M webclient/src_share/jni_util_export.h - new last argument to util_InitializeEventMaskValuesFromClass(const char *className, char *maskNames[], - jlong maskValues[]) + jlong maskValuesLong[], + jint maskValuesInt[]) Used when the maskValues are ints, otherwise null.
2004-12-01 06:21:23 +03:00
jobject CHAR_CODE;
jobject KEY_CODE;
jobject ALT_KEY;
jobject CTRL_KEY;
jobject SHIFT_KEY;
jobject META_KEY;
jobject BUTTON_KEY;
jobject CLICK_COUNT_KEY;
jobject USER_NAME_KEY;
jobject PASSWORD_KEY;
jobject EDIT_FIELD_1_KEY;
jobject EDIT_FIELD_2_KEY;
jobject CHECKBOX_STATE_KEY;
jobject BUTTON_PRESSED_KEY;
jobject TRUE_VALUE;
jobject FALSE_VALUE;
jobject ONE_VALUE;
jobject TWO_VALUE;
This checkin implements a response header listener feature. I have changed the usage contract of the DocumentLoadListener slightly. Prior to this checkin, calling getEventData() on the DocumentLoadEvent passed in to your eventDispatched() method returned the URI to which the event applies. Now the getEventData() returns a Map. You must look up the "URI" key to find the URI to which the event applies. If your listener is an instance of PageInfoListener, and your event mask is END_URL_LOAD_EVENT_MASK, your Map will have an additional entry under the key "headers". This entry is another Map representing the response headers. DocumentLoadListener: * <p>The <code>eventDispatched()</code> method is passed a {@link * DocumentLoadEvent} instance. The <code>type</code> property of the * event will be one of the types defined as a <code>public static final * int</code> in <code>DocumentLoadEvent</code>.</p> * * <p>The <code>eventData</code> property of the * <code>DocumentLoadEvent</code> instance will be a * <code>java.util.Map</code>. For all <code>EVENT_MASK</code> types in * <code>DocumentLoadEvent</code> the map will contain an entry under * the key "<code>URI</code>" without the quotes. This will be the * fully qualified URI for the event.</p> * * <p>For the <code>PROGRESS_URL_LOAD_EVENT_MASK</code> there will be an * entry in the map for the key "<code>message</code>". This will be * the progress message from the browser.</p> PageInfoListener: * <p>This {@link DocumentLoadListener} subclass adds the ability to get * detailed information on each event. </p> * * <p>The <code>eventDispatched()</code> method is passed the same thing * as in the {@link DocumentLoadListener}.</p> * * <p>The <code>eventData</code> property of the * <code>DocumentLoadEvent</code> instance will be a * <code>java.util.Map</code>. For the * <code>END_URL_LOAD_EVENT_MASK</code> type in * <code>DocumentLoadEvent</code> the map will contain an entry under * the key "<code>URI</code>" without the quotes. This will be the * fully qualified URI for the event. The map will also contain an * entry under the key "<code>headers</code>". This entry will be a * <code>Map</code> of all the response headers.</p> The next step will be to allow the same procedure to work to discover the request headers. Ed A classes_spec/org/mozilla/webclient/PageInfoListener.java - marker class for listenening for high fidelity page information. A src_moz/EventRegistrationImpl.cpp - add boolean property, capturePageInfo to turn on or off high fidelity page information collection. M build-tests.xml - add new test, DocumentLoadListenerTest M build.xml - added new JNI class, EventRegistrationImpl M classes_spec/org/mozilla/webclient/CurrentPage2.java M classes_spec/org/mozilla/webclient/impl/wrapper_native/CurrentPageImpl.java - rollback previous API for headers discovery M classes_spec/org/mozilla/webclient/impl/wrapper_native/EventRegistrationImpl.java - pass thru the capturePageInfo property - add URIToStringMap, currently not working. M classes_spec/org/mozilla/webclient/test/EMWindow.java - call toString() on the eventData, don't cast it to a String. M src_moz/EmbedProgress.cpp M src_moz/EmbedProgress.h - leverage the nsIHttpHeaderVisitor interface to discover the response headers. - add boolean property capturePageInfo A src_moz/HttpHeaderVisitorImpl.cpp A src_moz/HttpHeaderVisitorImpl.h - copy the headers to a Properties object. M src_moz/Makefile.in - compile two new files: + EventRegistrationImpl.cpp \ + HttpHeaderVisitorImpl.cpp \ M src_moz/NativeBrowserControl.cpp M src_moz/NativeBrowserControl.h - pass the NativeWrapperFactory to our Init() method - add wrapperFactory getter. M src_moz/WrapperFactoryImpl.cpp - pass the nativeWrapperFactory to the NativeBrowserControl's Init method. M src_share/jni_util.cpp M src_share/jni_util.h - new constants: URI, headers R test/automated/src/classes/org/mozilla/webclient/CurrentPageTest.java - not yet time for this one A test/automated/src/classes/org/mozilla/webclient/DocumentLoadListenerTest.java - exercise bare minimum functionality of PageInfoListener M test/manual/src/classes/org/mozilla/webclient/test/TestBrowser.java - print out headers.
2004-09-10 00:17:18 +04:00
jobject URI_VALUE;
jobject HEADERS_VALUE;
This checkin enables finding out the request method and response status of a URL_LOAD event. I'm still working on getting the request body via the nsIUploadChannel interface. Next step will be to get that working. I'm currently running into problems where the END_URL event for a POST doesn't have a status. I think this is because I'm using the Navigation.post() method rather than simulating a user post by pressing a form submit button. A classes_spec/org/mozilla/webclient/impl/wrapper_native/NativeInputStream.java A src_moz/NativeInputStreamImpl.cpp - Class to enable reading the post body from the request. M build.xml - add NativeInputStream to JNI generation M classes_spec/org/mozilla/webclient/PageInfoListener.java * <p>This {@link DocumentLoadListener} subclass adds the ability to get * detailed information on each event. </p> * * <p>The <code>eventData</code> property of the * <code>DocumentLoadEvent</code> instance will be a * <code>java.util.Map</code>. The following entries may be present in * this map for the following <code>*_EVENT_MASK</code> types in * <code>DocumentLoadEvent</code>.</p> * * <dl> * * <dt>For all <code>*_EVENT_MASK</code> types</dt> * * <dd><p>the map will contain an entry under the key "<code>URI</code>" * without the quotes. This will be the fully qualified URI for the * event. </p></dd> * * <dt>For <code>START_URL_LOAD</code> type</dt> * * <dd><p>The map will contain an entry under the key * "<code>method</code>" without the quotes. This will be the request * method for this event. The map will also contain an entry under the * key "<code>headers</code>". This entry will be a * <code>java.util.Map</code> of all the request headers.</p></dd> * * <dt>For <code>END_URL_LOAD</code> type</dt> * * <dd><p>The map will contain an entry under the key * "<code>method</code>" without the quotes. This will be the request * method for this event. The map will contain an entry under the key * "<code>status</code>" without the quotes. This will be the response * status string from the server, such as "<code>200 OK</code>". The * map will also contain an entry under the key "<code>headers</code>". * This entry will be a <code>java.util.Map</code> of all the response * headers.</p></dd> * * </dl> M src_moz/EmbedProgress.cpp - leverage nsIHttpChannel methods to get request method, response status, and post body. M src_moz/Makefile.in - add NativeInputStream M src_share/jni_util.cpp M src_share/jni_util.h - new constants - add variant of ThrowExceptionToJava that takes the exception class name. M test/automated/src/classes/org/mozilla/webclient/DocumentLoadListenerTest.java - new test content. Post related content commented out.
2005-02-28 20:15:45 +03:00
jobject METHOD_VALUE;
jobject STATUS_VALUE;
jobject REQUEST_BODY_VALUE;
This checkin implements a response header listener feature. I have changed the usage contract of the DocumentLoadListener slightly. Prior to this checkin, calling getEventData() on the DocumentLoadEvent passed in to your eventDispatched() method returned the URI to which the event applies. Now the getEventData() returns a Map. You must look up the "URI" key to find the URI to which the event applies. If your listener is an instance of PageInfoListener, and your event mask is END_URL_LOAD_EVENT_MASK, your Map will have an additional entry under the key "headers". This entry is another Map representing the response headers. DocumentLoadListener: * <p>The <code>eventDispatched()</code> method is passed a {@link * DocumentLoadEvent} instance. The <code>type</code> property of the * event will be one of the types defined as a <code>public static final * int</code> in <code>DocumentLoadEvent</code>.</p> * * <p>The <code>eventData</code> property of the * <code>DocumentLoadEvent</code> instance will be a * <code>java.util.Map</code>. For all <code>EVENT_MASK</code> types in * <code>DocumentLoadEvent</code> the map will contain an entry under * the key "<code>URI</code>" without the quotes. This will be the * fully qualified URI for the event.</p> * * <p>For the <code>PROGRESS_URL_LOAD_EVENT_MASK</code> there will be an * entry in the map for the key "<code>message</code>". This will be * the progress message from the browser.</p> PageInfoListener: * <p>This {@link DocumentLoadListener} subclass adds the ability to get * detailed information on each event. </p> * * <p>The <code>eventDispatched()</code> method is passed the same thing * as in the {@link DocumentLoadListener}.</p> * * <p>The <code>eventData</code> property of the * <code>DocumentLoadEvent</code> instance will be a * <code>java.util.Map</code>. For the * <code>END_URL_LOAD_EVENT_MASK</code> type in * <code>DocumentLoadEvent</code> the map will contain an entry under * the key "<code>URI</code>" without the quotes. This will be the * fully qualified URI for the event. The map will also contain an * entry under the key "<code>headers</code>". This entry will be a * <code>Map</code> of all the response headers.</p> The next step will be to allow the same procedure to work to discover the request headers. Ed A classes_spec/org/mozilla/webclient/PageInfoListener.java - marker class for listenening for high fidelity page information. A src_moz/EventRegistrationImpl.cpp - add boolean property, capturePageInfo to turn on or off high fidelity page information collection. M build-tests.xml - add new test, DocumentLoadListenerTest M build.xml - added new JNI class, EventRegistrationImpl M classes_spec/org/mozilla/webclient/CurrentPage2.java M classes_spec/org/mozilla/webclient/impl/wrapper_native/CurrentPageImpl.java - rollback previous API for headers discovery M classes_spec/org/mozilla/webclient/impl/wrapper_native/EventRegistrationImpl.java - pass thru the capturePageInfo property - add URIToStringMap, currently not working. M classes_spec/org/mozilla/webclient/test/EMWindow.java - call toString() on the eventData, don't cast it to a String. M src_moz/EmbedProgress.cpp M src_moz/EmbedProgress.h - leverage the nsIHttpHeaderVisitor interface to discover the response headers. - add boolean property capturePageInfo A src_moz/HttpHeaderVisitorImpl.cpp A src_moz/HttpHeaderVisitorImpl.h - copy the headers to a Properties object. M src_moz/Makefile.in - compile two new files: + EventRegistrationImpl.cpp \ + HttpHeaderVisitorImpl.cpp \ M src_moz/NativeBrowserControl.cpp M src_moz/NativeBrowserControl.h - pass the NativeWrapperFactory to our Init() method - add wrapperFactory getter. M src_moz/WrapperFactoryImpl.cpp - pass the nativeWrapperFactory to the NativeBrowserControl's Init method. M src_share/jni_util.cpp M src_share/jni_util.h - new constants: URI, headers R test/automated/src/classes/org/mozilla/webclient/CurrentPageTest.java - not yet time for this one A test/automated/src/classes/org/mozilla/webclient/DocumentLoadListenerTest.java - exercise bare minimum functionality of PageInfoListener M test/manual/src/classes/org/mozilla/webclient/test/TestBrowser.java - print out headers.
2004-09-10 00:17:18 +04:00
jobject MESSAGE_VALUE;
jobject BM_ADD_DATE_VALUE;
jobject BM_LAST_MODIFIED_DATE_VALUE;
jobject BM_LAST_VISIT_DATE_VALUE;
jobject BM_NAME_VALUE;
jobject BM_URL_VALUE;
jobject BM_DESCRIPTION_VALUE;
jobject BM_IS_FOLDER_VALUE;
jobject NODE_LONG_KEY;
jstring DOCUMENT_LOAD_LISTENER_CLASSNAME;
jstring MOUSE_LISTENER_CLASSNAME;
This checkin enables the KeyListener feature. A webclient/test/automated/src/classes/org/mozilla/webclient/KeyListenerTest.java A webclient/test/automated/src/test/KeyListenerTest1.html M webclient/build-tests.xml - add new testcase M webclient/classes_spec/org/mozilla/webclient/BrowserControlCanvas.java M webclient/classes_spec/org/mozilla/webclient/EventRegistration2.java - allow KeyListeners to be added and removed. M webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/EventRegistrationImpl.java - Lazily create listener lists. - Change the contract of queueEvent() to discard null events silently. - Add createKeyEvent() method. M webclient/src_moz/EmbedEventListener.cpp - new mask names and values, DOMDOMKeyListener_maskNames, DOMKeyListener_maskValues. - flesh out Key*() events. - add addKeyEventDataToProperties. - use eventType to discern how to populate the properties, with either key or mouse data. M webclient/src_moz/EmbedEventListener.h - key event includes and support methods. M webclient/src_moz/EmbedProgress.cpp - honor new last argument to util_InitializeEventMaskValuesFromClass(). M webclient/src_share/jni_util.cpp M webclient/src_share/jni_util.h - new constants +jobject CHAR_CODE; +jobject KEY_CODE; +jstring KEY_LISTENER_CLASSNAME; +char *DOMKeyListener_maskNames[] = { M webclient/src_share/jni_util_export.cpp M webclient/src_share/jni_util_export.h - new last argument to util_InitializeEventMaskValuesFromClass(const char *className, char *maskNames[], - jlong maskValues[]) + jlong maskValuesLong[], + jint maskValuesInt[]) Used when the maskValues are ints, otherwise null.
2004-12-01 06:21:23 +03:00
jstring KEY_LISTENER_CLASSNAME;
jstring NEW_WINDOW_LISTENER_CLASSNAME;
jlong DocumentLoader_maskValues[] = { -1L };
char * DocumentLoader_maskNames[] = {
START_DOCUMENT_LOAD_EVENT_MASK_VALUE,
END_DOCUMENT_LOAD_EVENT_MASK_VALUE,
START_URL_LOAD_EVENT_MASK_VALUE,
END_URL_LOAD_EVENT_MASK_VALUE,
PROGRESS_URL_LOAD_EVENT_MASK_VALUE,
STATUS_URL_LOAD_EVENT_MASK_VALUE,
UNKNOWN_CONTENT_EVENT_MASK_VALUE,
FETCH_INTERRUPT_EVENT_MASK_VALUE,
nsnull
};
jlong DOMMouseListener_maskValues[] = { -1L };
char *DOMMouseListener_maskNames[] = {
MOUSE_DOWN_EVENT_MASK_VALUE,
MOUSE_UP_EVENT_MASK_VALUE,
MOUSE_CLICK_EVENT_MASK_VALUE,
MOUSE_DOUBLE_CLICK_EVENT_MASK_VALUE,
MOUSE_OVER_EVENT_MASK_VALUE,
MOUSE_OUT_EVENT_MASK_VALUE,
nsnull
};
This checkin enables the KeyListener feature. A webclient/test/automated/src/classes/org/mozilla/webclient/KeyListenerTest.java A webclient/test/automated/src/test/KeyListenerTest1.html M webclient/build-tests.xml - add new testcase M webclient/classes_spec/org/mozilla/webclient/BrowserControlCanvas.java M webclient/classes_spec/org/mozilla/webclient/EventRegistration2.java - allow KeyListeners to be added and removed. M webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/EventRegistrationImpl.java - Lazily create listener lists. - Change the contract of queueEvent() to discard null events silently. - Add createKeyEvent() method. M webclient/src_moz/EmbedEventListener.cpp - new mask names and values, DOMDOMKeyListener_maskNames, DOMKeyListener_maskValues. - flesh out Key*() events. - add addKeyEventDataToProperties. - use eventType to discern how to populate the properties, with either key or mouse data. M webclient/src_moz/EmbedEventListener.h - key event includes and support methods. M webclient/src_moz/EmbedProgress.cpp - honor new last argument to util_InitializeEventMaskValuesFromClass(). M webclient/src_share/jni_util.cpp M webclient/src_share/jni_util.h - new constants +jobject CHAR_CODE; +jobject KEY_CODE; +jstring KEY_LISTENER_CLASSNAME; +char *DOMKeyListener_maskNames[] = { M webclient/src_share/jni_util_export.cpp M webclient/src_share/jni_util_export.h - new last argument to util_InitializeEventMaskValuesFromClass(const char *className, char *maskNames[], - jlong maskValues[]) + jlong maskValuesLong[], + jint maskValuesInt[]) Used when the maskValues are ints, otherwise null.
2004-12-01 06:21:23 +03:00
jint DOMKeyListener_maskValues[] = { -1 };
char *DOMKeyListener_maskNames[] = {
KEY_PRESSED_EVENT_MASK_VALUE,
KEY_RELEASED_EVENT_MASK_VALUE,
KEY_TYPED_EVENT_MASK_VALUE,
nsnull
};
This is a checkpoint milestone for webclient 2.0. Webclient currently doesn't run, but several unit tests for webclient do. I'll be proceeding through the rest of the webclient interfaces, building junit tests as I go, in the coming months. I hope to flesh out the basic framework, then publish build instructions, and hopefully I can get some contributions from the community. M util/classes/org/mozilla/util/Utilities.java new method: getImplFromServices: + * + * <p>This method tries to load the resource + * <code>META-INF/services/&gt;interfaceClassName&gt;</code>, where + * <code>&gt;interfaceClassName&lt;</code> is the argument to this + * method. If the resource is found, interpret it as a + * <code>Properties</code> file and read out its first line. + * Interpret the first line as the fully qualified class name of a + * class that implements <code></code>. The named class must have a + * public no-arg constructor.</p> M webclient/build-tests.xml - junit testcases for Webclient APIs, developed using test-first. M webclient/build.xml - changes for new package name structure: packages org.mozilla.webclient.{wrapper_native, wrapper_non_native} have gone away. Replaced with org.mozilla.webclient.impl.{wrapper_native, wrapper_non_native} - changes to accomodate "Services" based approach for pluggable webclient implementation. - don't bother re-naming the javah generated files, just let javah pick the names. - pass debugging args from build.properties - changed name of junit test target to "test". M webclient/classes_spec/org/mozilla/webclient/BrowserControl.java - got rid of BROWSER_TYPE. No longer necessary due to the new pluggability mechanism. M webclient/classes_spec/org/mozilla/webclient/BrowserControlFactory.java - Leverage the org.mozilla.util.Utilities.getImplFromServices() mechanism to allow a vendor-pluggable webclient implementation of the new "WebclientFactory" interface, which is method for method compatible with BrowserControlFactory. Make all BrowserControlFactory methods call through to methods on the vendor provided WebclientFactory implementation. R webclient/classes_spec/org/mozilla/webclient/BrowserControlFactoryInterface.java A webclient/classes_spec/org/mozilla/webclient/BrowserControlICE.java R webclient/classes_spec/org/mozilla/webclient/BrowserControlImpl.java R webclient/classes_spec/org/mozilla/webclient/BrowserType.java - move all implementation specific classe to the impl package. M webclient/classes_spec/org/mozilla/webclient/ImplObject.java - ImplObject shouldn't depend on vendor private classes. M webclient/classes_spec/org/mozilla/webclient/Preferences.java - new method + public void unregisterPrefChangedCallback(PrefChangedCallback cb, + String prefName, Object closure); M webclient/classes_spec/org/mozilla/webclient/ProfileManager.java - properly specify this interface. A webclient/classes_spec/org/mozilla/webclient/WebclientFactory.java * <p>This interface allows a pluggable webclient API implementation. * The static methods in {@link BrowserControlFactory} call through to * methods on this interface. Please see {@link BrowserControlFactory} * for information on how to hook up your <code>WebclientFactory</code> * implementation to the <code>BrowserControlFactory</code></p> R webclient/classes_spec/org/mozilla/webclient/WrapperFactory.java R webclient/classes_spec/org/mozilla/webclient/impl/BrowserControlFactoryImpl.java - moved these to the impl class A webclient/classes_spec/org/mozilla/webclient/impl/BrowserControlImpl.java A webclient/classes_spec/org/mozilla/webclient/impl/Service.java A webclient/classes_spec/org/mozilla/webclient/impl/WebclientFactoryImpl.java A webclient/classes_spec/org/mozilla/webclient/impl/WrapperFactory.java A webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/BookmarkEntryImpl.java A webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/BookmarksImpl.java A webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/CurrentPageImpl.java A webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/EventRegistrationImpl.java A webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/HistoryImpl.java A webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/ISupportsPeer.java A webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/ImplObjectNative.java A webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/NativeEventThread.java A webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/NavigationImpl.java A webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/PreferencesImpl.java A webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/ProfileManagerImpl.java A webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/RDFEnumeration.java A webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/RDFTreeNode.java A webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/SelectionImpl.java A webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/WCEventListenerWrapper.java A webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/WCMouseListenerImpl.java A webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/WindowControlImpl.java A webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/WrapperFactoryImpl.java A webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/gtk/GtkBrowserControlCanvas.java A webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/win32/Win32BrowserControlCanvas.java - copied from old package naming scheme. - lots and lots of cleanup. R webclient/classes_spec/org/mozilla/webclient/wrapper_native/BookmarkEntryImpl.java R webclient/classes_spec/org/mozilla/webclient/wrapper_native/BookmarksImpl.java R webclient/classes_spec/org/mozilla/webclient/wrapper_native/CurrentPageImpl.java R webclient/classes_spec/org/mozilla/webclient/wrapper_native/EventRegistrationImpl.java R webclient/classes_spec/org/mozilla/webclient/wrapper_native/HistoryImpl.java R webclient/classes_spec/org/mozilla/webclient/wrapper_native/ISupportsPeer.java R webclient/classes_spec/org/mozilla/webclient/wrapper_native/ImplObjectNative.java R webclient/classes_spec/org/mozilla/webclient/wrapper_native/NativeEventThread.java R webclient/classes_spec/org/mozilla/webclient/wrapper_native/NavigationImpl.java R webclient/classes_spec/org/mozilla/webclient/wrapper_native/PreferencesImpl.java R webclient/classes_spec/org/mozilla/webclient/wrapper_native/ProfileManagerImpl.java R webclient/classes_spec/org/mozilla/webclient/wrapper_native/RDFEnumeration.java R webclient/classes_spec/org/mozilla/webclient/wrapper_native/RDFTreeNode.java A webclient/classes_spec/org/mozilla/webclient/wrapper_native/README R webclient/classes_spec/org/mozilla/webclient/wrapper_native/SelectionImpl.java R webclient/classes_spec/org/mozilla/webclient/wrapper_native/WCEventListenerWrapper.java R webclient/classes_spec/org/mozilla/webclient/wrapper_native/WCMouseListenerImpl.java R webclient/classes_spec/org/mozilla/webclient/wrapper_native/WindowControlImpl.java R webclient/classes_spec/org/mozilla/webclient/wrapper_native/WrapperFactoryImpl.java R webclient/classes_spec/org/mozilla/webclient/wrapper_native/gtk/GtkBrowserControlCanvas.java R webclient/classes_spec/org/mozilla/webclient/wrapper_native/win32/Win32BrowserControlCanvas.java - removed from old package naming scheme M webclient/src_moz/BookmarksImpl.cpp - remove dependency on RDFActionEvents by inlining all the code that formerly was in the events. - package name change - JNI include file name change M webclient/src_moz/CurrentPageImpl.cpp M webclient/src_moz/HistoryImpl.cpp M webclient/src_moz/ISupportsPeer.cpp - package name change - JNI include file name change M webclient/src_moz/Makefile.in - get rid of PreferencesActionEvents.cpp and RDFActionEvents.cpp - add ProfileManagerImpl.cpp M webclient/src_moz/NativeEventThread.cpp - this file is not done yet. I've been pulling misplaced initialization stuff out of here and putting it into WrapperFactoryImpl.cpp. - got rid of gComponentManager, since we can use do_CreateInstance instead. - package name change - JNI include file name change M webclient/src_moz/NativeEventThreadActionEvents.h - JNI include file name change M webclient/src_moz/NavigationImpl.cpp - package name change - JNI include file name change R webclient/src_moz/PreferencesActionEvents.cpp R webclient/src_moz/PreferencesActionEvents.h - don't need these anymore! woohoo! M webclient/src_moz/PreferencesImpl.cpp - remove dependency on PreferencesActionEvents by inlining code into the methods that used to use the events. A webclient/src_moz/ProfileManagerImpl.cpp - new class, implementation of the ProfileManager interface. M webclient/src_moz/PromptActionEvents.cpp - change erroneous comment so my grep performed correctly. R webclient/src_moz/RDFActionEvents.cpp R webclient/src_moz/RDFActionEvents.h - don't need these anymore! woohoo! M webclient/src_moz/RDFEnumeration.cpp M webclient/src_moz/RDFTreeNode.cpp - remove dependency on RDFActionEvents by inlining code into the methods that used to use the events. M webclient/src_moz/WindowControlActionEvents.cpp - deallocate shareInitiContext. M webclient/src_moz/WindowControlImpl.cpp - package name change - JNI include file name change - remove the "sleep so I can attach gdb" code. Moved to WrapperFactoryImpl.cpp. M webclient/src_moz/WrapperFactoryImpl.cpp - lots of changes. This is now where the app initialization and shutdown happens, M webclient/src_moz/dom_util.cpp - comment change M webclient/src_moz/ns_globals.h - get rid of inappropriate global usage. M webclient/src_moz/ns_util.h - new struct WebclientContext for singletons. M webclient/src_moz/rdf_util.cpp - new methods, rdf_startup and rdf_shutdown. - replace calls to nsComponentManager::CreateInstance() with do_CreateInstance(). M webclient/src_moz/rdf_util.h - new methods, rdf_startup and rdf_shutdown. M webclient/src_moz/gtk/GtkBrowserControlCanvas.cpp - package name change - JNI include file name change M webclient/src_moz/gtk/GtkBrowserControlCanvasStub.cpp - package name change - JNI include file name change - this file isn't needed anymore, thankfully! I'll remove it soon. M webclient/src_moz/gtk/StubFunctions.h - package name change - JNI include file name change - this file isn't needed anymore, thankfully! I'll remove it soon. M webclient/src_moz/motif/BrowserControlNativeShimStub.cpp M webclient/src_moz/motif/MotifBrowserControlCanvas.cpp M webclient/src_moz/motif/MotifBrowserControlCanvasStub.cpp M webclient/src_moz/motif/NativeLoaderStub.cpp M webclient/src_moz/win32/Win32BrowserControlCanvas.cpp - package name change - JNI include file name change M webclient/src_share/jni_util.cpp M webclient/src_share/jni_util.h - util_InitializeShareInitContext() takes a JNIEnv *. - new methods +void util_DeleteGlobalRef(JNIEnv *env, jobject toDeleteRef); +void util_DeleteLocalRef(JNIEnv *env, jobject toDeleteRef); +void util_getSystemProperty(JNIEnv *env, + const char *propName, + char *propValue, + jint propValueLen); M webclient/src_share/jni_util_export.cpp M webclient/src_share/jni_util_export.h +JNIEXPORT jobjectArray util_GetJstringArrayFromJcharArray(JNIEnv *env, + jint len, + jchar **strings, + jint *stringLengths) A webclient/test/automated/src/classes/org/mozilla/webclient/BookmarksTest.java R webclient/test/automated/src/classes/org/mozilla/webclient/BrowserControlFactoryTest.java A webclient/test/automated/src/classes/org/mozilla/webclient/PreferencesTest.java A webclient/test/automated/src/classes/org/mozilla/webclient/ProfileManagerTest.java A webclient/test/automated/src/classes/org/mozilla/webclient/impl/WebclientFactoryImplTest.java A webclient/test/automated/src/classes/org/mozilla/webclient/impl/wrapper_native/WrapperFactoryImplTest.java A webclient/test/automated/src/classes/org/mozilla/webclient/impl/wrapper_native/gtk/TestGtkBrowserControlCanvas.java R webclient/test/automated/src/classes/org/mozilla/webclient/wrapper_native/gtk/TestGtkBrowserControlCanvas.java A webclient/test/automated/src/test/BrowserControlFactoryTest_correct - junit tests! TEST FIRST!
2003-09-28 10:29:22 +04:00
void util_InitializeShareInitContext(JNIEnv *env,
void *yourInitContext)
bug=47357 a=edburns r=ashuk This change creates a new directory, java/webclient/src_share, that contains the code that will be used in both src_moz and src_ie, and any other native browser wrapping implementations. Here are the steps I followed to implement this change. 1. Create a new directory java/webclient/src_share 2. Move all jni_util*.* files from src_moz into src_share 3. Make it so src_share compiles into a new .lib src_share has no netscape dependencies. Any functionality that depended on ns dependencies was kept in src_moz. In this case, we have a function prototype only in src_share, with the implementation in src_moz. We did this for nsHashtable. The other trick was for things in WebShellInitContext that had nothing to do with Netscape. This case was accomodated by creating a new struct, ShareInitContext, that contains all WebShellInitContext members that have nothing to do with Netscape. Currently this is just jobject propertiesClass. I modified the WebShellInitContext struct to contain a ShareContext struct as its last member. There are two new methods in jni_util.h that allow for the initialization and deallocation of the members of the ShareContext struct. 4. Make it so src_moz uses the new .lib to provide the jni_util behavior a. Create ns_util* files that include ../src_share/jni_util* files appropriately. The only tricky part was for things in jni_util.h that Here's the list of files in this change. cvs -z3 -n update (in directory D:\Projects\mozilla\java\webclient) cvs server: Updating . M Makefile.win // added src_share to DIRS M src_moz/BookmarksImpl.cpp // include ns_util instead of jni_util M src_moz/CBrowserContainer.cpp // include ns_util instead of jni_util M src_moz/CBrowserContainer.h // include ns_util instead of jni_util M src_moz/CurrentPageImpl.cpp // include ns_util instead of jni_util M src_moz/HistoryImpl.cpp // include ns_util instead of jni_util M src_moz/Makefile.win // include ns_util instead of jni_util M src_moz/NativeEventThread.cpp // include ns_util instead of jni_util M src_moz/NavigationImpl.cpp // include ns_util instead of jni_util M src_moz/RDFEnumeration.cpp // include ns_util instead of jni_util M src_moz/RDFTreeNode.cpp // include ns_util instead of jni_util M src_moz/WindowControlImpl.cpp // include ns_util instead of jni_util // also use new util_InitShareContext // function M src_moz/WrapperFactoryImpl.cpp // include ns_util instead of jni_util R src_moz/jni_util.cpp // moved to ../src_share R src_moz/jni_util.h // moved to ../src_share R src_moz/jni_util_export.cpp // moved to ../src_share R src_moz/jni_util_export.h // moved to ../src_share M src_moz/nsActions.cpp // include ns_util instead of jni_util // also use new util_DeallocateShareContext M src_moz/nsActions.h // include ns_util instead of jni_util A src_moz/ns_util.cpp // include jni_util.h A src_moz/ns_util.h // include jni_util.h, changes to // WebshellInitContext struct A src_moz/ns_util_export.cpp // provide impls for methods in // jni_util_export.h A src_share/Makefile.win A src_share/bal_util.cpp A src_share/bal_util.h A src_share/jni_util.cpp A src_share/jni_util.h A src_share/jni_util_export.cpp A src_share/jni_util_export.h *****CVS exited normally with code 0*****
2000-08-04 01:32:54 +04:00
{
ShareInitContext *initContext = (ShareInitContext *) yourInitContext;
initContext->propertiesClass = nsnull;
This is a checkpoint milestone for webclient 2.0. Webclient currently doesn't run, but several unit tests for webclient do. I'll be proceeding through the rest of the webclient interfaces, building junit tests as I go, in the coming months. I hope to flesh out the basic framework, then publish build instructions, and hopefully I can get some contributions from the community. M util/classes/org/mozilla/util/Utilities.java new method: getImplFromServices: + * + * <p>This method tries to load the resource + * <code>META-INF/services/&gt;interfaceClassName&gt;</code>, where + * <code>&gt;interfaceClassName&lt;</code> is the argument to this + * method. If the resource is found, interpret it as a + * <code>Properties</code> file and read out its first line. + * Interpret the first line as the fully qualified class name of a + * class that implements <code></code>. The named class must have a + * public no-arg constructor.</p> M webclient/build-tests.xml - junit testcases for Webclient APIs, developed using test-first. M webclient/build.xml - changes for new package name structure: packages org.mozilla.webclient.{wrapper_native, wrapper_non_native} have gone away. Replaced with org.mozilla.webclient.impl.{wrapper_native, wrapper_non_native} - changes to accomodate "Services" based approach for pluggable webclient implementation. - don't bother re-naming the javah generated files, just let javah pick the names. - pass debugging args from build.properties - changed name of junit test target to "test". M webclient/classes_spec/org/mozilla/webclient/BrowserControl.java - got rid of BROWSER_TYPE. No longer necessary due to the new pluggability mechanism. M webclient/classes_spec/org/mozilla/webclient/BrowserControlFactory.java - Leverage the org.mozilla.util.Utilities.getImplFromServices() mechanism to allow a vendor-pluggable webclient implementation of the new "WebclientFactory" interface, which is method for method compatible with BrowserControlFactory. Make all BrowserControlFactory methods call through to methods on the vendor provided WebclientFactory implementation. R webclient/classes_spec/org/mozilla/webclient/BrowserControlFactoryInterface.java A webclient/classes_spec/org/mozilla/webclient/BrowserControlICE.java R webclient/classes_spec/org/mozilla/webclient/BrowserControlImpl.java R webclient/classes_spec/org/mozilla/webclient/BrowserType.java - move all implementation specific classe to the impl package. M webclient/classes_spec/org/mozilla/webclient/ImplObject.java - ImplObject shouldn't depend on vendor private classes. M webclient/classes_spec/org/mozilla/webclient/Preferences.java - new method + public void unregisterPrefChangedCallback(PrefChangedCallback cb, + String prefName, Object closure); M webclient/classes_spec/org/mozilla/webclient/ProfileManager.java - properly specify this interface. A webclient/classes_spec/org/mozilla/webclient/WebclientFactory.java * <p>This interface allows a pluggable webclient API implementation. * The static methods in {@link BrowserControlFactory} call through to * methods on this interface. Please see {@link BrowserControlFactory} * for information on how to hook up your <code>WebclientFactory</code> * implementation to the <code>BrowserControlFactory</code></p> R webclient/classes_spec/org/mozilla/webclient/WrapperFactory.java R webclient/classes_spec/org/mozilla/webclient/impl/BrowserControlFactoryImpl.java - moved these to the impl class A webclient/classes_spec/org/mozilla/webclient/impl/BrowserControlImpl.java A webclient/classes_spec/org/mozilla/webclient/impl/Service.java A webclient/classes_spec/org/mozilla/webclient/impl/WebclientFactoryImpl.java A webclient/classes_spec/org/mozilla/webclient/impl/WrapperFactory.java A webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/BookmarkEntryImpl.java A webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/BookmarksImpl.java A webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/CurrentPageImpl.java A webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/EventRegistrationImpl.java A webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/HistoryImpl.java A webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/ISupportsPeer.java A webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/ImplObjectNative.java A webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/NativeEventThread.java A webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/NavigationImpl.java A webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/PreferencesImpl.java A webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/ProfileManagerImpl.java A webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/RDFEnumeration.java A webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/RDFTreeNode.java A webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/SelectionImpl.java A webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/WCEventListenerWrapper.java A webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/WCMouseListenerImpl.java A webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/WindowControlImpl.java A webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/WrapperFactoryImpl.java A webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/gtk/GtkBrowserControlCanvas.java A webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/win32/Win32BrowserControlCanvas.java - copied from old package naming scheme. - lots and lots of cleanup. R webclient/classes_spec/org/mozilla/webclient/wrapper_native/BookmarkEntryImpl.java R webclient/classes_spec/org/mozilla/webclient/wrapper_native/BookmarksImpl.java R webclient/classes_spec/org/mozilla/webclient/wrapper_native/CurrentPageImpl.java R webclient/classes_spec/org/mozilla/webclient/wrapper_native/EventRegistrationImpl.java R webclient/classes_spec/org/mozilla/webclient/wrapper_native/HistoryImpl.java R webclient/classes_spec/org/mozilla/webclient/wrapper_native/ISupportsPeer.java R webclient/classes_spec/org/mozilla/webclient/wrapper_native/ImplObjectNative.java R webclient/classes_spec/org/mozilla/webclient/wrapper_native/NativeEventThread.java R webclient/classes_spec/org/mozilla/webclient/wrapper_native/NavigationImpl.java R webclient/classes_spec/org/mozilla/webclient/wrapper_native/PreferencesImpl.java R webclient/classes_spec/org/mozilla/webclient/wrapper_native/ProfileManagerImpl.java R webclient/classes_spec/org/mozilla/webclient/wrapper_native/RDFEnumeration.java R webclient/classes_spec/org/mozilla/webclient/wrapper_native/RDFTreeNode.java A webclient/classes_spec/org/mozilla/webclient/wrapper_native/README R webclient/classes_spec/org/mozilla/webclient/wrapper_native/SelectionImpl.java R webclient/classes_spec/org/mozilla/webclient/wrapper_native/WCEventListenerWrapper.java R webclient/classes_spec/org/mozilla/webclient/wrapper_native/WCMouseListenerImpl.java R webclient/classes_spec/org/mozilla/webclient/wrapper_native/WindowControlImpl.java R webclient/classes_spec/org/mozilla/webclient/wrapper_native/WrapperFactoryImpl.java R webclient/classes_spec/org/mozilla/webclient/wrapper_native/gtk/GtkBrowserControlCanvas.java R webclient/classes_spec/org/mozilla/webclient/wrapper_native/win32/Win32BrowserControlCanvas.java - removed from old package naming scheme M webclient/src_moz/BookmarksImpl.cpp - remove dependency on RDFActionEvents by inlining all the code that formerly was in the events. - package name change - JNI include file name change M webclient/src_moz/CurrentPageImpl.cpp M webclient/src_moz/HistoryImpl.cpp M webclient/src_moz/ISupportsPeer.cpp - package name change - JNI include file name change M webclient/src_moz/Makefile.in - get rid of PreferencesActionEvents.cpp and RDFActionEvents.cpp - add ProfileManagerImpl.cpp M webclient/src_moz/NativeEventThread.cpp - this file is not done yet. I've been pulling misplaced initialization stuff out of here and putting it into WrapperFactoryImpl.cpp. - got rid of gComponentManager, since we can use do_CreateInstance instead. - package name change - JNI include file name change M webclient/src_moz/NativeEventThreadActionEvents.h - JNI include file name change M webclient/src_moz/NavigationImpl.cpp - package name change - JNI include file name change R webclient/src_moz/PreferencesActionEvents.cpp R webclient/src_moz/PreferencesActionEvents.h - don't need these anymore! woohoo! M webclient/src_moz/PreferencesImpl.cpp - remove dependency on PreferencesActionEvents by inlining code into the methods that used to use the events. A webclient/src_moz/ProfileManagerImpl.cpp - new class, implementation of the ProfileManager interface. M webclient/src_moz/PromptActionEvents.cpp - change erroneous comment so my grep performed correctly. R webclient/src_moz/RDFActionEvents.cpp R webclient/src_moz/RDFActionEvents.h - don't need these anymore! woohoo! M webclient/src_moz/RDFEnumeration.cpp M webclient/src_moz/RDFTreeNode.cpp - remove dependency on RDFActionEvents by inlining code into the methods that used to use the events. M webclient/src_moz/WindowControlActionEvents.cpp - deallocate shareInitiContext. M webclient/src_moz/WindowControlImpl.cpp - package name change - JNI include file name change - remove the "sleep so I can attach gdb" code. Moved to WrapperFactoryImpl.cpp. M webclient/src_moz/WrapperFactoryImpl.cpp - lots of changes. This is now where the app initialization and shutdown happens, M webclient/src_moz/dom_util.cpp - comment change M webclient/src_moz/ns_globals.h - get rid of inappropriate global usage. M webclient/src_moz/ns_util.h - new struct WebclientContext for singletons. M webclient/src_moz/rdf_util.cpp - new methods, rdf_startup and rdf_shutdown. - replace calls to nsComponentManager::CreateInstance() with do_CreateInstance(). M webclient/src_moz/rdf_util.h - new methods, rdf_startup and rdf_shutdown. M webclient/src_moz/gtk/GtkBrowserControlCanvas.cpp - package name change - JNI include file name change M webclient/src_moz/gtk/GtkBrowserControlCanvasStub.cpp - package name change - JNI include file name change - this file isn't needed anymore, thankfully! I'll remove it soon. M webclient/src_moz/gtk/StubFunctions.h - package name change - JNI include file name change - this file isn't needed anymore, thankfully! I'll remove it soon. M webclient/src_moz/motif/BrowserControlNativeShimStub.cpp M webclient/src_moz/motif/MotifBrowserControlCanvas.cpp M webclient/src_moz/motif/MotifBrowserControlCanvasStub.cpp M webclient/src_moz/motif/NativeLoaderStub.cpp M webclient/src_moz/win32/Win32BrowserControlCanvas.cpp - package name change - JNI include file name change M webclient/src_share/jni_util.cpp M webclient/src_share/jni_util.h - util_InitializeShareInitContext() takes a JNIEnv *. - new methods +void util_DeleteGlobalRef(JNIEnv *env, jobject toDeleteRef); +void util_DeleteLocalRef(JNIEnv *env, jobject toDeleteRef); +void util_getSystemProperty(JNIEnv *env, + const char *propName, + char *propValue, + jint propValueLen); M webclient/src_share/jni_util_export.cpp M webclient/src_share/jni_util_export.h +JNIEXPORT jobjectArray util_GetJstringArrayFromJcharArray(JNIEnv *env, + jint len, + jchar **strings, + jint *stringLengths) A webclient/test/automated/src/classes/org/mozilla/webclient/BookmarksTest.java R webclient/test/automated/src/classes/org/mozilla/webclient/BrowserControlFactoryTest.java A webclient/test/automated/src/classes/org/mozilla/webclient/PreferencesTest.java A webclient/test/automated/src/classes/org/mozilla/webclient/ProfileManagerTest.java A webclient/test/automated/src/classes/org/mozilla/webclient/impl/WebclientFactoryImplTest.java A webclient/test/automated/src/classes/org/mozilla/webclient/impl/wrapper_native/WrapperFactoryImplTest.java A webclient/test/automated/src/classes/org/mozilla/webclient/impl/wrapper_native/gtk/TestGtkBrowserControlCanvas.java R webclient/test/automated/src/classes/org/mozilla/webclient/wrapper_native/gtk/TestGtkBrowserControlCanvas.java A webclient/test/automated/src/test/BrowserControlFactoryTest_correct - junit tests! TEST FIRST!
2003-09-28 10:29:22 +04:00
initContext->propertiesClass =
::util_FindClass(env, "java/util/Properties");
util_Assert(initContext->propertiesClass);
bug=47357 a=edburns r=ashuk This change creates a new directory, java/webclient/src_share, that contains the code that will be used in both src_moz and src_ie, and any other native browser wrapping implementations. Here are the steps I followed to implement this change. 1. Create a new directory java/webclient/src_share 2. Move all jni_util*.* files from src_moz into src_share 3. Make it so src_share compiles into a new .lib src_share has no netscape dependencies. Any functionality that depended on ns dependencies was kept in src_moz. In this case, we have a function prototype only in src_share, with the implementation in src_moz. We did this for nsHashtable. The other trick was for things in WebShellInitContext that had nothing to do with Netscape. This case was accomodated by creating a new struct, ShareInitContext, that contains all WebShellInitContext members that have nothing to do with Netscape. Currently this is just jobject propertiesClass. I modified the WebShellInitContext struct to contain a ShareContext struct as its last member. There are two new methods in jni_util.h that allow for the initialization and deallocation of the members of the ShareContext struct. 4. Make it so src_moz uses the new .lib to provide the jni_util behavior a. Create ns_util* files that include ../src_share/jni_util* files appropriately. The only tricky part was for things in jni_util.h that Here's the list of files in this change. cvs -z3 -n update (in directory D:\Projects\mozilla\java\webclient) cvs server: Updating . M Makefile.win // added src_share to DIRS M src_moz/BookmarksImpl.cpp // include ns_util instead of jni_util M src_moz/CBrowserContainer.cpp // include ns_util instead of jni_util M src_moz/CBrowserContainer.h // include ns_util instead of jni_util M src_moz/CurrentPageImpl.cpp // include ns_util instead of jni_util M src_moz/HistoryImpl.cpp // include ns_util instead of jni_util M src_moz/Makefile.win // include ns_util instead of jni_util M src_moz/NativeEventThread.cpp // include ns_util instead of jni_util M src_moz/NavigationImpl.cpp // include ns_util instead of jni_util M src_moz/RDFEnumeration.cpp // include ns_util instead of jni_util M src_moz/RDFTreeNode.cpp // include ns_util instead of jni_util M src_moz/WindowControlImpl.cpp // include ns_util instead of jni_util // also use new util_InitShareContext // function M src_moz/WrapperFactoryImpl.cpp // include ns_util instead of jni_util R src_moz/jni_util.cpp // moved to ../src_share R src_moz/jni_util.h // moved to ../src_share R src_moz/jni_util_export.cpp // moved to ../src_share R src_moz/jni_util_export.h // moved to ../src_share M src_moz/nsActions.cpp // include ns_util instead of jni_util // also use new util_DeallocateShareContext M src_moz/nsActions.h // include ns_util instead of jni_util A src_moz/ns_util.cpp // include jni_util.h A src_moz/ns_util.h // include jni_util.h, changes to // WebshellInitContext struct A src_moz/ns_util_export.cpp // provide impls for methods in // jni_util_export.h A src_share/Makefile.win A src_share/bal_util.cpp A src_share/bal_util.h A src_share/jni_util.cpp A src_share/jni_util.h A src_share/jni_util_export.cpp A src_share/jni_util_export.h *****CVS exited normally with code 0*****
2000-08-04 01:32:54 +04:00
}
This is a checkpoint milestone for webclient 2.0. Webclient currently doesn't run, but several unit tests for webclient do. I'll be proceeding through the rest of the webclient interfaces, building junit tests as I go, in the coming months. I hope to flesh out the basic framework, then publish build instructions, and hopefully I can get some contributions from the community. M util/classes/org/mozilla/util/Utilities.java new method: getImplFromServices: + * + * <p>This method tries to load the resource + * <code>META-INF/services/&gt;interfaceClassName&gt;</code>, where + * <code>&gt;interfaceClassName&lt;</code> is the argument to this + * method. If the resource is found, interpret it as a + * <code>Properties</code> file and read out its first line. + * Interpret the first line as the fully qualified class name of a + * class that implements <code></code>. The named class must have a + * public no-arg constructor.</p> M webclient/build-tests.xml - junit testcases for Webclient APIs, developed using test-first. M webclient/build.xml - changes for new package name structure: packages org.mozilla.webclient.{wrapper_native, wrapper_non_native} have gone away. Replaced with org.mozilla.webclient.impl.{wrapper_native, wrapper_non_native} - changes to accomodate "Services" based approach for pluggable webclient implementation. - don't bother re-naming the javah generated files, just let javah pick the names. - pass debugging args from build.properties - changed name of junit test target to "test". M webclient/classes_spec/org/mozilla/webclient/BrowserControl.java - got rid of BROWSER_TYPE. No longer necessary due to the new pluggability mechanism. M webclient/classes_spec/org/mozilla/webclient/BrowserControlFactory.java - Leverage the org.mozilla.util.Utilities.getImplFromServices() mechanism to allow a vendor-pluggable webclient implementation of the new "WebclientFactory" interface, which is method for method compatible with BrowserControlFactory. Make all BrowserControlFactory methods call through to methods on the vendor provided WebclientFactory implementation. R webclient/classes_spec/org/mozilla/webclient/BrowserControlFactoryInterface.java A webclient/classes_spec/org/mozilla/webclient/BrowserControlICE.java R webclient/classes_spec/org/mozilla/webclient/BrowserControlImpl.java R webclient/classes_spec/org/mozilla/webclient/BrowserType.java - move all implementation specific classe to the impl package. M webclient/classes_spec/org/mozilla/webclient/ImplObject.java - ImplObject shouldn't depend on vendor private classes. M webclient/classes_spec/org/mozilla/webclient/Preferences.java - new method + public void unregisterPrefChangedCallback(PrefChangedCallback cb, + String prefName, Object closure); M webclient/classes_spec/org/mozilla/webclient/ProfileManager.java - properly specify this interface. A webclient/classes_spec/org/mozilla/webclient/WebclientFactory.java * <p>This interface allows a pluggable webclient API implementation. * The static methods in {@link BrowserControlFactory} call through to * methods on this interface. Please see {@link BrowserControlFactory} * for information on how to hook up your <code>WebclientFactory</code> * implementation to the <code>BrowserControlFactory</code></p> R webclient/classes_spec/org/mozilla/webclient/WrapperFactory.java R webclient/classes_spec/org/mozilla/webclient/impl/BrowserControlFactoryImpl.java - moved these to the impl class A webclient/classes_spec/org/mozilla/webclient/impl/BrowserControlImpl.java A webclient/classes_spec/org/mozilla/webclient/impl/Service.java A webclient/classes_spec/org/mozilla/webclient/impl/WebclientFactoryImpl.java A webclient/classes_spec/org/mozilla/webclient/impl/WrapperFactory.java A webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/BookmarkEntryImpl.java A webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/BookmarksImpl.java A webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/CurrentPageImpl.java A webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/EventRegistrationImpl.java A webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/HistoryImpl.java A webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/ISupportsPeer.java A webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/ImplObjectNative.java A webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/NativeEventThread.java A webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/NavigationImpl.java A webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/PreferencesImpl.java A webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/ProfileManagerImpl.java A webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/RDFEnumeration.java A webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/RDFTreeNode.java A webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/SelectionImpl.java A webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/WCEventListenerWrapper.java A webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/WCMouseListenerImpl.java A webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/WindowControlImpl.java A webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/WrapperFactoryImpl.java A webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/gtk/GtkBrowserControlCanvas.java A webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/win32/Win32BrowserControlCanvas.java - copied from old package naming scheme. - lots and lots of cleanup. R webclient/classes_spec/org/mozilla/webclient/wrapper_native/BookmarkEntryImpl.java R webclient/classes_spec/org/mozilla/webclient/wrapper_native/BookmarksImpl.java R webclient/classes_spec/org/mozilla/webclient/wrapper_native/CurrentPageImpl.java R webclient/classes_spec/org/mozilla/webclient/wrapper_native/EventRegistrationImpl.java R webclient/classes_spec/org/mozilla/webclient/wrapper_native/HistoryImpl.java R webclient/classes_spec/org/mozilla/webclient/wrapper_native/ISupportsPeer.java R webclient/classes_spec/org/mozilla/webclient/wrapper_native/ImplObjectNative.java R webclient/classes_spec/org/mozilla/webclient/wrapper_native/NativeEventThread.java R webclient/classes_spec/org/mozilla/webclient/wrapper_native/NavigationImpl.java R webclient/classes_spec/org/mozilla/webclient/wrapper_native/PreferencesImpl.java R webclient/classes_spec/org/mozilla/webclient/wrapper_native/ProfileManagerImpl.java R webclient/classes_spec/org/mozilla/webclient/wrapper_native/RDFEnumeration.java R webclient/classes_spec/org/mozilla/webclient/wrapper_native/RDFTreeNode.java A webclient/classes_spec/org/mozilla/webclient/wrapper_native/README R webclient/classes_spec/org/mozilla/webclient/wrapper_native/SelectionImpl.java R webclient/classes_spec/org/mozilla/webclient/wrapper_native/WCEventListenerWrapper.java R webclient/classes_spec/org/mozilla/webclient/wrapper_native/WCMouseListenerImpl.java R webclient/classes_spec/org/mozilla/webclient/wrapper_native/WindowControlImpl.java R webclient/classes_spec/org/mozilla/webclient/wrapper_native/WrapperFactoryImpl.java R webclient/classes_spec/org/mozilla/webclient/wrapper_native/gtk/GtkBrowserControlCanvas.java R webclient/classes_spec/org/mozilla/webclient/wrapper_native/win32/Win32BrowserControlCanvas.java - removed from old package naming scheme M webclient/src_moz/BookmarksImpl.cpp - remove dependency on RDFActionEvents by inlining all the code that formerly was in the events. - package name change - JNI include file name change M webclient/src_moz/CurrentPageImpl.cpp M webclient/src_moz/HistoryImpl.cpp M webclient/src_moz/ISupportsPeer.cpp - package name change - JNI include file name change M webclient/src_moz/Makefile.in - get rid of PreferencesActionEvents.cpp and RDFActionEvents.cpp - add ProfileManagerImpl.cpp M webclient/src_moz/NativeEventThread.cpp - this file is not done yet. I've been pulling misplaced initialization stuff out of here and putting it into WrapperFactoryImpl.cpp. - got rid of gComponentManager, since we can use do_CreateInstance instead. - package name change - JNI include file name change M webclient/src_moz/NativeEventThreadActionEvents.h - JNI include file name change M webclient/src_moz/NavigationImpl.cpp - package name change - JNI include file name change R webclient/src_moz/PreferencesActionEvents.cpp R webclient/src_moz/PreferencesActionEvents.h - don't need these anymore! woohoo! M webclient/src_moz/PreferencesImpl.cpp - remove dependency on PreferencesActionEvents by inlining code into the methods that used to use the events. A webclient/src_moz/ProfileManagerImpl.cpp - new class, implementation of the ProfileManager interface. M webclient/src_moz/PromptActionEvents.cpp - change erroneous comment so my grep performed correctly. R webclient/src_moz/RDFActionEvents.cpp R webclient/src_moz/RDFActionEvents.h - don't need these anymore! woohoo! M webclient/src_moz/RDFEnumeration.cpp M webclient/src_moz/RDFTreeNode.cpp - remove dependency on RDFActionEvents by inlining code into the methods that used to use the events. M webclient/src_moz/WindowControlActionEvents.cpp - deallocate shareInitiContext. M webclient/src_moz/WindowControlImpl.cpp - package name change - JNI include file name change - remove the "sleep so I can attach gdb" code. Moved to WrapperFactoryImpl.cpp. M webclient/src_moz/WrapperFactoryImpl.cpp - lots of changes. This is now where the app initialization and shutdown happens, M webclient/src_moz/dom_util.cpp - comment change M webclient/src_moz/ns_globals.h - get rid of inappropriate global usage. M webclient/src_moz/ns_util.h - new struct WebclientContext for singletons. M webclient/src_moz/rdf_util.cpp - new methods, rdf_startup and rdf_shutdown. - replace calls to nsComponentManager::CreateInstance() with do_CreateInstance(). M webclient/src_moz/rdf_util.h - new methods, rdf_startup and rdf_shutdown. M webclient/src_moz/gtk/GtkBrowserControlCanvas.cpp - package name change - JNI include file name change M webclient/src_moz/gtk/GtkBrowserControlCanvasStub.cpp - package name change - JNI include file name change - this file isn't needed anymore, thankfully! I'll remove it soon. M webclient/src_moz/gtk/StubFunctions.h - package name change - JNI include file name change - this file isn't needed anymore, thankfully! I'll remove it soon. M webclient/src_moz/motif/BrowserControlNativeShimStub.cpp M webclient/src_moz/motif/MotifBrowserControlCanvas.cpp M webclient/src_moz/motif/MotifBrowserControlCanvasStub.cpp M webclient/src_moz/motif/NativeLoaderStub.cpp M webclient/src_moz/win32/Win32BrowserControlCanvas.cpp - package name change - JNI include file name change M webclient/src_share/jni_util.cpp M webclient/src_share/jni_util.h - util_InitializeShareInitContext() takes a JNIEnv *. - new methods +void util_DeleteGlobalRef(JNIEnv *env, jobject toDeleteRef); +void util_DeleteLocalRef(JNIEnv *env, jobject toDeleteRef); +void util_getSystemProperty(JNIEnv *env, + const char *propName, + char *propValue, + jint propValueLen); M webclient/src_share/jni_util_export.cpp M webclient/src_share/jni_util_export.h +JNIEXPORT jobjectArray util_GetJstringArrayFromJcharArray(JNIEnv *env, + jint len, + jchar **strings, + jint *stringLengths) A webclient/test/automated/src/classes/org/mozilla/webclient/BookmarksTest.java R webclient/test/automated/src/classes/org/mozilla/webclient/BrowserControlFactoryTest.java A webclient/test/automated/src/classes/org/mozilla/webclient/PreferencesTest.java A webclient/test/automated/src/classes/org/mozilla/webclient/ProfileManagerTest.java A webclient/test/automated/src/classes/org/mozilla/webclient/impl/WebclientFactoryImplTest.java A webclient/test/automated/src/classes/org/mozilla/webclient/impl/wrapper_native/WrapperFactoryImplTest.java A webclient/test/automated/src/classes/org/mozilla/webclient/impl/wrapper_native/gtk/TestGtkBrowserControlCanvas.java R webclient/test/automated/src/classes/org/mozilla/webclient/wrapper_native/gtk/TestGtkBrowserControlCanvas.java A webclient/test/automated/src/test/BrowserControlFactoryTest_correct - junit tests! TEST FIRST!
2003-09-28 10:29:22 +04:00
void util_DeallocateShareInitContext(JNIEnv *env,
void *yourInitContext)
bug=47357 a=edburns r=ashuk This change creates a new directory, java/webclient/src_share, that contains the code that will be used in both src_moz and src_ie, and any other native browser wrapping implementations. Here are the steps I followed to implement this change. 1. Create a new directory java/webclient/src_share 2. Move all jni_util*.* files from src_moz into src_share 3. Make it so src_share compiles into a new .lib src_share has no netscape dependencies. Any functionality that depended on ns dependencies was kept in src_moz. In this case, we have a function prototype only in src_share, with the implementation in src_moz. We did this for nsHashtable. The other trick was for things in WebShellInitContext that had nothing to do with Netscape. This case was accomodated by creating a new struct, ShareInitContext, that contains all WebShellInitContext members that have nothing to do with Netscape. Currently this is just jobject propertiesClass. I modified the WebShellInitContext struct to contain a ShareContext struct as its last member. There are two new methods in jni_util.h that allow for the initialization and deallocation of the members of the ShareContext struct. 4. Make it so src_moz uses the new .lib to provide the jni_util behavior a. Create ns_util* files that include ../src_share/jni_util* files appropriately. The only tricky part was for things in jni_util.h that Here's the list of files in this change. cvs -z3 -n update (in directory D:\Projects\mozilla\java\webclient) cvs server: Updating . M Makefile.win // added src_share to DIRS M src_moz/BookmarksImpl.cpp // include ns_util instead of jni_util M src_moz/CBrowserContainer.cpp // include ns_util instead of jni_util M src_moz/CBrowserContainer.h // include ns_util instead of jni_util M src_moz/CurrentPageImpl.cpp // include ns_util instead of jni_util M src_moz/HistoryImpl.cpp // include ns_util instead of jni_util M src_moz/Makefile.win // include ns_util instead of jni_util M src_moz/NativeEventThread.cpp // include ns_util instead of jni_util M src_moz/NavigationImpl.cpp // include ns_util instead of jni_util M src_moz/RDFEnumeration.cpp // include ns_util instead of jni_util M src_moz/RDFTreeNode.cpp // include ns_util instead of jni_util M src_moz/WindowControlImpl.cpp // include ns_util instead of jni_util // also use new util_InitShareContext // function M src_moz/WrapperFactoryImpl.cpp // include ns_util instead of jni_util R src_moz/jni_util.cpp // moved to ../src_share R src_moz/jni_util.h // moved to ../src_share R src_moz/jni_util_export.cpp // moved to ../src_share R src_moz/jni_util_export.h // moved to ../src_share M src_moz/nsActions.cpp // include ns_util instead of jni_util // also use new util_DeallocateShareContext M src_moz/nsActions.h // include ns_util instead of jni_util A src_moz/ns_util.cpp // include jni_util.h A src_moz/ns_util.h // include jni_util.h, changes to // WebshellInitContext struct A src_moz/ns_util_export.cpp // provide impls for methods in // jni_util_export.h A src_share/Makefile.win A src_share/bal_util.cpp A src_share/bal_util.h A src_share/jni_util.cpp A src_share/jni_util.h A src_share/jni_util_export.cpp A src_share/jni_util_export.h *****CVS exited normally with code 0*****
2000-08-04 01:32:54 +04:00
{
// right now there is nothing to deallocate
}
jboolean util_InitStringConstants()
{
util_Assert(gVm);
JNIEnv *env = (JNIEnv *) JNU_GetEnv(gVm, JNI_VERSION);
if (nsnull == (SCREEN_X_KEY =
::util_NewGlobalRef(env, (jobject)
::util_NewStringUTF(env, "ScreenX")))) {
return JNI_FALSE;
}
if (nsnull == (SCREEN_Y_KEY =
::util_NewGlobalRef(env, (jobject)
::util_NewStringUTF(env, "ScreenY")))) {
return JNI_FALSE;
}
if (nsnull == (CLIENT_X_KEY =
::util_NewGlobalRef(env, (jobject)
::util_NewStringUTF(env, "ClientX")))) {
return JNI_FALSE;
}
if (nsnull == (CLIENT_Y_KEY =
::util_NewGlobalRef(env, (jobject)
::util_NewStringUTF(env, "ClientY")))) {
return JNI_FALSE;
}
This checkin enables the KeyListener feature. A webclient/test/automated/src/classes/org/mozilla/webclient/KeyListenerTest.java A webclient/test/automated/src/test/KeyListenerTest1.html M webclient/build-tests.xml - add new testcase M webclient/classes_spec/org/mozilla/webclient/BrowserControlCanvas.java M webclient/classes_spec/org/mozilla/webclient/EventRegistration2.java - allow KeyListeners to be added and removed. M webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/EventRegistrationImpl.java - Lazily create listener lists. - Change the contract of queueEvent() to discard null events silently. - Add createKeyEvent() method. M webclient/src_moz/EmbedEventListener.cpp - new mask names and values, DOMDOMKeyListener_maskNames, DOMKeyListener_maskValues. - flesh out Key*() events. - add addKeyEventDataToProperties. - use eventType to discern how to populate the properties, with either key or mouse data. M webclient/src_moz/EmbedEventListener.h - key event includes and support methods. M webclient/src_moz/EmbedProgress.cpp - honor new last argument to util_InitializeEventMaskValuesFromClass(). M webclient/src_share/jni_util.cpp M webclient/src_share/jni_util.h - new constants +jobject CHAR_CODE; +jobject KEY_CODE; +jstring KEY_LISTENER_CLASSNAME; +char *DOMKeyListener_maskNames[] = { M webclient/src_share/jni_util_export.cpp M webclient/src_share/jni_util_export.h - new last argument to util_InitializeEventMaskValuesFromClass(const char *className, char *maskNames[], - jlong maskValues[]) + jlong maskValuesLong[], + jint maskValuesInt[]) Used when the maskValues are ints, otherwise null.
2004-12-01 06:21:23 +03:00
if (nsnull == (CHAR_CODE =
::util_NewGlobalRef(env, (jobject)
::util_NewStringUTF(env, "KeyChar")))) {
This checkin enables the KeyListener feature. A webclient/test/automated/src/classes/org/mozilla/webclient/KeyListenerTest.java A webclient/test/automated/src/test/KeyListenerTest1.html M webclient/build-tests.xml - add new testcase M webclient/classes_spec/org/mozilla/webclient/BrowserControlCanvas.java M webclient/classes_spec/org/mozilla/webclient/EventRegistration2.java - allow KeyListeners to be added and removed. M webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/EventRegistrationImpl.java - Lazily create listener lists. - Change the contract of queueEvent() to discard null events silently. - Add createKeyEvent() method. M webclient/src_moz/EmbedEventListener.cpp - new mask names and values, DOMDOMKeyListener_maskNames, DOMKeyListener_maskValues. - flesh out Key*() events. - add addKeyEventDataToProperties. - use eventType to discern how to populate the properties, with either key or mouse data. M webclient/src_moz/EmbedEventListener.h - key event includes and support methods. M webclient/src_moz/EmbedProgress.cpp - honor new last argument to util_InitializeEventMaskValuesFromClass(). M webclient/src_share/jni_util.cpp M webclient/src_share/jni_util.h - new constants +jobject CHAR_CODE; +jobject KEY_CODE; +jstring KEY_LISTENER_CLASSNAME; +char *DOMKeyListener_maskNames[] = { M webclient/src_share/jni_util_export.cpp M webclient/src_share/jni_util_export.h - new last argument to util_InitializeEventMaskValuesFromClass(const char *className, char *maskNames[], - jlong maskValues[]) + jlong maskValuesLong[], + jint maskValuesInt[]) Used when the maskValues are ints, otherwise null.
2004-12-01 06:21:23 +03:00
return JNI_FALSE;
}
if (nsnull == (KEY_CODE =
::util_NewGlobalRef(env, (jobject)
::util_NewStringUTF(env, "KeyCode")))) {
This checkin enables the KeyListener feature. A webclient/test/automated/src/classes/org/mozilla/webclient/KeyListenerTest.java A webclient/test/automated/src/test/KeyListenerTest1.html M webclient/build-tests.xml - add new testcase M webclient/classes_spec/org/mozilla/webclient/BrowserControlCanvas.java M webclient/classes_spec/org/mozilla/webclient/EventRegistration2.java - allow KeyListeners to be added and removed. M webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/EventRegistrationImpl.java - Lazily create listener lists. - Change the contract of queueEvent() to discard null events silently. - Add createKeyEvent() method. M webclient/src_moz/EmbedEventListener.cpp - new mask names and values, DOMDOMKeyListener_maskNames, DOMKeyListener_maskValues. - flesh out Key*() events. - add addKeyEventDataToProperties. - use eventType to discern how to populate the properties, with either key or mouse data. M webclient/src_moz/EmbedEventListener.h - key event includes and support methods. M webclient/src_moz/EmbedProgress.cpp - honor new last argument to util_InitializeEventMaskValuesFromClass(). M webclient/src_share/jni_util.cpp M webclient/src_share/jni_util.h - new constants +jobject CHAR_CODE; +jobject KEY_CODE; +jstring KEY_LISTENER_CLASSNAME; +char *DOMKeyListener_maskNames[] = { M webclient/src_share/jni_util_export.cpp M webclient/src_share/jni_util_export.h - new last argument to util_InitializeEventMaskValuesFromClass(const char *className, char *maskNames[], - jlong maskValues[]) + jlong maskValuesLong[], + jint maskValuesInt[]) Used when the maskValues are ints, otherwise null.
2004-12-01 06:21:23 +03:00
return JNI_FALSE;
}
if (nsnull == (ALT_KEY =
::util_NewGlobalRef(env, (jobject)
::util_NewStringUTF(env, "Alt")))) {
return JNI_FALSE;
}
if (nsnull == (CTRL_KEY =
::util_NewGlobalRef(env, (jobject)
::util_NewStringUTF(env, "Ctrl")))) {
return JNI_FALSE;
}
if (nsnull == (SHIFT_KEY =
::util_NewGlobalRef(env, (jobject)
::util_NewStringUTF(env, "Shift")))) {
return JNI_FALSE;
}
if (nsnull == (META_KEY =
::util_NewGlobalRef(env, (jobject)
::util_NewStringUTF(env, "Meta")))) {
return JNI_FALSE;
}
if (nsnull == (BUTTON_KEY =
::util_NewGlobalRef(env, (jobject)
::util_NewStringUTF(env, "Button")))) {
return JNI_FALSE;
}
if (nsnull == (CLICK_COUNT_KEY =
::util_NewGlobalRef(env, (jobject)
::util_NewStringUTF(env,
"ClickCount")))) {
return JNI_FALSE;
}
if (nsnull == (USER_NAME_KEY =
::util_NewGlobalRef(env, (jobject)
::util_NewStringUTF(env,
"userName")))) {
return JNI_FALSE;
}
if (nsnull == (PASSWORD_KEY =
::util_NewGlobalRef(env, (jobject)
::util_NewStringUTF(env,
"password")))) {
return JNI_FALSE;
}
if (nsnull == (EDIT_FIELD_1_KEY =
::util_NewGlobalRef(env, (jobject)
::util_NewStringUTF(env,
"editfield1Value")))) {
return JNI_FALSE;
}
if (nsnull == (EDIT_FIELD_2_KEY =
::util_NewGlobalRef(env, (jobject)
::util_NewStringUTF(env,
"editfield12Value")))) {
return JNI_FALSE;
}
if (nsnull == (CHECKBOX_STATE_KEY =
::util_NewGlobalRef(env, (jobject)
::util_NewStringUTF(env,
"checkboxState")))) {
return JNI_FALSE;
}
if (nsnull == (BUTTON_PRESSED_KEY =
::util_NewGlobalRef(env, (jobject)
::util_NewStringUTF(env,
"buttonPressed")))) {
return JNI_FALSE;
}
if (nsnull == (TRUE_VALUE =
::util_NewGlobalRef(env, (jobject)
::util_NewStringUTF(env, "true")))) {
return JNI_FALSE;
}
if (nsnull == (FALSE_VALUE =
::util_NewGlobalRef(env, (jobject)
::util_NewStringUTF(env, "false")))) {
return JNI_FALSE;
}
if (nsnull == (ONE_VALUE =
::util_NewGlobalRef(env, (jobject)
::util_NewStringUTF(env, "1")))) {
return JNI_FALSE;
}
if (nsnull == (TWO_VALUE =
::util_NewGlobalRef(env, (jobject)
::util_NewStringUTF(env, "2")))) {
return JNI_FALSE;
}
This checkin implements a response header listener feature. I have changed the usage contract of the DocumentLoadListener slightly. Prior to this checkin, calling getEventData() on the DocumentLoadEvent passed in to your eventDispatched() method returned the URI to which the event applies. Now the getEventData() returns a Map. You must look up the "URI" key to find the URI to which the event applies. If your listener is an instance of PageInfoListener, and your event mask is END_URL_LOAD_EVENT_MASK, your Map will have an additional entry under the key "headers". This entry is another Map representing the response headers. DocumentLoadListener: * <p>The <code>eventDispatched()</code> method is passed a {@link * DocumentLoadEvent} instance. The <code>type</code> property of the * event will be one of the types defined as a <code>public static final * int</code> in <code>DocumentLoadEvent</code>.</p> * * <p>The <code>eventData</code> property of the * <code>DocumentLoadEvent</code> instance will be a * <code>java.util.Map</code>. For all <code>EVENT_MASK</code> types in * <code>DocumentLoadEvent</code> the map will contain an entry under * the key "<code>URI</code>" without the quotes. This will be the * fully qualified URI for the event.</p> * * <p>For the <code>PROGRESS_URL_LOAD_EVENT_MASK</code> there will be an * entry in the map for the key "<code>message</code>". This will be * the progress message from the browser.</p> PageInfoListener: * <p>This {@link DocumentLoadListener} subclass adds the ability to get * detailed information on each event. </p> * * <p>The <code>eventDispatched()</code> method is passed the same thing * as in the {@link DocumentLoadListener}.</p> * * <p>The <code>eventData</code> property of the * <code>DocumentLoadEvent</code> instance will be a * <code>java.util.Map</code>. For the * <code>END_URL_LOAD_EVENT_MASK</code> type in * <code>DocumentLoadEvent</code> the map will contain an entry under * the key "<code>URI</code>" without the quotes. This will be the * fully qualified URI for the event. The map will also contain an * entry under the key "<code>headers</code>". This entry will be a * <code>Map</code> of all the response headers.</p> The next step will be to allow the same procedure to work to discover the request headers. Ed A classes_spec/org/mozilla/webclient/PageInfoListener.java - marker class for listenening for high fidelity page information. A src_moz/EventRegistrationImpl.cpp - add boolean property, capturePageInfo to turn on or off high fidelity page information collection. M build-tests.xml - add new test, DocumentLoadListenerTest M build.xml - added new JNI class, EventRegistrationImpl M classes_spec/org/mozilla/webclient/CurrentPage2.java M classes_spec/org/mozilla/webclient/impl/wrapper_native/CurrentPageImpl.java - rollback previous API for headers discovery M classes_spec/org/mozilla/webclient/impl/wrapper_native/EventRegistrationImpl.java - pass thru the capturePageInfo property - add URIToStringMap, currently not working. M classes_spec/org/mozilla/webclient/test/EMWindow.java - call toString() on the eventData, don't cast it to a String. M src_moz/EmbedProgress.cpp M src_moz/EmbedProgress.h - leverage the nsIHttpHeaderVisitor interface to discover the response headers. - add boolean property capturePageInfo A src_moz/HttpHeaderVisitorImpl.cpp A src_moz/HttpHeaderVisitorImpl.h - copy the headers to a Properties object. M src_moz/Makefile.in - compile two new files: + EventRegistrationImpl.cpp \ + HttpHeaderVisitorImpl.cpp \ M src_moz/NativeBrowserControl.cpp M src_moz/NativeBrowserControl.h - pass the NativeWrapperFactory to our Init() method - add wrapperFactory getter. M src_moz/WrapperFactoryImpl.cpp - pass the nativeWrapperFactory to the NativeBrowserControl's Init method. M src_share/jni_util.cpp M src_share/jni_util.h - new constants: URI, headers R test/automated/src/classes/org/mozilla/webclient/CurrentPageTest.java - not yet time for this one A test/automated/src/classes/org/mozilla/webclient/DocumentLoadListenerTest.java - exercise bare minimum functionality of PageInfoListener M test/manual/src/classes/org/mozilla/webclient/test/TestBrowser.java - print out headers.
2004-09-10 00:17:18 +04:00
if (nsnull == (URI_VALUE =
::util_NewGlobalRef(env, (jobject)
::util_NewStringUTF(env, "URI")))) {
return JNI_FALSE;
}
if (nsnull == (HEADERS_VALUE =
::util_NewGlobalRef(env, (jobject)
::util_NewStringUTF(env, "headers")))) {
return JNI_FALSE;
}
This checkin enables finding out the request method and response status of a URL_LOAD event. I'm still working on getting the request body via the nsIUploadChannel interface. Next step will be to get that working. I'm currently running into problems where the END_URL event for a POST doesn't have a status. I think this is because I'm using the Navigation.post() method rather than simulating a user post by pressing a form submit button. A classes_spec/org/mozilla/webclient/impl/wrapper_native/NativeInputStream.java A src_moz/NativeInputStreamImpl.cpp - Class to enable reading the post body from the request. M build.xml - add NativeInputStream to JNI generation M classes_spec/org/mozilla/webclient/PageInfoListener.java * <p>This {@link DocumentLoadListener} subclass adds the ability to get * detailed information on each event. </p> * * <p>The <code>eventData</code> property of the * <code>DocumentLoadEvent</code> instance will be a * <code>java.util.Map</code>. The following entries may be present in * this map for the following <code>*_EVENT_MASK</code> types in * <code>DocumentLoadEvent</code>.</p> * * <dl> * * <dt>For all <code>*_EVENT_MASK</code> types</dt> * * <dd><p>the map will contain an entry under the key "<code>URI</code>" * without the quotes. This will be the fully qualified URI for the * event. </p></dd> * * <dt>For <code>START_URL_LOAD</code> type</dt> * * <dd><p>The map will contain an entry under the key * "<code>method</code>" without the quotes. This will be the request * method for this event. The map will also contain an entry under the * key "<code>headers</code>". This entry will be a * <code>java.util.Map</code> of all the request headers.</p></dd> * * <dt>For <code>END_URL_LOAD</code> type</dt> * * <dd><p>The map will contain an entry under the key * "<code>method</code>" without the quotes. This will be the request * method for this event. The map will contain an entry under the key * "<code>status</code>" without the quotes. This will be the response * status string from the server, such as "<code>200 OK</code>". The * map will also contain an entry under the key "<code>headers</code>". * This entry will be a <code>java.util.Map</code> of all the response * headers.</p></dd> * * </dl> M src_moz/EmbedProgress.cpp - leverage nsIHttpChannel methods to get request method, response status, and post body. M src_moz/Makefile.in - add NativeInputStream M src_share/jni_util.cpp M src_share/jni_util.h - new constants - add variant of ThrowExceptionToJava that takes the exception class name. M test/automated/src/classes/org/mozilla/webclient/DocumentLoadListenerTest.java - new test content. Post related content commented out.
2005-02-28 20:15:45 +03:00
if (nsnull == (STATUS_VALUE =
::util_NewGlobalRef(env, (jobject)
::util_NewStringUTF(env, "status")))) {
return JNI_FALSE;
}
if (nsnull == (REQUEST_BODY_VALUE =
::util_NewGlobalRef(env, (jobject)
::util_NewStringUTF(env, "requestBody")))) {
return JNI_FALSE;
}
if (nsnull == (METHOD_VALUE =
::util_NewGlobalRef(env, (jobject)
::util_NewStringUTF(env, "method")))) {
return JNI_FALSE;
}
This checkin implements a response header listener feature. I have changed the usage contract of the DocumentLoadListener slightly. Prior to this checkin, calling getEventData() on the DocumentLoadEvent passed in to your eventDispatched() method returned the URI to which the event applies. Now the getEventData() returns a Map. You must look up the "URI" key to find the URI to which the event applies. If your listener is an instance of PageInfoListener, and your event mask is END_URL_LOAD_EVENT_MASK, your Map will have an additional entry under the key "headers". This entry is another Map representing the response headers. DocumentLoadListener: * <p>The <code>eventDispatched()</code> method is passed a {@link * DocumentLoadEvent} instance. The <code>type</code> property of the * event will be one of the types defined as a <code>public static final * int</code> in <code>DocumentLoadEvent</code>.</p> * * <p>The <code>eventData</code> property of the * <code>DocumentLoadEvent</code> instance will be a * <code>java.util.Map</code>. For all <code>EVENT_MASK</code> types in * <code>DocumentLoadEvent</code> the map will contain an entry under * the key "<code>URI</code>" without the quotes. This will be the * fully qualified URI for the event.</p> * * <p>For the <code>PROGRESS_URL_LOAD_EVENT_MASK</code> there will be an * entry in the map for the key "<code>message</code>". This will be * the progress message from the browser.</p> PageInfoListener: * <p>This {@link DocumentLoadListener} subclass adds the ability to get * detailed information on each event. </p> * * <p>The <code>eventDispatched()</code> method is passed the same thing * as in the {@link DocumentLoadListener}.</p> * * <p>The <code>eventData</code> property of the * <code>DocumentLoadEvent</code> instance will be a * <code>java.util.Map</code>. For the * <code>END_URL_LOAD_EVENT_MASK</code> type in * <code>DocumentLoadEvent</code> the map will contain an entry under * the key "<code>URI</code>" without the quotes. This will be the * fully qualified URI for the event. The map will also contain an * entry under the key "<code>headers</code>". This entry will be a * <code>Map</code> of all the response headers.</p> The next step will be to allow the same procedure to work to discover the request headers. Ed A classes_spec/org/mozilla/webclient/PageInfoListener.java - marker class for listenening for high fidelity page information. A src_moz/EventRegistrationImpl.cpp - add boolean property, capturePageInfo to turn on or off high fidelity page information collection. M build-tests.xml - add new test, DocumentLoadListenerTest M build.xml - added new JNI class, EventRegistrationImpl M classes_spec/org/mozilla/webclient/CurrentPage2.java M classes_spec/org/mozilla/webclient/impl/wrapper_native/CurrentPageImpl.java - rollback previous API for headers discovery M classes_spec/org/mozilla/webclient/impl/wrapper_native/EventRegistrationImpl.java - pass thru the capturePageInfo property - add URIToStringMap, currently not working. M classes_spec/org/mozilla/webclient/test/EMWindow.java - call toString() on the eventData, don't cast it to a String. M src_moz/EmbedProgress.cpp M src_moz/EmbedProgress.h - leverage the nsIHttpHeaderVisitor interface to discover the response headers. - add boolean property capturePageInfo A src_moz/HttpHeaderVisitorImpl.cpp A src_moz/HttpHeaderVisitorImpl.h - copy the headers to a Properties object. M src_moz/Makefile.in - compile two new files: + EventRegistrationImpl.cpp \ + HttpHeaderVisitorImpl.cpp \ M src_moz/NativeBrowserControl.cpp M src_moz/NativeBrowserControl.h - pass the NativeWrapperFactory to our Init() method - add wrapperFactory getter. M src_moz/WrapperFactoryImpl.cpp - pass the nativeWrapperFactory to the NativeBrowserControl's Init method. M src_share/jni_util.cpp M src_share/jni_util.h - new constants: URI, headers R test/automated/src/classes/org/mozilla/webclient/CurrentPageTest.java - not yet time for this one A test/automated/src/classes/org/mozilla/webclient/DocumentLoadListenerTest.java - exercise bare minimum functionality of PageInfoListener M test/manual/src/classes/org/mozilla/webclient/test/TestBrowser.java - print out headers.
2004-09-10 00:17:18 +04:00
if (nsnull == (MESSAGE_VALUE =
::util_NewGlobalRef(env, (jobject)
::util_NewStringUTF(env, "message")))) {
return JNI_FALSE;
}
if (nsnull == (BM_ADD_DATE_VALUE =
::util_NewGlobalRef(env, (jobject)
::util_NewStringUTF(env,
BM_ADD_DATE)))) {
return JNI_FALSE;
}
if (nsnull == (BM_LAST_MODIFIED_DATE_VALUE =
::util_NewGlobalRef(env, (jobject)
::util_NewStringUTF(env,
BM_LAST_MODIFIED_DATE)))) {
return JNI_FALSE;
}
if (nsnull == (BM_LAST_VISIT_DATE_VALUE =
::util_NewGlobalRef(env, (jobject)
::util_NewStringUTF(env,
BM_LAST_VISIT_DATE)))) {
return JNI_FALSE;
}
if (nsnull == (BM_NAME_VALUE =
::util_NewGlobalRef(env, (jobject)
::util_NewStringUTF(env,
BM_NAME)))) {
return JNI_FALSE;
}
if (nsnull == (BM_URL_VALUE =
::util_NewGlobalRef(env, (jobject)
::util_NewStringUTF(env,
BM_URL)))) {
return JNI_FALSE;
}
if (nsnull == (BM_DESCRIPTION_VALUE =
::util_NewGlobalRef(env, (jobject)
::util_NewStringUTF(env,
BM_DESCRIPTION)))) {
return JNI_FALSE;
}
if (nsnull == (BM_IS_FOLDER_VALUE =
::util_NewGlobalRef(env, (jobject)
::util_NewStringUTF(env,
BM_IS_FOLDER)))) {
return JNI_FALSE;
}
if (nsnull == (DOCUMENT_LOAD_LISTENER_CLASSNAME = (jstring)
::util_NewGlobalRef(env, (jobject)
::util_NewStringUTF(env,
DOCUMENT_LOAD_LISTENER_CLASSNAME_VALUE)))) {
return JNI_FALSE;
}
if (nsnull == (MOUSE_LISTENER_CLASSNAME = (jstring)
::util_NewGlobalRef(env, (jobject)
::util_NewStringUTF(env,
MOUSE_LISTENER_CLASSNAME_VALUE)))) {
return JNI_FALSE;
}
This checkin enables the KeyListener feature. A webclient/test/automated/src/classes/org/mozilla/webclient/KeyListenerTest.java A webclient/test/automated/src/test/KeyListenerTest1.html M webclient/build-tests.xml - add new testcase M webclient/classes_spec/org/mozilla/webclient/BrowserControlCanvas.java M webclient/classes_spec/org/mozilla/webclient/EventRegistration2.java - allow KeyListeners to be added and removed. M webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/EventRegistrationImpl.java - Lazily create listener lists. - Change the contract of queueEvent() to discard null events silently. - Add createKeyEvent() method. M webclient/src_moz/EmbedEventListener.cpp - new mask names and values, DOMDOMKeyListener_maskNames, DOMKeyListener_maskValues. - flesh out Key*() events. - add addKeyEventDataToProperties. - use eventType to discern how to populate the properties, with either key or mouse data. M webclient/src_moz/EmbedEventListener.h - key event includes and support methods. M webclient/src_moz/EmbedProgress.cpp - honor new last argument to util_InitializeEventMaskValuesFromClass(). M webclient/src_share/jni_util.cpp M webclient/src_share/jni_util.h - new constants +jobject CHAR_CODE; +jobject KEY_CODE; +jstring KEY_LISTENER_CLASSNAME; +char *DOMKeyListener_maskNames[] = { M webclient/src_share/jni_util_export.cpp M webclient/src_share/jni_util_export.h - new last argument to util_InitializeEventMaskValuesFromClass(const char *className, char *maskNames[], - jlong maskValues[]) + jlong maskValuesLong[], + jint maskValuesInt[]) Used when the maskValues are ints, otherwise null.
2004-12-01 06:21:23 +03:00
if (nsnull == (KEY_LISTENER_CLASSNAME = (jstring)
::util_NewGlobalRef(env, (jobject)
::util_NewStringUTF(env,
KEY_LISTENER_CLASSNAME_VALUE)))) {
return JNI_FALSE;
}
if (nsnull == (NEW_WINDOW_LISTENER_CLASSNAME = (jstring)
::util_NewGlobalRef(env, (jobject)
::util_NewStringUTF(env,
NEW_WINDOW_LISTENER_CLASSNAME_VALUE)))) {
return JNI_FALSE;
}
if (nsnull == (NODE_LONG_KEY =
::util_NewGlobalRef(env, (jobject)
::util_NewStringUTF(env, "NodeLong")))) {
return JNI_FALSE;
}
return STRING_CONSTANTS_INITED = JNI_TRUE;
}
jboolean util_StringConstantsAreInitialized()
{
return STRING_CONSTANTS_INITED;
}
bug=47357 a=edburns r=ashuk This change creates a new directory, java/webclient/src_share, that contains the code that will be used in both src_moz and src_ie, and any other native browser wrapping implementations. Here are the steps I followed to implement this change. 1. Create a new directory java/webclient/src_share 2. Move all jni_util*.* files from src_moz into src_share 3. Make it so src_share compiles into a new .lib src_share has no netscape dependencies. Any functionality that depended on ns dependencies was kept in src_moz. In this case, we have a function prototype only in src_share, with the implementation in src_moz. We did this for nsHashtable. The other trick was for things in WebShellInitContext that had nothing to do with Netscape. This case was accomodated by creating a new struct, ShareInitContext, that contains all WebShellInitContext members that have nothing to do with Netscape. Currently this is just jobject propertiesClass. I modified the WebShellInitContext struct to contain a ShareContext struct as its last member. There are two new methods in jni_util.h that allow for the initialization and deallocation of the members of the ShareContext struct. 4. Make it so src_moz uses the new .lib to provide the jni_util behavior a. Create ns_util* files that include ../src_share/jni_util* files appropriately. The only tricky part was for things in jni_util.h that Here's the list of files in this change. cvs -z3 -n update (in directory D:\Projects\mozilla\java\webclient) cvs server: Updating . M Makefile.win // added src_share to DIRS M src_moz/BookmarksImpl.cpp // include ns_util instead of jni_util M src_moz/CBrowserContainer.cpp // include ns_util instead of jni_util M src_moz/CBrowserContainer.h // include ns_util instead of jni_util M src_moz/CurrentPageImpl.cpp // include ns_util instead of jni_util M src_moz/HistoryImpl.cpp // include ns_util instead of jni_util M src_moz/Makefile.win // include ns_util instead of jni_util M src_moz/NativeEventThread.cpp // include ns_util instead of jni_util M src_moz/NavigationImpl.cpp // include ns_util instead of jni_util M src_moz/RDFEnumeration.cpp // include ns_util instead of jni_util M src_moz/RDFTreeNode.cpp // include ns_util instead of jni_util M src_moz/WindowControlImpl.cpp // include ns_util instead of jni_util // also use new util_InitShareContext // function M src_moz/WrapperFactoryImpl.cpp // include ns_util instead of jni_util R src_moz/jni_util.cpp // moved to ../src_share R src_moz/jni_util.h // moved to ../src_share R src_moz/jni_util_export.cpp // moved to ../src_share R src_moz/jni_util_export.h // moved to ../src_share M src_moz/nsActions.cpp // include ns_util instead of jni_util // also use new util_DeallocateShareContext M src_moz/nsActions.h // include ns_util instead of jni_util A src_moz/ns_util.cpp // include jni_util.h A src_moz/ns_util.h // include jni_util.h, changes to // WebshellInitContext struct A src_moz/ns_util_export.cpp // provide impls for methods in // jni_util_export.h A src_share/Makefile.win A src_share/bal_util.cpp A src_share/bal_util.h A src_share/jni_util.cpp A src_share/jni_util.h A src_share/jni_util_export.cpp A src_share/jni_util_export.h *****CVS exited normally with code 0*****
2000-08-04 01:32:54 +04:00
void util_ThrowExceptionToJava (JNIEnv * env, const char * message)
This checkin enables finding out the request method and response status of a URL_LOAD event. I'm still working on getting the request body via the nsIUploadChannel interface. Next step will be to get that working. I'm currently running into problems where the END_URL event for a POST doesn't have a status. I think this is because I'm using the Navigation.post() method rather than simulating a user post by pressing a form submit button. A classes_spec/org/mozilla/webclient/impl/wrapper_native/NativeInputStream.java A src_moz/NativeInputStreamImpl.cpp - Class to enable reading the post body from the request. M build.xml - add NativeInputStream to JNI generation M classes_spec/org/mozilla/webclient/PageInfoListener.java * <p>This {@link DocumentLoadListener} subclass adds the ability to get * detailed information on each event. </p> * * <p>The <code>eventData</code> property of the * <code>DocumentLoadEvent</code> instance will be a * <code>java.util.Map</code>. The following entries may be present in * this map for the following <code>*_EVENT_MASK</code> types in * <code>DocumentLoadEvent</code>.</p> * * <dl> * * <dt>For all <code>*_EVENT_MASK</code> types</dt> * * <dd><p>the map will contain an entry under the key "<code>URI</code>" * without the quotes. This will be the fully qualified URI for the * event. </p></dd> * * <dt>For <code>START_URL_LOAD</code> type</dt> * * <dd><p>The map will contain an entry under the key * "<code>method</code>" without the quotes. This will be the request * method for this event. The map will also contain an entry under the * key "<code>headers</code>". This entry will be a * <code>java.util.Map</code> of all the request headers.</p></dd> * * <dt>For <code>END_URL_LOAD</code> type</dt> * * <dd><p>The map will contain an entry under the key * "<code>method</code>" without the quotes. This will be the request * method for this event. The map will contain an entry under the key * "<code>status</code>" without the quotes. This will be the response * status string from the server, such as "<code>200 OK</code>". The * map will also contain an entry under the key "<code>headers</code>". * This entry will be a <code>java.util.Map</code> of all the response * headers.</p></dd> * * </dl> M src_moz/EmbedProgress.cpp - leverage nsIHttpChannel methods to get request method, response status, and post body. M src_moz/Makefile.in - add NativeInputStream M src_share/jni_util.cpp M src_share/jni_util.h - new constants - add variant of ThrowExceptionToJava that takes the exception class name. M test/automated/src/classes/org/mozilla/webclient/DocumentLoadListenerTest.java - new test content. Post related content commented out.
2005-02-28 20:15:45 +03:00
{
util_ThrowExceptionToJava(env, "java/lang/RuntimeException", message);
}
void util_ThrowExceptionToJava (JNIEnv * env, const char * exceptionClass,
const char * message)
bug=47357 a=edburns r=ashuk This change creates a new directory, java/webclient/src_share, that contains the code that will be used in both src_moz and src_ie, and any other native browser wrapping implementations. Here are the steps I followed to implement this change. 1. Create a new directory java/webclient/src_share 2. Move all jni_util*.* files from src_moz into src_share 3. Make it so src_share compiles into a new .lib src_share has no netscape dependencies. Any functionality that depended on ns dependencies was kept in src_moz. In this case, we have a function prototype only in src_share, with the implementation in src_moz. We did this for nsHashtable. The other trick was for things in WebShellInitContext that had nothing to do with Netscape. This case was accomodated by creating a new struct, ShareInitContext, that contains all WebShellInitContext members that have nothing to do with Netscape. Currently this is just jobject propertiesClass. I modified the WebShellInitContext struct to contain a ShareContext struct as its last member. There are two new methods in jni_util.h that allow for the initialization and deallocation of the members of the ShareContext struct. 4. Make it so src_moz uses the new .lib to provide the jni_util behavior a. Create ns_util* files that include ../src_share/jni_util* files appropriately. The only tricky part was for things in jni_util.h that Here's the list of files in this change. cvs -z3 -n update (in directory D:\Projects\mozilla\java\webclient) cvs server: Updating . M Makefile.win // added src_share to DIRS M src_moz/BookmarksImpl.cpp // include ns_util instead of jni_util M src_moz/CBrowserContainer.cpp // include ns_util instead of jni_util M src_moz/CBrowserContainer.h // include ns_util instead of jni_util M src_moz/CurrentPageImpl.cpp // include ns_util instead of jni_util M src_moz/HistoryImpl.cpp // include ns_util instead of jni_util M src_moz/Makefile.win // include ns_util instead of jni_util M src_moz/NativeEventThread.cpp // include ns_util instead of jni_util M src_moz/NavigationImpl.cpp // include ns_util instead of jni_util M src_moz/RDFEnumeration.cpp // include ns_util instead of jni_util M src_moz/RDFTreeNode.cpp // include ns_util instead of jni_util M src_moz/WindowControlImpl.cpp // include ns_util instead of jni_util // also use new util_InitShareContext // function M src_moz/WrapperFactoryImpl.cpp // include ns_util instead of jni_util R src_moz/jni_util.cpp // moved to ../src_share R src_moz/jni_util.h // moved to ../src_share R src_moz/jni_util_export.cpp // moved to ../src_share R src_moz/jni_util_export.h // moved to ../src_share M src_moz/nsActions.cpp // include ns_util instead of jni_util // also use new util_DeallocateShareContext M src_moz/nsActions.h // include ns_util instead of jni_util A src_moz/ns_util.cpp // include jni_util.h A src_moz/ns_util.h // include jni_util.h, changes to // WebshellInitContext struct A src_moz/ns_util_export.cpp // provide impls for methods in // jni_util_export.h A src_share/Makefile.win A src_share/bal_util.cpp A src_share/bal_util.h A src_share/jni_util.cpp A src_share/jni_util.h A src_share/jni_util_export.cpp A src_share/jni_util_export.h *****CVS exited normally with code 0*****
2000-08-04 01:32:54 +04:00
{
if (env->ExceptionOccurred()) {
env->ExceptionClear();
}
This checkin enables finding out the request method and response status of a URL_LOAD event. I'm still working on getting the request body via the nsIUploadChannel interface. Next step will be to get that working. I'm currently running into problems where the END_URL event for a POST doesn't have a status. I think this is because I'm using the Navigation.post() method rather than simulating a user post by pressing a form submit button. A classes_spec/org/mozilla/webclient/impl/wrapper_native/NativeInputStream.java A src_moz/NativeInputStreamImpl.cpp - Class to enable reading the post body from the request. M build.xml - add NativeInputStream to JNI generation M classes_spec/org/mozilla/webclient/PageInfoListener.java * <p>This {@link DocumentLoadListener} subclass adds the ability to get * detailed information on each event. </p> * * <p>The <code>eventData</code> property of the * <code>DocumentLoadEvent</code> instance will be a * <code>java.util.Map</code>. The following entries may be present in * this map for the following <code>*_EVENT_MASK</code> types in * <code>DocumentLoadEvent</code>.</p> * * <dl> * * <dt>For all <code>*_EVENT_MASK</code> types</dt> * * <dd><p>the map will contain an entry under the key "<code>URI</code>" * without the quotes. This will be the fully qualified URI for the * event. </p></dd> * * <dt>For <code>START_URL_LOAD</code> type</dt> * * <dd><p>The map will contain an entry under the key * "<code>method</code>" without the quotes. This will be the request * method for this event. The map will also contain an entry under the * key "<code>headers</code>". This entry will be a * <code>java.util.Map</code> of all the request headers.</p></dd> * * <dt>For <code>END_URL_LOAD</code> type</dt> * * <dd><p>The map will contain an entry under the key * "<code>method</code>" without the quotes. This will be the request * method for this event. The map will contain an entry under the key * "<code>status</code>" without the quotes. This will be the response * status string from the server, such as "<code>200 OK</code>". The * map will also contain an entry under the key "<code>headers</code>". * This entry will be a <code>java.util.Map</code> of all the response * headers.</p></dd> * * </dl> M src_moz/EmbedProgress.cpp - leverage nsIHttpChannel methods to get request method, response status, and post body. M src_moz/Makefile.in - add NativeInputStream M src_share/jni_util.cpp M src_share/jni_util.h - new constants - add variant of ThrowExceptionToJava that takes the exception class name. M test/automated/src/classes/org/mozilla/webclient/DocumentLoadListenerTest.java - new test content. Post related content commented out.
2005-02-28 20:15:45 +03:00
jclass excCls = env->FindClass(exceptionClass);
bug=47357 a=edburns r=ashuk This change creates a new directory, java/webclient/src_share, that contains the code that will be used in both src_moz and src_ie, and any other native browser wrapping implementations. Here are the steps I followed to implement this change. 1. Create a new directory java/webclient/src_share 2. Move all jni_util*.* files from src_moz into src_share 3. Make it so src_share compiles into a new .lib src_share has no netscape dependencies. Any functionality that depended on ns dependencies was kept in src_moz. In this case, we have a function prototype only in src_share, with the implementation in src_moz. We did this for nsHashtable. The other trick was for things in WebShellInitContext that had nothing to do with Netscape. This case was accomodated by creating a new struct, ShareInitContext, that contains all WebShellInitContext members that have nothing to do with Netscape. Currently this is just jobject propertiesClass. I modified the WebShellInitContext struct to contain a ShareContext struct as its last member. There are two new methods in jni_util.h that allow for the initialization and deallocation of the members of the ShareContext struct. 4. Make it so src_moz uses the new .lib to provide the jni_util behavior a. Create ns_util* files that include ../src_share/jni_util* files appropriately. The only tricky part was for things in jni_util.h that Here's the list of files in this change. cvs -z3 -n update (in directory D:\Projects\mozilla\java\webclient) cvs server: Updating . M Makefile.win // added src_share to DIRS M src_moz/BookmarksImpl.cpp // include ns_util instead of jni_util M src_moz/CBrowserContainer.cpp // include ns_util instead of jni_util M src_moz/CBrowserContainer.h // include ns_util instead of jni_util M src_moz/CurrentPageImpl.cpp // include ns_util instead of jni_util M src_moz/HistoryImpl.cpp // include ns_util instead of jni_util M src_moz/Makefile.win // include ns_util instead of jni_util M src_moz/NativeEventThread.cpp // include ns_util instead of jni_util M src_moz/NavigationImpl.cpp // include ns_util instead of jni_util M src_moz/RDFEnumeration.cpp // include ns_util instead of jni_util M src_moz/RDFTreeNode.cpp // include ns_util instead of jni_util M src_moz/WindowControlImpl.cpp // include ns_util instead of jni_util // also use new util_InitShareContext // function M src_moz/WrapperFactoryImpl.cpp // include ns_util instead of jni_util R src_moz/jni_util.cpp // moved to ../src_share R src_moz/jni_util.h // moved to ../src_share R src_moz/jni_util_export.cpp // moved to ../src_share R src_moz/jni_util_export.h // moved to ../src_share M src_moz/nsActions.cpp // include ns_util instead of jni_util // also use new util_DeallocateShareContext M src_moz/nsActions.h // include ns_util instead of jni_util A src_moz/ns_util.cpp // include jni_util.h A src_moz/ns_util.h // include jni_util.h, changes to // WebshellInitContext struct A src_moz/ns_util_export.cpp // provide impls for methods in // jni_util_export.h A src_share/Makefile.win A src_share/bal_util.cpp A src_share/bal_util.h A src_share/jni_util.cpp A src_share/jni_util.h A src_share/jni_util_export.cpp A src_share/jni_util_export.h *****CVS exited normally with code 0*****
2000-08-04 01:32:54 +04:00
if (excCls == 0) { // Unable to find the exception class, give up.
if (env->ExceptionOccurred())
env->ExceptionClear();
return;
}
// Throw the exception with the error code and description
jmethodID jID = env->GetMethodID(excCls, "<init>", "(Ljava/lang/String;)V"); // void Exception(String)
if (jID != nsnull) {
jstring exceptionString = env->NewStringUTF(message);
jthrowable newException = (jthrowable) env->NewObject(excCls, jID, exceptionString);
if (newException != nsnull) {
env->Throw(newException);
}
else {
if (env->ExceptionOccurred())
env->ExceptionClear();
}
} else {
if (env->ExceptionOccurred())
env->ExceptionClear();
}
} // ThrowExceptionToJava()
This checkin has the basic functionality of NewWindowListener re-implemented using the new event model. It's a bit cleaner. Next step is to uncomment the selection check at the end of WindowCreatorTest.java. This code currently causes the VM to crash. I also plan to do some testing on the chrome flags. M classes_spec/org/mozilla/webclient/EventRegistration2.java - deprecate {add,remove}NewWindowListener(), replace with setNewWindowListener(). M classes_spec/org/mozilla/webclient/NewWindowEvent.java - added BrowserControl property, which the user sets into the event. M classes_spec/org/mozilla/webclient/impl/wrapper_native/EventRegistrationImpl.java - change newWindowListeners List ivar to newWindowListener ivar. - fix {add,remove}NewWindowListener() to leverage setNewWindowListener() - change nativeEventOccurred() to return an int instead of void. - add boolean property nativeSetNewWindowListenerAttached() M classes_spec/org/mozilla/webclient/impl/wrapper_native/NativeEventThread.java - modify pushBlockingWCRunnable() to execute the runnable right away if we're already on the NativeEventThread. This is necessary to allow re-entrancy. M src_moz/EmbedEventListener.cpp M src_moz/EmbedEventListener.h - expose the mEventRegistration ivar via a getter. M src_moz/EventRegistrationImpl.cpp M src_moz/NativeBrowserControl.cpp M src_moz/NativeBrowserControl.h - add nativeSetNewWindowListenerAttached(), which calls through and sets it on the NativeBrowserControl. M src_moz/WindowCreator.cpp - implement CreateChromeWindow2, which is called when the browser needs a new window. M src_share/jni_util.cpp M src_share/jni_util.h - change util_SendEventToJava() to return int. M test/automated/src/classes/org/mozilla/webclient/WindowCreatorTest.java
2005-01-18 18:20:52 +03:00
jint util_SendEventToJava(JNIEnv *yourEnv, jobject eventRegistrationImpl,
jstring eventListenerClassName,
bug=47357 a=edburns r=ashuk This change creates a new directory, java/webclient/src_share, that contains the code that will be used in both src_moz and src_ie, and any other native browser wrapping implementations. Here are the steps I followed to implement this change. 1. Create a new directory java/webclient/src_share 2. Move all jni_util*.* files from src_moz into src_share 3. Make it so src_share compiles into a new .lib src_share has no netscape dependencies. Any functionality that depended on ns dependencies was kept in src_moz. In this case, we have a function prototype only in src_share, with the implementation in src_moz. We did this for nsHashtable. The other trick was for things in WebShellInitContext that had nothing to do with Netscape. This case was accomodated by creating a new struct, ShareInitContext, that contains all WebShellInitContext members that have nothing to do with Netscape. Currently this is just jobject propertiesClass. I modified the WebShellInitContext struct to contain a ShareContext struct as its last member. There are two new methods in jni_util.h that allow for the initialization and deallocation of the members of the ShareContext struct. 4. Make it so src_moz uses the new .lib to provide the jni_util behavior a. Create ns_util* files that include ../src_share/jni_util* files appropriately. The only tricky part was for things in jni_util.h that Here's the list of files in this change. cvs -z3 -n update (in directory D:\Projects\mozilla\java\webclient) cvs server: Updating . M Makefile.win // added src_share to DIRS M src_moz/BookmarksImpl.cpp // include ns_util instead of jni_util M src_moz/CBrowserContainer.cpp // include ns_util instead of jni_util M src_moz/CBrowserContainer.h // include ns_util instead of jni_util M src_moz/CurrentPageImpl.cpp // include ns_util instead of jni_util M src_moz/HistoryImpl.cpp // include ns_util instead of jni_util M src_moz/Makefile.win // include ns_util instead of jni_util M src_moz/NativeEventThread.cpp // include ns_util instead of jni_util M src_moz/NavigationImpl.cpp // include ns_util instead of jni_util M src_moz/RDFEnumeration.cpp // include ns_util instead of jni_util M src_moz/RDFTreeNode.cpp // include ns_util instead of jni_util M src_moz/WindowControlImpl.cpp // include ns_util instead of jni_util // also use new util_InitShareContext // function M src_moz/WrapperFactoryImpl.cpp // include ns_util instead of jni_util R src_moz/jni_util.cpp // moved to ../src_share R src_moz/jni_util.h // moved to ../src_share R src_moz/jni_util_export.cpp // moved to ../src_share R src_moz/jni_util_export.h // moved to ../src_share M src_moz/nsActions.cpp // include ns_util instead of jni_util // also use new util_DeallocateShareContext M src_moz/nsActions.h // include ns_util instead of jni_util A src_moz/ns_util.cpp // include jni_util.h A src_moz/ns_util.h // include jni_util.h, changes to // WebshellInitContext struct A src_moz/ns_util_export.cpp // provide impls for methods in // jni_util_export.h A src_share/Makefile.win A src_share/bal_util.cpp A src_share/bal_util.h A src_share/jni_util.cpp A src_share/jni_util.h A src_share/jni_util_export.cpp A src_share/jni_util_export.h *****CVS exited normally with code 0*****
2000-08-04 01:32:54 +04:00
jlong eventType, jobject eventData)
{
This checkin has the basic functionality of NewWindowListener re-implemented using the new event model. It's a bit cleaner. Next step is to uncomment the selection check at the end of WindowCreatorTest.java. This code currently causes the VM to crash. I also plan to do some testing on the chrome flags. M classes_spec/org/mozilla/webclient/EventRegistration2.java - deprecate {add,remove}NewWindowListener(), replace with setNewWindowListener(). M classes_spec/org/mozilla/webclient/NewWindowEvent.java - added BrowserControl property, which the user sets into the event. M classes_spec/org/mozilla/webclient/impl/wrapper_native/EventRegistrationImpl.java - change newWindowListeners List ivar to newWindowListener ivar. - fix {add,remove}NewWindowListener() to leverage setNewWindowListener() - change nativeEventOccurred() to return an int instead of void. - add boolean property nativeSetNewWindowListenerAttached() M classes_spec/org/mozilla/webclient/impl/wrapper_native/NativeEventThread.java - modify pushBlockingWCRunnable() to execute the runnable right away if we're already on the NativeEventThread. This is necessary to allow re-entrancy. M src_moz/EmbedEventListener.cpp M src_moz/EmbedEventListener.h - expose the mEventRegistration ivar via a getter. M src_moz/EventRegistrationImpl.cpp M src_moz/NativeBrowserControl.cpp M src_moz/NativeBrowserControl.h - add nativeSetNewWindowListenerAttached(), which calls through and sets it on the NativeBrowserControl. M src_moz/WindowCreator.cpp - implement CreateChromeWindow2, which is called when the browser needs a new window. M src_share/jni_util.cpp M src_share/jni_util.h - change util_SendEventToJava() to return int. M test/automated/src/classes/org/mozilla/webclient/WindowCreatorTest.java
2005-01-18 18:20:52 +03:00
jint rv = -1;
bug=47357 a=edburns r=ashuk This change creates a new directory, java/webclient/src_share, that contains the code that will be used in both src_moz and src_ie, and any other native browser wrapping implementations. Here are the steps I followed to implement this change. 1. Create a new directory java/webclient/src_share 2. Move all jni_util*.* files from src_moz into src_share 3. Make it so src_share compiles into a new .lib src_share has no netscape dependencies. Any functionality that depended on ns dependencies was kept in src_moz. In this case, we have a function prototype only in src_share, with the implementation in src_moz. We did this for nsHashtable. The other trick was for things in WebShellInitContext that had nothing to do with Netscape. This case was accomodated by creating a new struct, ShareInitContext, that contains all WebShellInitContext members that have nothing to do with Netscape. Currently this is just jobject propertiesClass. I modified the WebShellInitContext struct to contain a ShareContext struct as its last member. There are two new methods in jni_util.h that allow for the initialization and deallocation of the members of the ShareContext struct. 4. Make it so src_moz uses the new .lib to provide the jni_util behavior a. Create ns_util* files that include ../src_share/jni_util* files appropriately. The only tricky part was for things in jni_util.h that Here's the list of files in this change. cvs -z3 -n update (in directory D:\Projects\mozilla\java\webclient) cvs server: Updating . M Makefile.win // added src_share to DIRS M src_moz/BookmarksImpl.cpp // include ns_util instead of jni_util M src_moz/CBrowserContainer.cpp // include ns_util instead of jni_util M src_moz/CBrowserContainer.h // include ns_util instead of jni_util M src_moz/CurrentPageImpl.cpp // include ns_util instead of jni_util M src_moz/HistoryImpl.cpp // include ns_util instead of jni_util M src_moz/Makefile.win // include ns_util instead of jni_util M src_moz/NativeEventThread.cpp // include ns_util instead of jni_util M src_moz/NavigationImpl.cpp // include ns_util instead of jni_util M src_moz/RDFEnumeration.cpp // include ns_util instead of jni_util M src_moz/RDFTreeNode.cpp // include ns_util instead of jni_util M src_moz/WindowControlImpl.cpp // include ns_util instead of jni_util // also use new util_InitShareContext // function M src_moz/WrapperFactoryImpl.cpp // include ns_util instead of jni_util R src_moz/jni_util.cpp // moved to ../src_share R src_moz/jni_util.h // moved to ../src_share R src_moz/jni_util_export.cpp // moved to ../src_share R src_moz/jni_util_export.h // moved to ../src_share M src_moz/nsActions.cpp // include ns_util instead of jni_util // also use new util_DeallocateShareContext M src_moz/nsActions.h // include ns_util instead of jni_util A src_moz/ns_util.cpp // include jni_util.h A src_moz/ns_util.h // include jni_util.h, changes to // WebshellInitContext struct A src_moz/ns_util_export.cpp // provide impls for methods in // jni_util_export.h A src_share/Makefile.win A src_share/bal_util.cpp A src_share/bal_util.h A src_share/jni_util.cpp A src_share/jni_util.h A src_share/jni_util_export.cpp A src_share/jni_util_export.h *****CVS exited normally with code 0*****
2000-08-04 01:32:54 +04:00
#ifdef BAL_INTERFACE
if (nsnull != externalEventOccurred) {
This checkin enables the StartDocumentLoadEvent. Now adding the rest of the DocumentLoadListener events will be trivial. Next step: flesh out the rest of the DocumentLoadListener events. Modify NavigationTest so that it does its selection checking inside the listeners. This will probably require creating a Thread, managed by EventRegistrationImpl, that is used to process callbacks from mozilla into Java, so that we don't get deadlock. M classes_spec/org/mozilla/webclient/impl/wrapper_native/EventRegistrationImpl.java - remove all dependencies on NativeEventThread - introduce dependency on BrowserControlCanvas (needed for future MouseListener) work. - {add,remove}DocumentLoadListener() now just a matter of adding/removing to List. - add nativeEventOccurred() method, called from native code M classes_spec/org/mozilla/webclient/impl/wrapper_native/NativeEventThread.java - remove dependency on BrowserControlCanvas - removed nativeEventOccurred M src_moz/EmbedProgress.cpp - delete the global ref in the dtor. - create the global ref in SetEventRegistration(). - call back to Java on startDocumentLoad. M src_moz/NativeBrowserControl.cpp - initialize our string constants. M src_share/jni_util.cpp M src_share/jni_util.h - alter the signature of util_SendEventToJava -void util_SendEventToJava(JNIEnv *yourEnv, jobject nativeEventThread, - jobject webclientEventListener, +void util_SendEventToJava(JNIEnv *yourEnv, jobject eventRegistrationImpl, jstring eventListenerClassName, jlong eventType, jobject eventData) M test/automated/src/classes/org/mozilla/webclient/NavigationTest.java - show that the DocumentLoadListener gets called.
2004-06-12 09:46:48 +04:00
externalEventOccurred(yourEnv, eventRegistrationImpl,
eventType, eventData);
bug=47357 a=edburns r=ashuk This change creates a new directory, java/webclient/src_share, that contains the code that will be used in both src_moz and src_ie, and any other native browser wrapping implementations. Here are the steps I followed to implement this change. 1. Create a new directory java/webclient/src_share 2. Move all jni_util*.* files from src_moz into src_share 3. Make it so src_share compiles into a new .lib src_share has no netscape dependencies. Any functionality that depended on ns dependencies was kept in src_moz. In this case, we have a function prototype only in src_share, with the implementation in src_moz. We did this for nsHashtable. The other trick was for things in WebShellInitContext that had nothing to do with Netscape. This case was accomodated by creating a new struct, ShareInitContext, that contains all WebShellInitContext members that have nothing to do with Netscape. Currently this is just jobject propertiesClass. I modified the WebShellInitContext struct to contain a ShareContext struct as its last member. There are two new methods in jni_util.h that allow for the initialization and deallocation of the members of the ShareContext struct. 4. Make it so src_moz uses the new .lib to provide the jni_util behavior a. Create ns_util* files that include ../src_share/jni_util* files appropriately. The only tricky part was for things in jni_util.h that Here's the list of files in this change. cvs -z3 -n update (in directory D:\Projects\mozilla\java\webclient) cvs server: Updating . M Makefile.win // added src_share to DIRS M src_moz/BookmarksImpl.cpp // include ns_util instead of jni_util M src_moz/CBrowserContainer.cpp // include ns_util instead of jni_util M src_moz/CBrowserContainer.h // include ns_util instead of jni_util M src_moz/CurrentPageImpl.cpp // include ns_util instead of jni_util M src_moz/HistoryImpl.cpp // include ns_util instead of jni_util M src_moz/Makefile.win // include ns_util instead of jni_util M src_moz/NativeEventThread.cpp // include ns_util instead of jni_util M src_moz/NavigationImpl.cpp // include ns_util instead of jni_util M src_moz/RDFEnumeration.cpp // include ns_util instead of jni_util M src_moz/RDFTreeNode.cpp // include ns_util instead of jni_util M src_moz/WindowControlImpl.cpp // include ns_util instead of jni_util // also use new util_InitShareContext // function M src_moz/WrapperFactoryImpl.cpp // include ns_util instead of jni_util R src_moz/jni_util.cpp // moved to ../src_share R src_moz/jni_util.h // moved to ../src_share R src_moz/jni_util_export.cpp // moved to ../src_share R src_moz/jni_util_export.h // moved to ../src_share M src_moz/nsActions.cpp // include ns_util instead of jni_util // also use new util_DeallocateShareContext M src_moz/nsActions.h // include ns_util instead of jni_util A src_moz/ns_util.cpp // include jni_util.h A src_moz/ns_util.h // include jni_util.h, changes to // WebshellInitContext struct A src_moz/ns_util_export.cpp // provide impls for methods in // jni_util_export.h A src_share/Makefile.win A src_share/bal_util.cpp A src_share/bal_util.h A src_share/jni_util.cpp A src_share/jni_util.h A src_share/jni_util_export.cpp A src_share/jni_util_export.h *****CVS exited normally with code 0*****
2000-08-04 01:32:54 +04:00
}
#else
if (nsnull == gVm) {
This checkin has the basic functionality of NewWindowListener re-implemented using the new event model. It's a bit cleaner. Next step is to uncomment the selection check at the end of WindowCreatorTest.java. This code currently causes the VM to crash. I also plan to do some testing on the chrome flags. M classes_spec/org/mozilla/webclient/EventRegistration2.java - deprecate {add,remove}NewWindowListener(), replace with setNewWindowListener(). M classes_spec/org/mozilla/webclient/NewWindowEvent.java - added BrowserControl property, which the user sets into the event. M classes_spec/org/mozilla/webclient/impl/wrapper_native/EventRegistrationImpl.java - change newWindowListeners List ivar to newWindowListener ivar. - fix {add,remove}NewWindowListener() to leverage setNewWindowListener() - change nativeEventOccurred() to return an int instead of void. - add boolean property nativeSetNewWindowListenerAttached() M classes_spec/org/mozilla/webclient/impl/wrapper_native/NativeEventThread.java - modify pushBlockingWCRunnable() to execute the runnable right away if we're already on the NativeEventThread. This is necessary to allow re-entrancy. M src_moz/EmbedEventListener.cpp M src_moz/EmbedEventListener.h - expose the mEventRegistration ivar via a getter. M src_moz/EventRegistrationImpl.cpp M src_moz/NativeBrowserControl.cpp M src_moz/NativeBrowserControl.h - add nativeSetNewWindowListenerAttached(), which calls through and sets it on the NativeBrowserControl. M src_moz/WindowCreator.cpp - implement CreateChromeWindow2, which is called when the browser needs a new window. M src_share/jni_util.cpp M src_share/jni_util.h - change util_SendEventToJava() to return int. M test/automated/src/classes/org/mozilla/webclient/WindowCreatorTest.java
2005-01-18 18:20:52 +03:00
return rv;
bug=47357 a=edburns r=ashuk This change creates a new directory, java/webclient/src_share, that contains the code that will be used in both src_moz and src_ie, and any other native browser wrapping implementations. Here are the steps I followed to implement this change. 1. Create a new directory java/webclient/src_share 2. Move all jni_util*.* files from src_moz into src_share 3. Make it so src_share compiles into a new .lib src_share has no netscape dependencies. Any functionality that depended on ns dependencies was kept in src_moz. In this case, we have a function prototype only in src_share, with the implementation in src_moz. We did this for nsHashtable. The other trick was for things in WebShellInitContext that had nothing to do with Netscape. This case was accomodated by creating a new struct, ShareInitContext, that contains all WebShellInitContext members that have nothing to do with Netscape. Currently this is just jobject propertiesClass. I modified the WebShellInitContext struct to contain a ShareContext struct as its last member. There are two new methods in jni_util.h that allow for the initialization and deallocation of the members of the ShareContext struct. 4. Make it so src_moz uses the new .lib to provide the jni_util behavior a. Create ns_util* files that include ../src_share/jni_util* files appropriately. The only tricky part was for things in jni_util.h that Here's the list of files in this change. cvs -z3 -n update (in directory D:\Projects\mozilla\java\webclient) cvs server: Updating . M Makefile.win // added src_share to DIRS M src_moz/BookmarksImpl.cpp // include ns_util instead of jni_util M src_moz/CBrowserContainer.cpp // include ns_util instead of jni_util M src_moz/CBrowserContainer.h // include ns_util instead of jni_util M src_moz/CurrentPageImpl.cpp // include ns_util instead of jni_util M src_moz/HistoryImpl.cpp // include ns_util instead of jni_util M src_moz/Makefile.win // include ns_util instead of jni_util M src_moz/NativeEventThread.cpp // include ns_util instead of jni_util M src_moz/NavigationImpl.cpp // include ns_util instead of jni_util M src_moz/RDFEnumeration.cpp // include ns_util instead of jni_util M src_moz/RDFTreeNode.cpp // include ns_util instead of jni_util M src_moz/WindowControlImpl.cpp // include ns_util instead of jni_util // also use new util_InitShareContext // function M src_moz/WrapperFactoryImpl.cpp // include ns_util instead of jni_util R src_moz/jni_util.cpp // moved to ../src_share R src_moz/jni_util.h // moved to ../src_share R src_moz/jni_util_export.cpp // moved to ../src_share R src_moz/jni_util_export.h // moved to ../src_share M src_moz/nsActions.cpp // include ns_util instead of jni_util // also use new util_DeallocateShareContext M src_moz/nsActions.h // include ns_util instead of jni_util A src_moz/ns_util.cpp // include jni_util.h A src_moz/ns_util.h // include jni_util.h, changes to // WebshellInitContext struct A src_moz/ns_util_export.cpp // provide impls for methods in // jni_util_export.h A src_share/Makefile.win A src_share/bal_util.cpp A src_share/bal_util.h A src_share/jni_util.cpp A src_share/jni_util.h A src_share/jni_util_export.cpp A src_share/jni_util_export.h *****CVS exited normally with code 0*****
2000-08-04 01:32:54 +04:00
}
JNIEnv *env = (JNIEnv *) JNU_GetEnv(gVm, JNI_VERSION);
bug=47357 a=edburns r=ashuk This change creates a new directory, java/webclient/src_share, that contains the code that will be used in both src_moz and src_ie, and any other native browser wrapping implementations. Here are the steps I followed to implement this change. 1. Create a new directory java/webclient/src_share 2. Move all jni_util*.* files from src_moz into src_share 3. Make it so src_share compiles into a new .lib src_share has no netscape dependencies. Any functionality that depended on ns dependencies was kept in src_moz. In this case, we have a function prototype only in src_share, with the implementation in src_moz. We did this for nsHashtable. The other trick was for things in WebShellInitContext that had nothing to do with Netscape. This case was accomodated by creating a new struct, ShareInitContext, that contains all WebShellInitContext members that have nothing to do with Netscape. Currently this is just jobject propertiesClass. I modified the WebShellInitContext struct to contain a ShareContext struct as its last member. There are two new methods in jni_util.h that allow for the initialization and deallocation of the members of the ShareContext struct. 4. Make it so src_moz uses the new .lib to provide the jni_util behavior a. Create ns_util* files that include ../src_share/jni_util* files appropriately. The only tricky part was for things in jni_util.h that Here's the list of files in this change. cvs -z3 -n update (in directory D:\Projects\mozilla\java\webclient) cvs server: Updating . M Makefile.win // added src_share to DIRS M src_moz/BookmarksImpl.cpp // include ns_util instead of jni_util M src_moz/CBrowserContainer.cpp // include ns_util instead of jni_util M src_moz/CBrowserContainer.h // include ns_util instead of jni_util M src_moz/CurrentPageImpl.cpp // include ns_util instead of jni_util M src_moz/HistoryImpl.cpp // include ns_util instead of jni_util M src_moz/Makefile.win // include ns_util instead of jni_util M src_moz/NativeEventThread.cpp // include ns_util instead of jni_util M src_moz/NavigationImpl.cpp // include ns_util instead of jni_util M src_moz/RDFEnumeration.cpp // include ns_util instead of jni_util M src_moz/RDFTreeNode.cpp // include ns_util instead of jni_util M src_moz/WindowControlImpl.cpp // include ns_util instead of jni_util // also use new util_InitShareContext // function M src_moz/WrapperFactoryImpl.cpp // include ns_util instead of jni_util R src_moz/jni_util.cpp // moved to ../src_share R src_moz/jni_util.h // moved to ../src_share R src_moz/jni_util_export.cpp // moved to ../src_share R src_moz/jni_util_export.h // moved to ../src_share M src_moz/nsActions.cpp // include ns_util instead of jni_util // also use new util_DeallocateShareContext M src_moz/nsActions.h // include ns_util instead of jni_util A src_moz/ns_util.cpp // include jni_util.h A src_moz/ns_util.h // include jni_util.h, changes to // WebshellInitContext struct A src_moz/ns_util_export.cpp // provide impls for methods in // jni_util_export.h A src_share/Makefile.win A src_share/bal_util.cpp A src_share/bal_util.h A src_share/jni_util.cpp A src_share/jni_util.h A src_share/jni_util_export.cpp A src_share/jni_util_export.h *****CVS exited normally with code 0*****
2000-08-04 01:32:54 +04:00
if (nsnull == env) {
This checkin has the basic functionality of NewWindowListener re-implemented using the new event model. It's a bit cleaner. Next step is to uncomment the selection check at the end of WindowCreatorTest.java. This code currently causes the VM to crash. I also plan to do some testing on the chrome flags. M classes_spec/org/mozilla/webclient/EventRegistration2.java - deprecate {add,remove}NewWindowListener(), replace with setNewWindowListener(). M classes_spec/org/mozilla/webclient/NewWindowEvent.java - added BrowserControl property, which the user sets into the event. M classes_spec/org/mozilla/webclient/impl/wrapper_native/EventRegistrationImpl.java - change newWindowListeners List ivar to newWindowListener ivar. - fix {add,remove}NewWindowListener() to leverage setNewWindowListener() - change nativeEventOccurred() to return an int instead of void. - add boolean property nativeSetNewWindowListenerAttached() M classes_spec/org/mozilla/webclient/impl/wrapper_native/NativeEventThread.java - modify pushBlockingWCRunnable() to execute the runnable right away if we're already on the NativeEventThread. This is necessary to allow re-entrancy. M src_moz/EmbedEventListener.cpp M src_moz/EmbedEventListener.h - expose the mEventRegistration ivar via a getter. M src_moz/EventRegistrationImpl.cpp M src_moz/NativeBrowserControl.cpp M src_moz/NativeBrowserControl.h - add nativeSetNewWindowListenerAttached(), which calls through and sets it on the NativeBrowserControl. M src_moz/WindowCreator.cpp - implement CreateChromeWindow2, which is called when the browser needs a new window. M src_share/jni_util.cpp M src_share/jni_util.h - change util_SendEventToJava() to return int. M test/automated/src/classes/org/mozilla/webclient/WindowCreatorTest.java
2005-01-18 18:20:52 +03:00
return rv;
bug=47357 a=edburns r=ashuk This change creates a new directory, java/webclient/src_share, that contains the code that will be used in both src_moz and src_ie, and any other native browser wrapping implementations. Here are the steps I followed to implement this change. 1. Create a new directory java/webclient/src_share 2. Move all jni_util*.* files from src_moz into src_share 3. Make it so src_share compiles into a new .lib src_share has no netscape dependencies. Any functionality that depended on ns dependencies was kept in src_moz. In this case, we have a function prototype only in src_share, with the implementation in src_moz. We did this for nsHashtable. The other trick was for things in WebShellInitContext that had nothing to do with Netscape. This case was accomodated by creating a new struct, ShareInitContext, that contains all WebShellInitContext members that have nothing to do with Netscape. Currently this is just jobject propertiesClass. I modified the WebShellInitContext struct to contain a ShareContext struct as its last member. There are two new methods in jni_util.h that allow for the initialization and deallocation of the members of the ShareContext struct. 4. Make it so src_moz uses the new .lib to provide the jni_util behavior a. Create ns_util* files that include ../src_share/jni_util* files appropriately. The only tricky part was for things in jni_util.h that Here's the list of files in this change. cvs -z3 -n update (in directory D:\Projects\mozilla\java\webclient) cvs server: Updating . M Makefile.win // added src_share to DIRS M src_moz/BookmarksImpl.cpp // include ns_util instead of jni_util M src_moz/CBrowserContainer.cpp // include ns_util instead of jni_util M src_moz/CBrowserContainer.h // include ns_util instead of jni_util M src_moz/CurrentPageImpl.cpp // include ns_util instead of jni_util M src_moz/HistoryImpl.cpp // include ns_util instead of jni_util M src_moz/Makefile.win // include ns_util instead of jni_util M src_moz/NativeEventThread.cpp // include ns_util instead of jni_util M src_moz/NavigationImpl.cpp // include ns_util instead of jni_util M src_moz/RDFEnumeration.cpp // include ns_util instead of jni_util M src_moz/RDFTreeNode.cpp // include ns_util instead of jni_util M src_moz/WindowControlImpl.cpp // include ns_util instead of jni_util // also use new util_InitShareContext // function M src_moz/WrapperFactoryImpl.cpp // include ns_util instead of jni_util R src_moz/jni_util.cpp // moved to ../src_share R src_moz/jni_util.h // moved to ../src_share R src_moz/jni_util_export.cpp // moved to ../src_share R src_moz/jni_util_export.h // moved to ../src_share M src_moz/nsActions.cpp // include ns_util instead of jni_util // also use new util_DeallocateShareContext M src_moz/nsActions.h // include ns_util instead of jni_util A src_moz/ns_util.cpp // include jni_util.h A src_moz/ns_util.h // include jni_util.h, changes to // WebshellInitContext struct A src_moz/ns_util_export.cpp // provide impls for methods in // jni_util_export.h A src_share/Makefile.win A src_share/bal_util.cpp A src_share/bal_util.h A src_share/jni_util.cpp A src_share/jni_util.h A src_share/jni_util_export.cpp A src_share/jni_util_export.h *****CVS exited normally with code 0*****
2000-08-04 01:32:54 +04:00
}
jthrowable exception;
if (nsnull != (exception = env->ExceptionOccurred())) {
env->ExceptionDescribe();
}
This checkin enables the StartDocumentLoadEvent. Now adding the rest of the DocumentLoadListener events will be trivial. Next step: flesh out the rest of the DocumentLoadListener events. Modify NavigationTest so that it does its selection checking inside the listeners. This will probably require creating a Thread, managed by EventRegistrationImpl, that is used to process callbacks from mozilla into Java, so that we don't get deadlock. M classes_spec/org/mozilla/webclient/impl/wrapper_native/EventRegistrationImpl.java - remove all dependencies on NativeEventThread - introduce dependency on BrowserControlCanvas (needed for future MouseListener) work. - {add,remove}DocumentLoadListener() now just a matter of adding/removing to List. - add nativeEventOccurred() method, called from native code M classes_spec/org/mozilla/webclient/impl/wrapper_native/NativeEventThread.java - remove dependency on BrowserControlCanvas - removed nativeEventOccurred M src_moz/EmbedProgress.cpp - delete the global ref in the dtor. - create the global ref in SetEventRegistration(). - call back to Java on startDocumentLoad. M src_moz/NativeBrowserControl.cpp - initialize our string constants. M src_share/jni_util.cpp M src_share/jni_util.h - alter the signature of util_SendEventToJava -void util_SendEventToJava(JNIEnv *yourEnv, jobject nativeEventThread, - jobject webclientEventListener, +void util_SendEventToJava(JNIEnv *yourEnv, jobject eventRegistrationImpl, jstring eventListenerClassName, jlong eventType, jobject eventData) M test/automated/src/classes/org/mozilla/webclient/NavigationTest.java - show that the DocumentLoadListener gets called.
2004-06-12 09:46:48 +04:00
jclass clazz = env->GetObjectClass(eventRegistrationImpl);
bug=47357 a=edburns r=ashuk This change creates a new directory, java/webclient/src_share, that contains the code that will be used in both src_moz and src_ie, and any other native browser wrapping implementations. Here are the steps I followed to implement this change. 1. Create a new directory java/webclient/src_share 2. Move all jni_util*.* files from src_moz into src_share 3. Make it so src_share compiles into a new .lib src_share has no netscape dependencies. Any functionality that depended on ns dependencies was kept in src_moz. In this case, we have a function prototype only in src_share, with the implementation in src_moz. We did this for nsHashtable. The other trick was for things in WebShellInitContext that had nothing to do with Netscape. This case was accomodated by creating a new struct, ShareInitContext, that contains all WebShellInitContext members that have nothing to do with Netscape. Currently this is just jobject propertiesClass. I modified the WebShellInitContext struct to contain a ShareContext struct as its last member. There are two new methods in jni_util.h that allow for the initialization and deallocation of the members of the ShareContext struct. 4. Make it so src_moz uses the new .lib to provide the jni_util behavior a. Create ns_util* files that include ../src_share/jni_util* files appropriately. The only tricky part was for things in jni_util.h that Here's the list of files in this change. cvs -z3 -n update (in directory D:\Projects\mozilla\java\webclient) cvs server: Updating . M Makefile.win // added src_share to DIRS M src_moz/BookmarksImpl.cpp // include ns_util instead of jni_util M src_moz/CBrowserContainer.cpp // include ns_util instead of jni_util M src_moz/CBrowserContainer.h // include ns_util instead of jni_util M src_moz/CurrentPageImpl.cpp // include ns_util instead of jni_util M src_moz/HistoryImpl.cpp // include ns_util instead of jni_util M src_moz/Makefile.win // include ns_util instead of jni_util M src_moz/NativeEventThread.cpp // include ns_util instead of jni_util M src_moz/NavigationImpl.cpp // include ns_util instead of jni_util M src_moz/RDFEnumeration.cpp // include ns_util instead of jni_util M src_moz/RDFTreeNode.cpp // include ns_util instead of jni_util M src_moz/WindowControlImpl.cpp // include ns_util instead of jni_util // also use new util_InitShareContext // function M src_moz/WrapperFactoryImpl.cpp // include ns_util instead of jni_util R src_moz/jni_util.cpp // moved to ../src_share R src_moz/jni_util.h // moved to ../src_share R src_moz/jni_util_export.cpp // moved to ../src_share R src_moz/jni_util_export.h // moved to ../src_share M src_moz/nsActions.cpp // include ns_util instead of jni_util // also use new util_DeallocateShareContext M src_moz/nsActions.h // include ns_util instead of jni_util A src_moz/ns_util.cpp // include jni_util.h A src_moz/ns_util.h // include jni_util.h, changes to // WebshellInitContext struct A src_moz/ns_util_export.cpp // provide impls for methods in // jni_util_export.h A src_share/Makefile.win A src_share/bal_util.cpp A src_share/bal_util.h A src_share/jni_util.cpp A src_share/jni_util.h A src_share/jni_util_export.cpp A src_share/jni_util_export.h *****CVS exited normally with code 0*****
2000-08-04 01:32:54 +04:00
jmethodID mid = env->GetMethodID(clazz, "nativeEventOccurred",
This checkin has the basic functionality of NewWindowListener re-implemented using the new event model. It's a bit cleaner. Next step is to uncomment the selection check at the end of WindowCreatorTest.java. This code currently causes the VM to crash. I also plan to do some testing on the chrome flags. M classes_spec/org/mozilla/webclient/EventRegistration2.java - deprecate {add,remove}NewWindowListener(), replace with setNewWindowListener(). M classes_spec/org/mozilla/webclient/NewWindowEvent.java - added BrowserControl property, which the user sets into the event. M classes_spec/org/mozilla/webclient/impl/wrapper_native/EventRegistrationImpl.java - change newWindowListeners List ivar to newWindowListener ivar. - fix {add,remove}NewWindowListener() to leverage setNewWindowListener() - change nativeEventOccurred() to return an int instead of void. - add boolean property nativeSetNewWindowListenerAttached() M classes_spec/org/mozilla/webclient/impl/wrapper_native/NativeEventThread.java - modify pushBlockingWCRunnable() to execute the runnable right away if we're already on the NativeEventThread. This is necessary to allow re-entrancy. M src_moz/EmbedEventListener.cpp M src_moz/EmbedEventListener.h - expose the mEventRegistration ivar via a getter. M src_moz/EventRegistrationImpl.cpp M src_moz/NativeBrowserControl.cpp M src_moz/NativeBrowserControl.h - add nativeSetNewWindowListenerAttached(), which calls through and sets it on the NativeBrowserControl. M src_moz/WindowCreator.cpp - implement CreateChromeWindow2, which is called when the browser needs a new window. M src_share/jni_util.cpp M src_share/jni_util.h - change util_SendEventToJava() to return int. M test/automated/src/classes/org/mozilla/webclient/WindowCreatorTest.java
2005-01-18 18:20:52 +03:00
"(Ljava/lang/String;JLjava/lang/Object;)I");
bug=47357 a=edburns r=ashuk This change creates a new directory, java/webclient/src_share, that contains the code that will be used in both src_moz and src_ie, and any other native browser wrapping implementations. Here are the steps I followed to implement this change. 1. Create a new directory java/webclient/src_share 2. Move all jni_util*.* files from src_moz into src_share 3. Make it so src_share compiles into a new .lib src_share has no netscape dependencies. Any functionality that depended on ns dependencies was kept in src_moz. In this case, we have a function prototype only in src_share, with the implementation in src_moz. We did this for nsHashtable. The other trick was for things in WebShellInitContext that had nothing to do with Netscape. This case was accomodated by creating a new struct, ShareInitContext, that contains all WebShellInitContext members that have nothing to do with Netscape. Currently this is just jobject propertiesClass. I modified the WebShellInitContext struct to contain a ShareContext struct as its last member. There are two new methods in jni_util.h that allow for the initialization and deallocation of the members of the ShareContext struct. 4. Make it so src_moz uses the new .lib to provide the jni_util behavior a. Create ns_util* files that include ../src_share/jni_util* files appropriately. The only tricky part was for things in jni_util.h that Here's the list of files in this change. cvs -z3 -n update (in directory D:\Projects\mozilla\java\webclient) cvs server: Updating . M Makefile.win // added src_share to DIRS M src_moz/BookmarksImpl.cpp // include ns_util instead of jni_util M src_moz/CBrowserContainer.cpp // include ns_util instead of jni_util M src_moz/CBrowserContainer.h // include ns_util instead of jni_util M src_moz/CurrentPageImpl.cpp // include ns_util instead of jni_util M src_moz/HistoryImpl.cpp // include ns_util instead of jni_util M src_moz/Makefile.win // include ns_util instead of jni_util M src_moz/NativeEventThread.cpp // include ns_util instead of jni_util M src_moz/NavigationImpl.cpp // include ns_util instead of jni_util M src_moz/RDFEnumeration.cpp // include ns_util instead of jni_util M src_moz/RDFTreeNode.cpp // include ns_util instead of jni_util M src_moz/WindowControlImpl.cpp // include ns_util instead of jni_util // also use new util_InitShareContext // function M src_moz/WrapperFactoryImpl.cpp // include ns_util instead of jni_util R src_moz/jni_util.cpp // moved to ../src_share R src_moz/jni_util.h // moved to ../src_share R src_moz/jni_util_export.cpp // moved to ../src_share R src_moz/jni_util_export.h // moved to ../src_share M src_moz/nsActions.cpp // include ns_util instead of jni_util // also use new util_DeallocateShareContext M src_moz/nsActions.h // include ns_util instead of jni_util A src_moz/ns_util.cpp // include jni_util.h A src_moz/ns_util.h // include jni_util.h, changes to // WebshellInitContext struct A src_moz/ns_util_export.cpp // provide impls for methods in // jni_util_export.h A src_share/Makefile.win A src_share/bal_util.cpp A src_share/bal_util.h A src_share/jni_util.cpp A src_share/jni_util.h A src_share/jni_util_export.cpp A src_share/jni_util_export.h *****CVS exited normally with code 0*****
2000-08-04 01:32:54 +04:00
if ( mid != nsnull) {
This checkin has the basic functionality of NewWindowListener re-implemented using the new event model. It's a bit cleaner. Next step is to uncomment the selection check at the end of WindowCreatorTest.java. This code currently causes the VM to crash. I also plan to do some testing on the chrome flags. M classes_spec/org/mozilla/webclient/EventRegistration2.java - deprecate {add,remove}NewWindowListener(), replace with setNewWindowListener(). M classes_spec/org/mozilla/webclient/NewWindowEvent.java - added BrowserControl property, which the user sets into the event. M classes_spec/org/mozilla/webclient/impl/wrapper_native/EventRegistrationImpl.java - change newWindowListeners List ivar to newWindowListener ivar. - fix {add,remove}NewWindowListener() to leverage setNewWindowListener() - change nativeEventOccurred() to return an int instead of void. - add boolean property nativeSetNewWindowListenerAttached() M classes_spec/org/mozilla/webclient/impl/wrapper_native/NativeEventThread.java - modify pushBlockingWCRunnable() to execute the runnable right away if we're already on the NativeEventThread. This is necessary to allow re-entrancy. M src_moz/EmbedEventListener.cpp M src_moz/EmbedEventListener.h - expose the mEventRegistration ivar via a getter. M src_moz/EventRegistrationImpl.cpp M src_moz/NativeBrowserControl.cpp M src_moz/NativeBrowserControl.h - add nativeSetNewWindowListenerAttached(), which calls through and sets it on the NativeBrowserControl. M src_moz/WindowCreator.cpp - implement CreateChromeWindow2, which is called when the browser needs a new window. M src_share/jni_util.cpp M src_share/jni_util.h - change util_SendEventToJava() to return int. M test/automated/src/classes/org/mozilla/webclient/WindowCreatorTest.java
2005-01-18 18:20:52 +03:00
rv = env->CallIntMethod(eventRegistrationImpl, mid,
eventListenerClassName,
eventType, eventData);
bug=47357 a=edburns r=ashuk This change creates a new directory, java/webclient/src_share, that contains the code that will be used in both src_moz and src_ie, and any other native browser wrapping implementations. Here are the steps I followed to implement this change. 1. Create a new directory java/webclient/src_share 2. Move all jni_util*.* files from src_moz into src_share 3. Make it so src_share compiles into a new .lib src_share has no netscape dependencies. Any functionality that depended on ns dependencies was kept in src_moz. In this case, we have a function prototype only in src_share, with the implementation in src_moz. We did this for nsHashtable. The other trick was for things in WebShellInitContext that had nothing to do with Netscape. This case was accomodated by creating a new struct, ShareInitContext, that contains all WebShellInitContext members that have nothing to do with Netscape. Currently this is just jobject propertiesClass. I modified the WebShellInitContext struct to contain a ShareContext struct as its last member. There are two new methods in jni_util.h that allow for the initialization and deallocation of the members of the ShareContext struct. 4. Make it so src_moz uses the new .lib to provide the jni_util behavior a. Create ns_util* files that include ../src_share/jni_util* files appropriately. The only tricky part was for things in jni_util.h that Here's the list of files in this change. cvs -z3 -n update (in directory D:\Projects\mozilla\java\webclient) cvs server: Updating . M Makefile.win // added src_share to DIRS M src_moz/BookmarksImpl.cpp // include ns_util instead of jni_util M src_moz/CBrowserContainer.cpp // include ns_util instead of jni_util M src_moz/CBrowserContainer.h // include ns_util instead of jni_util M src_moz/CurrentPageImpl.cpp // include ns_util instead of jni_util M src_moz/HistoryImpl.cpp // include ns_util instead of jni_util M src_moz/Makefile.win // include ns_util instead of jni_util M src_moz/NativeEventThread.cpp // include ns_util instead of jni_util M src_moz/NavigationImpl.cpp // include ns_util instead of jni_util M src_moz/RDFEnumeration.cpp // include ns_util instead of jni_util M src_moz/RDFTreeNode.cpp // include ns_util instead of jni_util M src_moz/WindowControlImpl.cpp // include ns_util instead of jni_util // also use new util_InitShareContext // function M src_moz/WrapperFactoryImpl.cpp // include ns_util instead of jni_util R src_moz/jni_util.cpp // moved to ../src_share R src_moz/jni_util.h // moved to ../src_share R src_moz/jni_util_export.cpp // moved to ../src_share R src_moz/jni_util_export.h // moved to ../src_share M src_moz/nsActions.cpp // include ns_util instead of jni_util // also use new util_DeallocateShareContext M src_moz/nsActions.h // include ns_util instead of jni_util A src_moz/ns_util.cpp // include jni_util.h A src_moz/ns_util.h // include jni_util.h, changes to // WebshellInitContext struct A src_moz/ns_util_export.cpp // provide impls for methods in // jni_util_export.h A src_share/Makefile.win A src_share/bal_util.cpp A src_share/bal_util.h A src_share/jni_util.cpp A src_share/jni_util.h A src_share/jni_util_export.cpp A src_share/jni_util_export.h *****CVS exited normally with code 0*****
2000-08-04 01:32:54 +04:00
} else {
util_LogMessage(3, "cannot call the Java Method!\n");
}
#endif
This checkin has the basic functionality of NewWindowListener re-implemented using the new event model. It's a bit cleaner. Next step is to uncomment the selection check at the end of WindowCreatorTest.java. This code currently causes the VM to crash. I also plan to do some testing on the chrome flags. M classes_spec/org/mozilla/webclient/EventRegistration2.java - deprecate {add,remove}NewWindowListener(), replace with setNewWindowListener(). M classes_spec/org/mozilla/webclient/NewWindowEvent.java - added BrowserControl property, which the user sets into the event. M classes_spec/org/mozilla/webclient/impl/wrapper_native/EventRegistrationImpl.java - change newWindowListeners List ivar to newWindowListener ivar. - fix {add,remove}NewWindowListener() to leverage setNewWindowListener() - change nativeEventOccurred() to return an int instead of void. - add boolean property nativeSetNewWindowListenerAttached() M classes_spec/org/mozilla/webclient/impl/wrapper_native/NativeEventThread.java - modify pushBlockingWCRunnable() to execute the runnable right away if we're already on the NativeEventThread. This is necessary to allow re-entrancy. M src_moz/EmbedEventListener.cpp M src_moz/EmbedEventListener.h - expose the mEventRegistration ivar via a getter. M src_moz/EventRegistrationImpl.cpp M src_moz/NativeBrowserControl.cpp M src_moz/NativeBrowserControl.h - add nativeSetNewWindowListenerAttached(), which calls through and sets it on the NativeBrowserControl. M src_moz/WindowCreator.cpp - implement CreateChromeWindow2, which is called when the browser needs a new window. M src_share/jni_util.cpp M src_share/jni_util.h - change util_SendEventToJava() to return int. M test/automated/src/classes/org/mozilla/webclient/WindowCreatorTest.java
2005-01-18 18:20:52 +03:00
return rv;
bug=47357 a=edburns r=ashuk This change creates a new directory, java/webclient/src_share, that contains the code that will be used in both src_moz and src_ie, and any other native browser wrapping implementations. Here are the steps I followed to implement this change. 1. Create a new directory java/webclient/src_share 2. Move all jni_util*.* files from src_moz into src_share 3. Make it so src_share compiles into a new .lib src_share has no netscape dependencies. Any functionality that depended on ns dependencies was kept in src_moz. In this case, we have a function prototype only in src_share, with the implementation in src_moz. We did this for nsHashtable. The other trick was for things in WebShellInitContext that had nothing to do with Netscape. This case was accomodated by creating a new struct, ShareInitContext, that contains all WebShellInitContext members that have nothing to do with Netscape. Currently this is just jobject propertiesClass. I modified the WebShellInitContext struct to contain a ShareContext struct as its last member. There are two new methods in jni_util.h that allow for the initialization and deallocation of the members of the ShareContext struct. 4. Make it so src_moz uses the new .lib to provide the jni_util behavior a. Create ns_util* files that include ../src_share/jni_util* files appropriately. The only tricky part was for things in jni_util.h that Here's the list of files in this change. cvs -z3 -n update (in directory D:\Projects\mozilla\java\webclient) cvs server: Updating . M Makefile.win // added src_share to DIRS M src_moz/BookmarksImpl.cpp // include ns_util instead of jni_util M src_moz/CBrowserContainer.cpp // include ns_util instead of jni_util M src_moz/CBrowserContainer.h // include ns_util instead of jni_util M src_moz/CurrentPageImpl.cpp // include ns_util instead of jni_util M src_moz/HistoryImpl.cpp // include ns_util instead of jni_util M src_moz/Makefile.win // include ns_util instead of jni_util M src_moz/NativeEventThread.cpp // include ns_util instead of jni_util M src_moz/NavigationImpl.cpp // include ns_util instead of jni_util M src_moz/RDFEnumeration.cpp // include ns_util instead of jni_util M src_moz/RDFTreeNode.cpp // include ns_util instead of jni_util M src_moz/WindowControlImpl.cpp // include ns_util instead of jni_util // also use new util_InitShareContext // function M src_moz/WrapperFactoryImpl.cpp // include ns_util instead of jni_util R src_moz/jni_util.cpp // moved to ../src_share R src_moz/jni_util.h // moved to ../src_share R src_moz/jni_util_export.cpp // moved to ../src_share R src_moz/jni_util_export.h // moved to ../src_share M src_moz/nsActions.cpp // include ns_util instead of jni_util // also use new util_DeallocateShareContext M src_moz/nsActions.h // include ns_util instead of jni_util A src_moz/ns_util.cpp // include jni_util.h A src_moz/ns_util.h // include jni_util.h, changes to // WebshellInitContext struct A src_moz/ns_util_export.cpp // provide impls for methods in // jni_util_export.h A src_share/Makefile.win A src_share/bal_util.cpp A src_share/bal_util.h A src_share/jni_util.cpp A src_share/jni_util.h A src_share/jni_util_export.cpp A src_share/jni_util_export.h *****CVS exited normally with code 0*****
2000-08-04 01:32:54 +04:00
}
/**
* @return: the string name of the current java thread. Must be freed!
*/
char *util_GetCurrentThreadName(JNIEnv *env)
{
jclass threadClass = env->FindClass("java/lang/Thread");
jobject currentThread;
jstring name;
char *result = nsnull;
const char *cstr;
jboolean isCopy;
if (nsnull != threadClass) {
jmethodID currentThreadID =
env->GetStaticMethodID(threadClass,"currentThread",
"()Ljava/lang/Thread;");
currentThread = env->CallStaticObjectMethod(threadClass,
currentThreadID);
if (nsnull != currentThread) {
jmethodID getNameID = env->GetMethodID(threadClass,
"getName",
"()Ljava/lang/String;");
name = (jstring) env->CallObjectMethod(currentThread, getNameID,
nsnull);
result = strdup(cstr = env->GetStringUTFChars(name, &isCopy));
if (JNI_TRUE == isCopy) {
env->ReleaseStringUTFChars(name, cstr);
}
}
}
return result;
}
// static
void util_DumpJavaStack(JNIEnv *env)
{
jclass threadClass = env->FindClass("java/lang/Thread");
if (nsnull != threadClass) {
jmethodID dumpStackID = env->GetStaticMethodID(threadClass,
"dumpStack",
"()V");
env->CallStaticVoidMethod(threadClass, dumpStackID);
}
}
jobject util_NewGlobalRef(JNIEnv *env, jobject obj)
{
jobject result = nsnull;
#ifdef BAL_INTERFACE
// PENDING(edburns): do we need to do anything here?
result = obj;
#else
result = env->NewGlobalRef(obj);
#endif
return result;
}
void util_DeleteGlobalRef(JNIEnv *env, jobject obj)
{
#ifdef BAL_INTERFACE
#else
env->DeleteGlobalRef(obj);
#endif
}
This is a checkpoint milestone for webclient 2.0. Webclient currently doesn't run, but several unit tests for webclient do. I'll be proceeding through the rest of the webclient interfaces, building junit tests as I go, in the coming months. I hope to flesh out the basic framework, then publish build instructions, and hopefully I can get some contributions from the community. M util/classes/org/mozilla/util/Utilities.java new method: getImplFromServices: + * + * <p>This method tries to load the resource + * <code>META-INF/services/&gt;interfaceClassName&gt;</code>, where + * <code>&gt;interfaceClassName&lt;</code> is the argument to this + * method. If the resource is found, interpret it as a + * <code>Properties</code> file and read out its first line. + * Interpret the first line as the fully qualified class name of a + * class that implements <code></code>. The named class must have a + * public no-arg constructor.</p> M webclient/build-tests.xml - junit testcases for Webclient APIs, developed using test-first. M webclient/build.xml - changes for new package name structure: packages org.mozilla.webclient.{wrapper_native, wrapper_non_native} have gone away. Replaced with org.mozilla.webclient.impl.{wrapper_native, wrapper_non_native} - changes to accomodate "Services" based approach for pluggable webclient implementation. - don't bother re-naming the javah generated files, just let javah pick the names. - pass debugging args from build.properties - changed name of junit test target to "test". M webclient/classes_spec/org/mozilla/webclient/BrowserControl.java - got rid of BROWSER_TYPE. No longer necessary due to the new pluggability mechanism. M webclient/classes_spec/org/mozilla/webclient/BrowserControlFactory.java - Leverage the org.mozilla.util.Utilities.getImplFromServices() mechanism to allow a vendor-pluggable webclient implementation of the new "WebclientFactory" interface, which is method for method compatible with BrowserControlFactory. Make all BrowserControlFactory methods call through to methods on the vendor provided WebclientFactory implementation. R webclient/classes_spec/org/mozilla/webclient/BrowserControlFactoryInterface.java A webclient/classes_spec/org/mozilla/webclient/BrowserControlICE.java R webclient/classes_spec/org/mozilla/webclient/BrowserControlImpl.java R webclient/classes_spec/org/mozilla/webclient/BrowserType.java - move all implementation specific classe to the impl package. M webclient/classes_spec/org/mozilla/webclient/ImplObject.java - ImplObject shouldn't depend on vendor private classes. M webclient/classes_spec/org/mozilla/webclient/Preferences.java - new method + public void unregisterPrefChangedCallback(PrefChangedCallback cb, + String prefName, Object closure); M webclient/classes_spec/org/mozilla/webclient/ProfileManager.java - properly specify this interface. A webclient/classes_spec/org/mozilla/webclient/WebclientFactory.java * <p>This interface allows a pluggable webclient API implementation. * The static methods in {@link BrowserControlFactory} call through to * methods on this interface. Please see {@link BrowserControlFactory} * for information on how to hook up your <code>WebclientFactory</code> * implementation to the <code>BrowserControlFactory</code></p> R webclient/classes_spec/org/mozilla/webclient/WrapperFactory.java R webclient/classes_spec/org/mozilla/webclient/impl/BrowserControlFactoryImpl.java - moved these to the impl class A webclient/classes_spec/org/mozilla/webclient/impl/BrowserControlImpl.java A webclient/classes_spec/org/mozilla/webclient/impl/Service.java A webclient/classes_spec/org/mozilla/webclient/impl/WebclientFactoryImpl.java A webclient/classes_spec/org/mozilla/webclient/impl/WrapperFactory.java A webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/BookmarkEntryImpl.java A webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/BookmarksImpl.java A webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/CurrentPageImpl.java A webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/EventRegistrationImpl.java A webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/HistoryImpl.java A webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/ISupportsPeer.java A webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/ImplObjectNative.java A webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/NativeEventThread.java A webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/NavigationImpl.java A webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/PreferencesImpl.java A webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/ProfileManagerImpl.java A webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/RDFEnumeration.java A webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/RDFTreeNode.java A webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/SelectionImpl.java A webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/WCEventListenerWrapper.java A webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/WCMouseListenerImpl.java A webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/WindowControlImpl.java A webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/WrapperFactoryImpl.java A webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/gtk/GtkBrowserControlCanvas.java A webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/win32/Win32BrowserControlCanvas.java - copied from old package naming scheme. - lots and lots of cleanup. R webclient/classes_spec/org/mozilla/webclient/wrapper_native/BookmarkEntryImpl.java R webclient/classes_spec/org/mozilla/webclient/wrapper_native/BookmarksImpl.java R webclient/classes_spec/org/mozilla/webclient/wrapper_native/CurrentPageImpl.java R webclient/classes_spec/org/mozilla/webclient/wrapper_native/EventRegistrationImpl.java R webclient/classes_spec/org/mozilla/webclient/wrapper_native/HistoryImpl.java R webclient/classes_spec/org/mozilla/webclient/wrapper_native/ISupportsPeer.java R webclient/classes_spec/org/mozilla/webclient/wrapper_native/ImplObjectNative.java R webclient/classes_spec/org/mozilla/webclient/wrapper_native/NativeEventThread.java R webclient/classes_spec/org/mozilla/webclient/wrapper_native/NavigationImpl.java R webclient/classes_spec/org/mozilla/webclient/wrapper_native/PreferencesImpl.java R webclient/classes_spec/org/mozilla/webclient/wrapper_native/ProfileManagerImpl.java R webclient/classes_spec/org/mozilla/webclient/wrapper_native/RDFEnumeration.java R webclient/classes_spec/org/mozilla/webclient/wrapper_native/RDFTreeNode.java A webclient/classes_spec/org/mozilla/webclient/wrapper_native/README R webclient/classes_spec/org/mozilla/webclient/wrapper_native/SelectionImpl.java R webclient/classes_spec/org/mozilla/webclient/wrapper_native/WCEventListenerWrapper.java R webclient/classes_spec/org/mozilla/webclient/wrapper_native/WCMouseListenerImpl.java R webclient/classes_spec/org/mozilla/webclient/wrapper_native/WindowControlImpl.java R webclient/classes_spec/org/mozilla/webclient/wrapper_native/WrapperFactoryImpl.java R webclient/classes_spec/org/mozilla/webclient/wrapper_native/gtk/GtkBrowserControlCanvas.java R webclient/classes_spec/org/mozilla/webclient/wrapper_native/win32/Win32BrowserControlCanvas.java - removed from old package naming scheme M webclient/src_moz/BookmarksImpl.cpp - remove dependency on RDFActionEvents by inlining all the code that formerly was in the events. - package name change - JNI include file name change M webclient/src_moz/CurrentPageImpl.cpp M webclient/src_moz/HistoryImpl.cpp M webclient/src_moz/ISupportsPeer.cpp - package name change - JNI include file name change M webclient/src_moz/Makefile.in - get rid of PreferencesActionEvents.cpp and RDFActionEvents.cpp - add ProfileManagerImpl.cpp M webclient/src_moz/NativeEventThread.cpp - this file is not done yet. I've been pulling misplaced initialization stuff out of here and putting it into WrapperFactoryImpl.cpp. - got rid of gComponentManager, since we can use do_CreateInstance instead. - package name change - JNI include file name change M webclient/src_moz/NativeEventThreadActionEvents.h - JNI include file name change M webclient/src_moz/NavigationImpl.cpp - package name change - JNI include file name change R webclient/src_moz/PreferencesActionEvents.cpp R webclient/src_moz/PreferencesActionEvents.h - don't need these anymore! woohoo! M webclient/src_moz/PreferencesImpl.cpp - remove dependency on PreferencesActionEvents by inlining code into the methods that used to use the events. A webclient/src_moz/ProfileManagerImpl.cpp - new class, implementation of the ProfileManager interface. M webclient/src_moz/PromptActionEvents.cpp - change erroneous comment so my grep performed correctly. R webclient/src_moz/RDFActionEvents.cpp R webclient/src_moz/RDFActionEvents.h - don't need these anymore! woohoo! M webclient/src_moz/RDFEnumeration.cpp M webclient/src_moz/RDFTreeNode.cpp - remove dependency on RDFActionEvents by inlining code into the methods that used to use the events. M webclient/src_moz/WindowControlActionEvents.cpp - deallocate shareInitiContext. M webclient/src_moz/WindowControlImpl.cpp - package name change - JNI include file name change - remove the "sleep so I can attach gdb" code. Moved to WrapperFactoryImpl.cpp. M webclient/src_moz/WrapperFactoryImpl.cpp - lots of changes. This is now where the app initialization and shutdown happens, M webclient/src_moz/dom_util.cpp - comment change M webclient/src_moz/ns_globals.h - get rid of inappropriate global usage. M webclient/src_moz/ns_util.h - new struct WebclientContext for singletons. M webclient/src_moz/rdf_util.cpp - new methods, rdf_startup and rdf_shutdown. - replace calls to nsComponentManager::CreateInstance() with do_CreateInstance(). M webclient/src_moz/rdf_util.h - new methods, rdf_startup and rdf_shutdown. M webclient/src_moz/gtk/GtkBrowserControlCanvas.cpp - package name change - JNI include file name change M webclient/src_moz/gtk/GtkBrowserControlCanvasStub.cpp - package name change - JNI include file name change - this file isn't needed anymore, thankfully! I'll remove it soon. M webclient/src_moz/gtk/StubFunctions.h - package name change - JNI include file name change - this file isn't needed anymore, thankfully! I'll remove it soon. M webclient/src_moz/motif/BrowserControlNativeShimStub.cpp M webclient/src_moz/motif/MotifBrowserControlCanvas.cpp M webclient/src_moz/motif/MotifBrowserControlCanvasStub.cpp M webclient/src_moz/motif/NativeLoaderStub.cpp M webclient/src_moz/win32/Win32BrowserControlCanvas.cpp - package name change - JNI include file name change M webclient/src_share/jni_util.cpp M webclient/src_share/jni_util.h - util_InitializeShareInitContext() takes a JNIEnv *. - new methods +void util_DeleteGlobalRef(JNIEnv *env, jobject toDeleteRef); +void util_DeleteLocalRef(JNIEnv *env, jobject toDeleteRef); +void util_getSystemProperty(JNIEnv *env, + const char *propName, + char *propValue, + jint propValueLen); M webclient/src_share/jni_util_export.cpp M webclient/src_share/jni_util_export.h +JNIEXPORT jobjectArray util_GetJstringArrayFromJcharArray(JNIEnv *env, + jint len, + jchar **strings, + jint *stringLengths) A webclient/test/automated/src/classes/org/mozilla/webclient/BookmarksTest.java R webclient/test/automated/src/classes/org/mozilla/webclient/BrowserControlFactoryTest.java A webclient/test/automated/src/classes/org/mozilla/webclient/PreferencesTest.java A webclient/test/automated/src/classes/org/mozilla/webclient/ProfileManagerTest.java A webclient/test/automated/src/classes/org/mozilla/webclient/impl/WebclientFactoryImplTest.java A webclient/test/automated/src/classes/org/mozilla/webclient/impl/wrapper_native/WrapperFactoryImplTest.java A webclient/test/automated/src/classes/org/mozilla/webclient/impl/wrapper_native/gtk/TestGtkBrowserControlCanvas.java R webclient/test/automated/src/classes/org/mozilla/webclient/wrapper_native/gtk/TestGtkBrowserControlCanvas.java A webclient/test/automated/src/test/BrowserControlFactoryTest_correct - junit tests! TEST FIRST!
2003-09-28 10:29:22 +04:00
void util_DeleteLocalRef(JNIEnv *env, jobject obj)
{
#ifdef BAL_INTERFACE
#else
env->DeleteLocalRef(obj);
#endif
}
bug=47357 a=edburns r=ashuk This change creates a new directory, java/webclient/src_share, that contains the code that will be used in both src_moz and src_ie, and any other native browser wrapping implementations. Here are the steps I followed to implement this change. 1. Create a new directory java/webclient/src_share 2. Move all jni_util*.* files from src_moz into src_share 3. Make it so src_share compiles into a new .lib src_share has no netscape dependencies. Any functionality that depended on ns dependencies was kept in src_moz. In this case, we have a function prototype only in src_share, with the implementation in src_moz. We did this for nsHashtable. The other trick was for things in WebShellInitContext that had nothing to do with Netscape. This case was accomodated by creating a new struct, ShareInitContext, that contains all WebShellInitContext members that have nothing to do with Netscape. Currently this is just jobject propertiesClass. I modified the WebShellInitContext struct to contain a ShareContext struct as its last member. There are two new methods in jni_util.h that allow for the initialization and deallocation of the members of the ShareContext struct. 4. Make it so src_moz uses the new .lib to provide the jni_util behavior a. Create ns_util* files that include ../src_share/jni_util* files appropriately. The only tricky part was for things in jni_util.h that Here's the list of files in this change. cvs -z3 -n update (in directory D:\Projects\mozilla\java\webclient) cvs server: Updating . M Makefile.win // added src_share to DIRS M src_moz/BookmarksImpl.cpp // include ns_util instead of jni_util M src_moz/CBrowserContainer.cpp // include ns_util instead of jni_util M src_moz/CBrowserContainer.h // include ns_util instead of jni_util M src_moz/CurrentPageImpl.cpp // include ns_util instead of jni_util M src_moz/HistoryImpl.cpp // include ns_util instead of jni_util M src_moz/Makefile.win // include ns_util instead of jni_util M src_moz/NativeEventThread.cpp // include ns_util instead of jni_util M src_moz/NavigationImpl.cpp // include ns_util instead of jni_util M src_moz/RDFEnumeration.cpp // include ns_util instead of jni_util M src_moz/RDFTreeNode.cpp // include ns_util instead of jni_util M src_moz/WindowControlImpl.cpp // include ns_util instead of jni_util // also use new util_InitShareContext // function M src_moz/WrapperFactoryImpl.cpp // include ns_util instead of jni_util R src_moz/jni_util.cpp // moved to ../src_share R src_moz/jni_util.h // moved to ../src_share R src_moz/jni_util_export.cpp // moved to ../src_share R src_moz/jni_util_export.h // moved to ../src_share M src_moz/nsActions.cpp // include ns_util instead of jni_util // also use new util_DeallocateShareContext M src_moz/nsActions.h // include ns_util instead of jni_util A src_moz/ns_util.cpp // include jni_util.h A src_moz/ns_util.h // include jni_util.h, changes to // WebshellInitContext struct A src_moz/ns_util_export.cpp // provide impls for methods in // jni_util_export.h A src_share/Makefile.win A src_share/bal_util.cpp A src_share/bal_util.h A src_share/jni_util.cpp A src_share/jni_util.h A src_share/jni_util_export.cpp A src_share/jni_util_export.h *****CVS exited normally with code 0*****
2000-08-04 01:32:54 +04:00
jthrowable util_ExceptionOccurred(JNIEnv *env)
{
jthrowable result = nsnull;
#ifdef BAL_INTERFACE
#else
result = env->ExceptionOccurred();
#endif
return result;
}
jint util_GetJavaVM(JNIEnv *env, JavaVM **vm)
{
int result = -1;
#ifdef BAL_INTERFACE
#else
result = env->GetJavaVM(vm);
#endif
return result;
}
jclass util_FindClass(JNIEnv *env, const char *fullyQualifiedClassName)
{
jclass result = nsnull;
#ifdef BAL_INTERFACE
result = util_GetClassMapping(fullyQualifiedClassName);
#else
result = env->FindClass(fullyQualifiedClassName);
#endif
return result;
}
jobject util_CallStaticObjectMethodlongArg(JNIEnv *env, jclass clazz,
jmethodID methodID, jlong longArg)
{
jobject result = nsnull;
#ifdef BAL_INTERFACE
#else
result = env->CallStaticObjectMethod(clazz, methodID, longArg);
#endif
return result;
}
bug=47357 a=edburns r=ashuk This change creates a new directory, java/webclient/src_share, that contains the code that will be used in both src_moz and src_ie, and any other native browser wrapping implementations. Here are the steps I followed to implement this change. 1. Create a new directory java/webclient/src_share 2. Move all jni_util*.* files from src_moz into src_share 3. Make it so src_share compiles into a new .lib src_share has no netscape dependencies. Any functionality that depended on ns dependencies was kept in src_moz. In this case, we have a function prototype only in src_share, with the implementation in src_moz. We did this for nsHashtable. The other trick was for things in WebShellInitContext that had nothing to do with Netscape. This case was accomodated by creating a new struct, ShareInitContext, that contains all WebShellInitContext members that have nothing to do with Netscape. Currently this is just jobject propertiesClass. I modified the WebShellInitContext struct to contain a ShareContext struct as its last member. There are two new methods in jni_util.h that allow for the initialization and deallocation of the members of the ShareContext struct. 4. Make it so src_moz uses the new .lib to provide the jni_util behavior a. Create ns_util* files that include ../src_share/jni_util* files appropriately. The only tricky part was for things in jni_util.h that Here's the list of files in this change. cvs -z3 -n update (in directory D:\Projects\mozilla\java\webclient) cvs server: Updating . M Makefile.win // added src_share to DIRS M src_moz/BookmarksImpl.cpp // include ns_util instead of jni_util M src_moz/CBrowserContainer.cpp // include ns_util instead of jni_util M src_moz/CBrowserContainer.h // include ns_util instead of jni_util M src_moz/CurrentPageImpl.cpp // include ns_util instead of jni_util M src_moz/HistoryImpl.cpp // include ns_util instead of jni_util M src_moz/Makefile.win // include ns_util instead of jni_util M src_moz/NativeEventThread.cpp // include ns_util instead of jni_util M src_moz/NavigationImpl.cpp // include ns_util instead of jni_util M src_moz/RDFEnumeration.cpp // include ns_util instead of jni_util M src_moz/RDFTreeNode.cpp // include ns_util instead of jni_util M src_moz/WindowControlImpl.cpp // include ns_util instead of jni_util // also use new util_InitShareContext // function M src_moz/WrapperFactoryImpl.cpp // include ns_util instead of jni_util R src_moz/jni_util.cpp // moved to ../src_share R src_moz/jni_util.h // moved to ../src_share R src_moz/jni_util_export.cpp // moved to ../src_share R src_moz/jni_util_export.h // moved to ../src_share M src_moz/nsActions.cpp // include ns_util instead of jni_util // also use new util_DeallocateShareContext M src_moz/nsActions.h // include ns_util instead of jni_util A src_moz/ns_util.cpp // include jni_util.h A src_moz/ns_util.h // include jni_util.h, changes to // WebshellInitContext struct A src_moz/ns_util_export.cpp // provide impls for methods in // jni_util_export.h A src_share/Makefile.win A src_share/bal_util.cpp A src_share/bal_util.h A src_share/jni_util.cpp A src_share/jni_util.h A src_share/jni_util_export.cpp A src_share/jni_util_export.h *****CVS exited normally with code 0*****
2000-08-04 01:32:54 +04:00
jfieldID util_GetStaticFieldID(JNIEnv *env, jclass clazz,
const char *fieldName,
const char *signature)
{
jfieldID result = nsnull;
#ifdef BAL_INTERFACE
#else
result = env->GetStaticFieldID(clazz, fieldName, signature);
#endif
return result;
}
jlong util_GetStaticLongField(JNIEnv *env, jclass clazz, jfieldID id)
{
jlong result = -1;
#ifdef BAL_INTERFACE
#else
result = env->GetStaticLongField(clazz, id);
#endif
return result;
}
This checkin enables the KeyListener feature. A webclient/test/automated/src/classes/org/mozilla/webclient/KeyListenerTest.java A webclient/test/automated/src/test/KeyListenerTest1.html M webclient/build-tests.xml - add new testcase M webclient/classes_spec/org/mozilla/webclient/BrowserControlCanvas.java M webclient/classes_spec/org/mozilla/webclient/EventRegistration2.java - allow KeyListeners to be added and removed. M webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/EventRegistrationImpl.java - Lazily create listener lists. - Change the contract of queueEvent() to discard null events silently. - Add createKeyEvent() method. M webclient/src_moz/EmbedEventListener.cpp - new mask names and values, DOMDOMKeyListener_maskNames, DOMKeyListener_maskValues. - flesh out Key*() events. - add addKeyEventDataToProperties. - use eventType to discern how to populate the properties, with either key or mouse data. M webclient/src_moz/EmbedEventListener.h - key event includes and support methods. M webclient/src_moz/EmbedProgress.cpp - honor new last argument to util_InitializeEventMaskValuesFromClass(). M webclient/src_share/jni_util.cpp M webclient/src_share/jni_util.h - new constants +jobject CHAR_CODE; +jobject KEY_CODE; +jstring KEY_LISTENER_CLASSNAME; +char *DOMKeyListener_maskNames[] = { M webclient/src_share/jni_util_export.cpp M webclient/src_share/jni_util_export.h - new last argument to util_InitializeEventMaskValuesFromClass(const char *className, char *maskNames[], - jlong maskValues[]) + jlong maskValuesLong[], + jint maskValuesInt[]) Used when the maskValues are ints, otherwise null.
2004-12-01 06:21:23 +03:00
jint util_GetStaticIntField(JNIEnv *env, jclass clazz, jfieldID id)
{
jint result = -1;
#ifdef BAL_INTERFACE
#else
result = env->GetStaticIntField(clazz, id);
#endif
return result;
}
bug=47357 a=edburns r=ashuk This change creates a new directory, java/webclient/src_share, that contains the code that will be used in both src_moz and src_ie, and any other native browser wrapping implementations. Here are the steps I followed to implement this change. 1. Create a new directory java/webclient/src_share 2. Move all jni_util*.* files from src_moz into src_share 3. Make it so src_share compiles into a new .lib src_share has no netscape dependencies. Any functionality that depended on ns dependencies was kept in src_moz. In this case, we have a function prototype only in src_share, with the implementation in src_moz. We did this for nsHashtable. The other trick was for things in WebShellInitContext that had nothing to do with Netscape. This case was accomodated by creating a new struct, ShareInitContext, that contains all WebShellInitContext members that have nothing to do with Netscape. Currently this is just jobject propertiesClass. I modified the WebShellInitContext struct to contain a ShareContext struct as its last member. There are two new methods in jni_util.h that allow for the initialization and deallocation of the members of the ShareContext struct. 4. Make it so src_moz uses the new .lib to provide the jni_util behavior a. Create ns_util* files that include ../src_share/jni_util* files appropriately. The only tricky part was for things in jni_util.h that Here's the list of files in this change. cvs -z3 -n update (in directory D:\Projects\mozilla\java\webclient) cvs server: Updating . M Makefile.win // added src_share to DIRS M src_moz/BookmarksImpl.cpp // include ns_util instead of jni_util M src_moz/CBrowserContainer.cpp // include ns_util instead of jni_util M src_moz/CBrowserContainer.h // include ns_util instead of jni_util M src_moz/CurrentPageImpl.cpp // include ns_util instead of jni_util M src_moz/HistoryImpl.cpp // include ns_util instead of jni_util M src_moz/Makefile.win // include ns_util instead of jni_util M src_moz/NativeEventThread.cpp // include ns_util instead of jni_util M src_moz/NavigationImpl.cpp // include ns_util instead of jni_util M src_moz/RDFEnumeration.cpp // include ns_util instead of jni_util M src_moz/RDFTreeNode.cpp // include ns_util instead of jni_util M src_moz/WindowControlImpl.cpp // include ns_util instead of jni_util // also use new util_InitShareContext // function M src_moz/WrapperFactoryImpl.cpp // include ns_util instead of jni_util R src_moz/jni_util.cpp // moved to ../src_share R src_moz/jni_util.h // moved to ../src_share R src_moz/jni_util_export.cpp // moved to ../src_share R src_moz/jni_util_export.h // moved to ../src_share M src_moz/nsActions.cpp // include ns_util instead of jni_util // also use new util_DeallocateShareContext M src_moz/nsActions.h // include ns_util instead of jni_util A src_moz/ns_util.cpp // include jni_util.h A src_moz/ns_util.h // include jni_util.h, changes to // WebshellInitContext struct A src_moz/ns_util_export.cpp // provide impls for methods in // jni_util_export.h A src_share/Makefile.win A src_share/bal_util.cpp A src_share/bal_util.h A src_share/jni_util.cpp A src_share/jni_util.h A src_share/jni_util_export.cpp A src_share/jni_util_export.h *****CVS exited normally with code 0*****
2000-08-04 01:32:54 +04:00
jboolean util_IsInstanceOf(JNIEnv *env, jobject obj, jclass clazz)
{
jboolean result = JNI_FALSE;
#ifdef BAL_INTERFACE
if (nsnull != externalInstanceOf) {
result = externalInstanceOf(env, obj, clazz);
}
#else
result = env->IsInstanceOf(obj, clazz);
#endif
return result;
}
jint util_GetIntValueFromInstance(JNIEnv *env, jobject obj,
const char *fieldName)
{
int result = -1;
#ifdef BAL_INTERFACE
#else
jclass objClass = env->GetObjectClass(obj);
if (nsnull == objClass) {
util_LogMessage(3,
"util_GetIntValueFromInstance: Can't get object class from instance.\n");
return result;
}
jfieldID theFieldID = env->GetFieldID(objClass, fieldName, "I");
if (nsnull == theFieldID) {
util_LogMessage(3,
"util_GetIntValueFromInstance: Can't get fieldID for fieldName.\n");
return result;
}
result = env->GetIntField(obj, theFieldID);
#endif
return result;
}
void util_SetIntValueForInstance(JNIEnv *env, jobject obj,
const char *fieldName, jint newValue)
{
#ifdef BAL_INTERFACE
#else
jclass objClass = env->GetObjectClass(obj);
if (nsnull == objClass) {
util_LogMessage(3,
"util_SetIntValueForInstance: Can't get object class from instance.\n");
return;
}
jfieldID fieldID = env->GetFieldID(objClass, fieldName, "I");
if (nsnull == fieldID) {
util_LogMessage(3,
"util_SetIntValueForInstance: Can't get fieldID for fieldName.\n");
return;
}
env->SetIntField(obj, fieldID, newValue);
#endif
bug=47357 a=edburns r=ashuk This change creates a new directory, java/webclient/src_share, that contains the code that will be used in both src_moz and src_ie, and any other native browser wrapping implementations. Here are the steps I followed to implement this change. 1. Create a new directory java/webclient/src_share 2. Move all jni_util*.* files from src_moz into src_share 3. Make it so src_share compiles into a new .lib src_share has no netscape dependencies. Any functionality that depended on ns dependencies was kept in src_moz. In this case, we have a function prototype only in src_share, with the implementation in src_moz. We did this for nsHashtable. The other trick was for things in WebShellInitContext that had nothing to do with Netscape. This case was accomodated by creating a new struct, ShareInitContext, that contains all WebShellInitContext members that have nothing to do with Netscape. Currently this is just jobject propertiesClass. I modified the WebShellInitContext struct to contain a ShareContext struct as its last member. There are two new methods in jni_util.h that allow for the initialization and deallocation of the members of the ShareContext struct. 4. Make it so src_moz uses the new .lib to provide the jni_util behavior a. Create ns_util* files that include ../src_share/jni_util* files appropriately. The only tricky part was for things in jni_util.h that Here's the list of files in this change. cvs -z3 -n update (in directory D:\Projects\mozilla\java\webclient) cvs server: Updating . M Makefile.win // added src_share to DIRS M src_moz/BookmarksImpl.cpp // include ns_util instead of jni_util M src_moz/CBrowserContainer.cpp // include ns_util instead of jni_util M src_moz/CBrowserContainer.h // include ns_util instead of jni_util M src_moz/CurrentPageImpl.cpp // include ns_util instead of jni_util M src_moz/HistoryImpl.cpp // include ns_util instead of jni_util M src_moz/Makefile.win // include ns_util instead of jni_util M src_moz/NativeEventThread.cpp // include ns_util instead of jni_util M src_moz/NavigationImpl.cpp // include ns_util instead of jni_util M src_moz/RDFEnumeration.cpp // include ns_util instead of jni_util M src_moz/RDFTreeNode.cpp // include ns_util instead of jni_util M src_moz/WindowControlImpl.cpp // include ns_util instead of jni_util // also use new util_InitShareContext // function M src_moz/WrapperFactoryImpl.cpp // include ns_util instead of jni_util R src_moz/jni_util.cpp // moved to ../src_share R src_moz/jni_util.h // moved to ../src_share R src_moz/jni_util_export.cpp // moved to ../src_share R src_moz/jni_util_export.h // moved to ../src_share M src_moz/nsActions.cpp // include ns_util instead of jni_util // also use new util_DeallocateShareContext M src_moz/nsActions.h // include ns_util instead of jni_util A src_moz/ns_util.cpp // include jni_util.h A src_moz/ns_util.h // include jni_util.h, changes to // WebshellInitContext struct A src_moz/ns_util_export.cpp // provide impls for methods in // jni_util_export.h A src_share/Makefile.win A src_share/bal_util.cpp A src_share/bal_util.h A src_share/jni_util.cpp A src_share/jni_util.h A src_share/jni_util_export.cpp A src_share/jni_util_export.h *****CVS exited normally with code 0*****
2000-08-04 01:32:54 +04:00
}
jobject util_CreatePropertiesObject(JNIEnv *env, jobject initContextObj)
{
jobject result = nsnull;
#ifdef BAL_INTERFACE
if (nsnull != externalCreatePropertiesObject) {
result = externalCreatePropertiesObject(env, initContextObj);
}
#else
util_Assert(initContextObj);
ShareInitContext *initContext = (ShareInitContext *) initContextObj;
jclass propertiesClass = nsnull;
bug=47357 a=edburns r=ashuk This change creates a new directory, java/webclient/src_share, that contains the code that will be used in both src_moz and src_ie, and any other native browser wrapping implementations. Here are the steps I followed to implement this change. 1. Create a new directory java/webclient/src_share 2. Move all jni_util*.* files from src_moz into src_share 3. Make it so src_share compiles into a new .lib src_share has no netscape dependencies. Any functionality that depended on ns dependencies was kept in src_moz. In this case, we have a function prototype only in src_share, with the implementation in src_moz. We did this for nsHashtable. The other trick was for things in WebShellInitContext that had nothing to do with Netscape. This case was accomodated by creating a new struct, ShareInitContext, that contains all WebShellInitContext members that have nothing to do with Netscape. Currently this is just jobject propertiesClass. I modified the WebShellInitContext struct to contain a ShareContext struct as its last member. There are two new methods in jni_util.h that allow for the initialization and deallocation of the members of the ShareContext struct. 4. Make it so src_moz uses the new .lib to provide the jni_util behavior a. Create ns_util* files that include ../src_share/jni_util* files appropriately. The only tricky part was for things in jni_util.h that Here's the list of files in this change. cvs -z3 -n update (in directory D:\Projects\mozilla\java\webclient) cvs server: Updating . M Makefile.win // added src_share to DIRS M src_moz/BookmarksImpl.cpp // include ns_util instead of jni_util M src_moz/CBrowserContainer.cpp // include ns_util instead of jni_util M src_moz/CBrowserContainer.h // include ns_util instead of jni_util M src_moz/CurrentPageImpl.cpp // include ns_util instead of jni_util M src_moz/HistoryImpl.cpp // include ns_util instead of jni_util M src_moz/Makefile.win // include ns_util instead of jni_util M src_moz/NativeEventThread.cpp // include ns_util instead of jni_util M src_moz/NavigationImpl.cpp // include ns_util instead of jni_util M src_moz/RDFEnumeration.cpp // include ns_util instead of jni_util M src_moz/RDFTreeNode.cpp // include ns_util instead of jni_util M src_moz/WindowControlImpl.cpp // include ns_util instead of jni_util // also use new util_InitShareContext // function M src_moz/WrapperFactoryImpl.cpp // include ns_util instead of jni_util R src_moz/jni_util.cpp // moved to ../src_share R src_moz/jni_util.h // moved to ../src_share R src_moz/jni_util_export.cpp // moved to ../src_share R src_moz/jni_util_export.h // moved to ../src_share M src_moz/nsActions.cpp // include ns_util instead of jni_util // also use new util_DeallocateShareContext M src_moz/nsActions.h // include ns_util instead of jni_util A src_moz/ns_util.cpp // include jni_util.h A src_moz/ns_util.h // include jni_util.h, changes to // WebshellInitContext struct A src_moz/ns_util_export.cpp // provide impls for methods in // jni_util_export.h A src_share/Makefile.win A src_share/bal_util.cpp A src_share/bal_util.h A src_share/jni_util.cpp A src_share/jni_util.h A src_share/jni_util_export.cpp A src_share/jni_util_export.h *****CVS exited normally with code 0*****
2000-08-04 01:32:54 +04:00
if (nsnull == (propertiesClass =
::util_FindClass(env, "java/util/Properties"))) {
return result;
bug=47357 a=edburns r=ashuk This change creates a new directory, java/webclient/src_share, that contains the code that will be used in both src_moz and src_ie, and any other native browser wrapping implementations. Here are the steps I followed to implement this change. 1. Create a new directory java/webclient/src_share 2. Move all jni_util*.* files from src_moz into src_share 3. Make it so src_share compiles into a new .lib src_share has no netscape dependencies. Any functionality that depended on ns dependencies was kept in src_moz. In this case, we have a function prototype only in src_share, with the implementation in src_moz. We did this for nsHashtable. The other trick was for things in WebShellInitContext that had nothing to do with Netscape. This case was accomodated by creating a new struct, ShareInitContext, that contains all WebShellInitContext members that have nothing to do with Netscape. Currently this is just jobject propertiesClass. I modified the WebShellInitContext struct to contain a ShareContext struct as its last member. There are two new methods in jni_util.h that allow for the initialization and deallocation of the members of the ShareContext struct. 4. Make it so src_moz uses the new .lib to provide the jni_util behavior a. Create ns_util* files that include ../src_share/jni_util* files appropriately. The only tricky part was for things in jni_util.h that Here's the list of files in this change. cvs -z3 -n update (in directory D:\Projects\mozilla\java\webclient) cvs server: Updating . M Makefile.win // added src_share to DIRS M src_moz/BookmarksImpl.cpp // include ns_util instead of jni_util M src_moz/CBrowserContainer.cpp // include ns_util instead of jni_util M src_moz/CBrowserContainer.h // include ns_util instead of jni_util M src_moz/CurrentPageImpl.cpp // include ns_util instead of jni_util M src_moz/HistoryImpl.cpp // include ns_util instead of jni_util M src_moz/Makefile.win // include ns_util instead of jni_util M src_moz/NativeEventThread.cpp // include ns_util instead of jni_util M src_moz/NavigationImpl.cpp // include ns_util instead of jni_util M src_moz/RDFEnumeration.cpp // include ns_util instead of jni_util M src_moz/RDFTreeNode.cpp // include ns_util instead of jni_util M src_moz/WindowControlImpl.cpp // include ns_util instead of jni_util // also use new util_InitShareContext // function M src_moz/WrapperFactoryImpl.cpp // include ns_util instead of jni_util R src_moz/jni_util.cpp // moved to ../src_share R src_moz/jni_util.h // moved to ../src_share R src_moz/jni_util_export.cpp // moved to ../src_share R src_moz/jni_util_export.h // moved to ../src_share M src_moz/nsActions.cpp // include ns_util instead of jni_util // also use new util_DeallocateShareContext M src_moz/nsActions.h // include ns_util instead of jni_util A src_moz/ns_util.cpp // include jni_util.h A src_moz/ns_util.h // include jni_util.h, changes to // WebshellInitContext struct A src_moz/ns_util_export.cpp // provide impls for methods in // jni_util_export.h A src_share/Makefile.win A src_share/bal_util.cpp A src_share/bal_util.h A src_share/jni_util.cpp A src_share/jni_util.h A src_share/jni_util_export.cpp A src_share/jni_util_export.h *****CVS exited normally with code 0*****
2000-08-04 01:32:54 +04:00
}
if (nsnull == gPropertiesInitMethodID) {
util_Assert(propertiesClass);
bug=47357 a=edburns r=ashuk This change creates a new directory, java/webclient/src_share, that contains the code that will be used in both src_moz and src_ie, and any other native browser wrapping implementations. Here are the steps I followed to implement this change. 1. Create a new directory java/webclient/src_share 2. Move all jni_util*.* files from src_moz into src_share 3. Make it so src_share compiles into a new .lib src_share has no netscape dependencies. Any functionality that depended on ns dependencies was kept in src_moz. In this case, we have a function prototype only in src_share, with the implementation in src_moz. We did this for nsHashtable. The other trick was for things in WebShellInitContext that had nothing to do with Netscape. This case was accomodated by creating a new struct, ShareInitContext, that contains all WebShellInitContext members that have nothing to do with Netscape. Currently this is just jobject propertiesClass. I modified the WebShellInitContext struct to contain a ShareContext struct as its last member. There are two new methods in jni_util.h that allow for the initialization and deallocation of the members of the ShareContext struct. 4. Make it so src_moz uses the new .lib to provide the jni_util behavior a. Create ns_util* files that include ../src_share/jni_util* files appropriately. The only tricky part was for things in jni_util.h that Here's the list of files in this change. cvs -z3 -n update (in directory D:\Projects\mozilla\java\webclient) cvs server: Updating . M Makefile.win // added src_share to DIRS M src_moz/BookmarksImpl.cpp // include ns_util instead of jni_util M src_moz/CBrowserContainer.cpp // include ns_util instead of jni_util M src_moz/CBrowserContainer.h // include ns_util instead of jni_util M src_moz/CurrentPageImpl.cpp // include ns_util instead of jni_util M src_moz/HistoryImpl.cpp // include ns_util instead of jni_util M src_moz/Makefile.win // include ns_util instead of jni_util M src_moz/NativeEventThread.cpp // include ns_util instead of jni_util M src_moz/NavigationImpl.cpp // include ns_util instead of jni_util M src_moz/RDFEnumeration.cpp // include ns_util instead of jni_util M src_moz/RDFTreeNode.cpp // include ns_util instead of jni_util M src_moz/WindowControlImpl.cpp // include ns_util instead of jni_util // also use new util_InitShareContext // function M src_moz/WrapperFactoryImpl.cpp // include ns_util instead of jni_util R src_moz/jni_util.cpp // moved to ../src_share R src_moz/jni_util.h // moved to ../src_share R src_moz/jni_util_export.cpp // moved to ../src_share R src_moz/jni_util_export.h // moved to ../src_share M src_moz/nsActions.cpp // include ns_util instead of jni_util // also use new util_DeallocateShareContext M src_moz/nsActions.h // include ns_util instead of jni_util A src_moz/ns_util.cpp // include jni_util.h A src_moz/ns_util.h // include jni_util.h, changes to // WebshellInitContext struct A src_moz/ns_util_export.cpp // provide impls for methods in // jni_util_export.h A src_share/Makefile.win A src_share/bal_util.cpp A src_share/bal_util.h A src_share/jni_util.cpp A src_share/jni_util.h A src_share/jni_util_export.cpp A src_share/jni_util_export.h *****CVS exited normally with code 0*****
2000-08-04 01:32:54 +04:00
if (nsnull == (gPropertiesInitMethodID =
env->GetMethodID(propertiesClass,
bug=47357 a=edburns r=ashuk This change creates a new directory, java/webclient/src_share, that contains the code that will be used in both src_moz and src_ie, and any other native browser wrapping implementations. Here are the steps I followed to implement this change. 1. Create a new directory java/webclient/src_share 2. Move all jni_util*.* files from src_moz into src_share 3. Make it so src_share compiles into a new .lib src_share has no netscape dependencies. Any functionality that depended on ns dependencies was kept in src_moz. In this case, we have a function prototype only in src_share, with the implementation in src_moz. We did this for nsHashtable. The other trick was for things in WebShellInitContext that had nothing to do with Netscape. This case was accomodated by creating a new struct, ShareInitContext, that contains all WebShellInitContext members that have nothing to do with Netscape. Currently this is just jobject propertiesClass. I modified the WebShellInitContext struct to contain a ShareContext struct as its last member. There are two new methods in jni_util.h that allow for the initialization and deallocation of the members of the ShareContext struct. 4. Make it so src_moz uses the new .lib to provide the jni_util behavior a. Create ns_util* files that include ../src_share/jni_util* files appropriately. The only tricky part was for things in jni_util.h that Here's the list of files in this change. cvs -z3 -n update (in directory D:\Projects\mozilla\java\webclient) cvs server: Updating . M Makefile.win // added src_share to DIRS M src_moz/BookmarksImpl.cpp // include ns_util instead of jni_util M src_moz/CBrowserContainer.cpp // include ns_util instead of jni_util M src_moz/CBrowserContainer.h // include ns_util instead of jni_util M src_moz/CurrentPageImpl.cpp // include ns_util instead of jni_util M src_moz/HistoryImpl.cpp // include ns_util instead of jni_util M src_moz/Makefile.win // include ns_util instead of jni_util M src_moz/NativeEventThread.cpp // include ns_util instead of jni_util M src_moz/NavigationImpl.cpp // include ns_util instead of jni_util M src_moz/RDFEnumeration.cpp // include ns_util instead of jni_util M src_moz/RDFTreeNode.cpp // include ns_util instead of jni_util M src_moz/WindowControlImpl.cpp // include ns_util instead of jni_util // also use new util_InitShareContext // function M src_moz/WrapperFactoryImpl.cpp // include ns_util instead of jni_util R src_moz/jni_util.cpp // moved to ../src_share R src_moz/jni_util.h // moved to ../src_share R src_moz/jni_util_export.cpp // moved to ../src_share R src_moz/jni_util_export.h // moved to ../src_share M src_moz/nsActions.cpp // include ns_util instead of jni_util // also use new util_DeallocateShareContext M src_moz/nsActions.h // include ns_util instead of jni_util A src_moz/ns_util.cpp // include jni_util.h A src_moz/ns_util.h // include jni_util.h, changes to // WebshellInitContext struct A src_moz/ns_util_export.cpp // provide impls for methods in // jni_util_export.h A src_share/Makefile.win A src_share/bal_util.cpp A src_share/bal_util.h A src_share/jni_util.cpp A src_share/jni_util.h A src_share/jni_util_export.cpp A src_share/jni_util_export.h *****CVS exited normally with code 0*****
2000-08-04 01:32:54 +04:00
"<init>", "()V"))) {
return result;
}
}
util_Assert(gPropertiesInitMethodID);
result = ::util_NewGlobalRef(env,
env->NewObject(propertiesClass,
bug=47357 a=edburns r=ashuk This change creates a new directory, java/webclient/src_share, that contains the code that will be used in both src_moz and src_ie, and any other native browser wrapping implementations. Here are the steps I followed to implement this change. 1. Create a new directory java/webclient/src_share 2. Move all jni_util*.* files from src_moz into src_share 3. Make it so src_share compiles into a new .lib src_share has no netscape dependencies. Any functionality that depended on ns dependencies was kept in src_moz. In this case, we have a function prototype only in src_share, with the implementation in src_moz. We did this for nsHashtable. The other trick was for things in WebShellInitContext that had nothing to do with Netscape. This case was accomodated by creating a new struct, ShareInitContext, that contains all WebShellInitContext members that have nothing to do with Netscape. Currently this is just jobject propertiesClass. I modified the WebShellInitContext struct to contain a ShareContext struct as its last member. There are two new methods in jni_util.h that allow for the initialization and deallocation of the members of the ShareContext struct. 4. Make it so src_moz uses the new .lib to provide the jni_util behavior a. Create ns_util* files that include ../src_share/jni_util* files appropriately. The only tricky part was for things in jni_util.h that Here's the list of files in this change. cvs -z3 -n update (in directory D:\Projects\mozilla\java\webclient) cvs server: Updating . M Makefile.win // added src_share to DIRS M src_moz/BookmarksImpl.cpp // include ns_util instead of jni_util M src_moz/CBrowserContainer.cpp // include ns_util instead of jni_util M src_moz/CBrowserContainer.h // include ns_util instead of jni_util M src_moz/CurrentPageImpl.cpp // include ns_util instead of jni_util M src_moz/HistoryImpl.cpp // include ns_util instead of jni_util M src_moz/Makefile.win // include ns_util instead of jni_util M src_moz/NativeEventThread.cpp // include ns_util instead of jni_util M src_moz/NavigationImpl.cpp // include ns_util instead of jni_util M src_moz/RDFEnumeration.cpp // include ns_util instead of jni_util M src_moz/RDFTreeNode.cpp // include ns_util instead of jni_util M src_moz/WindowControlImpl.cpp // include ns_util instead of jni_util // also use new util_InitShareContext // function M src_moz/WrapperFactoryImpl.cpp // include ns_util instead of jni_util R src_moz/jni_util.cpp // moved to ../src_share R src_moz/jni_util.h // moved to ../src_share R src_moz/jni_util_export.cpp // moved to ../src_share R src_moz/jni_util_export.h // moved to ../src_share M src_moz/nsActions.cpp // include ns_util instead of jni_util // also use new util_DeallocateShareContext M src_moz/nsActions.h // include ns_util instead of jni_util A src_moz/ns_util.cpp // include jni_util.h A src_moz/ns_util.h // include jni_util.h, changes to // WebshellInitContext struct A src_moz/ns_util_export.cpp // provide impls for methods in // jni_util_export.h A src_share/Makefile.win A src_share/bal_util.cpp A src_share/bal_util.h A src_share/jni_util.cpp A src_share/jni_util.h A src_share/jni_util_export.cpp A src_share/jni_util_export.h *****CVS exited normally with code 0*****
2000-08-04 01:32:54 +04:00
gPropertiesInitMethodID));
#endif
return result;
}
void util_DestroyPropertiesObject(JNIEnv *env, jobject propertiesObject,
jobject reserved_NotUsed)
{
#ifdef BAL_INTERFACE
if (nsnull != externalDestroyPropertiesObject) {
externalDestroyPropertiesObject(env, propertiesObject,
reserved_NotUsed);
}
#else
::util_DeleteGlobalRef(env, propertiesObject);
#endif
}
void util_ClearPropertiesObject(JNIEnv *env, jobject propertiesObject,
jobject initContextObj)
{
#ifdef BAL_INTERFACE
if (nsnull != externalClearPropertiesObject) {
externalClearPropertiesObject(env, propertiesObject, initContextObj);
}
#else
util_Assert(initContextObj);
ShareInitContext *initContext = (ShareInitContext *) initContextObj;
jclass propertiesClass = nsnull;
if (nsnull == (propertiesClass =
::util_FindClass(env, "java/util/Properties"))) {
return;
}
bug=47357 a=edburns r=ashuk This change creates a new directory, java/webclient/src_share, that contains the code that will be used in both src_moz and src_ie, and any other native browser wrapping implementations. Here are the steps I followed to implement this change. 1. Create a new directory java/webclient/src_share 2. Move all jni_util*.* files from src_moz into src_share 3. Make it so src_share compiles into a new .lib src_share has no netscape dependencies. Any functionality that depended on ns dependencies was kept in src_moz. In this case, we have a function prototype only in src_share, with the implementation in src_moz. We did this for nsHashtable. The other trick was for things in WebShellInitContext that had nothing to do with Netscape. This case was accomodated by creating a new struct, ShareInitContext, that contains all WebShellInitContext members that have nothing to do with Netscape. Currently this is just jobject propertiesClass. I modified the WebShellInitContext struct to contain a ShareContext struct as its last member. There are two new methods in jni_util.h that allow for the initialization and deallocation of the members of the ShareContext struct. 4. Make it so src_moz uses the new .lib to provide the jni_util behavior a. Create ns_util* files that include ../src_share/jni_util* files appropriately. The only tricky part was for things in jni_util.h that Here's the list of files in this change. cvs -z3 -n update (in directory D:\Projects\mozilla\java\webclient) cvs server: Updating . M Makefile.win // added src_share to DIRS M src_moz/BookmarksImpl.cpp // include ns_util instead of jni_util M src_moz/CBrowserContainer.cpp // include ns_util instead of jni_util M src_moz/CBrowserContainer.h // include ns_util instead of jni_util M src_moz/CurrentPageImpl.cpp // include ns_util instead of jni_util M src_moz/HistoryImpl.cpp // include ns_util instead of jni_util M src_moz/Makefile.win // include ns_util instead of jni_util M src_moz/NativeEventThread.cpp // include ns_util instead of jni_util M src_moz/NavigationImpl.cpp // include ns_util instead of jni_util M src_moz/RDFEnumeration.cpp // include ns_util instead of jni_util M src_moz/RDFTreeNode.cpp // include ns_util instead of jni_util M src_moz/WindowControlImpl.cpp // include ns_util instead of jni_util // also use new util_InitShareContext // function M src_moz/WrapperFactoryImpl.cpp // include ns_util instead of jni_util R src_moz/jni_util.cpp // moved to ../src_share R src_moz/jni_util.h // moved to ../src_share R src_moz/jni_util_export.cpp // moved to ../src_share R src_moz/jni_util_export.h // moved to ../src_share M src_moz/nsActions.cpp // include ns_util instead of jni_util // also use new util_DeallocateShareContext M src_moz/nsActions.h // include ns_util instead of jni_util A src_moz/ns_util.cpp // include jni_util.h A src_moz/ns_util.h // include jni_util.h, changes to // WebshellInitContext struct A src_moz/ns_util_export.cpp // provide impls for methods in // jni_util_export.h A src_share/Makefile.win A src_share/bal_util.cpp A src_share/bal_util.h A src_share/jni_util.cpp A src_share/jni_util.h A src_share/jni_util_export.cpp A src_share/jni_util_export.h *****CVS exited normally with code 0*****
2000-08-04 01:32:54 +04:00
if (nsnull == gPropertiesClearMethodID) {
if (nsnull == (gPropertiesClearMethodID =
env->GetMethodID(propertiesClass, "clear", "()V"))) {
bug=47357 a=edburns r=ashuk This change creates a new directory, java/webclient/src_share, that contains the code that will be used in both src_moz and src_ie, and any other native browser wrapping implementations. Here are the steps I followed to implement this change. 1. Create a new directory java/webclient/src_share 2. Move all jni_util*.* files from src_moz into src_share 3. Make it so src_share compiles into a new .lib src_share has no netscape dependencies. Any functionality that depended on ns dependencies was kept in src_moz. In this case, we have a function prototype only in src_share, with the implementation in src_moz. We did this for nsHashtable. The other trick was for things in WebShellInitContext that had nothing to do with Netscape. This case was accomodated by creating a new struct, ShareInitContext, that contains all WebShellInitContext members that have nothing to do with Netscape. Currently this is just jobject propertiesClass. I modified the WebShellInitContext struct to contain a ShareContext struct as its last member. There are two new methods in jni_util.h that allow for the initialization and deallocation of the members of the ShareContext struct. 4. Make it so src_moz uses the new .lib to provide the jni_util behavior a. Create ns_util* files that include ../src_share/jni_util* files appropriately. The only tricky part was for things in jni_util.h that Here's the list of files in this change. cvs -z3 -n update (in directory D:\Projects\mozilla\java\webclient) cvs server: Updating . M Makefile.win // added src_share to DIRS M src_moz/BookmarksImpl.cpp // include ns_util instead of jni_util M src_moz/CBrowserContainer.cpp // include ns_util instead of jni_util M src_moz/CBrowserContainer.h // include ns_util instead of jni_util M src_moz/CurrentPageImpl.cpp // include ns_util instead of jni_util M src_moz/HistoryImpl.cpp // include ns_util instead of jni_util M src_moz/Makefile.win // include ns_util instead of jni_util M src_moz/NativeEventThread.cpp // include ns_util instead of jni_util M src_moz/NavigationImpl.cpp // include ns_util instead of jni_util M src_moz/RDFEnumeration.cpp // include ns_util instead of jni_util M src_moz/RDFTreeNode.cpp // include ns_util instead of jni_util M src_moz/WindowControlImpl.cpp // include ns_util instead of jni_util // also use new util_InitShareContext // function M src_moz/WrapperFactoryImpl.cpp // include ns_util instead of jni_util R src_moz/jni_util.cpp // moved to ../src_share R src_moz/jni_util.h // moved to ../src_share R src_moz/jni_util_export.cpp // moved to ../src_share R src_moz/jni_util_export.h // moved to ../src_share M src_moz/nsActions.cpp // include ns_util instead of jni_util // also use new util_DeallocateShareContext M src_moz/nsActions.h // include ns_util instead of jni_util A src_moz/ns_util.cpp // include jni_util.h A src_moz/ns_util.h // include jni_util.h, changes to // WebshellInitContext struct A src_moz/ns_util_export.cpp // provide impls for methods in // jni_util_export.h A src_share/Makefile.win A src_share/bal_util.cpp A src_share/bal_util.h A src_share/jni_util.cpp A src_share/jni_util.h A src_share/jni_util_export.cpp A src_share/jni_util_export.h *****CVS exited normally with code 0*****
2000-08-04 01:32:54 +04:00
return;
}
}
util_Assert(gPropertiesClearMethodID);
env->CallVoidMethod(propertiesObject, gPropertiesClearMethodID);
return;
#endif
}
void util_StoreIntoPropertiesObject(JNIEnv *env, jobject propertiesObject,
jobject name, jobject value,
jobject initContextObj)
{
#ifdef BAL_INTERFACE
if (nsnull != externalStoreIntoPropertiesObject) {
externalStoreIntoPropertiesObject(env, propertiesObject, name, value,
initContextObj);
}
#else
util_Assert(initContextObj);
ShareInitContext *initContext = (ShareInitContext *) initContextObj;
jclass propertiesClass = nsnull;
if (nsnull == (propertiesClass =
::util_FindClass(env, "java/util/Properties"))) {
return;
}
bug=47357 a=edburns r=ashuk This change creates a new directory, java/webclient/src_share, that contains the code that will be used in both src_moz and src_ie, and any other native browser wrapping implementations. Here are the steps I followed to implement this change. 1. Create a new directory java/webclient/src_share 2. Move all jni_util*.* files from src_moz into src_share 3. Make it so src_share compiles into a new .lib src_share has no netscape dependencies. Any functionality that depended on ns dependencies was kept in src_moz. In this case, we have a function prototype only in src_share, with the implementation in src_moz. We did this for nsHashtable. The other trick was for things in WebShellInitContext that had nothing to do with Netscape. This case was accomodated by creating a new struct, ShareInitContext, that contains all WebShellInitContext members that have nothing to do with Netscape. Currently this is just jobject propertiesClass. I modified the WebShellInitContext struct to contain a ShareContext struct as its last member. There are two new methods in jni_util.h that allow for the initialization and deallocation of the members of the ShareContext struct. 4. Make it so src_moz uses the new .lib to provide the jni_util behavior a. Create ns_util* files that include ../src_share/jni_util* files appropriately. The only tricky part was for things in jni_util.h that Here's the list of files in this change. cvs -z3 -n update (in directory D:\Projects\mozilla\java\webclient) cvs server: Updating . M Makefile.win // added src_share to DIRS M src_moz/BookmarksImpl.cpp // include ns_util instead of jni_util M src_moz/CBrowserContainer.cpp // include ns_util instead of jni_util M src_moz/CBrowserContainer.h // include ns_util instead of jni_util M src_moz/CurrentPageImpl.cpp // include ns_util instead of jni_util M src_moz/HistoryImpl.cpp // include ns_util instead of jni_util M src_moz/Makefile.win // include ns_util instead of jni_util M src_moz/NativeEventThread.cpp // include ns_util instead of jni_util M src_moz/NavigationImpl.cpp // include ns_util instead of jni_util M src_moz/RDFEnumeration.cpp // include ns_util instead of jni_util M src_moz/RDFTreeNode.cpp // include ns_util instead of jni_util M src_moz/WindowControlImpl.cpp // include ns_util instead of jni_util // also use new util_InitShareContext // function M src_moz/WrapperFactoryImpl.cpp // include ns_util instead of jni_util R src_moz/jni_util.cpp // moved to ../src_share R src_moz/jni_util.h // moved to ../src_share R src_moz/jni_util_export.cpp // moved to ../src_share R src_moz/jni_util_export.h // moved to ../src_share M src_moz/nsActions.cpp // include ns_util instead of jni_util // also use new util_DeallocateShareContext M src_moz/nsActions.h // include ns_util instead of jni_util A src_moz/ns_util.cpp // include jni_util.h A src_moz/ns_util.h // include jni_util.h, changes to // WebshellInitContext struct A src_moz/ns_util_export.cpp // provide impls for methods in // jni_util_export.h A src_share/Makefile.win A src_share/bal_util.cpp A src_share/bal_util.h A src_share/jni_util.cpp A src_share/jni_util.h A src_share/jni_util_export.cpp A src_share/jni_util_export.h *****CVS exited normally with code 0*****
2000-08-04 01:32:54 +04:00
if (nsnull == gPropertiesSetPropertyMethodID) {
if (nsnull == (gPropertiesSetPropertyMethodID =
env->GetMethodID(propertiesClass,
bug=47357 a=edburns r=ashuk This change creates a new directory, java/webclient/src_share, that contains the code that will be used in both src_moz and src_ie, and any other native browser wrapping implementations. Here are the steps I followed to implement this change. 1. Create a new directory java/webclient/src_share 2. Move all jni_util*.* files from src_moz into src_share 3. Make it so src_share compiles into a new .lib src_share has no netscape dependencies. Any functionality that depended on ns dependencies was kept in src_moz. In this case, we have a function prototype only in src_share, with the implementation in src_moz. We did this for nsHashtable. The other trick was for things in WebShellInitContext that had nothing to do with Netscape. This case was accomodated by creating a new struct, ShareInitContext, that contains all WebShellInitContext members that have nothing to do with Netscape. Currently this is just jobject propertiesClass. I modified the WebShellInitContext struct to contain a ShareContext struct as its last member. There are two new methods in jni_util.h that allow for the initialization and deallocation of the members of the ShareContext struct. 4. Make it so src_moz uses the new .lib to provide the jni_util behavior a. Create ns_util* files that include ../src_share/jni_util* files appropriately. The only tricky part was for things in jni_util.h that Here's the list of files in this change. cvs -z3 -n update (in directory D:\Projects\mozilla\java\webclient) cvs server: Updating . M Makefile.win // added src_share to DIRS M src_moz/BookmarksImpl.cpp // include ns_util instead of jni_util M src_moz/CBrowserContainer.cpp // include ns_util instead of jni_util M src_moz/CBrowserContainer.h // include ns_util instead of jni_util M src_moz/CurrentPageImpl.cpp // include ns_util instead of jni_util M src_moz/HistoryImpl.cpp // include ns_util instead of jni_util M src_moz/Makefile.win // include ns_util instead of jni_util M src_moz/NativeEventThread.cpp // include ns_util instead of jni_util M src_moz/NavigationImpl.cpp // include ns_util instead of jni_util M src_moz/RDFEnumeration.cpp // include ns_util instead of jni_util M src_moz/RDFTreeNode.cpp // include ns_util instead of jni_util M src_moz/WindowControlImpl.cpp // include ns_util instead of jni_util // also use new util_InitShareContext // function M src_moz/WrapperFactoryImpl.cpp // include ns_util instead of jni_util R src_moz/jni_util.cpp // moved to ../src_share R src_moz/jni_util.h // moved to ../src_share R src_moz/jni_util_export.cpp // moved to ../src_share R src_moz/jni_util_export.h // moved to ../src_share M src_moz/nsActions.cpp // include ns_util instead of jni_util // also use new util_DeallocateShareContext M src_moz/nsActions.h // include ns_util instead of jni_util A src_moz/ns_util.cpp // include jni_util.h A src_moz/ns_util.h // include jni_util.h, changes to // WebshellInitContext struct A src_moz/ns_util_export.cpp // provide impls for methods in // jni_util_export.h A src_share/Makefile.win A src_share/bal_util.cpp A src_share/bal_util.h A src_share/jni_util.cpp A src_share/jni_util.h A src_share/jni_util_export.cpp A src_share/jni_util_export.h *****CVS exited normally with code 0*****
2000-08-04 01:32:54 +04:00
"setProperty",
"(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/Object;"))) {
return;
}
}
util_Assert(gPropertiesSetPropertyMethodID);
env->CallObjectMethod(propertiesObject, gPropertiesSetPropertyMethodID,
name, value);
#endif
}
jobject util_GetFromPropertiesObject(JNIEnv *env, jobject propertiesObject,
jobject name, jobject initContextObj)
{
jobject result = nsnull;
#ifdef BAL_INTERFACE
if (nsnull != externalGetFromPropertiesObject) {
result = externalGetFromPropertiesObject(env, propertiesObject, name,
initContextObj);
}
#else
util_Assert(initContextObj);
ShareInitContext *initContext = (ShareInitContext *) initContextObj;
jclass propertiesClass = nsnull;
if (nsnull == (propertiesClass =
::util_FindClass(env, "java/util/Properties"))) {
return result;
}
if (nsnull == gPropertiesGetPropertyMethodID) {
if (nsnull == (gPropertiesGetPropertyMethodID =
env->GetMethodID(propertiesClass,
"getProperty",
"(Ljava/lang/String;)Ljava/lang/String;"))) {
return result;
}
}
util_Assert(gPropertiesGetPropertyMethodID);
result = env->CallObjectMethod(propertiesObject,
gPropertiesGetPropertyMethodID, name);
#endif
return result;
}
jboolean util_GetBoolFromPropertiesObject(JNIEnv *env,
jobject propertiesObject,
jobject name, jobject reserved)
{
jboolean result = JNI_FALSE;
jstring stringResult = nsnull;
if (nsnull == (stringResult = (jstring)
util_GetFromPropertiesObject(env, propertiesObject,
name, reserved))) {
return result;
}
#ifdef BAL_INTERFACE
// PENDING(edburns): make it so there is a way to convert from
// string to boolean
#else
jclass clazz;
jmethodID valueOfMethodID;
jmethodID booleanValueMethodID;
jobject boolInstance;
if (nsnull == (clazz = ::util_FindClass(env, "java/lang/Boolean"))) {
return result;
}
if (nsnull == (valueOfMethodID =
env->GetStaticMethodID(clazz,"valueOf",
"(Ljava/lang/String;)Ljava/lang/Boolean;"))) {
return result;
}
if (nsnull == (boolInstance = env->CallStaticObjectMethod(clazz,
valueOfMethodID,
stringResult))) {
return result;
}
// now call booleanValue
if (nsnull == (booleanValueMethodID = env->GetMethodID(clazz,
"booleanValue",
"()Z"))) {
return result;
}
result = env->CallBooleanMethod(boolInstance, booleanValueMethodID);
#endif
return result;
}
jint util_GetIntFromPropertiesObject(JNIEnv *env, jobject propertiesObject,
jobject name, jobject reserved)
{
jint result = -1;
jstring stringResult = nsnull;
if (nsnull == (stringResult = (jstring)
util_GetFromPropertiesObject(env, propertiesObject, name,
reserved))) {
return result;
}
#ifdef BAL_INTERFACE
// PENDING(edburns): make it so there is a way to convert from
// string to int
#else
jclass clazz;
jmethodID valueOfMethodID, intValueMethodID;
jobject integer;
if (nsnull == (clazz = ::util_FindClass(env, "java/lang/Integer"))) {
return result;
}
if (nsnull == (valueOfMethodID =
env->GetStaticMethodID(clazz, "valueOf",
"(Ljava/lang/String;)Ljava/lang/Integer;"))) {
return result;
}
if (nsnull == (integer = env->CallStaticObjectMethod(clazz,
valueOfMethodID,
stringResult))) {
return result;
}
// now call intValue
if (nsnull == (intValueMethodID = env->GetMethodID(clazz, "intValue",
"()I"))) {
return result;
}
result = env->CallIntMethod(integer, intValueMethodID);
#endif
return result;
}
This is a checkpoint milestone for webclient 2.0. Webclient currently doesn't run, but several unit tests for webclient do. I'll be proceeding through the rest of the webclient interfaces, building junit tests as I go, in the coming months. I hope to flesh out the basic framework, then publish build instructions, and hopefully I can get some contributions from the community. M util/classes/org/mozilla/util/Utilities.java new method: getImplFromServices: + * + * <p>This method tries to load the resource + * <code>META-INF/services/&gt;interfaceClassName&gt;</code>, where + * <code>&gt;interfaceClassName&lt;</code> is the argument to this + * method. If the resource is found, interpret it as a + * <code>Properties</code> file and read out its first line. + * Interpret the first line as the fully qualified class name of a + * class that implements <code></code>. The named class must have a + * public no-arg constructor.</p> M webclient/build-tests.xml - junit testcases for Webclient APIs, developed using test-first. M webclient/build.xml - changes for new package name structure: packages org.mozilla.webclient.{wrapper_native, wrapper_non_native} have gone away. Replaced with org.mozilla.webclient.impl.{wrapper_native, wrapper_non_native} - changes to accomodate "Services" based approach for pluggable webclient implementation. - don't bother re-naming the javah generated files, just let javah pick the names. - pass debugging args from build.properties - changed name of junit test target to "test". M webclient/classes_spec/org/mozilla/webclient/BrowserControl.java - got rid of BROWSER_TYPE. No longer necessary due to the new pluggability mechanism. M webclient/classes_spec/org/mozilla/webclient/BrowserControlFactory.java - Leverage the org.mozilla.util.Utilities.getImplFromServices() mechanism to allow a vendor-pluggable webclient implementation of the new "WebclientFactory" interface, which is method for method compatible with BrowserControlFactory. Make all BrowserControlFactory methods call through to methods on the vendor provided WebclientFactory implementation. R webclient/classes_spec/org/mozilla/webclient/BrowserControlFactoryInterface.java A webclient/classes_spec/org/mozilla/webclient/BrowserControlICE.java R webclient/classes_spec/org/mozilla/webclient/BrowserControlImpl.java R webclient/classes_spec/org/mozilla/webclient/BrowserType.java - move all implementation specific classe to the impl package. M webclient/classes_spec/org/mozilla/webclient/ImplObject.java - ImplObject shouldn't depend on vendor private classes. M webclient/classes_spec/org/mozilla/webclient/Preferences.java - new method + public void unregisterPrefChangedCallback(PrefChangedCallback cb, + String prefName, Object closure); M webclient/classes_spec/org/mozilla/webclient/ProfileManager.java - properly specify this interface. A webclient/classes_spec/org/mozilla/webclient/WebclientFactory.java * <p>This interface allows a pluggable webclient API implementation. * The static methods in {@link BrowserControlFactory} call through to * methods on this interface. Please see {@link BrowserControlFactory} * for information on how to hook up your <code>WebclientFactory</code> * implementation to the <code>BrowserControlFactory</code></p> R webclient/classes_spec/org/mozilla/webclient/WrapperFactory.java R webclient/classes_spec/org/mozilla/webclient/impl/BrowserControlFactoryImpl.java - moved these to the impl class A webclient/classes_spec/org/mozilla/webclient/impl/BrowserControlImpl.java A webclient/classes_spec/org/mozilla/webclient/impl/Service.java A webclient/classes_spec/org/mozilla/webclient/impl/WebclientFactoryImpl.java A webclient/classes_spec/org/mozilla/webclient/impl/WrapperFactory.java A webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/BookmarkEntryImpl.java A webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/BookmarksImpl.java A webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/CurrentPageImpl.java A webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/EventRegistrationImpl.java A webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/HistoryImpl.java A webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/ISupportsPeer.java A webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/ImplObjectNative.java A webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/NativeEventThread.java A webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/NavigationImpl.java A webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/PreferencesImpl.java A webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/ProfileManagerImpl.java A webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/RDFEnumeration.java A webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/RDFTreeNode.java A webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/SelectionImpl.java A webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/WCEventListenerWrapper.java A webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/WCMouseListenerImpl.java A webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/WindowControlImpl.java A webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/WrapperFactoryImpl.java A webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/gtk/GtkBrowserControlCanvas.java A webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/win32/Win32BrowserControlCanvas.java - copied from old package naming scheme. - lots and lots of cleanup. R webclient/classes_spec/org/mozilla/webclient/wrapper_native/BookmarkEntryImpl.java R webclient/classes_spec/org/mozilla/webclient/wrapper_native/BookmarksImpl.java R webclient/classes_spec/org/mozilla/webclient/wrapper_native/CurrentPageImpl.java R webclient/classes_spec/org/mozilla/webclient/wrapper_native/EventRegistrationImpl.java R webclient/classes_spec/org/mozilla/webclient/wrapper_native/HistoryImpl.java R webclient/classes_spec/org/mozilla/webclient/wrapper_native/ISupportsPeer.java R webclient/classes_spec/org/mozilla/webclient/wrapper_native/ImplObjectNative.java R webclient/classes_spec/org/mozilla/webclient/wrapper_native/NativeEventThread.java R webclient/classes_spec/org/mozilla/webclient/wrapper_native/NavigationImpl.java R webclient/classes_spec/org/mozilla/webclient/wrapper_native/PreferencesImpl.java R webclient/classes_spec/org/mozilla/webclient/wrapper_native/ProfileManagerImpl.java R webclient/classes_spec/org/mozilla/webclient/wrapper_native/RDFEnumeration.java R webclient/classes_spec/org/mozilla/webclient/wrapper_native/RDFTreeNode.java A webclient/classes_spec/org/mozilla/webclient/wrapper_native/README R webclient/classes_spec/org/mozilla/webclient/wrapper_native/SelectionImpl.java R webclient/classes_spec/org/mozilla/webclient/wrapper_native/WCEventListenerWrapper.java R webclient/classes_spec/org/mozilla/webclient/wrapper_native/WCMouseListenerImpl.java R webclient/classes_spec/org/mozilla/webclient/wrapper_native/WindowControlImpl.java R webclient/classes_spec/org/mozilla/webclient/wrapper_native/WrapperFactoryImpl.java R webclient/classes_spec/org/mozilla/webclient/wrapper_native/gtk/GtkBrowserControlCanvas.java R webclient/classes_spec/org/mozilla/webclient/wrapper_native/win32/Win32BrowserControlCanvas.java - removed from old package naming scheme M webclient/src_moz/BookmarksImpl.cpp - remove dependency on RDFActionEvents by inlining all the code that formerly was in the events. - package name change - JNI include file name change M webclient/src_moz/CurrentPageImpl.cpp M webclient/src_moz/HistoryImpl.cpp M webclient/src_moz/ISupportsPeer.cpp - package name change - JNI include file name change M webclient/src_moz/Makefile.in - get rid of PreferencesActionEvents.cpp and RDFActionEvents.cpp - add ProfileManagerImpl.cpp M webclient/src_moz/NativeEventThread.cpp - this file is not done yet. I've been pulling misplaced initialization stuff out of here and putting it into WrapperFactoryImpl.cpp. - got rid of gComponentManager, since we can use do_CreateInstance instead. - package name change - JNI include file name change M webclient/src_moz/NativeEventThreadActionEvents.h - JNI include file name change M webclient/src_moz/NavigationImpl.cpp - package name change - JNI include file name change R webclient/src_moz/PreferencesActionEvents.cpp R webclient/src_moz/PreferencesActionEvents.h - don't need these anymore! woohoo! M webclient/src_moz/PreferencesImpl.cpp - remove dependency on PreferencesActionEvents by inlining code into the methods that used to use the events. A webclient/src_moz/ProfileManagerImpl.cpp - new class, implementation of the ProfileManager interface. M webclient/src_moz/PromptActionEvents.cpp - change erroneous comment so my grep performed correctly. R webclient/src_moz/RDFActionEvents.cpp R webclient/src_moz/RDFActionEvents.h - don't need these anymore! woohoo! M webclient/src_moz/RDFEnumeration.cpp M webclient/src_moz/RDFTreeNode.cpp - remove dependency on RDFActionEvents by inlining code into the methods that used to use the events. M webclient/src_moz/WindowControlActionEvents.cpp - deallocate shareInitiContext. M webclient/src_moz/WindowControlImpl.cpp - package name change - JNI include file name change - remove the "sleep so I can attach gdb" code. Moved to WrapperFactoryImpl.cpp. M webclient/src_moz/WrapperFactoryImpl.cpp - lots of changes. This is now where the app initialization and shutdown happens, M webclient/src_moz/dom_util.cpp - comment change M webclient/src_moz/ns_globals.h - get rid of inappropriate global usage. M webclient/src_moz/ns_util.h - new struct WebclientContext for singletons. M webclient/src_moz/rdf_util.cpp - new methods, rdf_startup and rdf_shutdown. - replace calls to nsComponentManager::CreateInstance() with do_CreateInstance(). M webclient/src_moz/rdf_util.h - new methods, rdf_startup and rdf_shutdown. M webclient/src_moz/gtk/GtkBrowserControlCanvas.cpp - package name change - JNI include file name change M webclient/src_moz/gtk/GtkBrowserControlCanvasStub.cpp - package name change - JNI include file name change - this file isn't needed anymore, thankfully! I'll remove it soon. M webclient/src_moz/gtk/StubFunctions.h - package name change - JNI include file name change - this file isn't needed anymore, thankfully! I'll remove it soon. M webclient/src_moz/motif/BrowserControlNativeShimStub.cpp M webclient/src_moz/motif/MotifBrowserControlCanvas.cpp M webclient/src_moz/motif/MotifBrowserControlCanvasStub.cpp M webclient/src_moz/motif/NativeLoaderStub.cpp M webclient/src_moz/win32/Win32BrowserControlCanvas.cpp - package name change - JNI include file name change M webclient/src_share/jni_util.cpp M webclient/src_share/jni_util.h - util_InitializeShareInitContext() takes a JNIEnv *. - new methods +void util_DeleteGlobalRef(JNIEnv *env, jobject toDeleteRef); +void util_DeleteLocalRef(JNIEnv *env, jobject toDeleteRef); +void util_getSystemProperty(JNIEnv *env, + const char *propName, + char *propValue, + jint propValueLen); M webclient/src_share/jni_util_export.cpp M webclient/src_share/jni_util_export.h +JNIEXPORT jobjectArray util_GetJstringArrayFromJcharArray(JNIEnv *env, + jint len, + jchar **strings, + jint *stringLengths) A webclient/test/automated/src/classes/org/mozilla/webclient/BookmarksTest.java R webclient/test/automated/src/classes/org/mozilla/webclient/BrowserControlFactoryTest.java A webclient/test/automated/src/classes/org/mozilla/webclient/PreferencesTest.java A webclient/test/automated/src/classes/org/mozilla/webclient/ProfileManagerTest.java A webclient/test/automated/src/classes/org/mozilla/webclient/impl/WebclientFactoryImplTest.java A webclient/test/automated/src/classes/org/mozilla/webclient/impl/wrapper_native/WrapperFactoryImplTest.java A webclient/test/automated/src/classes/org/mozilla/webclient/impl/wrapper_native/gtk/TestGtkBrowserControlCanvas.java R webclient/test/automated/src/classes/org/mozilla/webclient/wrapper_native/gtk/TestGtkBrowserControlCanvas.java A webclient/test/automated/src/test/BrowserControlFactoryTest_correct - junit tests! TEST FIRST!
2003-09-28 10:29:22 +04:00
void util_getSystemProperty(JNIEnv *env,
const char *propName,
char *propValue, jint propValueLen)
{
jstring
resultJstr = nsnull,
propNameJstr = ::util_NewStringUTF(env, propName);
jclass clazz = nsnull;
jmethodID getPropertyMethodId;
const char * result = nsnull;
int i = 0;
memset(propValue, nsnull, propValueLen);
if (nsnull == (clazz = ::util_FindClass(env, "java/lang/System"))) {
return;
}
if (nsnull == (getPropertyMethodId =
env->GetStaticMethodID(clazz, "getProperty",
"(Ljava/lang/String;)Ljava/lang/String;"))) {
return;
}
if (nsnull ==
(resultJstr = (jstring) env->CallStaticObjectMethod(clazz,
getPropertyMethodId,
propNameJstr))) {
return;
}
::util_DeleteStringUTF(env, propNameJstr);
result = ::util_GetStringUTFChars(env, resultJstr);
strncpy(propValue, result, propValueLen - 1);
::util_ReleaseStringUTFChars(env, resultJstr, result);
return;
}
bug=47357 a=edburns r=ashuk This change creates a new directory, java/webclient/src_share, that contains the code that will be used in both src_moz and src_ie, and any other native browser wrapping implementations. Here are the steps I followed to implement this change. 1. Create a new directory java/webclient/src_share 2. Move all jni_util*.* files from src_moz into src_share 3. Make it so src_share compiles into a new .lib src_share has no netscape dependencies. Any functionality that depended on ns dependencies was kept in src_moz. In this case, we have a function prototype only in src_share, with the implementation in src_moz. We did this for nsHashtable. The other trick was for things in WebShellInitContext that had nothing to do with Netscape. This case was accomodated by creating a new struct, ShareInitContext, that contains all WebShellInitContext members that have nothing to do with Netscape. Currently this is just jobject propertiesClass. I modified the WebShellInitContext struct to contain a ShareContext struct as its last member. There are two new methods in jni_util.h that allow for the initialization and deallocation of the members of the ShareContext struct. 4. Make it so src_moz uses the new .lib to provide the jni_util behavior a. Create ns_util* files that include ../src_share/jni_util* files appropriately. The only tricky part was for things in jni_util.h that Here's the list of files in this change. cvs -z3 -n update (in directory D:\Projects\mozilla\java\webclient) cvs server: Updating . M Makefile.win // added src_share to DIRS M src_moz/BookmarksImpl.cpp // include ns_util instead of jni_util M src_moz/CBrowserContainer.cpp // include ns_util instead of jni_util M src_moz/CBrowserContainer.h // include ns_util instead of jni_util M src_moz/CurrentPageImpl.cpp // include ns_util instead of jni_util M src_moz/HistoryImpl.cpp // include ns_util instead of jni_util M src_moz/Makefile.win // include ns_util instead of jni_util M src_moz/NativeEventThread.cpp // include ns_util instead of jni_util M src_moz/NavigationImpl.cpp // include ns_util instead of jni_util M src_moz/RDFEnumeration.cpp // include ns_util instead of jni_util M src_moz/RDFTreeNode.cpp // include ns_util instead of jni_util M src_moz/WindowControlImpl.cpp // include ns_util instead of jni_util // also use new util_InitShareContext // function M src_moz/WrapperFactoryImpl.cpp // include ns_util instead of jni_util R src_moz/jni_util.cpp // moved to ../src_share R src_moz/jni_util.h // moved to ../src_share R src_moz/jni_util_export.cpp // moved to ../src_share R src_moz/jni_util_export.h // moved to ../src_share M src_moz/nsActions.cpp // include ns_util instead of jni_util // also use new util_DeallocateShareContext M src_moz/nsActions.h // include ns_util instead of jni_util A src_moz/ns_util.cpp // include jni_util.h A src_moz/ns_util.h // include jni_util.h, changes to // WebshellInitContext struct A src_moz/ns_util_export.cpp // provide impls for methods in // jni_util_export.h A src_share/Makefile.win A src_share/bal_util.cpp A src_share/bal_util.h A src_share/jni_util.cpp A src_share/jni_util.h A src_share/jni_util_export.cpp A src_share/jni_util_export.h *****CVS exited normally with code 0*****
2000-08-04 01:32:54 +04:00
JNIEXPORT jvalue JNICALL
JNU_CallMethodByName(JNIEnv *env,
jboolean *hasException,
jobject obj,
const char *name,
const char *signature,
...)
{
jvalue result;
va_list args;
va_start(args, signature);
result = JNU_CallMethodByNameV(env, hasException, obj, name, signature,
args);
va_end(args);
return result;
}
JNIEXPORT jvalue JNICALL
JNU_CallMethodByNameV(JNIEnv *env,
jboolean *hasException,
jobject obj,
const char *name,
const char *signature,
va_list args)
{
jclass clazz;
jmethodID mid;
jvalue result;
const char *p = signature;
/* find out the return type */
while (*p && *p != ')')
p++;
p++;
result.i = 0;
#ifdef JNI_VERSION_1_2
bug=47357 a=edburns r=ashuk This change creates a new directory, java/webclient/src_share, that contains the code that will be used in both src_moz and src_ie, and any other native browser wrapping implementations. Here are the steps I followed to implement this change. 1. Create a new directory java/webclient/src_share 2. Move all jni_util*.* files from src_moz into src_share 3. Make it so src_share compiles into a new .lib src_share has no netscape dependencies. Any functionality that depended on ns dependencies was kept in src_moz. In this case, we have a function prototype only in src_share, with the implementation in src_moz. We did this for nsHashtable. The other trick was for things in WebShellInitContext that had nothing to do with Netscape. This case was accomodated by creating a new struct, ShareInitContext, that contains all WebShellInitContext members that have nothing to do with Netscape. Currently this is just jobject propertiesClass. I modified the WebShellInitContext struct to contain a ShareContext struct as its last member. There are two new methods in jni_util.h that allow for the initialization and deallocation of the members of the ShareContext struct. 4. Make it so src_moz uses the new .lib to provide the jni_util behavior a. Create ns_util* files that include ../src_share/jni_util* files appropriately. The only tricky part was for things in jni_util.h that Here's the list of files in this change. cvs -z3 -n update (in directory D:\Projects\mozilla\java\webclient) cvs server: Updating . M Makefile.win // added src_share to DIRS M src_moz/BookmarksImpl.cpp // include ns_util instead of jni_util M src_moz/CBrowserContainer.cpp // include ns_util instead of jni_util M src_moz/CBrowserContainer.h // include ns_util instead of jni_util M src_moz/CurrentPageImpl.cpp // include ns_util instead of jni_util M src_moz/HistoryImpl.cpp // include ns_util instead of jni_util M src_moz/Makefile.win // include ns_util instead of jni_util M src_moz/NativeEventThread.cpp // include ns_util instead of jni_util M src_moz/NavigationImpl.cpp // include ns_util instead of jni_util M src_moz/RDFEnumeration.cpp // include ns_util instead of jni_util M src_moz/RDFTreeNode.cpp // include ns_util instead of jni_util M src_moz/WindowControlImpl.cpp // include ns_util instead of jni_util // also use new util_InitShareContext // function M src_moz/WrapperFactoryImpl.cpp // include ns_util instead of jni_util R src_moz/jni_util.cpp // moved to ../src_share R src_moz/jni_util.h // moved to ../src_share R src_moz/jni_util_export.cpp // moved to ../src_share R src_moz/jni_util_export.h // moved to ../src_share M src_moz/nsActions.cpp // include ns_util instead of jni_util // also use new util_DeallocateShareContext M src_moz/nsActions.h // include ns_util instead of jni_util A src_moz/ns_util.cpp // include jni_util.h A src_moz/ns_util.h // include jni_util.h, changes to // WebshellInitContext struct A src_moz/ns_util_export.cpp // provide impls for methods in // jni_util_export.h A src_share/Makefile.win A src_share/bal_util.cpp A src_share/bal_util.h A src_share/jni_util.cpp A src_share/jni_util.h A src_share/jni_util_export.cpp A src_share/jni_util_export.h *****CVS exited normally with code 0*****
2000-08-04 01:32:54 +04:00
if (env->EnsureLocalCapacity(3) < 0)
goto done2;
#endif
bug=47357 a=edburns r=ashuk This change creates a new directory, java/webclient/src_share, that contains the code that will be used in both src_moz and src_ie, and any other native browser wrapping implementations. Here are the steps I followed to implement this change. 1. Create a new directory java/webclient/src_share 2. Move all jni_util*.* files from src_moz into src_share 3. Make it so src_share compiles into a new .lib src_share has no netscape dependencies. Any functionality that depended on ns dependencies was kept in src_moz. In this case, we have a function prototype only in src_share, with the implementation in src_moz. We did this for nsHashtable. The other trick was for things in WebShellInitContext that had nothing to do with Netscape. This case was accomodated by creating a new struct, ShareInitContext, that contains all WebShellInitContext members that have nothing to do with Netscape. Currently this is just jobject propertiesClass. I modified the WebShellInitContext struct to contain a ShareContext struct as its last member. There are two new methods in jni_util.h that allow for the initialization and deallocation of the members of the ShareContext struct. 4. Make it so src_moz uses the new .lib to provide the jni_util behavior a. Create ns_util* files that include ../src_share/jni_util* files appropriately. The only tricky part was for things in jni_util.h that Here's the list of files in this change. cvs -z3 -n update (in directory D:\Projects\mozilla\java\webclient) cvs server: Updating . M Makefile.win // added src_share to DIRS M src_moz/BookmarksImpl.cpp // include ns_util instead of jni_util M src_moz/CBrowserContainer.cpp // include ns_util instead of jni_util M src_moz/CBrowserContainer.h // include ns_util instead of jni_util M src_moz/CurrentPageImpl.cpp // include ns_util instead of jni_util M src_moz/HistoryImpl.cpp // include ns_util instead of jni_util M src_moz/Makefile.win // include ns_util instead of jni_util M src_moz/NativeEventThread.cpp // include ns_util instead of jni_util M src_moz/NavigationImpl.cpp // include ns_util instead of jni_util M src_moz/RDFEnumeration.cpp // include ns_util instead of jni_util M src_moz/RDFTreeNode.cpp // include ns_util instead of jni_util M src_moz/WindowControlImpl.cpp // include ns_util instead of jni_util // also use new util_InitShareContext // function M src_moz/WrapperFactoryImpl.cpp // include ns_util instead of jni_util R src_moz/jni_util.cpp // moved to ../src_share R src_moz/jni_util.h // moved to ../src_share R src_moz/jni_util_export.cpp // moved to ../src_share R src_moz/jni_util_export.h // moved to ../src_share M src_moz/nsActions.cpp // include ns_util instead of jni_util // also use new util_DeallocateShareContext M src_moz/nsActions.h // include ns_util instead of jni_util A src_moz/ns_util.cpp // include jni_util.h A src_moz/ns_util.h // include jni_util.h, changes to // WebshellInitContext struct A src_moz/ns_util_export.cpp // provide impls for methods in // jni_util_export.h A src_share/Makefile.win A src_share/bal_util.cpp A src_share/bal_util.h A src_share/jni_util.cpp A src_share/jni_util.h A src_share/jni_util_export.cpp A src_share/jni_util_export.h *****CVS exited normally with code 0*****
2000-08-04 01:32:54 +04:00
clazz = env->GetObjectClass(obj);
mid = env->GetMethodID(clazz, name, signature);
if (mid == 0)
goto done1;
switch (*p) {
case 'V':
env->CallVoidMethodV(obj, mid, args);
break;
case '[':
case 'L':
result.l = env->CallObjectMethodV(obj, mid, args);
break;
case 'Z':
result.z = env->CallBooleanMethodV(obj, mid, args);
break;
case 'B':
result.b = env->CallByteMethodV(obj, mid, args);
break;
case 'C':
result.c = env->CallCharMethodV(obj, mid, args);
break;
case 'S':
result.s = env->CallShortMethodV(obj, mid, args);
break;
case 'I':
result.i = env->CallIntMethodV(obj, mid, args);
break;
case 'J':
result.j = env->CallLongMethodV(obj, mid, args);
break;
case 'F':
result.f = env->CallFloatMethodV(obj, mid, args);
break;
case 'D':
result.d = env->CallDoubleMethodV(obj, mid, args);
break;
default:
env->FatalError("JNU_CallMethodByNameV: illegal signature");
}
done1:
env->DeleteLocalRef(clazz);
done2:
if (hasException) {
#ifdef JNI_VERSION_1_2
bug=47357 a=edburns r=ashuk This change creates a new directory, java/webclient/src_share, that contains the code that will be used in both src_moz and src_ie, and any other native browser wrapping implementations. Here are the steps I followed to implement this change. 1. Create a new directory java/webclient/src_share 2. Move all jni_util*.* files from src_moz into src_share 3. Make it so src_share compiles into a new .lib src_share has no netscape dependencies. Any functionality that depended on ns dependencies was kept in src_moz. In this case, we have a function prototype only in src_share, with the implementation in src_moz. We did this for nsHashtable. The other trick was for things in WebShellInitContext that had nothing to do with Netscape. This case was accomodated by creating a new struct, ShareInitContext, that contains all WebShellInitContext members that have nothing to do with Netscape. Currently this is just jobject propertiesClass. I modified the WebShellInitContext struct to contain a ShareContext struct as its last member. There are two new methods in jni_util.h that allow for the initialization and deallocation of the members of the ShareContext struct. 4. Make it so src_moz uses the new .lib to provide the jni_util behavior a. Create ns_util* files that include ../src_share/jni_util* files appropriately. The only tricky part was for things in jni_util.h that Here's the list of files in this change. cvs -z3 -n update (in directory D:\Projects\mozilla\java\webclient) cvs server: Updating . M Makefile.win // added src_share to DIRS M src_moz/BookmarksImpl.cpp // include ns_util instead of jni_util M src_moz/CBrowserContainer.cpp // include ns_util instead of jni_util M src_moz/CBrowserContainer.h // include ns_util instead of jni_util M src_moz/CurrentPageImpl.cpp // include ns_util instead of jni_util M src_moz/HistoryImpl.cpp // include ns_util instead of jni_util M src_moz/Makefile.win // include ns_util instead of jni_util M src_moz/NativeEventThread.cpp // include ns_util instead of jni_util M src_moz/NavigationImpl.cpp // include ns_util instead of jni_util M src_moz/RDFEnumeration.cpp // include ns_util instead of jni_util M src_moz/RDFTreeNode.cpp // include ns_util instead of jni_util M src_moz/WindowControlImpl.cpp // include ns_util instead of jni_util // also use new util_InitShareContext // function M src_moz/WrapperFactoryImpl.cpp // include ns_util instead of jni_util R src_moz/jni_util.cpp // moved to ../src_share R src_moz/jni_util.h // moved to ../src_share R src_moz/jni_util_export.cpp // moved to ../src_share R src_moz/jni_util_export.h // moved to ../src_share M src_moz/nsActions.cpp // include ns_util instead of jni_util // also use new util_DeallocateShareContext M src_moz/nsActions.h // include ns_util instead of jni_util A src_moz/ns_util.cpp // include jni_util.h A src_moz/ns_util.h // include jni_util.h, changes to // WebshellInitContext struct A src_moz/ns_util_export.cpp // provide impls for methods in // jni_util_export.h A src_share/Makefile.win A src_share/bal_util.cpp A src_share/bal_util.h A src_share/jni_util.cpp A src_share/jni_util.h A src_share/jni_util_export.cpp A src_share/jni_util_export.h *****CVS exited normally with code 0*****
2000-08-04 01:32:54 +04:00
*hasException = env->ExceptionCheck();
#else
jthrowable exception = env->ExceptionOccurred();
if ( exception != NULL ) {
*hasException = true;
env->DeleteLocalRef( exception );
}
else {
*hasException = false;
}
#endif
} // END
bug=47357 a=edburns r=ashuk This change creates a new directory, java/webclient/src_share, that contains the code that will be used in both src_moz and src_ie, and any other native browser wrapping implementations. Here are the steps I followed to implement this change. 1. Create a new directory java/webclient/src_share 2. Move all jni_util*.* files from src_moz into src_share 3. Make it so src_share compiles into a new .lib src_share has no netscape dependencies. Any functionality that depended on ns dependencies was kept in src_moz. In this case, we have a function prototype only in src_share, with the implementation in src_moz. We did this for nsHashtable. The other trick was for things in WebShellInitContext that had nothing to do with Netscape. This case was accomodated by creating a new struct, ShareInitContext, that contains all WebShellInitContext members that have nothing to do with Netscape. Currently this is just jobject propertiesClass. I modified the WebShellInitContext struct to contain a ShareContext struct as its last member. There are two new methods in jni_util.h that allow for the initialization and deallocation of the members of the ShareContext struct. 4. Make it so src_moz uses the new .lib to provide the jni_util behavior a. Create ns_util* files that include ../src_share/jni_util* files appropriately. The only tricky part was for things in jni_util.h that Here's the list of files in this change. cvs -z3 -n update (in directory D:\Projects\mozilla\java\webclient) cvs server: Updating . M Makefile.win // added src_share to DIRS M src_moz/BookmarksImpl.cpp // include ns_util instead of jni_util M src_moz/CBrowserContainer.cpp // include ns_util instead of jni_util M src_moz/CBrowserContainer.h // include ns_util instead of jni_util M src_moz/CurrentPageImpl.cpp // include ns_util instead of jni_util M src_moz/HistoryImpl.cpp // include ns_util instead of jni_util M src_moz/Makefile.win // include ns_util instead of jni_util M src_moz/NativeEventThread.cpp // include ns_util instead of jni_util M src_moz/NavigationImpl.cpp // include ns_util instead of jni_util M src_moz/RDFEnumeration.cpp // include ns_util instead of jni_util M src_moz/RDFTreeNode.cpp // include ns_util instead of jni_util M src_moz/WindowControlImpl.cpp // include ns_util instead of jni_util // also use new util_InitShareContext // function M src_moz/WrapperFactoryImpl.cpp // include ns_util instead of jni_util R src_moz/jni_util.cpp // moved to ../src_share R src_moz/jni_util.h // moved to ../src_share R src_moz/jni_util_export.cpp // moved to ../src_share R src_moz/jni_util_export.h // moved to ../src_share M src_moz/nsActions.cpp // include ns_util instead of jni_util // also use new util_DeallocateShareContext M src_moz/nsActions.h // include ns_util instead of jni_util A src_moz/ns_util.cpp // include jni_util.h A src_moz/ns_util.h // include jni_util.h, changes to // WebshellInitContext struct A src_moz/ns_util_export.cpp // provide impls for methods in // jni_util_export.h A src_share/Makefile.win A src_share/bal_util.cpp A src_share/bal_util.h A src_share/jni_util.cpp A src_share/jni_util.h A src_share/jni_util_export.cpp A src_share/jni_util_export.h *****CVS exited normally with code 0*****
2000-08-04 01:32:54 +04:00
return result;
}
JNIEXPORT void * JNICALL
JNU_GetEnv(JavaVM *vm, jint version)
{
// void *result;
//vm->GetEnv(&result, version);
JNIEnv *result = nsnull;
#ifdef BAL_INTERFACE
#else
#ifdef JNI_VERSION_1_2
bug=47357 a=edburns r=ashuk This change creates a new directory, java/webclient/src_share, that contains the code that will be used in both src_moz and src_ie, and any other native browser wrapping implementations. Here are the steps I followed to implement this change. 1. Create a new directory java/webclient/src_share 2. Move all jni_util*.* files from src_moz into src_share 3. Make it so src_share compiles into a new .lib src_share has no netscape dependencies. Any functionality that depended on ns dependencies was kept in src_moz. In this case, we have a function prototype only in src_share, with the implementation in src_moz. We did this for nsHashtable. The other trick was for things in WebShellInitContext that had nothing to do with Netscape. This case was accomodated by creating a new struct, ShareInitContext, that contains all WebShellInitContext members that have nothing to do with Netscape. Currently this is just jobject propertiesClass. I modified the WebShellInitContext struct to contain a ShareContext struct as its last member. There are two new methods in jni_util.h that allow for the initialization and deallocation of the members of the ShareContext struct. 4. Make it so src_moz uses the new .lib to provide the jni_util behavior a. Create ns_util* files that include ../src_share/jni_util* files appropriately. The only tricky part was for things in jni_util.h that Here's the list of files in this change. cvs -z3 -n update (in directory D:\Projects\mozilla\java\webclient) cvs server: Updating . M Makefile.win // added src_share to DIRS M src_moz/BookmarksImpl.cpp // include ns_util instead of jni_util M src_moz/CBrowserContainer.cpp // include ns_util instead of jni_util M src_moz/CBrowserContainer.h // include ns_util instead of jni_util M src_moz/CurrentPageImpl.cpp // include ns_util instead of jni_util M src_moz/HistoryImpl.cpp // include ns_util instead of jni_util M src_moz/Makefile.win // include ns_util instead of jni_util M src_moz/NativeEventThread.cpp // include ns_util instead of jni_util M src_moz/NavigationImpl.cpp // include ns_util instead of jni_util M src_moz/RDFEnumeration.cpp // include ns_util instead of jni_util M src_moz/RDFTreeNode.cpp // include ns_util instead of jni_util M src_moz/WindowControlImpl.cpp // include ns_util instead of jni_util // also use new util_InitShareContext // function M src_moz/WrapperFactoryImpl.cpp // include ns_util instead of jni_util R src_moz/jni_util.cpp // moved to ../src_share R src_moz/jni_util.h // moved to ../src_share R src_moz/jni_util_export.cpp // moved to ../src_share R src_moz/jni_util_export.h // moved to ../src_share M src_moz/nsActions.cpp // include ns_util instead of jni_util // also use new util_DeallocateShareContext M src_moz/nsActions.h // include ns_util instead of jni_util A src_moz/ns_util.cpp // include jni_util.h A src_moz/ns_util.h // include jni_util.h, changes to // WebshellInitContext struct A src_moz/ns_util_export.cpp // provide impls for methods in // jni_util_export.h A src_share/Makefile.win A src_share/bal_util.cpp A src_share/bal_util.h A src_share/jni_util.cpp A src_share/jni_util.h A src_share/jni_util_export.cpp A src_share/jni_util_export.h *****CVS exited normally with code 0*****
2000-08-04 01:32:54 +04:00
vm->AttachCurrentThread((void **)&result, (void *) version);
#else
vm->AttachCurrentThread( &result, ( void * )version);
#endif
bug=47357 a=edburns r=ashuk This change creates a new directory, java/webclient/src_share, that contains the code that will be used in both src_moz and src_ie, and any other native browser wrapping implementations. Here are the steps I followed to implement this change. 1. Create a new directory java/webclient/src_share 2. Move all jni_util*.* files from src_moz into src_share 3. Make it so src_share compiles into a new .lib src_share has no netscape dependencies. Any functionality that depended on ns dependencies was kept in src_moz. In this case, we have a function prototype only in src_share, with the implementation in src_moz. We did this for nsHashtable. The other trick was for things in WebShellInitContext that had nothing to do with Netscape. This case was accomodated by creating a new struct, ShareInitContext, that contains all WebShellInitContext members that have nothing to do with Netscape. Currently this is just jobject propertiesClass. I modified the WebShellInitContext struct to contain a ShareContext struct as its last member. There are two new methods in jni_util.h that allow for the initialization and deallocation of the members of the ShareContext struct. 4. Make it so src_moz uses the new .lib to provide the jni_util behavior a. Create ns_util* files that include ../src_share/jni_util* files appropriately. The only tricky part was for things in jni_util.h that Here's the list of files in this change. cvs -z3 -n update (in directory D:\Projects\mozilla\java\webclient) cvs server: Updating . M Makefile.win // added src_share to DIRS M src_moz/BookmarksImpl.cpp // include ns_util instead of jni_util M src_moz/CBrowserContainer.cpp // include ns_util instead of jni_util M src_moz/CBrowserContainer.h // include ns_util instead of jni_util M src_moz/CurrentPageImpl.cpp // include ns_util instead of jni_util M src_moz/HistoryImpl.cpp // include ns_util instead of jni_util M src_moz/Makefile.win // include ns_util instead of jni_util M src_moz/NativeEventThread.cpp // include ns_util instead of jni_util M src_moz/NavigationImpl.cpp // include ns_util instead of jni_util M src_moz/RDFEnumeration.cpp // include ns_util instead of jni_util M src_moz/RDFTreeNode.cpp // include ns_util instead of jni_util M src_moz/WindowControlImpl.cpp // include ns_util instead of jni_util // also use new util_InitShareContext // function M src_moz/WrapperFactoryImpl.cpp // include ns_util instead of jni_util R src_moz/jni_util.cpp // moved to ../src_share R src_moz/jni_util.h // moved to ../src_share R src_moz/jni_util_export.cpp // moved to ../src_share R src_moz/jni_util_export.h // moved to ../src_share M src_moz/nsActions.cpp // include ns_util instead of jni_util // also use new util_DeallocateShareContext M src_moz/nsActions.h // include ns_util instead of jni_util A src_moz/ns_util.cpp // include jni_util.h A src_moz/ns_util.h // include jni_util.h, changes to // WebshellInitContext struct A src_moz/ns_util_export.cpp // provide impls for methods in // jni_util_export.h A src_share/Makefile.win A src_share/bal_util.cpp A src_share/bal_util.h A src_share/jni_util.cpp A src_share/jni_util.h A src_share/jni_util_export.cpp A src_share/jni_util_export.h *****CVS exited normally with code 0*****
2000-08-04 01:32:54 +04:00
#endif
return result;
}