Bug 670194 - Startup numbers don't account for interactive startup interruptions. r=dtownsend

This commit is contained in:
Margaret Leibovic 2011-08-25 14:11:18 -04:00
parent 87db8378b2
commit 6a3ea80459
6 changed files with 28 additions and 2 deletions

View File

@ -134,7 +134,8 @@ nsAppStartup::nsAppStartup() :
mRunning(PR_FALSE),
mShuttingDown(PR_FALSE),
mAttemptingQuit(PR_FALSE),
mRestart(PR_FALSE)
mRestart(PR_FALSE),
mInterrupted(PR_FALSE)
{ }
@ -452,6 +453,20 @@ nsAppStartup::GetShuttingDown(PRBool *aResult)
return NS_OK;
}
NS_IMETHODIMP
nsAppStartup::SetInterrupted(PRBool aInterrupted)
{
mInterrupted = aInterrupted;
return NS_OK;
}
NS_IMETHODIMP
nsAppStartup::GetInterrupted(PRBool *aInterrupted)
{
*aInterrupted = mInterrupted;
return NS_OK;
}
//
// nsAppStartup->nsIWindowCreator
//

View File

@ -84,6 +84,7 @@ private:
PRPackedBool mShuttingDown; // Quit method reentrancy check
PRPackedBool mAttemptingQuit; // Quit(eAttemptQuit) still trying
PRPackedBool mRestart; // Quit(eRestart)
PRPackedBool mInterrupted; // Was startup interrupted by an interactive prompt?
};
#endif // nsAppStartup_h__

View File

@ -41,7 +41,7 @@
interface nsICmdLineService;
[scriptable, uuid(68b4b481-e21b-478f-8d75-41b131e1c261)]
[scriptable, uuid(35fcdb69-3bb6-4484-b99a-32f49a84fabd)]
interface nsIAppStartup : nsISupports
{
/**
@ -135,6 +135,11 @@ interface nsIAppStartup : nsISupports
* Properties may not be available depending on platform or application
*/
void getStartupInfo();
/**
* True if startup was interrupted by an interactive prompt.
*/
attribute boolean interrupted;
};
%{C++

View File

@ -86,6 +86,7 @@ let initTable = [
["vc", "@mozilla.org/xpcom/version-comparator;1", "nsIVersionComparator"],
["wm", "@mozilla.org/appshell/window-mediator;1", "nsIWindowMediator"],
["ww", "@mozilla.org/embedcomp/window-watcher;1", "nsIWindowWatcher"],
["startup", "@mozilla.org/toolkit/app-startup;1", "nsIAppStartup"],
];
initTable.forEach(function ([name, contract, intf])

View File

@ -1707,6 +1707,9 @@ var XPIProvider = {
* Shows the "Compatibility Updates" UI
*/
showUpgradeUI: function XPI_showUpgradeUI() {
// Flip a flag to indicate that we interrupted startup with an interactive prompt
Services.startup.interrupted = true;
if (!Prefs.getBoolPref(PREF_SHOWN_SELECTION_UI, false)) {
// This *must* be modal as it has to block startup.
var features = "chrome,centerscreen,dialog,titlebar,modal";

View File

@ -58,6 +58,7 @@ var WindowWatcher = {
arguments: null,
openWindow: function(parent, url, name, features, arguments) {
do_check_true(Services.startup.interrupted);
do_check_eq(url, URI_EXTENSION_UPDATE_DIALOG);
do_check_true(this.expected);
this.expected = false;