These changes make it so webclient compiles with the tip as of 20

September 2000.  It will run, but without bookmarks.

The changes consist of the following kinds of changes:

Changes to method signatures for methods implemented by webclient.

Changes to string functions.

Changes to account for the demise of PROGIDS in favor of ContractIDs

Modified files:

M classes_spec/org/mozilla/webclient/test/EMWindow.java
M src_moz/CBrowserContainer.cpp
M src_moz/CurrentPageImpl.cpp
M src_moz/Makefile.win
M src_moz/NativeEventThread.cpp
M src_moz/RDFEnumeration.cpp
M src_moz/RDFTreeNode.cpp
M src_moz/ns_util_export.cpp
M src_moz/rdf_util.cpp
This commit is contained in:
edburns%acm.org 2000-09-20 21:53:05 +00:00
parent c724c47c60
commit e2ea5ace19
9 changed files with 171 additions and 129 deletions

View File

@ -54,7 +54,7 @@ import org.w3c.dom.Document;
* This is a test application for using the BrowserControl.
*
* @version $Id: EMWindow.java,v 1.20 2000/09/19 00:18:13 edburns%acm.org Exp $
* @version $Id: EMWindow.java,v 1.21 2000/09/20 21:53:01 edburns%acm.org Exp $
*
* @see org.mozilla.webclient.BrowserControlFactory
@ -243,6 +243,7 @@ public class EMWindow extends Frame implements DialogClient, ActionListener, Doc
eventRegistration.addDocumentLoadListener(this);
eventRegistration.addMouseListener(this);
/*********
// PENDING(edburns): test code, replace with production code
bookmarks =
(Bookmarks)
@ -250,7 +251,6 @@ public class EMWindow extends Frame implements DialogClient, ActionListener, Doc
System.out.println("debug: edburns: got Bookmarks instance");
bookmarksTree = bookmarks.getBookmarks();
/*********
TreeNode bookmarksRoot = (TreeNode) bookmarksTree.getRoot();
System.out.println("debug: edburns: testing the Enumeration");

View File

@ -129,6 +129,14 @@ NS_IMETHODIMP CBrowserContainer::Alert(const PRUnichar *dialogTitle,
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP CBrowserContainer::AlertCheck(const PRUnichar *dialogTitle,
const PRUnichar *text,
const PRUnichar *checkMsg,
PRBool *checkValue)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* boolean confirm (in wstring text); */
NS_IMETHODIMP CBrowserContainer::Confirm(const PRUnichar *dialogTitle,
const PRUnichar *text,
@ -148,29 +156,35 @@ NS_IMETHODIMP CBrowserContainer::ConfirmCheck(const PRUnichar *dialogTitle,
}
/* boolean prompt (in wstring text, in wstring defaultText, out wstring result); */
NS_IMETHODIMP CBrowserContainer::Prompt(const PRUnichar *dialogTitle,
NS_IMETHODIMP CBrowserContainer::Prompt(const PRUnichar *dialogTitle,
const PRUnichar *text,
const PRUnichar* passwordRealm,
const PRUnichar* defaultText,
const PRUnichar *passwordRealm,
PRUint32 savePassword,
const PRUnichar *defaultText,
PRUnichar **result, PRBool *_retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* boolean promptUsernameAndPassword (in wstring text, out wstring user, out wstring pwd); */
NS_IMETHODIMP CBrowserContainer::PromptUsernameAndPassword(const PRUnichar *dialogTitle,
const PRUnichar *text, const PRUnichar *passwordRealm, PRBool persistPassword,
PRUnichar **user, PRUnichar **pwd, PRBool *_retval)
NS_IMETHODIMP CBrowserContainer::PromptUsernameAndPassword(const PRUnichar *dialogTitle,
const PRUnichar *text,
const PRUnichar *passwordRealm,
PRUint32 savePassword,
PRUnichar **user,
PRUnichar **pwd,
PRBool *_retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* boolean promptPassword (in wstring text, in wstring title, out wstring pwd); */
NS_IMETHODIMP CBrowserContainer::PromptPassword(const PRUnichar *dialogTitle,
NS_IMETHODIMP CBrowserContainer::PromptPassword(const PRUnichar *dialogTitle,
const PRUnichar *text,
const PRUnichar* passwordRealm,
PRBool persistPassword,
PRUnichar **pwd, PRBool *_retval)
const PRUnichar *passwordRealm,
PRUint32 savePassword,
PRUnichar **pwd,
PRBool *_retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
@ -191,8 +205,28 @@ NS_IMETHODIMP CBrowserContainer::UniversalDialog(const PRUnichar *inTitleMessage
///////////////////////////////////////////////////////////////////////////////
// nsIWebProgressListener
NS_IMETHODIMP CBrowserContainer::OnStateChange(nsIWebProgress *aWebProgress,
nsIRequest *aRequest,
PRInt32 aStateFlags,
PRUint32 aStatus)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP CBrowserContainer::OnSecurityChange(nsIWebProgress *aWebProgress,
nsIRequest *aRequest,
PRInt32 state)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* void onProgressChange (in nsIChannel channel, in long curSelfProgress, in long maxSelfProgress, in long curTotalProgress, in long maxTotalProgress); */
NS_IMETHODIMP CBrowserContainer::OnProgressChange(nsIChannel *channel, PRInt32 curSelfProgress, PRInt32 maxSelfProgress, PRInt32 curTotalProgress, PRInt32 maxTotalProgress)
NS_IMETHODIMP CBrowserContainer::OnProgressChange(nsIWebProgress *aWebProgress,
nsIRequest *aRequest,
PRInt32 aCurSelfProgress,
PRInt32 aMaxSelfProgress,
PRInt32 curTotalProgress,
PRInt32 maxTotalProgress)
{
// NG_TRACE(_T("CBrowserContainer::OnProgressChange(...)\n"));
@ -217,31 +251,20 @@ NS_IMETHODIMP CBrowserContainer::OnProgressChange(nsIChannel *channel, PRInt32 c
return NS_OK;
}
/* void onChildProgressChange (in nsIChannel channel, in long curChildProgress, in long maxChildProgress); */
NS_IMETHODIMP CBrowserContainer::OnChildProgressChange(nsIChannel *channel, PRInt32 curChildProgress, PRInt32 maxChildProgress)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* void onStatusChange (in nsIChannel channel, in long progressStatusFlags); */
NS_IMETHODIMP CBrowserContainer::OnStatusChange(nsIChannel *channel, PRInt32 progressStatusFlags)
NS_IMETHODIMP CBrowserContainer::OnStatusChange(nsIWebProgress *aWebProgress,
nsIRequest *aRequest,
nsresult aStatus,
const PRUnichar *aMessage)
{
return NS_OK;
}
/* void onChildStatusChange (in nsIChannel channel, in long progressStatusFlags); */
NS_IMETHODIMP CBrowserContainer::OnChildStatusChange(nsIChannel *channel, PRInt32 progressStatusFlags)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* void onLocationChange (in nsIURI location); */
NS_IMETHODIMP CBrowserContainer::OnLocationChange(nsIURI *location)
NS_IMETHODIMP CBrowserContainer::OnLocationChange(nsIWebProgress *aWebProgress,
nsIRequest *aRequest,
nsIURI *location)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
@ -356,6 +379,13 @@ CBrowserContainer::ShowModal()
return NS_OK;
}
NS_IMETHODIMP
CBrowserContainer::ExitModalLoop(nsresult aStatus)
{
// Ignore request to be shown modally
return NS_OK;
}
NS_IMETHODIMP CBrowserContainer::GetNewWindow(PRInt32 aChromeFlags,
nsIDocShellTreeItem** aDocShellTreeItem)
@ -519,21 +549,7 @@ CBrowserContainer::SetTitle(const PRUnichar * aTitle)
// nsIWebBrowserChrome implementation
NS_IMETHODIMP
CBrowserContainer::SetJSStatus(const PRUnichar *status)
{
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP
CBrowserContainer::SetJSDefaultStatus(const PRUnichar *status)
{
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP
CBrowserContainer::SetOverLink(const PRUnichar *link)
CBrowserContainer::SetStatus(PRUint32 statusType, const PRUnichar *status)
{
return NS_ERROR_FAILURE;
}
@ -552,28 +568,26 @@ CBrowserContainer::SetWebBrowser(nsIWebBrowser * aWebBrowser)
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP
CBrowserContainer::GetChromeMask(PRUint32 *aChromeMask)
CBrowserContainer::GetChromeFlags(PRUint32 *aChromeFlags)
{
return NS_ERROR_FAILURE;
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP
CBrowserContainer::SetChromeMask(PRUint32 aChromeMask)
CBrowserContainer::SetChromeFlags(PRUint32 aChromeFlags)
{
return NS_ERROR_FAILURE;
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP
CBrowserContainer::GetNewBrowser(PRUint32 chromeMask, nsIWebBrowser **_retval)
CBrowserContainer::CreateBrowserWindow(PRUint32 chromeMask, PRInt32 aX,
PRInt32 aY, PRInt32 aCX, PRInt32 aCY,
nsIWebBrowser **aWebBrowser)
{
return NS_ERROR_FAILURE;
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP
CBrowserContainer::FindNamedBrowserItem(const PRUnichar *aName, nsIDocShellTreeItem **_retval)
{
@ -594,6 +608,25 @@ CBrowserContainer::ShowAsModal(void)
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP
CBrowserContainer::ExitModalEventLoop(nsresult aStatus)
{
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP
CBrowserContainer::SetPersistence(PRBool persistX, PRBool persistY, PRBool persistCX, PRBool persistCY, PRBool persistSizeMode)
{
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP
CBrowserContainer::GetPersistence(PRBool *persistX, PRBool *persistY, PRBool *persistCX, PRBool *persistCY, PRBool *persistSizeMode)
{
return NS_ERROR_FAILURE;
}
///////////////////////////////////////////////////////////////////////////////
// nsIStreamObserver implementation
@ -624,10 +657,8 @@ CBrowserContainer::OnStartDocumentLoad(nsIDocumentLoader* loader, nsIURI* aURL,
{
// remove the old mouse listener for the old document
if (mDomEventTarget) {
nsCAutoString eType("mouseover");
PRUnichar *eTypeUni = eType.ToNewUnicode();
mDomEventTarget->RemoveEventListener(eTypeUni, this, PR_FALSE);
nsCRT::free(eTypeUni);
mDomEventTarget->RemoveEventListener(NS_LITERAL_STRING("mouseover"),
this, PR_FALSE);
mDomEventTarget = nsnull;
}
@ -685,11 +716,8 @@ CBrowserContainer::OnEndDocumentLoad(nsIDocumentLoader* loader, nsIChannel *aCha
do_QueryInterface(mInitContext->currentDocument);
// if successful
if (mDomEventTarget) {
nsCAutoString eType("mouseover");
PRUnichar *eTypeUni = eType.ToNewUnicode();
mDomEventTarget->AddEventListener(eTypeUni, this,
PR_FALSE);
nsCRT::free(eTypeUni);
mDomEventTarget->AddEventListener(NS_LITERAL_STRING("mouseover"),
this, PR_FALSE);
}
}
}
@ -1025,10 +1053,8 @@ NS_IMETHODIMP CBrowserContainer::RemoveDocumentLoadListener()
NS_IMETHODIMP CBrowserContainer::RemoveAllListeners()
{
if (mDomEventTarget) {
nsCAutoString eType("mouseover");
PRUnichar *eTypeUni = eType.ToNewUnicode();
mDomEventTarget->RemoveEventListener(eTypeUni, this, PR_FALSE);
nsCRT::free(eTypeUni);
mDomEventTarget->RemoveEventListener(NS_LITERAL_STRING("mouseover"),
this, PR_FALSE);
mDomEventTarget = nsnull;
}

View File

@ -43,7 +43,6 @@
#include "nsIFindComponent.h"
#include "nsISearchContext.h"
#include "nsIDocShell.h"
#include "nsIDOMSelection.h"
#include "nsIDocumentViewer.h"
#include "nsIDocument.h"
#include "nsIDOMHTMLDocument.h"
@ -54,7 +53,7 @@
#include "nsIServiceManager.h"
#include "nsIContentViewer.h"
#include "nsIContentViewerEdit.h"
#include "nsIDOMWindow.h"
#include "nsIDOMWindowInternal.h"
#include "nsIScriptGlobalObject.h"
#include "nsIInterfaceRequestor.h"
@ -96,26 +95,28 @@ JNIEXPORT void JNICALL Java_org_mozilla_webclient_wrapper_1native_CurrentPageImp
//First get the FindComponent object
nsresult rv;
NS_WITH_SERVICE(nsIFindComponent, findComponent, NS_IFINDCOMPONENT_PROGID, &rv);
NS_WITH_SERVICE(nsIFindComponent, findComponent, NS_IFINDCOMPONENT_CONTRACTID, &rv);
if (NS_FAILED(rv) || nsnull == findComponent) {
initContext->initFailCode = kFindComponentError;
::util_ThrowExceptionToJava(env, "Exception: can't access FindComponent Service");
return;
}
nsCOMPtr<nsIDOMWindow> domWindow;
nsCOMPtr<nsIDOMWindowInternal> domWindowInternal;
if (initContext->docShell != nsnull) {
nsCOMPtr<nsIInterfaceRequestor> interfaceRequestor(do_QueryInterface(initContext->docShell));
nsCOMPtr<nsIURI> url;
rv = initContext->docShell->GetCurrentURI(getter_AddRefs(url));
nsCOMPtr<nsIURI> url = nsnull;
// PENDING(edburns): commented out for 52883
// rv = initContext->docShell->GetCurrentURI(getter_AddRefs(url));
if (NS_FAILED(rv) || nsnull == url) {
::util_ThrowExceptionToJava(env, "Exception: NULL URL passed to Find call");
return;
}
if (interfaceRequestor != nsnull) {
rv = interfaceRequestor->GetInterface(NS_GET_IID(nsIDOMWindow), getter_AddRefs(domWindow));
if (NS_FAILED(rv) || nsnull == domWindow) {
rv = interfaceRequestor->GetInterface(NS_GET_IID(nsIDOMWindowInternal), getter_AddRefs(domWindowInternal));
if (NS_FAILED(rv) || nsnull == domWindowInternal) {
initContext->initFailCode = kGetDOMWindowError;
::util_ThrowExceptionToJava(env, "Exception: cant get DOMWindow from DocShell");
return;
@ -136,7 +137,7 @@ JNIEXPORT void JNICALL Java_org_mozilla_webclient_wrapper_1native_CurrentPageImp
}
nsCOMPtr<nsISupports> searchContext;
rv = findComponent->CreateContext(domWindow, nsnull, getter_AddRefs(searchContext));
rv = findComponent->CreateContext(domWindowInternal, nsnull, getter_AddRefs(searchContext));
if (NS_FAILED(rv)) {
initContext->initFailCode = kSearchContextError;
::util_ThrowExceptionToJava(env, "Exception: can't create SearchContext for Find");
@ -190,7 +191,7 @@ JNIEXPORT void JNICALL Java_org_mozilla_webclient_wrapper_1native_CurrentPageImp
//First get the FindComponent object
nsresult rv;
NS_WITH_SERVICE(nsIFindComponent, findComponent, NS_IFINDCOMPONENT_PROGID, &rv);
NS_WITH_SERVICE(nsIFindComponent, findComponent, NS_IFINDCOMPONENT_CONTRACTID, &rv);
if (NS_FAILED(rv)) {
initContext->initFailCode = kFindComponentError;
::util_ThrowExceptionToJava(env, "Exception: can't access FindComponent Service");

View File

@ -44,7 +44,7 @@ OBJS = \
.\$(OBJDIR)\RDFEnumeration.obj \
.\$(OBJDIR)\RDFTreeNode.obj \
.\$(OBJDIR)\ISupportsPeer.obj \
.\$(OBJDIR)\nsSetupRegistry.obj \
# .\$(OBJDIR)\nsSetupRegistry.obj \
$(NULL)
@ -66,7 +66,8 @@ DLLNAME = webclient
DLL=.\$(OBJDIR)\$(DLLNAME).dll
LLIBS = \
$(DIST)\lib\gkweb.lib \
$(DIST)\lib\baseembed_s.lib \
$(DIST)\lib\appfilelocprovider_s.lib \
$(DIST)\lib\raptorbasewidget_s.lib \
$(DIST)\lib\gkwidget.lib \
$(DIST)\lib\xpcom.lib \
@ -78,6 +79,14 @@ LLIBS = \
# $(DEPTH)\xpfe\bootstrap\$(OBJDIR)\nsSetupRegistry.obj \
$(NULL)
WIN_LIBS= \
ole32.lib \
comdlg32.lib \
shell32.lib \
version.lib \
$(NULL)
!ifdef BAL_INTERFACE
LLIBS = $(LLIBS) \
$(DIST)\lib\wc_share_bal.lib \
@ -88,10 +97,6 @@ LLIBS = $(LLIBS) \
$(NULL)
!endif
WIN_LIBS = \
version.lib
include <$(DEPTH)\config\rules.mak>
!ifdef BAL_INTERFACE

View File

@ -32,7 +32,7 @@
#include "ns_util.h"
#include "ns_globals.h"
#include "nsIServiceManager.h" // for NS_InitXPCOM
#include "nsEmbedAPI.h" // for NS_InitEmbedding
#include "nsIProfile.h" // for the profile manager
#include "nsICmdLineService.h" // for the cmdline service to give to the
@ -446,16 +446,16 @@ void DoMozInitialization(WebShellInitContext * initContext)
JNIEnv * env = initContext->env;
const char * BinDir = gBinDir;
rv = NS_NewLocalFile(BinDir, &pathFile);
rv = NS_NewLocalFile(BinDir, PR_TRUE, &pathFile);
if (NS_FAILED(rv)) {
::util_ThrowExceptionToJava(env, "call to NS_NewLocalFile failed.");
return;
}
// It is vitally important to call NS_InitXPCOM before calling
// It is vitally important to call NS_InitEmbedding before calling
// anything else.
NS_InitXPCOM(nsnull, pathFile);
NS_SetupRegistry();
NS_InitEmbedding(pathFile, nsnull);
// NS_SetupRegistry();
rv = NS_GetGlobalComponentManager(&gComponentManager);
if (NS_FAILED(rv)) {
::util_ThrowExceptionToJava(env, "NS_GetGlobalComponentManager() failed.");
@ -475,7 +475,7 @@ void DoMozInitialization(WebShellInitContext * initContext)
// handle the profile manager nonsense
nsCOMPtr<nsICmdLineService> cmdLine =do_GetService(kCmdLineServiceCID);
nsCOMPtr<nsIProfile> profile = do_GetService(NS_PROFILE_PROGID);
nsCOMPtr<nsIProfile> profile = do_GetService(NS_PROFILE_CONTRACTID);
if (!cmdLine || !profile) {
::util_ThrowExceptionToJava(env, "Can't get the profile manager.");
return;
@ -507,7 +507,7 @@ nsresult InitMozillaStuff (WebShellInitContext * initContext)
PR_ASSERT(gComponentManager);
nsCOMPtr<nsIEventQueueService>
aEventQService = do_GetService(NS_EVENTQUEUESERVICE_PROGID);
aEventQService = do_GetService(NS_EVENTQUEUESERVICE_CONTRACTID);
// if we get here, we know that aEventQService is not null.
if (!aEventQService) {
@ -583,8 +583,8 @@ nsresult InitMozillaStuff (WebShellInitContext * initContext)
PRBool allowPlugins = PR_TRUE;
// Create the WebBrowser.
nsCOMPtr<nsIWebBrowser> webBrowser;
webBrowser = do_CreateInstance(NS_WEBBROWSER_PROGID);
nsCOMPtr<nsIWebBrowser> webBrowser = nsnull;
webBrowser = do_CreateInstance(NS_WEBBROWSER_CONTRACTID);
initContext->webBrowser = webBrowser;
@ -625,12 +625,9 @@ nsresult InitMozillaStuff (WebShellInitContext * initContext)
// Create the DocShell
nsIDocShell * docShell;
rv = webBrowser->GetDocShell(getter_AddRefs(&docShell));
initContext->docShell = docShell;
printf("docShell is %l \n", docShell);
initContext->docShell = do_GetInterface(initContext->webBrowser);
if (NS_FAILED(rv)) {
if (!initContext->docShell) {
initContext->initFailCode = kCreateDocShellError;
return rv;
}
@ -645,7 +642,7 @@ nsresult InitMozillaStuff (WebShellInitContext * initContext)
// because nsWebShell.cpp still checks for mContainer all over the
// place.
nsCOMPtr<nsIWebShellContainer> wsContainer(do_QueryInterface(initContext->browserContainer));
nsCOMPtr<nsIWebShell> webShell(do_QueryInterface(docShell));
nsCOMPtr<nsIWebShell> webShell(do_QueryInterface(initContext->docShell));
webShell->SetContainer(wsContainer);
// set the URIContentListener
@ -653,13 +650,13 @@ nsresult InitMozillaStuff (WebShellInitContext * initContext)
webBrowser->SetParentURIContentListener(contentListener);
// set the TreeOwner
nsCOMPtr<nsIDocShellTreeItem> docShellAsItem(do_QueryInterface(docShell));
nsCOMPtr<nsIDocShellTreeItem> docShellAsItem(do_QueryInterface(initContext->docShell));
nsCOMPtr<nsIDocShellTreeOwner> treeOwner(do_QueryInterface(initContext->browserContainer));
docShellAsItem->SetTreeOwner(treeOwner);
// set the docloaderobserver
nsCOMPtr<nsIDocumentLoaderObserver> observer(do_QueryInterface(initContext->browserContainer));
docShell->SetDocLoaderObserver(observer);
initContext->docShell->SetDocLoaderObserver(observer);
if (nsnull == gHistory) {
rv = gComponentManager->CreateInstance(kSHistoryCID, nsnull,

View File

@ -31,6 +31,10 @@
#include "prlog.h" // for PR_ASSERT
#include "nsRDFCID.h" // for NS_RDFCONTAINER_CID
static NS_DEFINE_CID(kRDFContainerCID, NS_RDFCONTAINER_CID);
//
// Local function prototypes
//
@ -199,10 +203,10 @@ jint getNativeEnumFromJava(JNIEnv *env, jobject obj, jint nativeRDFNode)
PR_ASSERT(gComponentManager);
// get a container in order to get the enum
rv = gComponentManager->CreateInstanceByProgID(NS_RDFCONTAINER_PROGID,
nsnull,
NS_GET_IID(nsIRDFContainer),
getter_AddRefs(container));
rv = gComponentManager->CreateInstance(kRDFContainerCID,
nsnull,
NS_GET_IID(nsIRDFContainer),
getter_AddRefs(container));
if (NS_FAILED(rv)) {
if (prLogModuleInfo) {
PR_LOG(prLogModuleInfo, 3,

View File

@ -30,6 +30,10 @@
#include "prlog.h" // for PR_ASSERT
#include "nsRDFCID.h" // for NS_RDFCONTAINER_CID
static NS_DEFINE_CID(kRDFContainerCID, NS_RDFCONTAINER_CID);
//
// Local function prototypes
//
@ -262,10 +266,10 @@ Java_org_mozilla_webclient_wrapper_1native_RDFTreeNode_nativeInsertElementAt
PR_ASSERT(gComponentManager);
// get a container in order to create a child
rv = gComponentManager->CreateInstanceByProgID(NS_RDFCONTAINER_PROGID,
nsnull,
NS_GET_IID(nsIRDFContainer),
getter_AddRefs(container));
rv = gComponentManager->CreateInstance(kRDFContainerCID,
nsnull,
NS_GET_IID(nsIRDFContainer),
getter_AddRefs(container));
if (NS_FAILED(rv)) {
::util_ThrowExceptionToJava(env, "Exception: nativeNewRDFNode: can't create container.");
return;

View File

@ -41,7 +41,8 @@ JNIEXPORT jint JNICALL util_StoreClassMapping(const char* jniClassName,
}
}
nsStringKey key(jniClassName);
NS_ConvertASCIItoUCS2 keyString(jniClassName);
nsStringKey key(keyString);
gClassMappingTable->Put(&key, yourClassType);
return 0;
@ -55,7 +56,8 @@ JNIEXPORT jclass JNICALL util_GetClassMapping(const char* jniClassName)
return nsnull;
}
nsStringKey key(jniClassName);
NS_ConvertASCIItoUCS2 keyString(jniClassName);
nsStringKey key(keyString);
result = (jclass) gClassMappingTable->Get(&key);
return result;

View File

@ -27,6 +27,8 @@
#include "nsIServiceManager.h"
#include "nsRDFCID.h" // for NS_RDFCONTAINER_CID
#include "prlog.h" // for PR_ASSERT
static PRBool rdf_inited = PR_FALSE;
@ -42,6 +44,7 @@ nsCOMPtr<nsIRDFResource> kNC_URL = nsnull;
nsCOMPtr<nsIRDFResource> kNC_Folder = nsnull;
nsCOMPtr<nsIRDFResource> kRDF_type = nsnull;
static NS_DEFINE_CID(kRDFContainerCID, NS_RDFCONTAINER_CID);
nsresult rdf_InitRDFUtils()
{
@ -55,7 +58,7 @@ nsresult rdf_InitRDFUtils()
if (nsnull == gBookmarks) {
// Get the bookmarks service
gBookmarks = do_GetService(NS_BOOKMARKS_SERVICE_PROGID, &rv);
gBookmarks = do_GetService(NS_BOOKMARKS_SERVICE_CONTRACTID, &rv);
if (NS_FAILED(rv)) {
return rv;
}
@ -184,10 +187,10 @@ void rdf_recursiveResourceTraversal(nsCOMPtr<nsIRDFResource> currentResource)
PR_ASSERT(gComponentManager);
// get a container in order to recurr
rv = gComponentManager->
CreateInstanceByProgID(NS_RDFCONTAINER_PROGID,
nsnull,
NS_GET_IID(nsIRDFContainer),
getter_AddRefs(container));
CreateInstance(kRDFContainerCID,
nsnull,
NS_GET_IID(nsIRDFContainer),
getter_AddRefs(container));
if (NS_FAILED(rv)) {
if (prLogModuleInfo) {
PR_LOG(prLogModuleInfo, 3,
@ -424,10 +427,10 @@ nsresult rdf_getChildAt(int index, nsIRDFResource *theParent,
PR_ASSERT(gComponentManager);
rv = gComponentManager->CreateInstanceByProgID(NS_RDFCONTAINER_PROGID,
nsnull,
NS_GET_IID(nsIRDFContainer),
getter_AddRefs(container));
rv = gComponentManager->CreateInstance(kRDFContainerCID,
nsnull,
NS_GET_IID(nsIRDFContainer),
getter_AddRefs(container));
if (NS_FAILED(rv)) {
return rv;
}
@ -492,10 +495,10 @@ nsresult rdf_getChildCount(nsIRDFResource *theParent, PRInt32 *count)
return NS_OK;
}
PR_ASSERT(gComponentManager);
rv = gComponentManager->CreateInstanceByProgID(NS_RDFCONTAINER_PROGID,
nsnull,
NS_GET_IID(nsIRDFContainer),
getter_AddRefs(container));
rv = gComponentManager->CreateInstance(kRDFContainerCID,
nsnull,
NS_GET_IID(nsIRDFContainer),
getter_AddRefs(container));
if (NS_FAILED(rv)) {
return rv;
}
@ -537,10 +540,10 @@ nsresult rdf_getIndexOfChild(nsIRDFResource *theParent,
return NS_OK;
}
PR_ASSERT(gComponentManager);
rv = gComponentManager->CreateInstanceByProgID(NS_RDFCONTAINER_PROGID,
nsnull,
NS_GET_IID(nsIRDFContainer),
getter_AddRefs(container));
rv = gComponentManager->CreateInstance(kRDFContainerCID,
nsnull,
NS_GET_IID(nsIRDFContainer),
getter_AddRefs(container));
if (NS_FAILED(rv)) {
return rv;
}