Type-check method calls on wrong class of object, required for hand-rolled JS natives (290162, r=dveditz/sr=shaver/a=drivers).

This commit is contained in:
brendan%mozilla.org 2005-04-13 22:22:55 +00:00
Родитель f3cf8e3b3b
Коммит 6537ab102c
7 изменённых файлов: 563 добавлений и 523 удалений

Просмотреть файл

@ -78,25 +78,43 @@ extern PRBool ConvertJSValToObj(nsISupports** aSupports,
jsval aValue);
extern JSObject *gFileSpecProto;
/***********************************************************************/
//
// class for FileOp operations
//
JSClass FileOpClass = {
"File",
JSCLASS_HAS_PRIVATE,
JS_PropertyStub,
JS_PropertyStub,
JS_PropertyStub,
JS_PropertyStub,
JS_EnumerateStub,
JS_ResolveStub,
JS_ConvertStub,
JS_FinalizeStub
};
//
// Native method DirCreate
//
JSBool PR_CALLBACK
InstallFileOpDirCreate(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
nsInstall *nativeThis = (nsInstall*)JS_GetPrivate(cx, obj);
nsInstall *nativeThis =
(nsInstall*)JS_GetInstancePrivate(cx, obj, &FileOpClass, argv);
if (!nativeThis)
return JS_FALSE;
PRInt32 nativeRet;
JSObject *jsObj;
nsInstallFolder *folder;
*rval = INT_TO_JSVAL(nsInstall::UNEXPECTED_ERROR);
// If there's no private data, this must be the prototype, so ignore
if(nsnull == nativeThis)
{
return JS_TRUE;
}
// public int DirCreate (nsInstallFolder aNativeFolderPath);
if ( argc == 0 || argv[0] == JSVAL_NULL || !JSVAL_IS_OBJECT(argv[0])) //argv[0] MUST be a jsval
@ -131,19 +149,16 @@ InstallFileOpDirCreate(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, js
JSBool PR_CALLBACK
InstallFileOpDirGetParent(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
nsInstall* nativeThis = (nsInstall*)JS_GetPrivate(cx, obj);
nsInstall *nativeThis =
(nsInstall*)JS_GetInstancePrivate(cx, obj, &FileOpClass, argv);
if (!nativeThis)
return JS_FALSE;
JSObject *jsObj;
nsInstallFolder *parentFolder, *folder;
*rval = JSVAL_NULL;
// If there's no private data, this must be the prototype, so ignore
if(nsnull == nativeThis)
{
return JS_TRUE;
}
// public int DirGetParent (nsInstallFolder NativeFolderPath);
if ( argc == 0 || argv[0] == JSVAL_NULL || !JSVAL_IS_OBJECT(argv[0])) //argv[0] MUST be a jsval
@ -194,7 +209,11 @@ InstallFileOpDirGetParent(JSContext *cx, JSObject *obj, uintN argc, jsval *argv,
JSBool PR_CALLBACK
InstallFileOpDirRemove(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
nsInstall *nativeThis = (nsInstall*)JS_GetPrivate(cx, obj);
nsInstall *nativeThis =
(nsInstall*)JS_GetInstancePrivate(cx, obj, &FileOpClass, argv);
if (!nativeThis)
return JS_FALSE;
PRInt32 nativeRet;
PRBool bRecursive = PR_FALSE;
JSObject *jsObj;
@ -202,14 +221,8 @@ InstallFileOpDirRemove(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, js
*rval = INT_TO_JSVAL(nsInstall::UNEXPECTED_ERROR);
// If there's no private data, this must be the prototype, so ignore
if(nsnull == nativeThis)
{
return JS_TRUE;
}
// public int DirRemove (nsInstallFolder aNativeFolderPath,
// Bool aRecursive);
// public int DirRemove (nsInstallFolder aNativeFolderPath,
// Bool aRecursive);
if ( argc == 0 || argv[0] == JSVAL_NULL || !JSVAL_IS_OBJECT(argv[0])) //argv[0] MUST be a jsval
{
@ -249,7 +262,11 @@ InstallFileOpDirRemove(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, js
JSBool PR_CALLBACK
InstallFileOpDirRename(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
nsInstall *nativeThis = (nsInstall*)JS_GetPrivate(cx, obj);
nsInstall *nativeThis =
(nsInstall*)JS_GetInstancePrivate(cx, obj, &FileOpClass, argv);
if (!nativeThis)
return JS_FALSE;
PRInt32 nativeRet;
nsAutoString b1;
JSObject *jsObj;
@ -257,12 +274,6 @@ InstallFileOpDirRename(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, js
*rval = INT_TO_JSVAL(nsInstall::UNEXPECTED_ERROR);
// If there's no private data, this must be the prototype, so ignore
if(nsnull == nativeThis)
{
return JS_TRUE;
}
if(argc >= 2)
{
// public int DirRename (String aSourceFolder,
@ -314,19 +325,17 @@ InstallFileOpDirRename(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, js
JSBool PR_CALLBACK
InstallFileOpFileCopy(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
nsInstall *nativeThis = (nsInstall*)JS_GetPrivate(cx, obj);
nsInstall *nativeThis =
(nsInstall*)JS_GetInstancePrivate(cx, obj, &FileOpClass, argv);
if (!nativeThis)
return JS_FALSE;
PRInt32 nativeRet;
JSObject *jsSrcObj, *jsTargetObj;
nsInstallFolder *srcFolder, *targetFolder;
*rval = INT_TO_JSVAL(nsInstall::UNEXPECTED_ERROR);
// If there's no private data, this must be the prototype, so ignore
if(nsnull == nativeThis)
{
return JS_TRUE;
}
if(argc >= 2)
{
// public int FileCopy (nsInstallFolder aSourceFolder,
@ -385,20 +394,18 @@ InstallFileOpFileCopy(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsv
JSBool PR_CALLBACK
InstallFileOpFileRemove(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
nsInstall *nativeThis = (nsInstall*)JS_GetPrivate(cx, obj);
nsInstall *nativeThis =
(nsInstall*)JS_GetInstancePrivate(cx, obj, &FileOpClass, argv);
if (!nativeThis)
return JS_FALSE;
PRInt32 nativeRet;
JSObject *jsObj;
nsInstallFolder *folder;
*rval = INT_TO_JSVAL(nsInstall::UNEXPECTED_ERROR);
// If there's no private data, this must be the prototype, so ignore
if(nsnull == nativeThis)
{
return JS_TRUE;
}
// public int FileDelete (nsInstallFolder aSourceFolder);
// public int FileDelete (nsInstallFolder aSourceFolder);
if (argc == 0 || argv[0] == JSVAL_NULL || !JSVAL_IS_OBJECT(argv[0])) //argv[0] MUST be a jsval
{
@ -432,19 +439,17 @@ InstallFileOpFileRemove(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, j
JSBool PR_CALLBACK
InstallFileOpFileExists(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
nsInstall *nativeThis = (nsInstall*)JS_GetPrivate(cx, obj);
nsInstall *nativeThis =
(nsInstall*)JS_GetInstancePrivate(cx, obj, &FileOpClass, argv);
if (!nativeThis)
return JS_FALSE;
PRInt32 nativeRet;
JSObject *jsObj;
nsInstallFolder *folder;
*rval = INT_TO_JSVAL(nsInstall::UNEXPECTED_ERROR);
// If there's no private data, this must be the prototype, so ignore
if(nsnull == nativeThis)
{
return JS_TRUE;
}
// public int FileExists (nsInstallFolder NativeFolderPath);
if (argc == 0 || argv[0] == JSVAL_NULL || !JSVAL_IS_OBJECT(argv[0])) //argv[0] MUST be a jsval
@ -479,7 +484,11 @@ InstallFileOpFileExists(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, j
JSBool PR_CALLBACK
InstallFileOpFileExecute(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
nsInstall *nativeThis = (nsInstall*)JS_GetPrivate(cx, obj);
nsInstall *nativeThis =
(nsInstall*)JS_GetInstancePrivate(cx, obj, &FileOpClass, argv);
if (!nativeThis)
return JS_FALSE;
PRInt32 nativeRet;
nsAutoString b1;
PRBool blocking = PR_FALSE;
@ -488,12 +497,6 @@ InstallFileOpFileExecute(JSContext *cx, JSObject *obj, uintN argc, jsval *argv,
*rval = INT_TO_JSVAL(nsInstall::UNEXPECTED_ERROR);
// If there's no private data, this must be the prototype, so ignore
if(nsnull == nativeThis)
{
return JS_TRUE;
}
if(argc >= 3)
{
// public int FileExecute (nsInstallFolder aSourceFolder,
@ -556,19 +559,17 @@ InstallFileOpFileExecute(JSContext *cx, JSObject *obj, uintN argc, jsval *argv,
JSBool PR_CALLBACK
InstallFileOpFileGetNativeVersion(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
nsInstall* nativeThis = (nsInstall*)JS_GetPrivate(cx, obj);
nsInstall *nativeThis =
(nsInstall*)JS_GetInstancePrivate(cx, obj, &FileOpClass, argv);
if (!nativeThis)
return JS_FALSE;
nsAutoString nativeRet;
JSObject *jsObj;
nsInstallFolder *folder;
*rval = JSVAL_NULL;
// If there's no private data, this must be the prototype, so ignore
if(nsnull == nativeThis)
{
return JS_TRUE;
}
// public int FileGetNativeVersion (nsInstallFolder NativeFolderPath);
if (argc == 0 || argv[0] == JSVAL_NULL || !JSVAL_IS_OBJECT(argv[0])) //argv[0] MUST be a jsval
@ -604,19 +605,17 @@ JSBool PR_CALLBACK
InstallFileOpFileGetDiskSpaceAvailable(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
nsInstall* nativeThis = (nsInstall*)JS_GetPrivate(cx, obj);
nsInstall *nativeThis =
(nsInstall*)JS_GetInstancePrivate(cx, obj, &FileOpClass, argv);
if (!nativeThis)
return JS_FALSE;
PRInt64 nativeRet;
JSObject *jsObj;
nsInstallFolder *folder;
*rval = INT_TO_JSVAL(nsInstall::UNEXPECTED_ERROR);
// If there's no private data, this must be the prototype, so ignore
if(nsnull == nativeThis)
{
return JS_TRUE;
}
// public int FileGetDiskSpaceAvailable (String NativeFolderPath);
if (argc == 0 || argv[0] == JSVAL_NULL || !JSVAL_IS_OBJECT(argv[0])) //argv[0] MUST be a jsval
@ -653,19 +652,17 @@ InstallFileOpFileGetDiskSpaceAvailable(JSContext *cx, JSObject *obj, uintN argc,
JSBool PR_CALLBACK
InstallFileOpFileGetModDate(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
nsInstall* nativeThis = (nsInstall*)JS_GetPrivate(cx, obj);
nsInstall *nativeThis =
(nsInstall*)JS_GetInstancePrivate(cx, obj, &FileOpClass, argv);
if (!nativeThis)
return JS_FALSE;
double nativeRet;
JSObject *jsObj;
nsInstallFolder *folder;
*rval = INT_TO_JSVAL(nsInstall::UNEXPECTED_ERROR);;
// If there's no private data, this must be the prototype, so ignore
if(nsnull == nativeThis)
{
return JS_TRUE;
}
// public int FileGetModDate (nsInstallFolder NativeFolderPath);
if (argc == 0 || argv[0] == JSVAL_NULL || !JSVAL_IS_OBJECT(argv[0])) //argv[0] MUST be a jsval
@ -700,19 +697,17 @@ InstallFileOpFileGetModDate(JSContext *cx, JSObject *obj, uintN argc, jsval *arg
JSBool PR_CALLBACK
InstallFileOpFileGetSize(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
nsInstall* nativeThis = (nsInstall*)JS_GetPrivate(cx, obj);
nsInstall *nativeThis =
(nsInstall*)JS_GetInstancePrivate(cx, obj, &FileOpClass, argv);
if (!nativeThis)
return JS_FALSE;
PRInt64 nativeRet;
JSObject *jsObj;
nsInstallFolder *folder;
*rval = INT_TO_JSVAL(nsInstall::UNEXPECTED_ERROR);
// If there's no private data, this must be the prototype, so ignore
if(nsnull == nativeThis)
{
return JS_TRUE;
}
// public int FileGetSize (String NativeFolderPath);
if (argc == 0 || argv[0] == JSVAL_NULL || !JSVAL_IS_OBJECT(argv[0])) //argv[0] MUST be a jsval
@ -750,19 +745,17 @@ InstallFileOpFileGetSize(JSContext *cx, JSObject *obj, uintN argc, jsval *argv,
JSBool PR_CALLBACK
InstallFileOpFileIsDirectory(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
nsInstall *nativeThis = (nsInstall*)JS_GetPrivate(cx, obj);
nsInstall *nativeThis =
(nsInstall*)JS_GetInstancePrivate(cx, obj, &FileOpClass, argv);
if (!nativeThis)
return JS_FALSE;
PRInt32 nativeRet;
JSObject *jsObj;
nsInstallFolder *folder;
*rval = BOOLEAN_TO_JSVAL(PR_FALSE);
// If there's no private data, this must be the prototype, so ignore
if(nsnull == nativeThis)
{
return JS_TRUE;
}
// public int FileIsDirectory (String NativeFolderPath);
if (argc == 0 || argv[0] == JSVAL_NULL || !JSVAL_IS_OBJECT(argv[0])) //argv[0] MUST be a jsval
@ -797,19 +790,17 @@ InstallFileOpFileIsDirectory(JSContext *cx, JSObject *obj, uintN argc, jsval *ar
JSBool PR_CALLBACK
InstallFileOpFileIsWritable(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
nsInstall *nativeThis = (nsInstall*)JS_GetPrivate(cx, obj);
nsInstall *nativeThis =
(nsInstall*)JS_GetInstancePrivate(cx, obj, &FileOpClass, argv);
if (!nativeThis)
return JS_FALSE;
PRInt32 nativeRet;
JSObject *jsObj;
nsInstallFolder *folder;
*rval = BOOLEAN_TO_JSVAL(PR_FALSE);
// If there's no private data, this must be the prototype, so ignore
if(nsnull == nativeThis)
{
return JS_TRUE;
}
if (argc == 0 || argv[0] == JSVAL_NULL || !JSVAL_IS_OBJECT(argv[0])) //argv[0] MUST be a jsval
{
*rval = BOOLEAN_TO_JSVAL(PR_FALSE);
@ -843,20 +834,18 @@ InstallFileOpFileIsWritable(JSContext *cx, JSObject *obj, uintN argc, jsval *arg
JSBool PR_CALLBACK
InstallFileOpFileIsFile(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
nsInstall *nativeThis = (nsInstall*)JS_GetPrivate(cx, obj);
nsInstall *nativeThis =
(nsInstall*)JS_GetInstancePrivate(cx, obj, &FileOpClass, argv);
if (!nativeThis)
return JS_FALSE;
PRInt32 nativeRet;
JSObject *jsObj;
nsInstallFolder *folder;
*rval = BOOLEAN_TO_JSVAL(PR_FALSE);
// If there's no private data, this must be the prototype, so ignore
if(nsnull == nativeThis)
{
return JS_TRUE;
}
// public int FileIsFile (nsInstallFolder NativeFolderPath);
// public int FileIsFile (nsInstallFolder NativeFolderPath);
if (argc == 0 || argv[0] == JSVAL_NULL || !JSVAL_IS_OBJECT(argv[0])) //argv[0] MUST be a jsval
{
@ -890,19 +879,17 @@ InstallFileOpFileIsFile(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, j
JSBool PR_CALLBACK
InstallFileOpFileModDateChanged(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
nsInstall* nativeThis = (nsInstall*)JS_GetPrivate(cx, obj);
nsInstall *nativeThis =
(nsInstall*)JS_GetInstancePrivate(cx, obj, &FileOpClass, argv);
if (!nativeThis)
return JS_FALSE;
PRInt32 nativeRet;
JSObject *jsObj;
nsInstallFolder *folder;
*rval = BOOLEAN_TO_JSVAL(PR_FALSE);
// If there's no private data, this must be the prototype, so ignore
if(nsnull == nativeThis)
{
return JS_TRUE;
}
if(argc >= 2)
{
// public int FileModDateChanged (nsInstallFolder aSourceFolder,
@ -947,19 +934,17 @@ InstallFileOpFileModDateChanged(JSContext *cx, JSObject *obj, uintN argc, jsval
JSBool PR_CALLBACK
InstallFileOpFileMove(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
nsInstall *nativeThis = (nsInstall*)JS_GetPrivate(cx, obj);
nsInstall *nativeThis =
(nsInstall*)JS_GetInstancePrivate(cx, obj, &FileOpClass, argv);
if (!nativeThis)
return JS_FALSE;
PRInt32 nativeRet;
JSObject *jsSrcObj, *jsTargetObj;
nsInstallFolder *srcFolder, *targetFolder;
*rval = INT_TO_JSVAL(nsInstall::UNEXPECTED_ERROR);
// If there's no private data, this must be the prototype, so ignore
if(nsnull == nativeThis)
{
return JS_TRUE;
}
if(argc >= 2)
{
// public int FileMove (nsInstallFolder aSourceFolder,
@ -1015,7 +1000,11 @@ InstallFileOpFileMove(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsv
JSBool PR_CALLBACK
InstallFileOpFileRename(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
nsInstall *nativeThis = (nsInstall*)JS_GetPrivate(cx, obj);
nsInstall *nativeThis =
(nsInstall*)JS_GetInstancePrivate(cx, obj, &FileOpClass, argv);
if (!nativeThis)
return JS_FALSE;
PRInt32 nativeRet;
nsAutoString b1;
JSObject *jsObj;
@ -1023,12 +1012,6 @@ InstallFileOpFileRename(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, j
*rval = INT_TO_JSVAL(nsInstall::UNEXPECTED_ERROR);
// If there's no private data, this must be the prototype, so ignore
if(nsnull == nativeThis)
{
return JS_TRUE;
}
if(argc >= 2)
{
// public int FileRename (nsInstallFolder aSourceFolder,
@ -1081,18 +1064,16 @@ JSBool PR_CALLBACK
InstallFileOpFileWindowsGetShortName(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
nsAutoString shortPathName;
nsInstall* nativeThis = (nsInstall*)JS_GetPrivate(cx, obj);
nsInstall *nativeThis =
(nsInstall*)JS_GetInstancePrivate(cx, obj, &FileOpClass, argv);
if (!nativeThis)
return JS_FALSE;
JSObject *jsObj;
nsInstallFolder *longPathName;
*rval = JSVAL_NULL;
// If there's no private data, this must be the prototype, so ignore
if(nsnull == nativeThis)
{
return JS_TRUE;
}
// public String windowsGetShortName (File NativeFolderPath);
if ( argc == 0 || argv[0] == JSVAL_NULL || !JSVAL_IS_OBJECT(argv[0])) //argv[0] MUST be a jsval
@ -1128,7 +1109,11 @@ InstallFileOpFileWindowsGetShortName(JSContext *cx, JSObject *obj, uintN argc, j
JSBool PR_CALLBACK
InstallFileOpFileWindowsShortcut(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
nsInstall *nativeThis = (nsInstall*)JS_GetPrivate(cx, obj);
nsInstall *nativeThis =
(nsInstall*)JS_GetInstancePrivate(cx, obj, &FileOpClass, argv);
if (!nativeThis)
return JS_FALSE;
PRInt32 nativeRet;
nsAutoString b0;
nsAutoString b1;
@ -1147,12 +1132,6 @@ InstallFileOpFileWindowsShortcut(JSContext *cx, JSObject *obj, uintN argc, jsval
*rval = JSVAL_NULL;
// If there's no private data, this must be the prototype, so ignore
if(nsnull == nativeThis)
{
return JS_TRUE;
}
if(argc >= 7)
{
// public int FileWindowsShortcut(String aTarget,
@ -1206,7 +1185,11 @@ InstallFileOpFileWindowsShortcut(JSContext *cx, JSObject *obj, uintN argc, jsval
JSBool PR_CALLBACK
InstallFileOpFileMacAlias(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
nsInstall *nativeThis = (nsInstall *)JS_GetPrivate(cx, obj);
nsInstall *nativeThis =
(nsInstall*)JS_GetInstancePrivate(cx, obj, &FileOpClass, argv);
if (!nativeThis)
return JS_FALSE;
PRInt32 nativeRet;
nsAutoString sourceLeaf, aliasLeaf;
JSObject *jsoSourceFolder, *jsoAliasFolder;
@ -1215,12 +1198,6 @@ InstallFileOpFileMacAlias(JSContext *cx, JSObject *obj, uintN argc, jsval *argv,
*rval = JSVAL_NULL;
// If there's no private data, this must be the prototype, so ignore
if(nsnull == nativeThis)
{
return JS_TRUE;
}
if(argc >= 3)
{
// public int FileMacAlias( InstallFolder aSourceFolder,
@ -1330,7 +1307,11 @@ InstallFileOpFileMacAlias(JSContext *cx, JSObject *obj, uintN argc, jsval *argv,
JSBool PR_CALLBACK
InstallFileOpFileUnixLink(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
nsInstall *nativeThis = (nsInstall*)JS_GetPrivate(cx, obj);
nsInstall *nativeThis =
(nsInstall*)JS_GetInstancePrivate(cx, obj, &FileOpClass, argv);
if (!nativeThis)
return JS_FALSE;
PRInt32 nativeRet;
//nsAutoString b0;
PRInt32 b1;
@ -1339,12 +1320,6 @@ InstallFileOpFileUnixLink(JSContext *cx, JSObject *obj, uintN argc, jsval *argv,
*rval = JSVAL_NULL;
// If there's no private data, this must be the prototype, so ignore
if(nsnull == nativeThis)
{
return JS_TRUE;
}
if(argc >= 2)
{
// public int FileUnixLinkCreate (String aSourceFolder,
@ -1389,19 +1364,17 @@ InstallFileOpFileUnixLink(JSContext *cx, JSObject *obj, uintN argc, jsval *argv,
JSBool PR_CALLBACK
InstallFileOpWinRegisterServer(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
nsInstall *nativeThis = (nsInstall*)JS_GetPrivate(cx, obj);
nsInstall *nativeThis =
(nsInstall*)JS_GetInstancePrivate(cx, obj, &FileOpClass, argv);
if (!nativeThis)
return JS_FALSE;
PRInt32 nativeRet;
JSObject *jsObj;
nsInstallFolder *folder;
*rval = INT_TO_JSVAL(nsInstall::UNEXPECTED_ERROR);
// If there's no private data, this must be the prototype, so ignore
if(nsnull == nativeThis)
{
return JS_TRUE;
}
// public int WinRegisterServer (nsInstallFolder aNativeFolderPath);
if ( argc == 0 || argv[0] == JSVAL_NULL || !JSVAL_IS_OBJECT(argv[0])) //argv[0] MUST be a jsval
@ -1430,47 +1403,6 @@ InstallFileOpWinRegisterServer(JSContext *cx, JSObject *obj, uintN argc, jsval *
}
/***********************************************************************/
//
// Install Properties Getter
//
JSBool PR_CALLBACK
GetFileProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
{
return PR_TRUE;
}
/***********************************************************************/
//
// File Properties Setter
//
JSBool PR_CALLBACK
SetFileProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
{
return PR_TRUE;
}
/***********************************************************************/
//
// class for FileOp operations
//
JSClass FileOpClass = {
"File",
JSCLASS_HAS_PRIVATE,
JS_PropertyStub,
JS_PropertyStub,
GetFileProperty,
SetFileProperty,
JS_EnumerateStub,
JS_ResolveStub,
JS_ConvertStub,
JS_FinalizeStub
};
//
// File class methods
//

Просмотреть файл

@ -64,6 +64,27 @@ extern PRBool ConvertJSValToObj(nsISupports** aSupports,
static void PR_CALLBACK
FileSpecObjectCleanup(JSContext *cx, JSObject *obj);
/***********************************************************************/
//
// class for FileObj
//
JSClass FileSpecObjectClass = {
"FileSpecObject",
JSCLASS_HAS_PRIVATE,
JS_PropertyStub,
JS_PropertyStub,
JS_PropertyStub,
JS_PropertyStub,
JS_EnumerateStub,
JS_ResolveStub,
JS_ConvertStub,
FileSpecObjectCleanup
};
/***********************************************************************************/
// Native methods for FileSpecObj functions
@ -73,18 +94,16 @@ extern PRBool ConvertJSValToObj(nsISupports** aSupports,
PR_STATIC_CALLBACK(JSBool)
fso_ToString(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
nsInstallFolder *nativeThis =
(nsInstallFolder*)JS_GetInstancePrivate(cx, obj, &FileSpecObjectClass,
argv);
if (!nativeThis)
return JS_FALSE;
nsInstallFolder *nativeThis = (nsInstallFolder*)JS_GetPrivate(cx, obj);
nsAutoString stringReturned;
*rval = JSVAL_NULL;
// If there's no private data, this must be the prototype, so ignore
if(nsnull == nativeThis)
{
return JS_TRUE;
}
if(NS_FAILED( nativeThis->ToString(&stringReturned)))
return JS_TRUE;
@ -116,29 +135,11 @@ fso_AppendPath(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rva
*/
static void PR_CALLBACK FileSpecObjectCleanup(JSContext *cx, JSObject *obj)
{
nsInstallFolder *nativeThis = (nsInstallFolder*)JS_GetPrivate(cx, obj);
if (nativeThis != nsnull)
delete nativeThis;
nsInstallFolder *nativeThis = (nsInstallFolder*)JS_GetPrivate(cx, obj);
if (nativeThis != nsnull)
delete nativeThis;
}
/***********************************************************************/
//
// class for FileObj
//
JSClass FileSpecObjectClass = {
"FileSpecObject",
JSCLASS_HAS_PRIVATE,
JS_PropertyStub,
JS_PropertyStub,
JS_PropertyStub,
JS_PropertyStub,
JS_EnumerateStub,
JS_ResolveStub,
JS_ConvertStub,
FileSpecObjectCleanup
};
//
// FileObj class methods
//

Просмотреть файл

@ -66,6 +66,32 @@ extern JSClass FileSpecObjectClass;
extern JSClass FileOpClass;
PR_STATIC_CALLBACK(JSBool)
GetInstallProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp);
PR_STATIC_CALLBACK(JSBool)
SetInstallProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp);
PR_STATIC_CALLBACK(void)
FinalizeInstall(JSContext *cx, JSObject *obj);
/***********************************************************************/
//
// class for Install
//
JSClass InstallClass = {
"Install",
JSCLASS_HAS_PRIVATE,
JS_PropertyStub,
JS_PropertyStub,
GetInstallProperty,
SetInstallProperty,
JS_EnumerateStub,
JS_ResolveStub,
JS_ConvertStub,
FinalizeInstall
};
//
// Install property ids
//
@ -334,7 +360,11 @@ void ConvertJSvalToVersionString(nsString& versionString, JSContext* cx, jsval a
PR_STATIC_CALLBACK(JSBool)
InstallAbortInstall(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
nsInstall *nativeThis = (nsInstall*)JS_GetPrivate(cx, obj);
nsInstall *nativeThis =
(nsInstall*)JS_GetInstancePrivate(cx, obj, &InstallClass, argv);
if (!nativeThis)
return JS_FALSE;
int32 b0;
*rval = JSVAL_VOID;
@ -372,7 +402,11 @@ InstallAbortInstall(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval
PR_STATIC_CALLBACK(JSBool)
InstallAddDirectory(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
nsInstall *nativeThis = (nsInstall*)JS_GetPrivate(cx, obj);
nsInstall *nativeThis =
(nsInstall*)JS_GetInstancePrivate(cx, obj, &InstallClass, argv);
if (!nativeThis)
return JS_FALSE;
PRInt32 nativeRet;
nsAutoString b0;
nsAutoString b1;
@ -524,7 +558,11 @@ InstallAddDirectory(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval
PR_STATIC_CALLBACK(JSBool)
InstallAddSubcomponent(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
nsInstall *nativeThis = (nsInstall*)JS_GetPrivate(cx, obj);
nsInstall *nativeThis =
(nsInstall*)JS_GetInstancePrivate(cx, obj, &InstallClass, argv);
if (!nativeThis)
return JS_FALSE;
PRInt32 nativeRet;
nsAutoString b0;
nsAutoString b1;
@ -697,7 +735,11 @@ InstallDeleteComponent(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, js
PR_STATIC_CALLBACK(JSBool)
InstallExecute(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
nsInstall *nativeThis = (nsInstall*)JS_GetPrivate(cx, obj);
nsInstall *nativeThis =
(nsInstall*)JS_GetInstancePrivate(cx, obj, &InstallClass, argv);
if (!nativeThis)
return JS_FALSE;
PRInt32 nativeRet;
nsAutoString b0;
nsAutoString b1;
@ -762,7 +804,11 @@ InstallExecute(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rva
PR_STATIC_CALLBACK(JSBool)
InstallFinalizeInstall(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
nsInstall *nativeThis = (nsInstall*)JS_GetPrivate(cx, obj);
nsInstall *nativeThis =
(nsInstall*)JS_GetInstancePrivate(cx, obj, &InstallClass, argv);
if (!nativeThis)
return JS_FALSE;
PRInt32 nativeRet;
*rval = INT_TO_JSVAL(nsInstall::UNEXPECTED_ERROR);
@ -791,7 +837,11 @@ InstallFinalizeInstall(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, js
PR_STATIC_CALLBACK(JSBool)
InstallGestalt(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
nsInstall *nativeThis = (nsInstall*)JS_GetPrivate(cx, obj);
nsInstall *nativeThis =
(nsInstall*)JS_GetInstancePrivate(cx, obj, &InstallClass, argv);
if (!nativeThis)
return JS_FALSE;
PRInt32 nativeRet;
nsAutoString b0;
@ -832,7 +882,11 @@ InstallGestalt(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rva
PR_STATIC_CALLBACK(JSBool)
InstallGetComponentFolder(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
nsInstall *nativeThis = (nsInstall*)JS_GetPrivate(cx, obj);
nsInstall *nativeThis =
(nsInstall*)JS_GetInstancePrivate(cx, obj, &InstallClass, argv);
if (!nativeThis)
return JS_FALSE;
nsInstallFolder* folder;
nsAutoString b0;
nsAutoString b1;
@ -904,7 +958,11 @@ InstallGetComponentFolder(JSContext *cx, JSObject *obj, uintN argc, jsval *argv,
PR_STATIC_CALLBACK(JSBool)
InstallGetFolder(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
nsInstall *nativeThis = (nsInstall*)JS_GetPrivate(cx, obj);
nsInstall *nativeThis =
(nsInstall*)JS_GetInstancePrivate(cx, obj, &InstallClass, argv);
if (!nativeThis)
return JS_FALSE;
JSObject *jsObj;
nsAutoString b0;
nsAutoString b1;
@ -1005,7 +1063,11 @@ InstallGetFolder(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *r
PR_STATIC_CALLBACK(JSBool)
InstallGetLastError(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
nsInstall *nativeThis = (nsInstall*)JS_GetPrivate(cx, obj);
nsInstall *nativeThis =
(nsInstall*)JS_GetInstancePrivate(cx, obj, &InstallClass, argv);
if (!nativeThis)
return JS_FALSE;
PRInt32 nativeRet;
@ -1035,16 +1097,14 @@ InstallGetWinProfile(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsva
*rval = JSVAL_NULL;
#ifdef _WINDOWS
nsInstall *nativeThis = (nsInstall*)JS_GetPrivate(cx, obj);
nsInstall *nativeThis =
(nsInstall*)JS_GetInstancePrivate(cx, obj, &InstallClass, argv);
if (!nativeThis)
return JS_FALSE;
nsAutoString b0;
nsAutoString b1;
// If there's no private data, this must be the prototype, so ignore
if(nsnull == nativeThis)
{
return JS_TRUE;
}
if(argc >= 2)
{
// public int GetWinProfile (Object folder,
@ -1079,13 +1139,10 @@ InstallGetWinRegistry(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsv
#ifdef _WINDOWS
nsInstall *nativeThis = (nsInstall*)JS_GetPrivate(cx, obj);
// If there's no private data, this must be the prototype, so ignore
if(nsnull == nativeThis)
{
return JS_TRUE;
}
nsInstall *nativeThis =
(nsInstall*)JS_GetInstancePrivate(cx, obj, &InstallClass, argv);
if (!nativeThis)
return JS_FALSE;
// public int GetWinRegistry (void);
if(NS_OK != nativeThis->GetWinRegistry(cx, &WinRegClass, rval))
@ -1105,31 +1162,35 @@ InstallGetWinRegistry(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsv
PR_STATIC_CALLBACK(JSBool)
InstallLoadResources(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
nsInstall *nativeThis = (nsInstall*)JS_GetPrivate(cx, obj);
nsAutoString b0;
nsInstall *nativeThis =
(nsInstall*)JS_GetInstancePrivate(cx, obj, &InstallClass, argv);
if (!nativeThis)
return JS_FALSE;
*rval = JSVAL_NULL;
nsAutoString b0;
// If there's no private data, this must be the prototype, so ignore
if (nsnull == nativeThis) {
return JS_TRUE;
}
if (argc >= 1)
{
ConvertJSValToStr(b0, cx, argv[0]);
if (NS_OK != nativeThis->LoadResources(cx, b0, rval))
{
return JS_FALSE;
}
}
else
{
JS_ReportError(cx, "Function LoadResources requires 1 parameter");
return JS_FALSE;
}
*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)
{
ConvertJSValToStr(b0, cx, argv[0]);
if (NS_OK != nativeThis->LoadResources(cx, b0, rval))
{
return JS_FALSE;
}
}
else
{
JS_ReportError(cx, "Function LoadResources requires 1 parameter");
return JS_FALSE;
}
return JS_TRUE;
}
@ -1139,7 +1200,11 @@ InstallLoadResources(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsva
PR_STATIC_CALLBACK(JSBool)
InstallPatch(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
nsInstall *nativeThis = (nsInstall*)JS_GetPrivate(cx, obj);
nsInstall *nativeThis =
(nsInstall*)JS_GetInstancePrivate(cx, obj, &InstallClass, argv);
if (!nativeThis)
return JS_FALSE;
PRInt32 nativeRet;
nsAutoString b0;
nsAutoString b1;
@ -1251,7 +1316,11 @@ PR_STATIC_CALLBACK(JSBool)
InstallRegisterChrome(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
// If there's no private data, this must be the prototype, so ignore
nsInstall *nativeThis = (nsInstall*)JS_GetPrivate(cx, obj);
nsInstall *nativeThis =
(nsInstall*)JS_GetInstancePrivate(cx, obj, &InstallClass, argv);
if (!nativeThis)
return JS_FALSE;
if (nsnull == nativeThis) {
*rval = INT_TO_JSVAL(nsInstall::UNEXPECTED_ERROR);
return JS_TRUE;
@ -1294,8 +1363,12 @@ InstallRegisterChrome(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsv
PR_STATIC_CALLBACK(JSBool)
InstallRefreshPlugins(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
nsInstall *nativeThis =
(nsInstall*)JS_GetInstancePrivate(cx, obj, &InstallClass, argv);
if (!nativeThis)
return JS_FALSE;
// If there's no private data, this must be the prototype, so ignore
nsInstall *nativeThis = (nsInstall*)JS_GetPrivate(cx, obj);
if (!nativeThis)
{
*rval = INT_TO_JSVAL(nsInstall::UNEXPECTED_ERROR);
@ -1318,7 +1391,10 @@ InstallRefreshPlugins(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsv
PR_STATIC_CALLBACK(JSBool)
InstallResetError(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
nsInstall *nativeThis = (nsInstall*)JS_GetPrivate(cx, obj);
nsInstall *nativeThis =
(nsInstall*)JS_GetInstancePrivate(cx, obj, &InstallClass, argv);
if (!nativeThis)
return JS_FALSE;
*rval = JSVAL_VOID;
@ -1344,7 +1420,11 @@ InstallResetError(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *
PR_STATIC_CALLBACK(JSBool)
InstallSetPackageFolder(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
nsInstall *nativeThis = (nsInstall*)JS_GetPrivate(cx, obj);
nsInstall *nativeThis =
(nsInstall*)JS_GetInstancePrivate(cx, obj, &InstallClass, argv);
if (!nativeThis)
return JS_FALSE;
nsAutoString b0;
JSObject *jsObj;
nsInstallFolder *folder;
@ -1402,7 +1482,11 @@ InstallSetPackageFolder(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, j
PR_STATIC_CALLBACK(JSBool)
InstallStartInstall(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
nsInstall *nativeThis = (nsInstall*)JS_GetPrivate(cx, obj);
nsInstall *nativeThis =
(nsInstall*)JS_GetInstancePrivate(cx, obj, &InstallClass, argv);
if (!nativeThis)
return JS_FALSE;
PRInt32 nativeRet;
nsAutoString b0;
nsAutoString b1;
@ -1454,7 +1538,11 @@ InstallStartInstall(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval
PR_STATIC_CALLBACK(JSBool)
InstallUninstall(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
nsInstall *nativeThis = (nsInstall*)JS_GetPrivate(cx, obj);
nsInstall *nativeThis =
(nsInstall*)JS_GetInstancePrivate(cx, obj, &InstallClass, argv);
if (!nativeThis)
return JS_FALSE;
PRInt32 nativeRet;
nsAutoString b0;
@ -1515,17 +1603,15 @@ InstallTRACE(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
PR_STATIC_CALLBACK(JSBool)
InstallLogComment(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
nsInstall *nativeThis = (nsInstall*)JS_GetPrivate(cx, obj);
nsInstall *nativeThis =
(nsInstall*)JS_GetInstancePrivate(cx, obj, &InstallClass, argv);
if (!nativeThis)
return JS_FALSE;
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 LogComment (String aComment);
@ -1550,17 +1636,15 @@ InstallLogComment(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *
PR_STATIC_CALLBACK(JSBool)
InstallAlert(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
nsInstall *nativeThis = (nsInstall*)JS_GetPrivate(cx, obj);
nsInstall *nativeThis =
(nsInstall*)JS_GetInstancePrivate(cx, obj, &InstallClass, argv);
if (!nativeThis)
return JS_FALSE;
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);
@ -1588,7 +1672,11 @@ InstallAlert(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
PR_STATIC_CALLBACK(JSBool)
InstallConfirm(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
nsInstall *nativeThis = (nsInstall*)JS_GetPrivate(cx, obj);
nsInstall *nativeThis =
(nsInstall*)JS_GetInstancePrivate(cx, obj, &InstallClass, argv);
if (!nativeThis)
return JS_FALSE;
nsAutoString text;
nsAutoString title;
PRUint32 buttonFlags = nsIPromptService::STD_OK_CANCEL_BUTTONS;
@ -1603,12 +1691,6 @@ InstallConfirm(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rva
*rval = JSVAL_NULL;
// If there's no private data, this must be the prototype, so ignore
if(nsnull == nativeThis)
{
return JS_TRUE;
}
if(argc == 0)
{
JS_ReportError(cx, "Function Confirm requires at least 1 parameter");
@ -1687,23 +1769,6 @@ InstallConfirm(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rva
return JS_TRUE;
}
/***********************************************************************/
//
// class for Install
//
JSClass InstallClass = {
"Install",
JSCLASS_HAS_PRIVATE,
JS_PropertyStub,
JS_PropertyStub,
GetInstallProperty,
SetInstallProperty,
JS_EnumerateStub,
JS_ResolveStub,
JS_ConvertStub,
FinalizeInstall
};
//
// Install class properties
//

Просмотреть файл

@ -71,6 +71,26 @@ extern PRBool ConvertJSValToObj(nsISupports** aSupports,
JSContext* aContext,
jsval aValue);
PR_STATIC_CALLBACK(void)
FinalizeInstallTriggerGlobal(JSContext *cx, JSObject *obj);
/***********************************************************************/
//
// class for InstallTriggerGlobal
//
JSClass InstallTriggerGlobalClass = {
"InstallTrigger",
JSCLASS_HAS_PRIVATE,
JS_PropertyStub,
JS_PropertyStub,
JS_PropertyStub,
JS_PropertyStub,
JS_EnumerateStub,
JS_ResolveStub,
JS_ConvertStub,
FinalizeInstallTriggerGlobal
};
//
// InstallTriggerGlobal finalizer
//
@ -129,7 +149,10 @@ static JSBool CreateNativeObject(JSContext *cx, JSObject *obj, nsIDOMInstallTrig
PR_STATIC_CALLBACK(JSBool)
InstallTriggerGlobalUpdateEnabled(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
nsIDOMInstallTriggerGlobal *nativeThis = (nsIDOMInstallTriggerGlobal*)JS_GetPrivate(cx, obj);
nsIDOMInstallTriggerGlobal *nativeThis = (nsIDOMInstallTriggerGlobal*)
JS_GetInstancePrivate(cx, obj, &InstallTriggerGlobalClass, argv);
if (!nativeThis)
return JS_FALSE;
*rval = JSVAL_FALSE;
@ -154,8 +177,11 @@ InstallTriggerGlobalUpdateEnabled(JSContext *cx, JSObject *obj, uintN argc, jsva
//
PR_STATIC_CALLBACK(JSBool)
InstallTriggerGlobalInstall(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
nsIDOMInstallTriggerGlobal *nativeThis = (nsIDOMInstallTriggerGlobal*)JS_GetPrivate(cx, obj);
{
nsIDOMInstallTriggerGlobal *nativeThis = (nsIDOMInstallTriggerGlobal*)
JS_GetInstancePrivate(cx, obj, &InstallTriggerGlobalClass, argv);
if (!nativeThis)
return JS_FALSE;
*rval = JSVAL_FALSE;
@ -307,7 +333,11 @@ InstallTriggerGlobalInstall(JSContext *cx, JSObject *obj, uintN argc, jsval *arg
PR_STATIC_CALLBACK(JSBool)
InstallTriggerGlobalInstallChrome(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
nsIDOMInstallTriggerGlobal *nativeThis = (nsIDOMInstallTriggerGlobal*)JS_GetPrivate(cx, obj);
nsIDOMInstallTriggerGlobal *nativeThis = (nsIDOMInstallTriggerGlobal*)
JS_GetInstancePrivate(cx, obj, &InstallTriggerGlobalClass, argv);
if (!nativeThis)
return JS_FALSE;
uint32 chromeType = NOT_CHROME;
nsAutoString sourceURL;
nsAutoString name;
@ -400,7 +430,11 @@ InstallTriggerGlobalInstallChrome(JSContext *cx, JSObject *obj, uintN argc, jsva
PR_STATIC_CALLBACK(JSBool)
InstallTriggerGlobalStartSoftwareUpdate(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
nsIDOMInstallTriggerGlobal *nativeThis = (nsIDOMInstallTriggerGlobal*)JS_GetPrivate(cx, obj);
nsIDOMInstallTriggerGlobal *nativeThis = (nsIDOMInstallTriggerGlobal*)
JS_GetInstancePrivate(cx, obj, &InstallTriggerGlobalClass, argv);
if (!nativeThis)
return JS_FALSE;
PRBool nativeRet;
PRInt32 flags = 0;
@ -489,7 +523,11 @@ InstallTriggerGlobalStartSoftwareUpdate(JSContext *cx, JSObject *obj, uintN argc
PR_STATIC_CALLBACK(JSBool)
InstallTriggerGlobalCompareVersion(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
nsIDOMInstallTriggerGlobal *nativeThis = (nsIDOMInstallTriggerGlobal*)JS_GetPrivate(cx, obj);
nsIDOMInstallTriggerGlobal *nativeThis = (nsIDOMInstallTriggerGlobal*)
JS_GetInstancePrivate(cx, obj, &InstallTriggerGlobalClass, argv);
if (!nativeThis)
return JS_FALSE;
nsAutoString regname;
nsAutoString version;
int32 major,minor,release,build;
@ -588,7 +626,10 @@ InstallTriggerGlobalCompareVersion(JSContext *cx, JSObject *obj, uintN argc, jsv
PR_STATIC_CALLBACK(JSBool)
InstallTriggerGlobalGetVersion(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
nsIDOMInstallTriggerGlobal *nativeThis = (nsIDOMInstallTriggerGlobal*)JS_GetPrivate(cx, obj);
nsIDOMInstallTriggerGlobal *nativeThis = (nsIDOMInstallTriggerGlobal*)
JS_GetInstancePrivate(cx, obj, &InstallTriggerGlobalClass, argv);
if (!nativeThis)
return JS_FALSE;
nsAutoString regname;
nsAutoString version;
@ -623,23 +664,6 @@ InstallTriggerGlobalGetVersion(JSContext *cx, JSObject *obj, uintN argc, jsval *
return JS_TRUE;
}
/***********************************************************************/
//
// class for InstallTriggerGlobal
//
JSClass InstallTriggerGlobalClass = {
"InstallTrigger",
JSCLASS_HAS_PRIVATE,
JS_PropertyStub,
JS_PropertyStub,
JS_PropertyStub,
JS_PropertyStub,
JS_EnumerateStub,
JS_ResolveStub,
JS_ConvertStub,
FinalizeInstallTriggerGlobal
};
//
// InstallTriggerGlobal class methods
//

Просмотреть файл

@ -49,6 +49,40 @@
#include "nsSoftwareUpdateIIDs.h"
PR_STATIC_CALLBACK(JSBool)
GetInstallVersionProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp);
PR_STATIC_CALLBACK(JSBool)
SetInstallVersionProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp);
PR_STATIC_CALLBACK(JSBool)
EnumerateInstallVersion(JSContext *cx, JSObject *obj);
PR_STATIC_CALLBACK(JSBool)
ResolveInstallVersion(JSContext *cx, JSObject *obj, jsval id);
PR_STATIC_CALLBACK(void)
FinalizeInstallVersion(JSContext *cx, JSObject *obj);
/***********************************************************************/
//
// class for InstallVersion
//
JSClass InstallVersionClass = {
"InstallVersion",
JSCLASS_HAS_PRIVATE,
JS_PropertyStub,
JS_PropertyStub,
GetInstallVersionProperty,
SetInstallVersionProperty,
EnumerateInstallVersion,
ResolveInstallVersion,
JS_ConvertStub,
FinalizeInstallVersion
};
extern void ConvertJSValToStr(nsString& aString,
JSContext* aContext,
jsval aValue);
@ -282,7 +316,12 @@ ResolveInstallVersion(JSContext *cx, JSObject *obj, jsval id)
PR_STATIC_CALLBACK(JSBool)
InstallVersionInit(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
nsIDOMInstallVersion *nativeThis = (nsIDOMInstallVersion*)JS_GetPrivate(cx, obj);
nsIDOMInstallVersion *nativeThis =
(nsIDOMInstallVersion*)JS_GetInstancePrivate(cx, obj, &InstallVersionClass,
argv);
if (!nativeThis)
return JS_FALSE;
nsAutoString b0;
*rval = JSVAL_NULL;
@ -320,7 +359,12 @@ InstallVersionInit(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval
PR_STATIC_CALLBACK(JSBool)
InstallVersionToString(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
nsIDOMInstallVersion *nativeThis = (nsIDOMInstallVersion*)JS_GetPrivate(cx, obj);
nsIDOMInstallVersion *nativeThis =
(nsIDOMInstallVersion*)JS_GetInstancePrivate(cx, obj, &InstallVersionClass,
argv);
if (!nativeThis)
return JS_FALSE;
nsAutoString nativeRet;
*rval = JSVAL_NULL;
@ -351,7 +395,12 @@ InstallVersionToString(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, js
PR_STATIC_CALLBACK(JSBool)
InstallVersionCompareTo(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
nsIDOMInstallVersion *nativeThis = (nsIDOMInstallVersion*)JS_GetPrivate(cx, obj);
nsIDOMInstallVersion *nativeThis =
(nsIDOMInstallVersion*)JS_GetInstancePrivate(cx, obj, &InstallVersionClass,
argv);
if (!nativeThis)
return JS_FALSE;
PRInt32 nativeRet;
nsString b0str;
PRInt32 b0int;
@ -450,24 +499,6 @@ InstallVersionCompareTo(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, j
}
/***********************************************************************/
//
// class for InstallVersion
//
JSClass InstallVersionClass = {
"InstallVersion",
JSCLASS_HAS_PRIVATE,
JS_PropertyStub,
JS_PropertyStub,
GetInstallVersionProperty,
SetInstallVersionProperty,
EnumerateInstallVersion,
ResolveInstallVersion,
JS_ConvertStub,
FinalizeInstallVersion
};
//
// InstallVersion class properties
//

Просмотреть файл

@ -63,6 +63,27 @@ extern PRBool ConvertJSValToObj(nsISupports** aSupports,
jsval aValue);
static void PR_CALLBACK
WinProfileCleanup(JSContext *cx, JSObject *obj);
/***********************************************************************/
//
// class for WinProfile
//
JSClass WinProfileClass = {
"WinProfile",
JSCLASS_HAS_PRIVATE,
JS_PropertyStub,
JS_PropertyStub,
JS_PropertyStub,
JS_PropertyStub,
JS_EnumerateStub,
JS_ResolveStub,
JS_ConvertStub,
WinProfileCleanup
};
static void PR_CALLBACK WinProfileCleanup(JSContext *cx, JSObject *obj)
{
nsWinProfile *nativeThis = (nsWinProfile*)JS_GetPrivate(cx, obj);
@ -78,19 +99,17 @@ static void PR_CALLBACK WinProfileCleanup(JSContext *cx, JSObject *obj)
PR_STATIC_CALLBACK(JSBool)
WinProfileGetString(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
nsWinProfile *nativeThis = (nsWinProfile*)JS_GetPrivate(cx, obj);
nsWinProfile *nativeThis =
(nsWinProfile*)JS_GetInstancePrivate(cx, obj, &WinProfileClass, argv);
if (!nativeThis)
return JS_FALSE;
nsString nativeRet;
nsAutoString b0;
nsAutoString b1;
*rval = JSVAL_NULL;
// If there's no private data, this must be the prototype, so ignore
if(nsnull == nativeThis)
{
return JS_TRUE;
}
if(argc >= 2)
{
// public string getString ( String section,
@ -111,13 +130,35 @@ WinProfileGetString(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval
return JS_TRUE;
}
/***********************************************************************/
//
// class for WinProfile
//
JSClass WinProfileClass = {
"WinProfile",
JSCLASS_HAS_PRIVATE,
JS_PropertyStub,
JS_PropertyStub,
JS_PropertyStub,
JS_PropertyStub,
JS_EnumerateStub,
JS_ResolveStub,
JS_ConvertStub,
WinProfileCleanup
};
//
// Native method WriteString
//
PR_STATIC_CALLBACK(JSBool)
WinProfileWriteString(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
nsWinProfile *nativeThis = (nsWinProfile*)JS_GetPrivate(cx, obj);
nsWinProfile *nativeThis =
(nsWinProfile*)JS_GetInstancePrivate(cx, obj, &WinProfileClass, argv);
if (!nativeThis)
return JS_FALSE;
PRInt32 nativeRet;
nsAutoString b0;
nsAutoString b1;
@ -125,12 +166,6 @@ WinProfileWriteString(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsv
*rval = JSVAL_ZERO;
// If there's no private data, this must be the prototype, so ignore
if(nsnull == nativeThis)
{
return JS_TRUE;
}
if(argc >= 3)
{
// public int writeString ( String section,
@ -163,24 +198,6 @@ WinProfile(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
return JS_FALSE;
}
/***********************************************************************/
//
// class for WinProfile
//
JSClass WinProfileClass = {
"WinProfile",
JSCLASS_HAS_PRIVATE,
JS_PropertyStub,
JS_PropertyStub,
JS_PropertyStub,
JS_PropertyStub,
JS_EnumerateStub,
JS_ResolveStub,
JS_ConvertStub,
WinProfileCleanup
};
static JSConstDoubleSpec winprofile_constants[] =
{
{0}

Просмотреть файл

@ -71,6 +71,23 @@ static void PR_CALLBACK WinRegCleanup(JSContext *cx, JSObject *obj)
delete nativeThis;
}
/***********************************************************************/
//
// class for WinReg
//
JSClass WinRegClass = {
"WinReg",
JSCLASS_HAS_PRIVATE,
JS_PropertyStub,
JS_PropertyStub,
JS_PropertyStub,
JS_PropertyStub,
JS_EnumerateStub,
JS_ResolveStub,
JS_ConvertStub,
WinRegCleanup
};
/***********************************************************************************/
// Native mothods for WinReg functions
@ -80,17 +97,15 @@ static void PR_CALLBACK WinRegCleanup(JSContext *cx, JSObject *obj)
PR_STATIC_CALLBACK(JSBool)
WinRegSetRootKey(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
nsWinReg *nativeThis = (nsWinReg*)JS_GetPrivate(cx, obj);
nsWinReg *nativeThis =
(nsWinReg*)JS_GetInstancePrivate(cx, obj, &WinRegClass, argv);
if (!nativeThis)
return JS_FALSE;
PRInt32 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 void setRootKey(PRInt32 key);
@ -118,18 +133,16 @@ WinRegSetRootKey(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *r
PR_STATIC_CALLBACK(JSBool)
WinRegKeyExists(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
nsWinReg *nativeThis = (nsWinReg*)JS_GetPrivate(cx, obj);
nsWinReg *nativeThis =
(nsWinReg*)JS_GetInstancePrivate(cx, obj, &WinRegClass, argv);
if (!nativeThis)
return JS_FALSE;
PRBool nativeRet;
nsAutoString b0;
*rval = JSVAL_FALSE;
// If there's no private data, this must be the prototype, so ignore
if(nsnull == nativeThis)
{
return JS_TRUE;
}
if(argc >= 1)
{
// public boolean keyExists ( String subKey );
@ -159,19 +172,17 @@ WinRegKeyExists(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rv
PR_STATIC_CALLBACK(JSBool)
WinRegValueExists(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
nsWinReg *nativeThis = (nsWinReg*)JS_GetPrivate(cx, obj);
nsWinReg *nativeThis =
(nsWinReg*)JS_GetInstancePrivate(cx, obj, &WinRegClass, argv);
if (!nativeThis)
return JS_FALSE;
PRBool nativeRet;
nsAutoString b0;
nsAutoString b1;
*rval = JSVAL_FALSE;
// If there's no private data, this must be the prototype, so ignore
if(nsnull == nativeThis)
{
return JS_TRUE;
}
if(argc >= 2)
{
// public boolean valueExists ( String subKey,
@ -199,18 +210,16 @@ WinRegValueExists(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *
PR_STATIC_CALLBACK(JSBool)
WinRegIsKeyWritable(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
nsWinReg *nativeThis = (nsWinReg*)JS_GetPrivate(cx, obj);
nsWinReg *nativeThis =
(nsWinReg*)JS_GetInstancePrivate(cx, obj, &WinRegClass, argv);
if (!nativeThis)
return JS_FALSE;
PRInt32 nativeRet;
nsAutoString b0;
*rval = JSVAL_FALSE;
// If there's no private data, this must be the prototype, so ignore
if(nsnull == nativeThis)
{
return JS_TRUE;
}
if(argc >= 1)
{
// public boolean isKeyWritable ( String subKey );
@ -236,19 +245,17 @@ WinRegIsKeyWritable(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval
PR_STATIC_CALLBACK(JSBool)
WinRegCreateKey(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
nsWinReg *nativeThis = (nsWinReg*)JS_GetPrivate(cx, obj);
nsWinReg *nativeThis =
(nsWinReg*)JS_GetInstancePrivate(cx, obj, &WinRegClass, argv);
if (!nativeThis)
return JS_FALSE;
PRInt32 nativeRet;
nsAutoString b0;
nsAutoString b1;
*rval = INT_TO_JSVAL(nsInstall::UNEXPECTED_ERROR);
// If there's no private data, this must be the prototype, so ignore
if(nsnull == nativeThis)
{
return JS_TRUE;
}
if(argc >= 2)
{
// public int createKey ( String subKey,
@ -276,18 +283,16 @@ WinRegCreateKey(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rv
PR_STATIC_CALLBACK(JSBool)
WinRegDeleteKey(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
nsWinReg *nativeThis = (nsWinReg*)JS_GetPrivate(cx, obj);
nsWinReg *nativeThis =
(nsWinReg*)JS_GetInstancePrivate(cx, obj, &WinRegClass, argv);
if (!nativeThis)
return JS_FALSE;
PRInt32 nativeRet;
nsAutoString b0;
*rval = INT_TO_JSVAL(nsInstall::UNEXPECTED_ERROR);
// If there's no private data, this must be the prototype, so ignore
if(nsnull == nativeThis)
{
return JS_TRUE;
}
if(argc >= 1)
{
// public int deleteKey ( String subKey);
@ -314,19 +319,17 @@ WinRegDeleteKey(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rv
PR_STATIC_CALLBACK(JSBool)
WinRegDeleteValue(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
nsWinReg *nativeThis = (nsWinReg*)JS_GetPrivate(cx, obj);
nsWinReg *nativeThis =
(nsWinReg*)JS_GetInstancePrivate(cx, obj, &WinRegClass, argv);
if (!nativeThis)
return JS_FALSE;
PRInt32 nativeRet;
nsString b0;
nsString b1;
*rval = INT_TO_JSVAL(nsInstall::UNEXPECTED_ERROR);
// If there's no private data, this must be the prototype, so ignore
if(nsnull == nativeThis)
{
return JS_TRUE;
}
if(argc >= 2)
{
// public int deleteValue ( String subKey,
@ -354,7 +357,11 @@ WinRegDeleteValue(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *
PR_STATIC_CALLBACK(JSBool)
WinRegSetValueString(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
nsWinReg *nativeThis = (nsWinReg*)JS_GetPrivate(cx, obj);
nsWinReg *nativeThis =
(nsWinReg*)JS_GetInstancePrivate(cx, obj, &WinRegClass, argv);
if (!nativeThis)
return JS_FALSE;
PRInt32 nativeRet;
nsAutoString b0;
nsAutoString b1;
@ -362,12 +369,6 @@ WinRegSetValueString(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsva
*rval = INT_TO_JSVAL(nsInstall::UNEXPECTED_ERROR);
// If there's no private data, this must be the prototype, so ignore
if(nsnull == nativeThis)
{
return JS_TRUE;
}
if(argc >= 3)
{
// public int setValueString ( String subKey,
@ -397,19 +398,17 @@ WinRegSetValueString(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsva
PR_STATIC_CALLBACK(JSBool)
WinRegGetValueString(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
nsWinReg* nativeThis = (nsWinReg*)JS_GetPrivate(cx, obj);
nsWinReg *nativeThis =
(nsWinReg*)JS_GetInstancePrivate(cx, obj, &WinRegClass, argv);
if (!nativeThis)
return JS_FALSE;
nsString nativeRet;
nsAutoString b0;
nsAutoString b1;
*rval = JSVAL_NULL;
// If there's no private data, this must be the prototype, so ignore
if(nsnull == nativeThis)
{
return JS_TRUE;
}
if(argc >= 2)
{
// public string getValueString ( String subKey,
@ -437,19 +436,17 @@ WinRegGetValueString(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsva
PR_STATIC_CALLBACK(JSBool)
WinRegEnumValueNames(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
nsWinReg* nativeThis = (nsWinReg*)JS_GetPrivate(cx, obj);
nsWinReg *nativeThis =
(nsWinReg*)JS_GetInstancePrivate(cx, obj, &WinRegClass, argv);
if (!nativeThis)
return JS_FALSE;
nsAutoString nativeRet;
nsAutoString b0;
int32 b1;
*rval = JSVAL_NULL;
// If there's no private data, this must be the prototype, so ignore
if(nsnull == nativeThis)
{
return JS_TRUE;
}
if(argc >= 2)
{
// public String enumValueNames ( String subkey,
@ -484,19 +481,17 @@ WinRegEnumValueNames(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsva
PR_STATIC_CALLBACK(JSBool)
WinRegEnumKeys(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
nsWinReg* nativeThis = (nsWinReg*)JS_GetPrivate(cx, obj);
nsWinReg *nativeThis =
(nsWinReg*)JS_GetInstancePrivate(cx, obj, &WinRegClass, argv);
if (!nativeThis)
return JS_FALSE;
nsAutoString nativeRet;
nsAutoString b0;
int32 b1;
*rval = JSVAL_NULL;
// If there's no private data, this must be the prototype, so ignore
if(nsnull == nativeThis)
{
return JS_TRUE;
}
if(argc >= 2)
{
// public String enumKeys ( String subkey,
@ -531,7 +526,11 @@ WinRegEnumKeys(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rva
PR_STATIC_CALLBACK(JSBool)
WinRegSetValueNumber(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
nsWinReg *nativeThis = (nsWinReg*)JS_GetPrivate(cx, obj);
nsWinReg *nativeThis =
(nsWinReg*)JS_GetInstancePrivate(cx, obj, &WinRegClass, argv);
if (!nativeThis)
return JS_FALSE;
PRInt32 nativeRet;
nsAutoString b0;
nsAutoString b1;
@ -539,12 +538,6 @@ WinRegSetValueNumber(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsva
*rval = INT_TO_JSVAL(nsInstall::UNEXPECTED_ERROR);
// If there's no private data, this must be the prototype, so ignore
if(nsnull == nativeThis)
{
return JS_TRUE;
}
if(argc >= 3)
{
// public int setValueNumber ( String subKey,
@ -577,19 +570,17 @@ WinRegSetValueNumber(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsva
PR_STATIC_CALLBACK(JSBool)
WinRegGetValueNumber(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
nsWinReg* nativeThis = (nsWinReg*)JS_GetPrivate(cx, obj);
nsWinReg *nativeThis =
(nsWinReg*)JS_GetInstancePrivate(cx, obj, &WinRegClass, argv);
if (!nativeThis)
return JS_FALSE;
PRInt32 nativeRet;
nsAutoString b0;
nsAutoString b1;
*rval = JSVAL_NULL;
// If there's no private data, this must be the prototype, so ignore
if(nsnull == nativeThis)
{
return JS_TRUE;
}
if(argc >= 2)
{
// public int getValueNumber ( String subKey,
@ -617,18 +608,16 @@ WinRegGetValueNumber(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsva
PR_STATIC_CALLBACK(JSBool)
WinRegSetValue(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
nsWinReg *nativeThis = (nsWinReg*)JS_GetPrivate(cx, obj);
nsWinReg *nativeThis =
(nsWinReg*)JS_GetInstancePrivate(cx, obj, &WinRegClass, argv);
if (!nativeThis)
return JS_FALSE;
nsAutoString b0;
nsAutoString b1;
*rval = INT_TO_JSVAL(nsInstall::UNEXPECTED_ERROR);
// If there's no private data, this must be the prototype, so ignore
if(nsnull == nativeThis)
{
return JS_TRUE;
}
if(argc >= 3)
{
// public int setValue ( String subKey,
@ -663,19 +652,17 @@ WinRegSetValue(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rva
PR_STATIC_CALLBACK(JSBool)
WinRegGetValue(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
nsWinReg *nativeThis = (nsWinReg*)JS_GetPrivate(cx, obj);
nsWinReg *nativeThis =
(nsWinReg*)JS_GetInstancePrivate(cx, obj, &WinRegClass, argv);
if (!nativeThis)
return JS_FALSE;
nsWinRegValue *nativeRet;
nsAutoString b0;
nsAutoString b1;
*rval = JSVAL_NULL;
// If there's no private data, this must be the prototype, so ignore
if(nsnull == nativeThis)
{
return JS_TRUE;
}
if(argc >= 2)
{
// public int getValue ( String subKey,
@ -708,23 +695,6 @@ WinReg(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
}
/***********************************************************************/
//
// class for WinReg
//
JSClass WinRegClass = {
"WinReg",
JSCLASS_HAS_PRIVATE,
JS_PropertyStub,
JS_PropertyStub,
JS_PropertyStub,
JS_PropertyStub,
JS_EnumerateStub,
JS_ResolveStub,
JS_ConvertStub,
WinRegCleanup
};
static JSConstDoubleSpec winreg_constants[] =
{
{ nsWinReg::NS_HKEY_CLASSES_ROOT, "HKEY_CLASSES_ROOT" },