Type-check method calls on wrong class of object, required for hand-rolled JS natives (290162, r=dveditz/sr=shaver/a=drivers).
git-svn-id: svn://10.0.0.236/trunk@172098 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -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
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user