int getScriptObject (int /*long*/ aContext, int /*long*/ aScriptObject) { byte[] jsLibPath = Mozilla.getJSLibPathBytes (); int /*long*/ nativeContext = XPCOM.nsIScriptContext_GetNativeContext (aContext); int /*long*/ globalJSObject = XPCOM.JS_GetGlobalObject (jsLibPath, nativeContext); int /*long*/ newObject = XPCOM.JS_NewObject (jsLibPath, nativeContext, 0, 0, globalJSObject); byte[] functionName = MozillaDelegate.wcsToMbcs (null, CALLJAVA, true); int flags = XPCOM.JSPROP_ENUMERATE | XPCOM.JSPROP_READONLY | XPCOM.JSPROP_PERMANENT; XPCOM.JS_DefineFunction (jsLibPath, nativeContext, newObject, functionName, XPCOM.CALLBACK_JSNative (CallJavaProc.getAddress ()), 3, flags); XPCOM.memmove (aScriptObject, new int /*long*/[] {newObject}, C.PTR_SIZEOF); return XPCOM.NS_OK; }
int ReadSegments (int /*long*/ aWriter, int /*long*/ aClosure, int aCount, int /*long*/ _retval) { int max = buffer == null ? 0 : buffer.length - index; if (aCount != -1) { max = Math.min (max, aCount); } int cnt = max; while (cnt > 0) { int[] aWriteCount = new int[1]; int /*long*/ rc = XPCOM.Call (aWriter, getAddress (), aClosure, buffer, index, cnt, aWriteCount); if (rc != XPCOM.NS_OK) break; index += aWriteCount[0]; cnt -= aWriteCount[0]; } XPCOM.memmove (_retval, new int[] {max - cnt}, 4); return XPCOM.NS_OK; }
rc = XPCOM.NS_GetComponentManager (result); if (rc != XPCOM.NS_OK) error (rc); if (result[0] == 0) error (XPCOM.NS_NOINTERFACE); long /*int*/ string = XPCOM.nsEmbedString_new (); rc = serializer.SerializeToString (document, string); serializer.Release (); int length = XPCOM.nsEmbedString_Length (string); long /*int*/ buffer = XPCOM.nsEmbedString_get (string); chars = new char[length]; XPCOM.memmove (chars, buffer, length * 2); XPCOM.nsEmbedString_delete (string); } else { /* mozilla < 1.7 */ rc = componentManager.CreateInstanceByContractID (contractID, 0, nsIDOMSerializer.NS_IDOMSERIALIZER_IID, result); serializer.Release (); int length = XPCOM.strlen_PRUnichar (result[0]); chars = new char[length]; XPCOM.memmove (chars, result[0], length * 2);
int rc = XPCOM.NS_NewLocalFile (pathString.getAddress (), 1, result); pathString.dispose (); if (rc != XPCOM.NS_OK) { result[0] = 0; if (isXULRunner) { int size = XPCOM.nsDynamicFunctionLoad_sizeof (); functionLoad.function = C.malloc (C.PTR_SIZEOF); C.memmove (functionLoad.function, new long /*int*/[] {0} , C.PTR_SIZEOF); XPCOM.memmove (ptr, functionLoad, XPCOM.nsDynamicFunctionLoad_sizeof ()); rc = XPCOM.XPCOMGlueLoadXULFunctions (ptr); if (rc == XPCOM.NS_OK) { /* > 3.x */ result[0] = 0; functionLoad.functionName = C.malloc (bytes.length); C.memmove (functionLoad.functionName, bytes, bytes.length); XPCOM.memmove (ptr, functionLoad, XPCOM.nsDynamicFunctionLoad_sizeof ()); rc = XPCOM.XPCOMGlueLoadXULFunctions (ptr); IsPre_4 = IsPre_17 = true; rc = XPCOM.Call (functionPtr, localFile.getAddress (), localFile.getAddress (), LocationProvider.getAddress (), 0, 0); } else { rc = XPCOM.Call (functionPtr, localFile.getAddress (), localFile.getAddress (), LocationProvider.getAddress ()); rc = XPCOM.NS_InitXPCOM2 (0, localFile.getAddress(), LocationProvider.getAddress ());
nsIInterfaceRequestor interfaceRequestor = new nsIInterfaceRequestor (result[0]); result[0] = 0; rc = XPCOM.NS_GetServiceManager (result); if (rc != XPCOM.NS_OK) error (rc); if (result[0] == 0) error (XPCOM.NS_NOINTERFACE); int rc = XPCOM.NS_GetServiceManager (result); if (rc != XPCOM.NS_OK) error (rc); if (result[0] == 0) error (XPCOM.NS_NOINTERFACE); int /*long*/ scriptGlobalObject = result[0]; result[0] = 0; rc = (int/*64*/)XPCOM.nsIScriptGlobalObject_EnsureScriptEnvironment (scriptGlobalObject, 2); /* nsIProgrammingLanguage.JAVASCRIPT */ if (rc != XPCOM.NS_OK) { new nsISupports (scriptGlobalObject).Release (); } else { int /*long*/ scriptContext = XPCOM.nsIScriptGlobalObject_GetScriptContext (scriptGlobalObject, 2); /* nsIProgrammingLanguage.JAVASCRIPT */ int /*long*/ jsContext = XPCOM.nsIScriptContext_GetNativeContext (scriptContext); if (jsContext != 0) { int length = script.length (); int /*long*/ globalJSObject = XPCOM.JS_GetGlobalObject (jsLibPath, jsContext); if (globalJSObject != 0) { aContractID = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_CONTEXTSTACK_CONTRACTID, true); boolean success; if (MozillaVersion.CheckVersion (MozillaVersion.VERSION_XR1_9, true)) { success = XPCOM.JS_EvaluateUCScriptForPrincipals (jsLibPath, jsContext, globalJSObject, principals, scriptChars, length, urlbytes, 0, result) != 0;
int rc = XPCOM.NS_GetServiceManager (result); if (rc != XPCOM.NS_OK) error (rc); if (result[0] == 0) error (XPCOM.NS_NOINTERFACE); result[0] = 0; byte[] bytes = MozillaDelegate.wcsToMbcs (null, CookieUrl, false); long /*int*/ aSpec = XPCOM.nsEmbedCString_new (bytes, bytes.length); rc = ioService.NewURI (aSpec, null, 0, result); XPCOM.nsEmbedCString_delete (aSpec); ioService.Release (); if (rc != XPCOM.NS_OK) { XPCOM.memmove (bytes, cookieString, length); if (!XPCOM.NS_Free (pathBytes_NSFree, cookieString)) { C.free (cookieString);
int rc = XPCOM.NS_GetServiceManager (result); if (rc != XPCOM.NS_OK) error (rc); if (result[0] == 0) error (XPCOM.NS_NOINTERFACE); result[0] = 0; if (IsPre_17) { rc = (int/*64*/)XPCOM.nsIScriptGlobalObject_EnsureScriptEnvironment (scriptGlobalObject, 2); /* nsIProgrammingLanguage.JAVASCRIPT */ } else { rc = (int/*64*/)XPCOM.nsIScriptGlobalObject17_EnsureScriptEnvironment (scriptGlobalObject); long /*int*/ scriptContext; if (IsPre_17) { scriptContext = XPCOM.nsIScriptGlobalObject_GetScriptContext (scriptGlobalObject, 2); /* nsIProgrammingLanguage.JAVASCRIPT */ } else { scriptContext = XPCOM.nsIScriptGlobalObject17_GetScriptContext (scriptGlobalObject); jsContext = XPCOM.nsIScriptContext_GetNativeContext (scriptContext); } else { jsContext = XPCOM.nsIScriptContext17_GetNativeContext (scriptContext); long /*int*/ globalJSObject = XPCOM.JS_GetGlobalObject (jsLibPath, jsContext); if (globalJSObject != 0) { aContractID = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_CONTEXTSTACK_CONTRACTID, true); stack.Release (); } else { boolean success = XPCOM.JS_EvaluateUCScriptForPrincipals (jsLibPath, jsContext, globalJSObject, principals, scriptChars, length, urlbytes, 0, isXULRunner190x ? result : null) != 0; result[0] = 0; rc = stack.Pop (result);
int size = XPCOM.nsDynamicFunctionLoad_sizeof (); functionLoad.function = C.malloc (C.PTR_SIZEOF); C.memmove (functionLoad.function, new long /*int*/[] {0} , C.PTR_SIZEOF); XPCOM.memmove (ptr, functionLoad, XPCOM.nsDynamicFunctionLoad_sizeof ()); XPCOM.XPCOMGlueLoadXULFunctions (ptr); C.memmove (result, functionLoad.function, C.PTR_SIZEOF); long /*int*/ functionPtr = result[0]; rc = XPCOM.Call (functionPtr); if (rc != XPCOM.NS_OK) { browser.dispose ();
int canCallMethod (long /*int*/ iid, long /*int*/ methodName, long /*int*/ _retVal) { long /*int*/[] result = new long /*int*/[1]; int rc = XPCOM.NS_GetServiceManager (result); if (rc != XPCOM.NS_OK) Mozilla.error (rc); if (result[0] == 0) Mozilla.error (XPCOM.NS_NOINTERFACE); int length = XPCOM.strlen_PRUnichar (methodName); char[] dest = new char[length]; XPCOM.memmove (dest, methodName, length * 2); String string = new String (dest); byte[] bytes;
int rc = XPCOM.NS_GetServiceManager (result); if (rc != XPCOM.NS_OK) Mozilla.error (rc); if (result[0] == 0) Mozilla.error (XPCOM.NS_NOINTERFACE); rc = XPCOM.NS_GetComponentManager (result); if (rc != XPCOM.NS_OK) Mozilla.error (rc); if (result[0] == 0) Mozilla.error (XPCOM.NS_NOINTERFACE); long /*int*/ jsVal = memory.Alloc (jsval_sizeof); C.memset (jsVal, 0, jsval_sizeof); long /*int*/ globalObject = XPCOM.JS_GetGlobalObject (Mozilla.getJSLibPathBytes (), cx); rc = connect.VariantToJS (cx, globalObject, resultVariant.getAddress (), jsVal); resultVariant.Release ();
rc = XPCOM.NS_GetComponentManager (result); if (rc != XPCOM.NS_OK) error (rc); if (result[0] == 0) error (XPCOM.NS_NOINTERFACE); rc = serializer.SerializeToString (document, result); if (rc == XPCOM.NS_OK) { int length = XPCOM.strlen_PRUnichar (result[0]); char[] chars = new char[length]; XPCOM.memmove (chars, result[0], length * 2); text = new String (chars);
int ShowAsModal () { long /*int*/[] result = new long /*int*/[1]; int rc = XPCOM.NS_GetServiceManager (result); if (rc != XPCOM.NS_OK) error (rc); if (result[0] == 0) error (XPCOM.NS_NOINTERFACE);
int getInterfaces (long /*int*/ count, long /*int*/ array) { long /*int*/[] result = new long /*int*/[1]; int rc = XPCOM.NS_GetServiceManager (result); if (rc != XPCOM.NS_OK) Mozilla.error (rc); if (result[0] == 0) Mozilla.error (XPCOM.NS_NOINTERFACE); result[0] = 0; long /*int*/ securityCheckedComponentIID = memory.Alloc (nsID.sizeof); XPCOM.memmove (securityCheckedComponentIID, XPCOM.NS_ISECURITYCHECKEDCOMPONENT_IID, nsID.sizeof); long /*int*/ externalIID = memory.Alloc (nsID.sizeof); XPCOM.memmove (externalIID, EXTERNAL_IID, nsID.sizeof); long /*int*/ ptrArray = memory.Alloc (3 * C.PTR_SIZEOF); C.memmove (ptrArray, new long /*int*/[] {securityCheckedComponentIID}, C.PTR_SIZEOF); XPCOM.memmove (asdfIID, NS_ASDF_IID, nsID.sizeof); C.memmove (ptrArray + 2 * C.PTR_SIZEOF, new long /*int*/[] {asdfIID}, C.PTR_SIZEOF);
int rc = XPCOM.NS_GetComponentManager (result); if (rc != XPCOM.NS_OK) { browser.dispose (); result[0] = 0; rc = XPCOM.NS_GetServiceManager (result); if (rc != XPCOM.NS_OK) { browser.dispose (); int rc = XPCOM.NS_GetComponentManager (result); if (rc != XPCOM.NS_OK) { browser.dispose ();
InputStream dataStream = null; if (postData != null) { rc = XPCOM.NS_GetComponentManager (result); if (rc != XPCOM.NS_OK) error (rc); if (result[0] == 0) error (XPCOM.NS_NOINTERFACE);
if (new PromptDialog (browser.getShell ()).invalidCert (browser, message, finalProblems, cert)) { int /*long*/[] result = new int /*long*/[1]; int rc = XPCOM.NS_GetServiceManager (result); if (rc != XPCOM.NS_OK) error (rc); if (result[0] == 0) error (XPCOM.NS_NOINTERFACE); result[0] = 0; byte[] hostBytes = MozillaDelegate.wcsToMbcs (null, host, false); int /*long*/ hostString = XPCOM.nsEmbedCString_new (hostBytes, hostBytes.length); rc = overrideService.RememberValidityOverride (hostString, port, cert.getAddress (), finalFlags, 1); navigate (badCertRequest); XPCOM.nsEmbedCString_delete (hostString); overrideService.Release ();
int rc = XPCOM.NS_NewLocalFile (pathString.getAddress (), 1, result); pathString.dispose (); if (rc != XPCOM.NS_OK) { result[0] = 0; if (isXULRunner) { int size = XPCOM.nsDynamicFunctionLoad_sizeof (); functionLoad.function = C.malloc (C.PTR_SIZEOF); C.memmove (functionLoad.function, new int /*long*/[] {0} , C.PTR_SIZEOF); XPCOM.memmove (ptr, functionLoad, XPCOM.nsDynamicFunctionLoad_sizeof ()); rc = XPCOM.XPCOMGlueLoadXULFunctions (ptr); if (rc == XPCOM.NS_OK) { /* > 3.x */ result[0] = 0; functionLoad.functionName = C.malloc (bytes.length); C.memmove (functionLoad.functionName, bytes, bytes.length); XPCOM.memmove (ptr, functionLoad, XPCOM.nsDynamicFunctionLoad_sizeof ()); rc = XPCOM.XPCOMGlueLoadXULFunctions (ptr); rc = XPCOM.Call (functionPtr, localFile.getAddress (), localFile.getAddress (), LocationProvider.getAddress ()); } else { rc = XPCOM.Call (functionPtr, localFile.getAddress (), localFile.getAddress (), LocationProvider.getAddress (), 0, 0); rc = XPCOM.NS_InitXPCOM2 (0, localFile.getAddress(), LocationProvider.getAddress ());
nsIInterfaceRequestor interfaceRequestor = new nsIInterfaceRequestor (result[0]); result[0] = 0; rc = XPCOM.NS_GetServiceManager (result); if (rc != XPCOM.NS_OK) error (rc); if (result[0] == 0) error (XPCOM.NS_NOINTERFACE); int rc = XPCOM.NS_GetServiceManager (result); if (rc != XPCOM.NS_OK) error (rc); if (result[0] == 0) error (XPCOM.NS_NOINTERFACE); int /*long*/ scriptGlobalObject = result[0]; result[0] = 0; rc = (int/*64*/)XPCOM.nsIScriptGlobalObject_EnsureScriptEnvironment (scriptGlobalObject, 2); /* nsIProgrammingLanguage.JAVASCRIPT */ if (rc != XPCOM.NS_OK) { new nsISupports (scriptGlobalObject).Release (); } else { int /*long*/ scriptContext = XPCOM.nsIScriptGlobalObject_GetScriptContext (scriptGlobalObject, 2); /* nsIProgrammingLanguage.JAVASCRIPT */ int /*long*/ jsContext = XPCOM.nsIScriptContext_GetNativeContext (scriptContext); if (jsContext != 0) { int length = script.length (); int /*long*/ globalJSObject = XPCOM.JS_GetGlobalObject (jsLibPath, jsContext); if (globalJSObject != 0) { aContractID = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_CONTEXTSTACK_CONTRACTID, true); boolean success; if (MozillaVersion.CheckVersion (MozillaVersion.VERSION_XR1_9, true)) { success = XPCOM.JS_EvaluateUCScriptForPrincipals (jsLibPath, jsContext, globalJSObject, principals, scriptChars, length, urlbytes, 0, result) != 0;
int rc = XPCOM.NS_GetServiceManager (result); if (rc != XPCOM.NS_OK) error (rc); if (result[0] == 0) error (XPCOM.NS_NOINTERFACE); result[0] = 0; byte[] bytes = MozillaDelegate.wcsToMbcs (null, CookieUrl, false); int /*long*/ aSpec = XPCOM.nsEmbedCString_new (bytes, bytes.length); rc = ioService.NewURI (aSpec, null, 0, result); XPCOM.nsEmbedCString_delete (aSpec); ioService.Release (); if (rc != XPCOM.NS_OK) { XPCOM.memmove (bytes, cookieString, length); if (!XPCOM.NS_Free (pathBytes_NSFree, cookieString)) { C.free (cookieString);
int size = XPCOM.nsDynamicFunctionLoad_sizeof (); functionLoad.function = C.malloc (C.PTR_SIZEOF); C.memmove (functionLoad.function, new long /*int*/[] {0} , C.PTR_SIZEOF); XPCOM.memmove (ptr, functionLoad, XPCOM.nsDynamicFunctionLoad_sizeof ()); XPCOM.XPCOMGlueLoadXULFunctions (ptr); C.memmove (result, functionLoad.function, C.PTR_SIZEOF); long /*int*/ functionPtr = result[0]; rc = XPCOM.Call (functionPtr); if (rc != XPCOM.NS_OK) { browser.dispose ();