зеркало из https://github.com/mozilla/pjs.git
Fix for 11214.
This commit is contained in:
Родитель
6d8c3af528
Коммит
b362c9153a
|
@ -57,6 +57,10 @@
|
|||
#include "nsNeckoUtil.h"
|
||||
#endif
|
||||
|
||||
#include "nsProxiedService.h"
|
||||
#include "nsINetSupportDialogService.h"
|
||||
#include "nsIPrompt.h"
|
||||
|
||||
#ifdef _WINDOWS
|
||||
#include "nsWinReg.h"
|
||||
#include "nsWinProfile.h"
|
||||
|
@ -85,6 +89,9 @@ static NS_DEFINE_IID(kIEventQueueServiceIID, NS_IEVENTQUEUESERVICE_IID);
|
|||
static NS_DEFINE_IID(kNetServiceCID, NS_NETSERVICE_CID);
|
||||
static NS_DEFINE_IID(kINetServiceIID, NS_INETSERVICE_IID);
|
||||
#endif
|
||||
|
||||
static NS_DEFINE_CID(kNetSupportDialogCID, NS_NETSUPPORTDIALOG_CID);
|
||||
|
||||
static NS_DEFINE_IID(kStringBundleServiceCID, NS_STRINGBUNDLESERVICE_CID);
|
||||
static NS_DEFINE_IID(kIStringBundleServiceIID, NS_ISTRINGBUNDLESERVICE_IID);
|
||||
|
||||
|
@ -2014,6 +2021,32 @@ void nsInstall::GetInstallURL(nsString& url) { url = mInstallURL; }
|
|||
void nsInstall::SetInstallURL(const nsString& url) { mInstallURL = url; }
|
||||
|
||||
|
||||
PRInt32
|
||||
nsInstall::Alert(nsString& string)
|
||||
{
|
||||
nsresult res;
|
||||
|
||||
NS_WITH_PROXIED_SERVICE(nsIPrompt, dialog, kNetSupportDialogCID, nsnull, &res);
|
||||
if (NS_FAILED(res))
|
||||
return res;
|
||||
|
||||
return dialog->Alert(string.GetUnicode());
|
||||
}
|
||||
|
||||
PRInt32
|
||||
nsInstall::Confirm(nsString& string, PRBool* aReturn)
|
||||
{
|
||||
*aReturn = PR_FALSE; /* default value */
|
||||
|
||||
nsresult res;
|
||||
NS_WITH_PROXIED_SERVICE(nsIPrompt, dialog, kNetSupportDialogCID, nsnull, &res);
|
||||
if (NS_FAILED(res))
|
||||
return res;
|
||||
|
||||
return dialog->Confirm(string.GetUnicode(), aReturn);
|
||||
}
|
||||
|
||||
|
||||
|
||||
PRInt32
|
||||
nsInstall::OpenJARFile(void)
|
||||
|
|
|
@ -235,6 +235,10 @@ class nsInstall
|
|||
|
||||
void GetInstallURL(nsString& url);
|
||||
void SetInstallURL(const nsString& url);
|
||||
|
||||
PRInt32 Alert(nsString& string);
|
||||
PRInt32 Confirm(nsString& string, PRBool* aReturn);
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
|
|
@ -2273,6 +2273,76 @@ InstallLogComment(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Native method InstallAlert
|
||||
//
|
||||
PR_STATIC_CALLBACK(JSBool)
|
||||
InstallAlert(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
|
||||
{
|
||||
nsInstall *nativeThis = (nsInstall*)JS_GetPrivate(cx, obj);
|
||||
nsAutoString b0;
|
||||
|
||||
*rval = JSVAL_NULL;
|
||||
|
||||
// If there's no private data, this must be the prototype, so ignore
|
||||
if(nsnull == nativeThis)
|
||||
{
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
if(argc == 1)
|
||||
{
|
||||
// public int InstallAlert (String aComment);
|
||||
|
||||
ConvertJSValToStr(b0, cx, argv[0]);
|
||||
nativeThis->Alert(b0);
|
||||
}
|
||||
else
|
||||
{
|
||||
JS_ReportError(cx, "Function LogComment requires 1 parameter");
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
//
|
||||
// Native method InstallConfirm
|
||||
//
|
||||
PR_STATIC_CALLBACK(JSBool)
|
||||
InstallConfirm(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
|
||||
{
|
||||
nsInstall *nativeThis = (nsInstall*)JS_GetPrivate(cx, obj);
|
||||
nsAutoString b0;
|
||||
PRInt32 nativeRet;
|
||||
|
||||
*rval = JSVAL_NULL;
|
||||
|
||||
// If there's no private data, this must be the prototype, so ignore
|
||||
if(nsnull == nativeThis)
|
||||
{
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
if(argc == 1)
|
||||
{
|
||||
// public int InstallConfirm (String aComment);
|
||||
|
||||
ConvertJSValToStr(b0, cx, argv[0]);
|
||||
nativeThis->Confirm(b0, &nativeRet);
|
||||
|
||||
*rval = INT_TO_JSVAL(nativeRet);
|
||||
}
|
||||
else
|
||||
{
|
||||
JS_ReportError(cx, "Function LogComment requires 1 parameter");
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
/***********************************************************************/
|
||||
//
|
||||
// class for Install
|
||||
|
@ -2398,6 +2468,8 @@ static JSFunctionSpec InstallMethods[] =
|
|||
{"FileMacAliasCreate", InstallFileOpFileMacAliasCreate, 2},
|
||||
{"FileUnixLinkCreate", InstallFileOpFileUnixLinkCreate, 2},
|
||||
{"LogComment", InstallLogComment, 1},
|
||||
{"Alert", InstallAlert, 1},
|
||||
{"Confirm", InstallConfirm, 2},
|
||||
{0}
|
||||
};
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче