From 979446d392f9fca751b2cadd6f9b0ba49ffee2cf Mon Sep 17 00:00:00 2001 From: "sspitzer%netscape.com" Date: Tue, 28 Sep 1999 04:40:59 +0000 Subject: [PATCH] use the NS_WITH_SERVICE macro. #15042 remove calls to toolkit appcore, as it is going away soon. #14999 --- profile/pref-migrator/resources/pmunprog.js | 4 +-- profile/pref-migrator/src/nsPMProgressDlg.cpp | 35 ++++--------------- 2 files changed, 9 insertions(+), 30 deletions(-) diff --git a/profile/pref-migrator/resources/pmunprog.js b/profile/pref-migrator/resources/pmunprog.js index 1da830792a89..88a7e48d4fa5 100644 --- a/profile/pref-migrator/resources/pmunprog.js +++ b/profile/pref-migrator/resources/pmunprog.js @@ -55,10 +55,10 @@ function open() { browser.loadUrl( url ); /* Close dialog. */ - toolkit.CloseWindow( window ); + window.close(); } function cancel() { - toolkit.CloseWindow( window ); + window.close(); } diff --git a/profile/pref-migrator/src/nsPMProgressDlg.cpp b/profile/pref-migrator/src/nsPMProgressDlg.cpp index 984856cc8558..d123e6c6235c 100644 --- a/profile/pref-migrator/src/nsPMProgressDlg.cpp +++ b/profile/pref-migrator/src/nsPMProgressDlg.cpp @@ -161,13 +161,9 @@ nsPrefMigrationProgressDialog::CreateProfileProgressDialog() nsresult rv = NS_OK; // Get app shell service. - nsIAppShellService *appShell; - rv = nsServiceManager::GetService( kAppShellServiceCID, - nsIAppShellService::GetIID(), - (nsISupports**)&appShell ); + NS_WITH_SERVICE(nsIAppShellService, appShell, kAppShellServiceCID, &rv); + if (NS_FAILED(rv)) return rv; - if ( NS_SUCCEEDED( rv ) ) - { // Open "progress" dialog. nsCOMPtr url; const char *urlSpec = "resource:/res/profile/progress_undetermined.xul"; @@ -201,13 +197,7 @@ nsPrefMigrationProgressDialog::CreateProfileProgressDialog() DEBUG_PRINTF( PR_STDOUT, "Error creating progress dialog, rv=0x%X\n", (int)rv ); } } - - nsServiceManager::ReleaseService( kAppShellServiceCID, appShell ); - } - else - { - DEBUG_PRINTF( PR_STDOUT, "Unable to get app shell service, rv=0x%X\n", (int)rv ); - } + return NS_OK; } @@ -215,22 +205,11 @@ NS_IMETHODIMP nsPrefMigrationProgressDialog::KillProfileProgressDialog() { nsresult rv = NS_OK; - nsIAppShellService *appShell; - - rv = nsServiceManager::GetService( kAppShellServiceCID, - nsIAppShellService::GetIID(), - (nsISupports**)&appShell ); + NS_WITH_SERVICE(nsIAppShellService, appShell, kAppShellServiceCID, &rv); + if (NS_FAILED(rv)) return rv; - if ( NS_SUCCEEDED( rv ) ) - { - rv = appShell->CloseTopLevelWindow( mWindow ); - nsServiceManager::ReleaseService(kAppShellServiceCID, appShell); - } - else - { - DEBUG_PRINTF( PR_STDOUT, "Unable to get app shell service, rv=0x%X\n", (int)rv ); - } - return NS_OK; + rv = appShell->CloseTopLevelWindow( mWindow ); + return rv; }