зеркало из https://github.com/mozilla/pjs.git
bug: 119680
Changes to make webclient compile and minimally run with Netscape 6.2.1.
This commit is contained in:
Родитель
363f41f64d
Коммит
2b34635933
|
@ -41,9 +41,9 @@ buildRunems:
|
|||
-mkdir $(PACKAGE_EXAMPLE)
|
||||
-mkdir $(DIST)\..\java\build\org
|
||||
-mkdir $(DIST)\..\java\build\org\mozilla
|
||||
xcopy /E $(DIST)\..\classes\org\mozilla\dom $(DIST)\..\java\build\org\mozilla
|
||||
xcopy /E $(DIST)\..\classes\org\mozilla\util $(DIST)\..\java\build\org\mozilla
|
||||
xcopy /E $(DIST)\..\classes\org\w3c $(DIST)\..\java\build\org
|
||||
xcopy /E /Y $(DIST)\..\classes\org\mozilla\dom $(DIST)\..\java\build\org\mozilla
|
||||
xcopy /E /Y $(DIST)\..\classes\org\mozilla\util $(DIST)\..\java\build\org\mozilla
|
||||
xcopy /E /Y $(DIST)\..\classes\org\w3c $(DIST)\..\java\build\org
|
||||
cd $(DIST)\..\java\build
|
||||
jar -cvfM0 JavaDOM_$(PACKAGE_VER)_win32.jar org
|
||||
copy JavaDOM_$(PACKAGE_VER)_win32.jar ..\..\javadev\lib\JavaDOM_$(PACKAGE_VER)_win32.jar
|
||||
|
@ -66,10 +66,10 @@ buildRunems:
|
|||
-mkdir $(PACKAGE_EXAMPLE)
|
||||
-mkdir $(DIST)\..\java\build\org
|
||||
-mkdir $(DIST)\..\java\build\org\mozilla
|
||||
xcopy /E $(DIST)\..\classes\org\mozilla\util $(DIST)\..\java\build\org\mozilla
|
||||
xcopy /E $(DIST)\..\classes\org\mozilla\dom $(DIST)\..\java\build\org\mozilla
|
||||
xcopy /E $(DIST)\..\classes\org\mozilla\plugins $(DIST)\..\java\build\org\mozilla
|
||||
xcopy /E $(DIST)\..\classes\org\w3c $(DIST)\..\java\build\org
|
||||
xcopy /E /Y $(DIST)\..\classes\org\mozilla\util $(DIST)\..\java\build\org\mozilla
|
||||
xcopy /E /Y $(DIST)\..\classes\org\mozilla\dom $(DIST)\..\java\build\org\mozilla
|
||||
xcopy /E /Y $(DIST)\..\classes\org\mozilla\plugins $(DIST)\..\java\build\org\mozilla
|
||||
xcopy /E /Y $(DIST)\..\classes\org\w3c $(DIST)\..\java\build\org
|
||||
cd $(DIST)\..\java\build
|
||||
jar -cvfM0 Pluglet_$(PACKAGE_VER)_win32.jar org
|
||||
copy Pluglet_$(PACKAGE_VER)_win32.jar ..\..\javadev\lib\Pluglet_$(PACKAGE_VER)_win32.jar
|
||||
|
@ -96,11 +96,11 @@ buildRunems:
|
|||
-mkdir $(PACKAGE_EXAMPLE)
|
||||
-mkdir $(DIST)\..\java\build\org
|
||||
-mkdir $(DIST)\..\java\build\org\mozilla
|
||||
xcopy /E $(DIST)\..\classes\org\mozilla\util $(DIST)\..\java\build\org\mozilla
|
||||
xcopy /E $(DIST)\..\classes\org\mozilla\dom $(DIST)\..\java\build\org\mozilla
|
||||
xcopy /E $(DIST)\..\classes\org\mozilla\webclient $(DIST)\..\java\build\org\mozilla
|
||||
xcopy /E $(DIST)\..\classes\org\mozilla\xpcom $(DIST)\..\java\build\org\mozilla
|
||||
xcopy /E $(DIST)\..\classes\org\w3c $(DIST)\..\java\build\org
|
||||
xcopy /E /Y $(DIST)\..\classes\org\mozilla\util $(DIST)\..\java\build\org\mozilla
|
||||
xcopy /E /Y $(DIST)\..\classes\org\mozilla\dom $(DIST)\..\java\build\org\mozilla
|
||||
xcopy /E /Y $(DIST)\..\classes\org\mozilla\webclient $(DIST)\..\java\build\org\mozilla
|
||||
xcopy /E /Y $(DIST)\..\classes\org\mozilla\xpcom $(DIST)\..\java\build\org\mozilla
|
||||
xcopy /E /Y $(DIST)\..\classes\org\w3c $(DIST)\..\java\build\org
|
||||
cd $(DIST)\..\java\build
|
||||
jar -cvfM0 Webclient_$(PACKAGE_VER)_win32.jar org
|
||||
copy Webclient_$(PACKAGE_VER)_win32.jar ..\..\javadev\lib\Webclient_$(PACKAGE_VER)_win32.jar
|
||||
|
@ -126,7 +126,7 @@ buildRunems:
|
|||
chmod 775 $(PACKAGE_LIB)\webclient.dll
|
||||
chmod 775 $(PACKAGE_LIB)\wc_share.lib
|
||||
@echo +++ Creating Commercial Package. Use runem.bat to run the test browser.
|
||||
del /Q runem_win_commercial.bat
|
||||
rm -f runem_win_commercial.bat
|
||||
@echo set CLASSPATH=..\lib\Webclient_$(PACKAGE_VER)_win32.jar > runem_win_commercial.bat
|
||||
@echo $(PERL) .\runem.pl org.mozilla.webclient.test.EmbeddedMozilla $(DEPTH) %1% >> runem_win_commercial.bat
|
||||
copy runem_win_commercial.bat $(PACKAGE_EXAMPLE)\runem.bat
|
||||
|
@ -145,8 +145,8 @@ buildRunems:
|
|||
-mkdir $(PACKAGE_EXAMPLE)
|
||||
-mkdir $(DIST)\..\java\build\org
|
||||
-mkdir $(DIST)\..\java\build\org\mozilla
|
||||
xcopy /E $(DIST)\..\classes\org\mozilla\util $(DIST)\..\java\build\org\mozilla
|
||||
xcopy /E $(DIST)\..\classes\org\mozilla\xpcom $(DIST)\..\java\build\org\mozilla
|
||||
xcopy /E /Y $(DIST)\..\classes\org\mozilla\util $(DIST)\..\java\build\org\mozilla
|
||||
xcopy /E /Y $(DIST)\..\classes\org\mozilla\xpcom $(DIST)\..\java\build\org\mozilla
|
||||
cd $(DIST)\..\java\build
|
||||
jar -cvfM0 Blackconnect_$(PACKAGE_VER)_win32.jar org
|
||||
copy Blackconnect_$(PACKAGE_VER)_win32.jar ..\..\javadev\lib\Blackconnect_$(PACKAGE_VER)_win32.jar
|
||||
|
@ -175,8 +175,8 @@ buildRunems:
|
|||
-mkdir $(PACKAGE_EXAMPLE)
|
||||
-mkdir $(DIST)\..\java\build\org
|
||||
-mkdir $(DIST)\..\java\build\org\mozilla
|
||||
xcopy /E $(DIST)\..\classes\org\mozilla\* $(DIST)\..\java\build\org
|
||||
xcopy /E $(DIST)\..\classes\org\w3c $(DIST)\..\java\build\org
|
||||
xcopy /E /Y $(DIST)\..\classes\org\mozilla\* $(DIST)\..\java\build\org
|
||||
xcopy /E /Y $(DIST)\..\classes\org\w3c $(DIST)\..\java\build\org
|
||||
cd $(DIST)\..\java\build
|
||||
jar -cvfM0 Blackwood_$(PACKAGE_VER)_win32.jar org
|
||||
copy Blackwood_$(PACKAGE_VER)_win32.jar ..\..\javadev\lib\Blackwood_$(PACKAGE_VER)_win32.jar
|
||||
|
@ -206,7 +206,7 @@ buildRunems:
|
|||
chmod 775 $(PACKAGE_LIB)\bcxpcomstubs.dll
|
||||
chmod 775 $(PACKAGE_LIB)\regxpcom.exe
|
||||
@echo +++ Creating Commercial Package. Use runem.bat to run the test browser.
|
||||
del /Q runem_win_commercial.bat
|
||||
rm -f runem_win_commercial.bat
|
||||
@echo set CLASSPATH=..\lib\Blackwood_$(PACKAGE_VER)_win32.jar > runem_win_commercial.bat
|
||||
@echo $(PERL) .\runem.pl org.mozilla.webclient.test.EmbeddedMozilla $(DEPTH) %1% >> runem_win_commercial.bat
|
||||
copy runem_win_commercial.bat $(PACKAGE_EXAMPLE)\runem.bat
|
||||
|
|
|
@ -48,7 +48,7 @@ JNIEXPORT jstring JNICALL Java_org_mozilla_dom_AttrImpl_getName
|
|||
return NULL;
|
||||
}
|
||||
|
||||
jstring jname = env->NewString((jchar*) name.GetUnicode(), name.Length());
|
||||
jstring jname = env->NewString((jchar*) name.get(), name.Length());
|
||||
if (!jname) {
|
||||
PR_LOG(JavaDOMGlobals::log, PR_LOG_ERROR,
|
||||
("Attr.getName: NewString failed\n"));
|
||||
|
@ -108,7 +108,7 @@ JNIEXPORT jstring JNICALL Java_org_mozilla_dom_AttrImpl_getValue
|
|||
return NULL;
|
||||
}
|
||||
|
||||
jstring jval = env->NewString((jchar*) value.GetUnicode(), value.Length());
|
||||
jstring jval = env->NewString((jchar*) value.get(), value.Length());
|
||||
if (!jval) {
|
||||
PR_LOG(JavaDOMGlobals::log, PR_LOG_ERROR,
|
||||
("Attr.getValue: NewString failed\n"));
|
||||
|
|
|
@ -125,7 +125,7 @@ JNIEXPORT jstring JNICALL Java_org_mozilla_dom_CharacterDataImpl_getData
|
|||
return NULL;
|
||||
}
|
||||
|
||||
jstring jret = env->NewString((jchar*) ret.GetUnicode(), ret.Length());
|
||||
jstring jret = env->NewString((jchar*) ret.get(), ret.Length());
|
||||
if (!jret) {
|
||||
JavaDOMGlobals::ThrowException(env,
|
||||
"CharacterData.getData: NewString failed");
|
||||
|
@ -313,7 +313,7 @@ JNIEXPORT jstring JNICALL Java_org_mozilla_dom_CharacterDataImpl_substringData
|
|||
return NULL;
|
||||
}
|
||||
|
||||
jstring jret = env->NewString((jchar*) ret.GetUnicode(), ret.Length());
|
||||
jstring jret = env->NewString((jchar*) ret.get(), ret.Length());
|
||||
if (!jret) {
|
||||
JavaDOMGlobals::ThrowException(env,
|
||||
"CharacterData.substringData: NewString failed");
|
||||
|
|
|
@ -33,7 +33,8 @@ JNIEXPORT void JNICALL Java_org_mozilla_dom_DOMAccessor_register
|
|||
("DOMAccessor::register: GetService(JavaDOM) failed: %x\n",
|
||||
rv));
|
||||
} else {
|
||||
NS_WITH_SERVICE(nsIWebProgressListener, javaDOM, kJavaDOMCID, &rv);
|
||||
nsCOMPtr<nsIWebProgressListener> javaDOM;
|
||||
javaDOM = do_GetService(kJavaDOMCID, &rv);
|
||||
if (NS_FAILED(rv) || !javaDOM) {
|
||||
PR_LOG(JavaDOMGlobals::log, PR_LOG_ERROR,
|
||||
("DOMAccessor::register: GetService(JavaDOM) failed: %x\n",
|
||||
|
@ -77,7 +78,8 @@ JNIEXPORT void JNICALL Java_org_mozilla_dom_DOMAccessor_unregister
|
|||
("DOMAccessor::unregister: GetService(DocLoaderService) failed %x\n",
|
||||
rv));
|
||||
} else {
|
||||
NS_WITH_SERVICE(nsIWebProgressListener, javaDOM, kJavaDOMCID, &rv);
|
||||
nsCOMPtr<nsIWebProgressListener> javaDOM;
|
||||
javaDOM = do_GetService(kJavaDOMCID, &rv);
|
||||
if (NS_FAILED(rv) || !javaDOM) {
|
||||
PR_LOG(JavaDOMGlobals::log, PR_LOG_ERROR,
|
||||
("DOMAccessor::unregister: GetService(JavaDOM) failed %x\n",
|
||||
|
|
|
@ -92,7 +92,7 @@ JNIEXPORT jstring JNICALL Java_org_mozilla_dom_DocumentTypeImpl_getName
|
|||
return NULL;
|
||||
}
|
||||
|
||||
jstring jret = env->NewString((jchar*) ret.GetUnicode(), ret.Length());
|
||||
jstring jret = env->NewString((jchar*) ret.get(), ret.Length());
|
||||
if (!jret) {
|
||||
PR_LOG(JavaDOMGlobals::log, PR_LOG_ERROR,
|
||||
("DocumentType.getName: NewString failed\n"));
|
||||
|
@ -167,7 +167,7 @@ JNIEXPORT jstring JNICALL Java_org_mozilla_dom_DocumentTypeImpl_getPublicId
|
|||
return NULL;
|
||||
}
|
||||
|
||||
jstring jret = env->NewString((jchar*) ret.GetUnicode(), ret.Length());
|
||||
jstring jret = env->NewString((jchar*) ret.get(), ret.Length());
|
||||
if (!jret) {
|
||||
PR_LOG(JavaDOMGlobals::log, PR_LOG_ERROR,
|
||||
("DocumentType.getPublicId: NewString failed\n"));
|
||||
|
@ -200,7 +200,7 @@ JNIEXPORT jstring JNICALL Java_org_mozilla_dom_DocumentTypeImpl_getSystemId
|
|||
return NULL;
|
||||
}
|
||||
|
||||
jstring jret = env->NewString((jchar*) ret.GetUnicode(), ret.Length());
|
||||
jstring jret = env->NewString((jchar*) ret.get(), ret.Length());
|
||||
if (!jret) {
|
||||
PR_LOG(JavaDOMGlobals::log, PR_LOG_ERROR,
|
||||
("DocumentType.getSystemId: NewString failed\n"));
|
||||
|
@ -233,7 +233,7 @@ JNIEXPORT jstring JNICALL Java_org_mozilla_dom_DocumentTypeImpl_getInternalSubse
|
|||
return NULL;
|
||||
}
|
||||
|
||||
jstring jret = env->NewString((jchar*) ret.GetUnicode(), ret.Length());
|
||||
jstring jret = env->NewString((jchar*) ret.get(), ret.Length());
|
||||
if (!jret) {
|
||||
PR_LOG(JavaDOMGlobals::log, PR_LOG_ERROR,
|
||||
("DocumentType.getInternalSubset: NewString failed\n"));
|
||||
|
|
|
@ -58,7 +58,7 @@ JNIEXPORT jstring JNICALL Java_org_mozilla_dom_ElementImpl_getAttribute
|
|||
return NULL;
|
||||
}
|
||||
|
||||
jstring jattr = env->NewString((jchar*) attr.GetUnicode(), attr.Length());
|
||||
jstring jattr = env->NewString((jchar*) attr.get(), attr.Length());
|
||||
if (!jattr) {
|
||||
JavaDOMGlobals::ThrowException(env,
|
||||
"Element.getAttribute: NewString failed");
|
||||
|
@ -190,7 +190,7 @@ JNIEXPORT jstring JNICALL Java_org_mozilla_dom_ElementImpl_getTagName
|
|||
return NULL;
|
||||
}
|
||||
|
||||
jstring jTagName = env->NewString((jchar*) tagName.GetUnicode(), tagName.Length());
|
||||
jstring jTagName = env->NewString((jchar*) tagName.get(), tagName.Length());
|
||||
if (!jTagName) {
|
||||
JavaDOMGlobals::ThrowException(env,
|
||||
"Element.getTagName: NewString failed");
|
||||
|
@ -453,7 +453,7 @@ JNIEXPORT jstring JNICALL Java_org_mozilla_dom_ElementImpl_getAttributeNS
|
|||
return NULL;
|
||||
}
|
||||
|
||||
jstring jret = env->NewString((jchar*) ret.GetUnicode(), ret.Length());
|
||||
jstring jret = env->NewString((jchar*) ret.get(), ret.Length());
|
||||
if (!jret) {
|
||||
PR_LOG(JavaDOMGlobals::log, PR_LOG_ERROR,
|
||||
("Element.getAttributeNS: NewString failed\n"));
|
||||
|
|
|
@ -49,7 +49,7 @@ JNIEXPORT jstring JNICALL Java_org_mozilla_dom_EntityImpl_getNotationName
|
|||
return NULL;
|
||||
}
|
||||
|
||||
jstring jret = env->NewString((jchar*) ret.GetUnicode(), ret.Length());
|
||||
jstring jret = env->NewString((jchar*) ret.get(), ret.Length());
|
||||
if (!jret) {
|
||||
PR_LOG(JavaDOMGlobals::log, PR_LOG_ERROR,
|
||||
("Entity.getNotationName: NewString failed\n"));
|
||||
|
@ -83,7 +83,7 @@ JNIEXPORT jstring JNICALL Java_org_mozilla_dom_EntityImpl_getPublicId
|
|||
return NULL;
|
||||
}
|
||||
|
||||
jstring jret = env->NewString((jchar*) ret.GetUnicode(), ret.Length());
|
||||
jstring jret = env->NewString((jchar*) ret.get(), ret.Length());
|
||||
if (!jret) {
|
||||
PR_LOG(JavaDOMGlobals::log, PR_LOG_ERROR,
|
||||
("Entity.getPublicId: NewString failed\n"));
|
||||
|
@ -117,7 +117,7 @@ JNIEXPORT jstring JNICALL Java_org_mozilla_dom_EntityImpl_getSystemId
|
|||
return NULL;
|
||||
}
|
||||
|
||||
jstring jret = env->NewString((jchar*) ret.GetUnicode(), ret.Length());
|
||||
jstring jret = env->NewString((jchar*) ret.get(), ret.Length());
|
||||
if (!jret) {
|
||||
PR_LOG(JavaDOMGlobals::log, PR_LOG_ERROR,
|
||||
("Entity.getSystemId: NewString failed\n"));
|
||||
|
|
|
@ -561,7 +561,7 @@ JNIEXPORT jstring JNICALL Java_org_mozilla_dom_NodeImpl_getNodeName
|
|||
return NULL;
|
||||
}
|
||||
|
||||
jstring jret = env->NewString((jchar*) ret.GetUnicode(), ret.Length());
|
||||
jstring jret = env->NewString((jchar*) ret.get(), ret.Length());
|
||||
if (!jret) {
|
||||
JavaDOMGlobals::ThrowException(env,
|
||||
"Node.getNodeName: NewString failed");
|
||||
|
@ -717,7 +717,7 @@ JNIEXPORT jstring JNICALL Java_org_mozilla_dom_NodeImpl_getNodeValue
|
|||
return NULL;
|
||||
}
|
||||
|
||||
jstring jret = env->NewString((jchar*) ret.GetUnicode(), ret.Length());
|
||||
jstring jret = env->NewString((jchar*) ret.get(), ret.Length());
|
||||
if (!jret) {
|
||||
JavaDOMGlobals::ThrowException(env,
|
||||
"Node.getNodeValue: NewString failed");
|
||||
|
@ -1216,7 +1216,7 @@ JNIEXPORT jstring JNICALL Java_org_mozilla_dom_NodeImpl_getNamespaceURI
|
|||
return NULL;
|
||||
}
|
||||
|
||||
jstring jret = env->NewString((jchar*) ret.GetUnicode(), ret.Length());
|
||||
jstring jret = env->NewString((jchar*) ret.get(), ret.Length());
|
||||
if (!jret) {
|
||||
PR_LOG(JavaDOMGlobals::log, PR_LOG_ERROR,
|
||||
("Node.getNamespaceURI: NewString failed\n"));
|
||||
|
@ -1250,7 +1250,7 @@ JNIEXPORT jstring JNICALL Java_org_mozilla_dom_NodeImpl_getPrefix
|
|||
return NULL;
|
||||
}
|
||||
|
||||
jstring jret = env->NewString((jchar*) ret.GetUnicode(), ret.Length());
|
||||
jstring jret = env->NewString((jchar*) ret.get(), ret.Length());
|
||||
if (!jret) {
|
||||
PR_LOG(JavaDOMGlobals::log, PR_LOG_ERROR,
|
||||
("Node.getPrefix: NewString failed\n"));
|
||||
|
@ -1320,7 +1320,7 @@ JNIEXPORT jstring JNICALL Java_org_mozilla_dom_NodeImpl_getLocalName
|
|||
return NULL;
|
||||
}
|
||||
|
||||
jstring jret = env->NewString((jchar*) ret.GetUnicode(), ret.Length());
|
||||
jstring jret = env->NewString((jchar*) ret.get(), ret.Length());
|
||||
if (!jret) {
|
||||
PR_LOG(JavaDOMGlobals::log, PR_LOG_ERROR,
|
||||
("Node.getLocalName: NewString failed\n"));
|
||||
|
|
|
@ -49,7 +49,7 @@ JNIEXPORT jstring JNICALL Java_org_mozilla_dom_NotationImpl_getPublicId
|
|||
return NULL;
|
||||
}
|
||||
|
||||
jstring jret = env->NewString((jchar*) ret.GetUnicode(), ret.Length());
|
||||
jstring jret = env->NewString((jchar*) ret.get(), ret.Length());
|
||||
if (!jret) {
|
||||
PR_LOG(JavaDOMGlobals::log, PR_LOG_ERROR,
|
||||
("Notation.getPublicId: NewString failed\n"));
|
||||
|
@ -83,7 +83,7 @@ JNIEXPORT jstring JNICALL Java_org_mozilla_dom_NotationImpl_getSystemId
|
|||
return NULL;
|
||||
}
|
||||
|
||||
jstring jret = env->NewString((jchar*) ret.GetUnicode(), ret.Length());
|
||||
jstring jret = env->NewString((jchar*) ret.get(), ret.Length());
|
||||
if (!jret) {
|
||||
PR_LOG(JavaDOMGlobals::log, PR_LOG_ERROR,
|
||||
("Notation.getSystemId: NewString failed\n"));
|
||||
|
|
|
@ -50,7 +50,7 @@ JNIEXPORT jstring JNICALL Java_org_mozilla_dom_ProcessingInstructionImpl_getData
|
|||
return NULL;
|
||||
}
|
||||
|
||||
jstring jret = env->NewString((jchar*) ret.GetUnicode(), ret.Length());
|
||||
jstring jret = env->NewString((jchar*) ret.get(), ret.Length());
|
||||
if (!jret) {
|
||||
JavaDOMGlobals::ThrowException(env,
|
||||
"ProcessingInstruction.getData: NewString failed");
|
||||
|
@ -84,7 +84,7 @@ JNIEXPORT jstring JNICALL Java_org_mozilla_dom_ProcessingInstructionImpl_getTarg
|
|||
return NULL;
|
||||
}
|
||||
|
||||
jstring jret = env->NewString((jchar*) ret.GetUnicode(), ret.Length());
|
||||
jstring jret = env->NewString((jchar*) ret.get(), ret.Length());
|
||||
if (!jret) {
|
||||
JavaDOMGlobals::ThrowException(env,
|
||||
"ProcessingInstruction.getTarget: NewString failed");
|
||||
|
|
|
@ -221,7 +221,7 @@ JNIEXPORT jstring JNICALL Java_org_mozilla_dom_events_EventImpl_getType
|
|||
return NULL;
|
||||
}
|
||||
|
||||
jstring jret = env->NewString((jchar*) ret.GetUnicode(), ret.Length());
|
||||
jstring jret = env->NewString((jchar*) ret.get(), ret.Length());
|
||||
if (!jret) {
|
||||
JavaDOMGlobals::ThrowException(env,
|
||||
"Event.getType: NewString failed");
|
||||
|
|
|
@ -37,6 +37,7 @@
|
|||
#include "nsIGenericFactory.h"
|
||||
|
||||
#include "nsXPIDLString.h"
|
||||
#include "nsCOMPtr.h"
|
||||
|
||||
#if defined(DEBUG)
|
||||
#include <stdio.h>
|
||||
|
@ -632,8 +633,8 @@ static void dump_node(FILE* of, nsIDOMNode* node, int indent,
|
|||
node->GetNodeValue(value);
|
||||
node->GetNodeType(&type);
|
||||
|
||||
const PRUnichar* cname = name.GetUnicode();
|
||||
const PRUnichar* cvalue = value.GetUnicode();
|
||||
const PRUnichar* cname = name.get();
|
||||
const PRUnichar* cvalue = value.get();
|
||||
char* cnorm = strip_whitespace(cvalue, value.Length());
|
||||
fprintf(of, "name=\"%s\" type=%s value=\"%s\"",
|
||||
cname, describe_type(type), cnorm);
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsISimpleEnumerator.h"
|
||||
#include "nsString.h"
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_org_mozilla_webclient_wrapper_1native_BookmarksImpl_nativeAddBookmark
|
||||
|
|
|
@ -664,7 +664,7 @@ NS_IMETHODIMP CBrowserContainer::OnProgressChange(nsIWebProgress *aWebProgress,
|
|||
|
||||
JNIEnv *env = (JNIEnv *) JNU_GetEnv(gVm, JNI_VERSION);
|
||||
|
||||
msgJStr = (jobject) ::util_NewString(env, autoName.GetUnicode(),
|
||||
msgJStr = (jobject) ::util_NewString(env, autoName.get(),
|
||||
autoName.Length());
|
||||
|
||||
util_SendEventToJava(mInitContext->env,
|
||||
|
@ -704,7 +704,7 @@ NS_IMETHODIMP CBrowserContainer::OnStatusChange(nsIWebProgress *aWebProgress,
|
|||
|
||||
JNIEnv *env = (JNIEnv *) JNU_GetEnv(gVm, JNI_VERSION);
|
||||
jstring statusMessage = ::util_NewString(env, (const jchar *)
|
||||
aMsg.GetUnicode(), length);
|
||||
aMsg.get(), length);
|
||||
|
||||
util_SendEventToJava(mInitContext->env, mInitContext->nativeEventThread,
|
||||
mDocTarget,
|
||||
|
@ -842,7 +842,7 @@ CBrowserContainer::doStartURLLoad(const PRUnichar *aDocumentName)
|
|||
#endif
|
||||
nsAutoString nameAutoStr(aDocumentName);
|
||||
jstring nameJStr = ::util_NewString(env, (const jchar *)
|
||||
nameAutoStr.GetUnicode(),
|
||||
nameAutoStr.get(),
|
||||
nameAutoStr.Length());
|
||||
|
||||
util_SendEventToJava(mInitContext->env,
|
||||
|
@ -875,7 +875,7 @@ CBrowserContainer::doEndURLLoad(const PRUnichar *aDocumentName)
|
|||
#endif
|
||||
nsAutoString nameAutoStr(aDocumentName);
|
||||
jstring nameJStr = ::util_NewString(env, (const jchar *)
|
||||
nameAutoStr.GetUnicode(),
|
||||
nameAutoStr.get(),
|
||||
nameAutoStr.Length());
|
||||
|
||||
util_SendEventToJava(mInitContext->env,
|
||||
|
@ -1745,9 +1745,9 @@ nsresult JNICALL CBrowserContainer::takeActionOnNode(nsCOMPtr<nsIDOMNode> curren
|
|||
PR_LOG(prLogModuleInfo, 4, ("%s", (const char *)nodeInfoCStr));
|
||||
}
|
||||
|
||||
jNodeName = ::util_NewString(env, nodeName.GetUnicode(),
|
||||
jNodeName = ::util_NewString(env, nodeName.get(),
|
||||
nodeName.Length());
|
||||
jNodeValue = ::util_NewString(env, nodeValue.GetUnicode(),
|
||||
jNodeValue = ::util_NewString(env, nodeValue.get(),
|
||||
nodeValue.Length());
|
||||
|
||||
util_StoreIntoPropertiesObject(env, (jobject) curThis->properties,
|
||||
|
@ -1809,9 +1809,9 @@ nsresult JNICALL CBrowserContainer::takeActionOnNode(nsCOMPtr<nsIDOMNode> curren
|
|||
PR_LOG(prLogModuleInfo, 4,
|
||||
("attribute[%d] %s", i,(const char *)nodeInfoCStr));
|
||||
}
|
||||
jNodeName = ::util_NewString(env, nodeName.GetUnicode(),
|
||||
jNodeName = ::util_NewString(env, nodeName.get(),
|
||||
nodeName.Length());
|
||||
jNodeValue = ::util_NewString(env, nodeValue.GetUnicode(),
|
||||
jNodeValue = ::util_NewString(env, nodeValue.get(),
|
||||
nodeValue.Length());
|
||||
|
||||
util_StoreIntoPropertiesObject(env, (jobject) curThis->properties,
|
||||
|
|
|
@ -40,7 +40,8 @@
|
|||
#include "nsIContentViewer.h"
|
||||
#include "nsIContentViewerEdit.h"
|
||||
#include "nsIInterfaceRequestor.h"
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIServiceManager.h"
|
||||
|
||||
wsCopySelectionEvent::wsCopySelectionEvent(WebShellInitContext *yourInitContext) :
|
||||
nsActionEvent(),
|
||||
|
@ -98,7 +99,8 @@ wsFindEvent::handleEvent ()
|
|||
|
||||
if (mInitContext) {
|
||||
//First get the FindComponent object
|
||||
NS_WITH_SERVICE(nsIFindComponent, findComponent, NS_IFINDCOMPONENT_CONTRACTID, &rv);
|
||||
nsCOMPtr<nsIFindComponent> findComponent;
|
||||
findComponent = do_GetService(NS_IFINDCOMPONENT_CONTRACTID, &rv);
|
||||
|
||||
if (NS_FAILED(rv) || nsnull == findComponent) {
|
||||
return (void *) rv;
|
||||
|
|
|
@ -31,6 +31,8 @@
|
|||
|
||||
#include "ns_util.h"
|
||||
|
||||
#include "nsCRT.h"
|
||||
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_org_mozilla_webclient_wrapper_1native_HistoryImpl_nativeBack
|
||||
|
|
|
@ -67,7 +67,7 @@ wsLoadURLEvent::handleEvent ()
|
|||
printf ("+++++++++++++++++++++ Thread Id ---- %p\n\n", threadId);
|
||||
|
||||
if (mWebNavigation && mURL) {
|
||||
nsresult rv = mWebNavigation->LoadURI(mURL->GetUnicode(), nsIWebNavigation::LOAD_FLAGS_NONE);
|
||||
nsresult rv = mWebNavigation->LoadURI(mURL->get(), nsIWebNavigation::LOAD_FLAGS_NONE);
|
||||
}
|
||||
return nsnull;
|
||||
} // handleEvent()
|
||||
|
@ -317,8 +317,8 @@ wsPostEvent::handleEvent ()
|
|||
|
||||
rv = lh->OnLinkClick(content,
|
||||
eLinkVerb_Replace,
|
||||
mAbsoluteURL->GetUnicode(),
|
||||
((mTarget != nsnull) ? mTarget->GetUnicode() : nsnull),
|
||||
mAbsoluteURL->get(),
|
||||
((mTarget != nsnull) ? mTarget->get() : nsnull),
|
||||
postDataStream,
|
||||
headersDataStream);
|
||||
|
||||
|
@ -352,7 +352,7 @@ void *
|
|||
wsStopEvent::handleEvent ()
|
||||
{
|
||||
if (mWebNavigation) {
|
||||
nsresult rv = mWebNavigation->Stop();
|
||||
nsresult rv = mWebNavigation->Stop(nsIWebNavigation::STOP_ALL);
|
||||
}
|
||||
return nsnull;
|
||||
} // handleEvent()
|
||||
|
|
|
@ -28,6 +28,9 @@
|
|||
|
||||
#include "nsIPref.h"
|
||||
#include "nsCRT.h" // for memset
|
||||
#include "nsString2.h" // for nsAutoString
|
||||
|
||||
#include "nsIServiceManager.h" // for do_GetService
|
||||
|
||||
|
||||
static NS_DEFINE_CID(kPrefServiceCID, NS_PREF_CID);
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
#include "PromptActionEvents.h"
|
||||
|
||||
#include "ns_util.h"
|
||||
|
||||
#include "nsString2.h" // for nsAutoString
|
||||
|
||||
wsPromptUsernameAndPasswordEvent::wsPromptUsernameAndPasswordEvent(WebShellInitContext *yourInitContext,
|
||||
jobject yourPromptGlobalRef,
|
||||
|
|
|
@ -45,6 +45,7 @@
|
|||
#include "nsRDFCID.h" // for NS_RDFCONTAINER_CID
|
||||
|
||||
#include "wsRDFObserver.h"
|
||||
#include "nsString.h" // for nsCAutoString
|
||||
|
||||
static NS_DEFINE_CID(kRDFContainerCID, NS_RDFCONTAINER_CID);
|
||||
static NS_DEFINE_CID(kSupportsArrayCID, NS_SUPPORTSARRAY_CID);
|
||||
|
|
|
@ -33,6 +33,8 @@
|
|||
#include "nsIStringBundle.h"
|
||||
#include "nsIServiceManager.h"
|
||||
|
||||
#include "nsString2.h"
|
||||
|
||||
static NS_DEFINE_CID(kStringBundleServiceCID, NS_STRINGBUNDLESERVICE_CID);
|
||||
|
||||
#define kCommonDialogsProperties "chrome://global/locale/commonDialogs.properties"
|
||||
|
@ -86,9 +88,9 @@ nsresult util_CreateJstringsFromUnichars(wsStringStruct *strings,
|
|||
for (i = 0; i < arrayLen; i++) {
|
||||
autoStr = strings[i].uniStr;
|
||||
strings[i].jStr = nsnull;
|
||||
if (autoStr.GetUnicode()) {
|
||||
if (autoStr.get()) {
|
||||
strings[i].jStr = ::util_NewString(env, (const jchar *)
|
||||
autoStr.GetUnicode(),
|
||||
autoStr.get(),
|
||||
autoStr.Length());
|
||||
if (nsnull == strings[i].jStr) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
@ -166,7 +168,7 @@ nsresult util_GetLocaleString(const char *aKey, PRUnichar **aResult)
|
|||
rv = stringService->CreateBundle(kCommonDialogsProperties, getter_AddRefs(stringBundle));
|
||||
if (NS_FAILED(rv)) return NS_ERROR_FAILURE;
|
||||
|
||||
rv = stringBundle->GetStringFromName(NS_ConvertASCIItoUCS2(aKey).GetUnicode(), aResult);
|
||||
rv = stringBundle->GetStringFromName(NS_ConvertASCIItoUCS2(aKey).get(), aResult);
|
||||
|
||||
return rv;
|
||||
|
||||
|
|
|
@ -1,58 +0,0 @@
|
|||
#!gmake
|
||||
#
|
||||
# The contents of this file are subject to the Netscape 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/NPL/
|
||||
#
|
||||
# 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 mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# Igor Kushnirskiy <idk@eng.sun.com>
|
||||
#
|
||||
|
||||
DEPTH = ..\..\..\..
|
||||
|
||||
JAVAXPIDLSRCS = nsISupports.idl \
|
||||
nsIFile.idl \
|
||||
nsIEnumerator.idl \
|
||||
nsIComponentManager.idl \
|
||||
nsIFactory.idl \
|
||||
nsISupportsPrimitives.idl \
|
||||
nsIXPIDLServiceManager.idl \
|
||||
$(NULL)
|
||||
|
||||
include <$(DEPTH)\config\rules.mak>
|
||||
include ..\config\rules.mak
|
||||
|
||||
.SUFFIXES: .idl .java
|
||||
import: $(XPIDLSRCS)
|
||||
|
||||
$(JAVAXPIDLSRCS) :
|
||||
copy $(DEPTH)\dist\idl\$(@F) .
|
||||
|
||||
#we have to exclude some files from here
|
||||
#xpidl compiler does not support typedefs, yet.
|
||||
#we do not have typedefs in java
|
||||
#what is the best solution?
|
||||
#idk@eng.sun.com (04/02/2001)
|
||||
|
||||
exclude:
|
||||
del nsISupportsPRTime.java
|
||||
|
||||
java2class:
|
||||
if not exist $(DEPTH)\dist\classes mkdir $(DEPTH)\dist\classes
|
||||
$(JDKHOME)\bin\javac -classpath ".;..\classes\;$(CLASSPATH)" -d $(DEPTH)\dist\classes *.java
|
||||
|
||||
export:: import idl2java exclude java2class
|
||||
|
|
@ -1,464 +0,0 @@
|
|||
/* -*- 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 mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Sun Microsystems,
|
||||
* Inc. Portions created by Sun are
|
||||
* Copyright (C) 1999 Sun Microsystems, Inc. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Igor Kushnirskiy <idk@eng.sun.com>
|
||||
*/
|
||||
|
||||
/*
|
||||
A bunch of stuff was copied from mozJSComponentLoader.cpp
|
||||
*/
|
||||
#include "nsICategoryManager.h"
|
||||
#include "bcJavaComponentLoader.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIModule.h"
|
||||
#include "nsIGenericFactory.h"
|
||||
#include "nsXPIDLString.h"
|
||||
#include "nsCRT.h"
|
||||
#include "bcJavaModule.h"
|
||||
|
||||
|
||||
|
||||
const char javaComponentTypeName[] = JAVACOMPONENTTYPENAME;
|
||||
|
||||
/* XXX export properly from libxpcom, for now this will let Mac build */
|
||||
#ifdef RHAPSODY
|
||||
extern const char fileSizeValueName[]; // = "FileSize";
|
||||
extern const char lastModValueName[]; // = "LastModTimeStamp";
|
||||
extern const char xpcomKeyName[]; // = "Software/Mozilla/XPCOM";
|
||||
#else
|
||||
const char fileSizeValueName[] = "FileSize";
|
||||
const char lastModValueName[] = "LastModTimeStamp";
|
||||
const char xpcomKeyName[] = "software/mozilla/XPCOM/components";
|
||||
#endif
|
||||
|
||||
NS_IMPL_THREADSAFE_ISUPPORTS(bcJavaComponentLoader,NS_GET_IID(nsIComponentLoader));
|
||||
|
||||
bcJavaComponentLoader::bcJavaComponentLoader()
|
||||
: mCompMgr(NULL),
|
||||
|
||||
mXPCOMKey(0)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
printf("--bcJavaComponentLoader::bcJavaComponentLoader \n");
|
||||
}
|
||||
|
||||
bcJavaComponentLoader::~bcJavaComponentLoader() { //nb
|
||||
printf("--bcJavaComponentLoader::~bcJavaComponentLoader \n");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the factory for a given component.
|
||||
*/
|
||||
/* nsIFactory getFactory (in nsIIDRef aCID, in string aLocation, in string aType); */
|
||||
NS_IMETHODIMP bcJavaComponentLoader::GetFactory(const nsIID & aCID, const char *aLocation, const char *aType, nsIFactory **_retval) {
|
||||
printf("--bcJavaComponentLoader::GetFactory \n");
|
||||
if (!_retval)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
#ifdef DEBUG
|
||||
char *cidString = aCID.ToString();
|
||||
fprintf(stderr, "--bcJavaComponentLoader::GetFactory(%s,%s,%s)\n", cidString, aLocation, aType);
|
||||
delete [] cidString;
|
||||
#endif
|
||||
nsIModule * module = ModuleForLocation(aLocation, 0);
|
||||
if (!module) {
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "ERROR: couldn't get module for %s\n", aLocation);
|
||||
#endif
|
||||
return NS_ERROR_FACTORY_NOT_LOADED;
|
||||
}
|
||||
|
||||
nsresult rv = module->GetClassObject(mCompMgr, aCID,
|
||||
NS_GET_IID(nsIFactory),
|
||||
(void **)_retval);
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "GetClassObject %s\n", NS_FAILED(rv) ? "FAILED" : "ok");
|
||||
#endif
|
||||
return rv;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize the loader.
|
||||
*
|
||||
* We use nsISupports here because nsIRegistry isn't IDLized yet.
|
||||
*/
|
||||
/* void init (in nsIComponentManager aCompMgr, in nsISupports aRegistry); */
|
||||
NS_IMETHODIMP bcJavaComponentLoader::Init(nsIComponentManager *aCompMgr, nsISupports *aReg) {
|
||||
printf("--bcJavaComponentLoader::Init \n");
|
||||
nsresult rv;
|
||||
mCompMgr = aCompMgr;
|
||||
mRegistry = do_QueryInterface(aReg, &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = mRegistry->GetSubtree(nsIRegistry::Common, xpcomKeyName,
|
||||
&mXPCOMKey);
|
||||
if (NS_FAILED(rv))
|
||||
/* if we can't get the XPCOM key, just skip all registry ops */
|
||||
mRegistry = nsnull;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when a component of the appropriate type is registered,
|
||||
* to give the component loader an opportunity to do things like
|
||||
* annotate the registry and such.
|
||||
*/
|
||||
/* void onRegister (in nsIIDRef aCID, in string aType, in string aClassName, in string aContractID, in string aLocation, in boolean aReplace, in boolean aPersist); */
|
||||
NS_IMETHODIMP bcJavaComponentLoader::OnRegister(const nsIID & aCID, const char *aType, const char *aClassName, const char *aContractID, const char *aLocation, PRBool aReplace, PRBool aPersist) { //nb
|
||||
printf("--bcJavaComponentLoader::OnRegister \n");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* AutoRegister components in the given directory.
|
||||
*/
|
||||
NS_IMETHODIMP bcJavaComponentLoader::AutoRegisterComponents(PRInt32 aWhen, nsIFile *aDirectory) {
|
||||
printf("--bcJavaComponentLoader::AutoRegisterComponents \n");
|
||||
return RegisterComponentsInDir(aWhen,aDirectory);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP bcJavaComponentLoader::AutoUnregisterComponent(PRInt32 when,
|
||||
nsIFile *component,
|
||||
PRBool *unregistered) {
|
||||
//nb need to impelement
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult bcJavaComponentLoader::RegisterComponentsInDir(PRInt32 when, nsIFile *dir)
|
||||
{
|
||||
nsresult rv;
|
||||
PRBool isDir;
|
||||
|
||||
if (NS_FAILED(rv = dir->IsDirectory(&isDir)))
|
||||
return rv;
|
||||
|
||||
if (!isDir)
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
|
||||
// Create a directory iterator
|
||||
nsCOMPtr<nsISimpleEnumerator> dirIterator;
|
||||
rv = dir->GetDirectoryEntries(getter_AddRefs(dirIterator));
|
||||
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
// whip through the directory to register every file
|
||||
nsIFile *dirEntry = NULL;
|
||||
PRBool more = PR_FALSE;
|
||||
|
||||
rv = dirIterator->HasMoreElements(&more);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
while (more == PR_TRUE)
|
||||
{
|
||||
rv = dirIterator->GetNext((nsISupports**)&dirEntry);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
rv = dirEntry->IsDirectory(&isDir);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
if (isDir == PR_TRUE)
|
||||
{
|
||||
// This is a directory. Grovel for components into the directory.
|
||||
rv = RegisterComponentsInDir(when, dirEntry);
|
||||
}
|
||||
else
|
||||
{
|
||||
PRBool registered;
|
||||
// This is a file. Try to register it.
|
||||
rv = AutoRegisterComponent(when, dirEntry, ®istered);
|
||||
}
|
||||
}
|
||||
NS_RELEASE(dirEntry);
|
||||
}
|
||||
rv = dirIterator->HasMoreElements(&more);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* AutoRegister the given component.
|
||||
*
|
||||
* Returns true if the component was registered, false if it couldn't
|
||||
* attempt to register the component (wrong type) and ``throws'' an
|
||||
* NS_FAILED code if there was an error during registration.
|
||||
*/
|
||||
/* boolean autoRegisterComponent (in long aWhen, in nsIFile aComponent); */
|
||||
|
||||
/* copied from mozJSComponentLoader.cpp */
|
||||
NS_IMETHODIMP bcJavaComponentLoader::AutoRegisterComponent(PRInt32 when, nsIFile *component, PRBool *registered) {
|
||||
//printf("--bcJavaComponentLoader::AutoRegisterComponent \n");
|
||||
nsresult rv;
|
||||
if (!registered)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
const char javaExtension[] = ".jar.info";
|
||||
int javaExtensionLen = 9;
|
||||
nsXPIDLCString leafName;
|
||||
|
||||
*registered = PR_FALSE;
|
||||
|
||||
/* we only do files */
|
||||
PRBool isFile = PR_FALSE;
|
||||
if (NS_FAILED(rv = component->IsFile(&isFile)) || !isFile)
|
||||
return rv;
|
||||
|
||||
if (NS_FAILED(rv = component->GetLeafName(getter_Copies(leafName))))
|
||||
return rv;
|
||||
int len = PL_strlen(leafName);
|
||||
|
||||
/* if it's not javaExtension return now */
|
||||
if (len < javaExtensionLen || // too short
|
||||
PL_strcasecmp(leafName + len - javaExtensionLen, javaExtension))
|
||||
return NS_OK;
|
||||
|
||||
printf("--bcJavaComponentLoader: registering bcJavaComponent component %s\n",(const char *)leafName);
|
||||
rv = AttemptRegistration(component, PR_FALSE);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
printf("registered module %s\n", (const char *)leafName);
|
||||
else if (rv == NS_ERROR_FACTORY_REGISTER_AGAIN)
|
||||
printf("deferred module %s\n", (const char *)leafName);
|
||||
else
|
||||
printf("failed to register %s\n", (const char *)leafName);
|
||||
*registered = (PRBool) NS_SUCCEEDED(rv);
|
||||
return NS_OK;
|
||||
|
||||
}
|
||||
|
||||
|
||||
nsresult bcJavaComponentLoader::AttemptRegistration(nsIFile *component,
|
||||
PRBool deferred) {
|
||||
nsXPIDLCString registryLocation;
|
||||
nsresult rv;
|
||||
nsIModule *module;
|
||||
|
||||
rv = mCompMgr->RegistryLocationForSpec(component,
|
||||
getter_Copies(registryLocation));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
/* no need to check registry data on deferred reg */
|
||||
if (deferred || HasChanged(registryLocation, component)) {
|
||||
module = ModuleForLocation(registryLocation, component);
|
||||
if (module) {
|
||||
rv = module->RegisterSelf(mCompMgr, component, registryLocation,
|
||||
javaComponentTypeName);
|
||||
if (rv == NS_ERROR_FACTORY_REGISTER_AGAIN) {
|
||||
mDeferredComponents.AppendElement(component);
|
||||
/*
|
||||
* we don't enter in the registry because we may want to
|
||||
* try again on a later autoreg, in case a dependency has
|
||||
* become available.
|
||||
*/
|
||||
return rv;
|
||||
}
|
||||
}
|
||||
}
|
||||
SetRegistryInfo(registryLocation, component);
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsresult bcJavaComponentLoader::SetRegistryInfo(const char *registryLocation,
|
||||
nsIFile *component)
|
||||
{
|
||||
if (!mRegistry.get())
|
||||
return NS_OK; // silent failure
|
||||
|
||||
nsresult rv;
|
||||
nsRegistryKey key;
|
||||
|
||||
rv = mRegistry->AddSubtreeRaw(mXPCOMKey, registryLocation, &key);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
PRInt64 modDate;
|
||||
|
||||
if (NS_FAILED(rv = component->GetLastModifiedTime(&modDate)) ||
|
||||
NS_FAILED(rv = mRegistry->SetLongLong(key, lastModValueName, &modDate)))
|
||||
return rv;
|
||||
|
||||
PRInt64 fileSize;
|
||||
if (NS_FAILED(rv = component->GetFileSize(&fileSize)) ||
|
||||
NS_FAILED(rv = mRegistry->SetLongLong(key, fileSizeValueName, &fileSize)))
|
||||
return rv;
|
||||
printf("SetRegistryInfo(%s) => (%d,%d)\n", registryLocation,
|
||||
(int)modDate, (int)fileSize);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
PRBool bcJavaComponentLoader::HasChanged(const char *registryLocation, nsIFile *component) {
|
||||
/* if we don't have a registry handle, force registration of component */
|
||||
if (!mRegistry)
|
||||
return PR_TRUE;
|
||||
|
||||
nsRegistryKey key;
|
||||
if (NS_FAILED(mRegistry->GetSubtreeRaw(mXPCOMKey, registryLocation, &key)))
|
||||
return PR_TRUE;
|
||||
|
||||
/* check modification date */
|
||||
PRInt64 regTime, lastTime;
|
||||
if (NS_FAILED(mRegistry->GetLongLong(key, lastModValueName, ®Time)))
|
||||
return PR_TRUE;
|
||||
|
||||
if (NS_FAILED(component->GetLastModifiedTime(&lastTime)) || LL_NE(lastTime, regTime))
|
||||
return PR_TRUE;
|
||||
|
||||
/* check file size */
|
||||
PRInt64 regSize;
|
||||
if (NS_FAILED(mRegistry->GetLongLong(key, fileSizeValueName, ®Size)))
|
||||
return PR_TRUE;
|
||||
PRInt64 size;
|
||||
if (NS_FAILED(component->GetFileSize(&size)) || LL_NE(size,regSize) )
|
||||
return PR_TRUE;
|
||||
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
nsIModule * bcJavaComponentLoader::ModuleForLocation(const char *registryLocation, nsIFile *component) {
|
||||
nsStringKey key((const PRUnichar *)registryLocation); //nb can I do this?
|
||||
nsIModule *res = NULL;
|
||||
res = (nsIModule*)mModules.Get(&key);
|
||||
PRBool needRelease = PR_FALSE;
|
||||
if (res) {
|
||||
return res;
|
||||
}
|
||||
if (!component) {
|
||||
if (NS_FAILED(mCompMgr->SpecForRegistryLocation(registryLocation, &component)))
|
||||
return NULL;
|
||||
needRelease = PR_TRUE;
|
||||
}
|
||||
res = new bcJavaModule(registryLocation, component);
|
||||
if (needRelease) {
|
||||
NS_IF_RELEASE(component);
|
||||
}
|
||||
|
||||
if (res) {
|
||||
mModules.Put(&key,res);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
/**
|
||||
* Register any deferred (NS_ERROR_FACTORY_REGISTER_AGAIN) components.
|
||||
* Return registered-any-components?
|
||||
*/
|
||||
/* boolean registerDeferredComponents (in long aWhen); */
|
||||
NS_IMETHODIMP bcJavaComponentLoader::RegisterDeferredComponents(PRInt32 aWhen, PRBool *aRegistered) {
|
||||
printf("--bcJavaComponentLoader::RegisterDeferredComponents \n");
|
||||
nsresult rv;
|
||||
*aRegistered = PR_FALSE;
|
||||
PRUint32 count;
|
||||
rv = mDeferredComponents.Count(&count);
|
||||
printf("mJCL: registering deferred (%d)\n", count);
|
||||
if (NS_FAILED(rv) || !count)
|
||||
return NS_OK;
|
||||
|
||||
for (PRUint32 i = 0; i < count; i++) {
|
||||
nsCOMPtr<nsISupports> supports;
|
||||
nsCOMPtr<nsIFile> component;
|
||||
|
||||
rv = mDeferredComponents.GetElementAt(i, getter_AddRefs(supports));
|
||||
if (NS_FAILED(rv))
|
||||
continue;
|
||||
|
||||
component = do_QueryInterface(supports, &rv);
|
||||
if (NS_FAILED(rv))
|
||||
continue;
|
||||
|
||||
rv = AttemptRegistration(component, PR_TRUE /* deferred */);
|
||||
if (rv != NS_ERROR_FACTORY_REGISTER_AGAIN) {
|
||||
if (NS_SUCCEEDED(rv))
|
||||
*aRegistered = PR_TRUE;
|
||||
mDeferredComponents.RemoveElementAt(i);
|
||||
}
|
||||
}
|
||||
rv = mDeferredComponents.Count(&count);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
if (*aRegistered)
|
||||
printf("mJCL: registered deferred, %d left\n", count);
|
||||
else
|
||||
printf("mJCL: didn't register any components, %d left\n", count);
|
||||
}
|
||||
/* are there any fatal errors? */
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Unload all components that are willing.
|
||||
*/
|
||||
/* void unloadAll (in long aWhen); */
|
||||
NS_IMETHODIMP bcJavaComponentLoader::UnloadAll(PRInt32 aWhen) { //nb
|
||||
printf("--bcJavaComponentLoader::UnloadAll \n");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------------------------------
|
||||
|
||||
/* XXX this should all be data-driven, via NS_IMPL_GETMODULE_WITH_CATEGORIES */
|
||||
static NS_METHOD
|
||||
RegisterJavaLoader(nsIComponentManager *aCompMgr, nsIFile *aPath,
|
||||
const char *registryLocation, const char * componentType, const nsModuleComponentInfo *info)
|
||||
{
|
||||
printf("--JavaLoader got registered\n");
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsICategoryManager> catman =
|
||||
do_GetService(NS_CATEGORYMANAGER_CONTRACTID, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
nsXPIDLCString previous;
|
||||
return catman->AddCategoryEntry("component-loader", javaComponentTypeName,
|
||||
BC_JAVACOMPONENTLOADER_ContractID,
|
||||
PR_TRUE, PR_TRUE, getter_Copies(previous));
|
||||
|
||||
}
|
||||
|
||||
static NS_METHOD
|
||||
UnregisterJavaLoader(nsIComponentManager *aCompMgr, nsIFile *aPath,
|
||||
const char *registryLocation, const nsModuleComponentInfo *info)
|
||||
{
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsICategoryManager> catman =
|
||||
do_GetService(NS_CATEGORYMANAGER_CONTRACTID, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
nsXPIDLCString javaLoader;
|
||||
rv = catman->GetCategoryEntry("component-loader", javaComponentTypeName,
|
||||
getter_Copies(javaLoader));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
// only unregister if we're the current JS component loader
|
||||
if (!strcmp(javaLoader, BC_JAVACOMPONENTLOADER_ContractID)) {
|
||||
return catman->DeleteCategoryEntry("component-loader",
|
||||
javaComponentTypeName, PR_TRUE);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(bcJavaComponentLoader);
|
||||
|
||||
static nsModuleComponentInfo components_loader[] = {
|
||||
{ "Java component loader", BC_JAVACOMPONENTLOADER_CID,
|
||||
BC_JAVACOMPONENTLOADER_ContractID,
|
||||
bcJavaComponentLoaderConstructor,
|
||||
RegisterJavaLoader, UnregisterJavaLoader },
|
||||
};
|
||||
|
||||
NS_IMPL_NSGETMODULE("Java component loader", components_loader);
|
||||
|
Загрузка…
Ссылка в новой задаче