зеркало из https://github.com/mozilla/gecko-dev.git
fixing bug #8620
This commit is contained in:
Родитель
87ba003503
Коммит
001771c6cb
|
@ -34,4 +34,5 @@ interface nsIXPINotifier : nsISupports
|
|||
void ItemScheduled([const] in string message );
|
||||
void InstallFinalization([const] in string message, in long itemNum, in long totNum );
|
||||
void InstallAborted();
|
||||
void LogComment([const] in string comment);
|
||||
};
|
||||
|
|
|
@ -1372,6 +1372,13 @@ nsInstall::FileOpFileUnixLinkCreate(nsFileSpec& aTarget, PRInt32 aFlags, PRInt32
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
nsInstall::LogComment(nsString& aComment)
|
||||
{
|
||||
if(mNotifier)
|
||||
mNotifier->LogComment(nsAutoCString(aComment));
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// Private Methods
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -201,6 +201,8 @@ class nsInstall
|
|||
PRInt32 FileOpFileMacAliasCreate(nsFileSpec& aTarget, PRInt32 aFlags, PRInt32* aReturn);
|
||||
PRInt32 FileOpFileUnixLinkCreate(nsFileSpec& aTarget, PRInt32 aFlags, PRInt32* aReturn);
|
||||
|
||||
void LogComment(nsString& aComment);
|
||||
|
||||
PRInt32 ExtractFileFromJar(const nsString& aJarfile, nsFileSpec* aSuggestedName, nsFileSpec** aRealName);
|
||||
void AddPatch(nsHashKey *aKey, nsFileSpec* fileName);
|
||||
void GetPatch(nsHashKey *aKey, nsFileSpec** fileName);
|
||||
|
|
|
@ -151,7 +151,11 @@ nsInstallProgressDialog::InstallAborted()
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsInstallProgressDialog::LogComment(const char* comment)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
// Do startup stuff from C++ side.
|
||||
|
|
|
@ -57,6 +57,7 @@ class nsInstallProgressDialog : public nsIXPINotifier,
|
|||
NS_IMETHOD ItemScheduled(const char *message);
|
||||
NS_IMETHOD InstallFinalization(const char *message, PRInt32 itemNum, PRInt32 totNum);
|
||||
NS_IMETHOD InstallAborted();
|
||||
NS_IMETHOD LogComment(const char* comment);
|
||||
|
||||
// implement nsIXPIProgressDlg
|
||||
NS_IMETHOD Open();
|
||||
|
@ -80,4 +81,4 @@ class nsInstallProgressDialog : public nsIXPINotifier,
|
|||
nsCOMPtr<nsIDOMXULDocument> mDocument; // why is this owned?
|
||||
nsCOMPtr<nsIWebShellWindow> mWindow; // why is this owned?
|
||||
};
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -2254,6 +2254,40 @@ InstallFileOpFileUnixLinkCreate(JSContext *cx, JSObject *obj, uintN argc, jsval
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
//
|
||||
// Native method LogComment
|
||||
//
|
||||
PR_STATIC_CALLBACK(JSBool)
|
||||
InstallLogComment(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 LogComment (String aComment);
|
||||
|
||||
ConvertJSValToStr(b0, cx, argv[0]);
|
||||
|
||||
nativeThis->LogComment(b0);
|
||||
}
|
||||
else
|
||||
{
|
||||
JS_ReportError(cx, "Function LogComment requires 1 parameter");
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
/***********************************************************************/
|
||||
//
|
||||
// class for Install
|
||||
|
@ -2369,6 +2403,7 @@ static JSFunctionSpec InstallMethods[] =
|
|||
{"FileWinShortcutCreate", InstallFileOpFileWinShortcutCreate, 2},
|
||||
{"FileMacAliasCreate", InstallFileOpFileMacAliasCreate, 2},
|
||||
{"FileUnixLinkCreate", InstallFileOpFileUnixLinkCreate, 2},
|
||||
{"LogComment", InstallLogComment, 1},
|
||||
{0}
|
||||
};
|
||||
|
||||
|
|
|
@ -131,4 +131,13 @@ nsLoggingProgressNotifier::GetTime(char** aString)
|
|||
PR_FormatTimeUSEnglish(line, sizeof(line), "%m/%d/%Y %H:%M:%S", &et);
|
||||
*aString = PL_strdup(line);
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsLoggingProgressNotifier::LogComment(const char* comment)
|
||||
{
|
||||
if (mLogStream == nsnull) return -1;
|
||||
|
||||
*mLogStream << " Comment: " << comment << nsEndl;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -40,16 +40,18 @@ class nsLoggingProgressNotifier : public nsIXPINotifier
|
|||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// nsIXPINotifier interfaces
|
||||
NS_IMETHOD BeforeJavascriptEvaluation();
|
||||
NS_IMETHOD AfterJavascriptEvaluation();
|
||||
NS_IMETHOD InstallStarted(const char* UIPackageName);
|
||||
NS_IMETHOD ItemScheduled(const char* message );
|
||||
NS_IMETHOD InstallFinalization(const char* message, PRInt32 itemNum, PRInt32 totNum );
|
||||
NS_IMETHOD InstallAborted();
|
||||
NS_IMETHOD LogComment(const char* comment);
|
||||
|
||||
private:
|
||||
void GetTime(char** aString);
|
||||
nsOutputFileStream *mLogStream;
|
||||
};
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -167,4 +167,19 @@ nsTopProgressNotifier::InstallAborted(void)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsTopProgressNotifier::LogComment(const char* comment)
|
||||
{
|
||||
if (mNotifiers)
|
||||
{
|
||||
PRUint32 i=0;
|
||||
for (; i < mNotifiers->GetSize(); i++)
|
||||
{
|
||||
nsIXPINotifier* element = (nsIXPINotifier*)mNotifiers->Get(i);
|
||||
if (element != NULL)
|
||||
element->LogComment(comment);
|
||||
}
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -41,13 +41,14 @@ class nsTopProgressNotifier : public nsIXPINotifier
|
|||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
|
||||
// nsIXPINotifier interfaces
|
||||
NS_IMETHOD BeforeJavascriptEvaluation();
|
||||
NS_IMETHOD AfterJavascriptEvaluation();
|
||||
NS_IMETHOD InstallStarted(const char* UIPackageName);
|
||||
NS_IMETHOD ItemScheduled(const char* message );
|
||||
NS_IMETHOD InstallFinalization(const char* message, PRInt32 itemNum, PRInt32 totNum );
|
||||
NS_IMETHOD InstallAborted();
|
||||
NS_IMETHOD LogComment(const char* comment);
|
||||
|
||||
private:
|
||||
nsVector *mNotifiers;
|
||||
|
|
|
@ -483,3 +483,10 @@ nsXPInstallManager::InstallAborted()
|
|||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXPInstallManager::LogComment(const char* comment)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -75,6 +75,7 @@ class nsXPInstallManager : public nsIXPINotifier, public nsIStreamListener
|
|||
NS_IMETHOD ItemScheduled(const char *message);
|
||||
NS_IMETHOD InstallFinalization(const char *message, PRInt32 itemNum, PRInt32 totNum);
|
||||
NS_IMETHOD InstallAborted();
|
||||
NS_IMETHOD LogComment(const char *comment);
|
||||
|
||||
// IXULWindowCallbacks methods
|
||||
// NS_IMETHOD ConstructBeforeJavaScript(nsIWebShell *aWebShell);
|
||||
|
@ -91,4 +92,4 @@ class nsXPInstallManager : public nsIXPINotifier, public nsIStreamListener
|
|||
nsCOMPtr<nsIXPIProgressDlg> mProxy;
|
||||
};
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
|
Загрузка…
Ссылка в новой задаче