2nd patch for bug 158080
Description: replace the hardcode of "@mozilla.org/embedcomp/window-watcher;1" with NS_WINDOWWATCHER_CONTRACTID Patch by Henry.Jia@sun.com r=anto, sr=alecf
This commit is contained in:
Родитель
21f46def80
Коммит
edb10a6aac
|
@ -79,7 +79,7 @@ NS_IMETHODIMP nsSDRContext::GetInterface(const nsIID & uuid, void * *result)
|
|||
if (!proxyman) return NS_ERROR_FAILURE;
|
||||
|
||||
nsCOMPtr<nsIPrompt> prompter;
|
||||
nsCOMPtr<nsIWindowWatcher> wwatch(do_GetService("@mozilla.org/embedcomp/window-watcher;1"));
|
||||
nsCOMPtr<nsIWindowWatcher> wwatch(do_GetService(NS_WINDOWWATCHER_CONTRACTID));
|
||||
if (wwatch) {
|
||||
wwatch->GetNewPrompter(0, getter_AddRefs(prompter));
|
||||
if (prompter) {
|
||||
|
|
|
@ -337,7 +337,7 @@ nsViewerApp::InitializeWindowCreator()
|
|||
if (creatorCallback) {
|
||||
nsCOMPtr<nsIWindowCreator> windowCreator(dont_QueryInterface(NS_STATIC_CAST(nsIWindowCreator *, creatorCallback)));
|
||||
if (windowCreator) {
|
||||
nsCOMPtr<nsIWindowWatcher> wwatch(do_GetService("@mozilla.org/embedcomp/window-watcher;1"));
|
||||
nsCOMPtr<nsIWindowWatcher> wwatch(do_GetService(NS_WINDOWWATCHER_CONTRACTID));
|
||||
if (wwatch) {
|
||||
wwatch->SetWindowCreator(windowCreator);
|
||||
return NS_OK;
|
||||
|
|
|
@ -54,6 +54,7 @@
|
|||
|
||||
#include "nsIAppShell.h"
|
||||
#include "nsIWidget.h"
|
||||
#include "nsIWindowWatcher.h"
|
||||
#include "nsIDOMWindowInternal.h"
|
||||
#include "nsIWebShellWindow.h"
|
||||
#include "nsWebShellWindow.h"
|
||||
|
@ -95,7 +96,6 @@ static NS_DEFINE_CID(kEventQueueServiceCID, NS_EVENTQUEUESERVICE_CID);
|
|||
static NS_DEFINE_CID(kWindowMediatorCID, NS_WINDOWMEDIATOR_CID);
|
||||
static NS_DEFINE_CID(kXPConnectCID, NS_XPCONNECT_CID);
|
||||
|
||||
#define sWindowWatcherContractID "@mozilla.org/embedcomp/window-watcher;1"
|
||||
#define gEQActivatedNotification "nsIEventQueueActivated"
|
||||
#define gEQDestroyedNotification "nsIEventQueueDestroyed"
|
||||
#define gSkinSelectedTopic "skin-selected"
|
||||
|
@ -178,7 +178,7 @@ nsAppShellService::Initialize( nsICmdLineService *aCmdLineService,
|
|||
|
||||
// enable window mediation (and fail if we can't get the mediator)
|
||||
mWindowMediator = do_GetService(kWindowMediatorCID, &rv);
|
||||
mWindowWatcher = do_GetService(sWindowWatcherContractID);
|
||||
mWindowWatcher = do_GetService(NS_WINDOWWATCHER_CONTRACTID);
|
||||
|
||||
done:
|
||||
return rv;
|
||||
|
|
|
@ -321,7 +321,7 @@ OSErr nsMacCommandLine::HandlePrintOneDoc(const FSSpec& inFileSpec, OSType fileT
|
|||
nsresult nsMacCommandLine::OpenWindow(const char *chrome, const PRUnichar *url)
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
nsCOMPtr<nsIWindowWatcher> wwatch(do_GetService("@mozilla.org/embedcomp/window-watcher;1"));
|
||||
nsCOMPtr<nsIWindowWatcher> wwatch(do_GetService(NS_WINDOWWATCHER_CONTRACTID));
|
||||
nsCOMPtr<nsISupportsString> urlWrapper(do_CreateInstance(NS_SUPPORTS_STRING_CONTRACTID));
|
||||
if (!wwatch || !urlWrapper)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
|
|
@ -670,7 +670,7 @@ nsWindowMediator::Init()
|
|||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
mWatcher = do_GetService("@mozilla.org/embedcomp/window-watcher;1", &rv);
|
||||
mWatcher = do_GetService(NS_WINDOWWATCHER_CONTRACTID, &rv);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
|
|
|
@ -770,7 +770,7 @@ NS_IMETHODIMP nsXULWindow::EnsurePrompter()
|
|||
nsCOMPtr<nsIDOMWindowInternal> ourWindow;
|
||||
nsresult rv = GetWindowDOMWindow(getter_AddRefs(ourWindow));
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsCOMPtr<nsIWindowWatcher> wwatch(do_GetService("@mozilla.org/embedcomp/window-watcher;1"));
|
||||
nsCOMPtr<nsIWindowWatcher> wwatch(do_GetService(NS_WINDOWWATCHER_CONTRACTID));
|
||||
if (wwatch)
|
||||
wwatch->GetNewPrompter(ourWindow, getter_AddRefs(mPrompter));
|
||||
}
|
||||
|
@ -785,7 +785,7 @@ NS_IMETHODIMP nsXULWindow::EnsureAuthPrompter()
|
|||
nsCOMPtr<nsIDOMWindowInternal> ourWindow;
|
||||
nsresult rv = GetWindowDOMWindow(getter_AddRefs(ourWindow));
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsCOMPtr<nsIWindowWatcher> wwatch(do_GetService("@mozilla.org/embedcomp/window-watcher;1"));
|
||||
nsCOMPtr<nsIWindowWatcher> wwatch(do_GetService(NS_WINDOWWATCHER_CONTRACTID));
|
||||
if (wwatch)
|
||||
wwatch->GetNewAuthPrompter(ourWindow, getter_AddRefs(mAuthPrompter));
|
||||
}
|
||||
|
|
|
@ -334,8 +334,6 @@ static void InitializeMacOSXApp(int argc, char* argv[])
|
|||
/* Define Class IDs */
|
||||
static NS_DEFINE_CID(kAppShellServiceCID, NS_APPSHELL_SERVICE_CID);
|
||||
static NS_DEFINE_CID(kCmdLineServiceCID, NS_COMMANDLINE_SERVICE_CID);
|
||||
static const char sWatcherServiceContractID[] = "@mozilla.org/embedcomp/window-watcher;1";
|
||||
|
||||
|
||||
#include "nsNativeAppSupport.h"
|
||||
|
||||
|
@ -456,7 +454,7 @@ static nsresult OpenWindow(const nsAFlatCString& aChromeURL,
|
|||
aWidth, aHeight);
|
||||
#endif /* DEBUG_CMD_LINE */
|
||||
|
||||
nsCOMPtr<nsIWindowWatcher> wwatch(do_GetService("@mozilla.org/embedcomp/window-watcher;1"));
|
||||
nsCOMPtr<nsIWindowWatcher> wwatch(do_GetService(NS_WINDOWWATCHER_CONTRACTID));
|
||||
nsCOMPtr<nsISupportsString> sarg(do_CreateInstance(NS_SUPPORTS_STRING_CONTRACTID));
|
||||
if (!wwatch || !sarg)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
@ -1182,7 +1180,7 @@ static nsresult InitializeWindowCreator()
|
|||
|
||||
nsCOMPtr<nsIWindowCreator> windowCreator(NS_STATIC_CAST(nsIWindowCreator *, creatorCallback));
|
||||
if (windowCreator) {
|
||||
nsCOMPtr<nsIWindowWatcher> wwatch(do_GetService(sWatcherServiceContractID));
|
||||
nsCOMPtr<nsIWindowWatcher> wwatch(do_GetService(NS_WINDOWWATCHER_CONTRACTID));
|
||||
if (wwatch) {
|
||||
wwatch->SetWindowCreator(windowCreator);
|
||||
return NS_OK;
|
||||
|
|
|
@ -1909,7 +1909,7 @@ nsNativeAppSupportOS2::OpenWindow( const char*urlstr, const char *args ) {
|
|||
|
||||
nsresult rv = NS_ERROR_FAILURE;
|
||||
|
||||
nsCOMPtr<nsIWindowWatcher> wwatch(do_GetService("@mozilla.org/embedcomp/window-watcher;1"));
|
||||
nsCOMPtr<nsIWindowWatcher> wwatch(do_GetService(NS_WINDOWWATCHER_CONTRACTID));
|
||||
nsCOMPtr<nsISupportsCString> sarg(do_CreateInstance(NS_SUPPORTS_CSTRING_CONTRACTID));
|
||||
if (sarg)
|
||||
sarg->SetData(args);
|
||||
|
@ -2188,7 +2188,7 @@ nsNativeAppSupportOS2::StartServerMode() {
|
|||
#endif /* DOWENEED */
|
||||
|
||||
// Create some of the objects we'll need.
|
||||
nsCOMPtr<nsIWindowWatcher> ww(do_GetService("@mozilla.org/embedcomp/window-watcher;1"));
|
||||
nsCOMPtr<nsIWindowWatcher> ww(do_GetService(NS_WINDOWWATCHER_CONTRACTID));
|
||||
nsCOMPtr<nsISupportsString> arg1(do_CreateInstance(NS_SUPPORTS_STRING_CONTRACTID));
|
||||
nsCOMPtr<nsISupportsString> arg2(do_CreateInstance(NS_SUPPORTS_STRING_CONTRACTID));
|
||||
if ( !ww || !arg1 || !arg2 ) {
|
||||
|
|
|
@ -2088,7 +2088,7 @@ nsNativeAppSupportWin::OpenWindow( const char*urlstr, const char *args ) {
|
|||
|
||||
nsresult rv = NS_ERROR_FAILURE;
|
||||
|
||||
nsCOMPtr<nsIWindowWatcher> wwatch(do_GetService("@mozilla.org/embedcomp/window-watcher;1"));
|
||||
nsCOMPtr<nsIWindowWatcher> wwatch(do_GetService(NS_WINDOWWATCHER_CONTRACTID));
|
||||
nsCOMPtr<nsISupportsCString> sarg(do_CreateInstance(NS_SUPPORTS_CSTRING_CONTRACTID));
|
||||
if (sarg)
|
||||
sarg->SetData(args);
|
||||
|
@ -2449,7 +2449,7 @@ nsNativeAppSupportWin::StartServerMode() {
|
|||
// so thing work alright.
|
||||
|
||||
// Create some of the objects we'll need.
|
||||
nsCOMPtr<nsIWindowWatcher> ww(do_GetService("@mozilla.org/embedcomp/window-watcher;1"));
|
||||
nsCOMPtr<nsIWindowWatcher> ww(do_GetService(NS_WINDOWWATCHER_CONTRACTID));
|
||||
nsCOMPtr<nsISupportsString> arg1(do_CreateInstance(NS_SUPPORTS_STRING_CONTRACTID));
|
||||
nsCOMPtr<nsISupportsString> arg2(do_CreateInstance(NS_SUPPORTS_STRING_CONTRACTID));
|
||||
if ( !ww || !arg1 || !arg2 ) {
|
||||
|
|
|
@ -831,7 +831,7 @@ NS_IMETHODIMP nsBrowserContentHandler::HandleContent(const char * aContentType,
|
|||
nsCAutoString spec;
|
||||
uri->GetSpec(spec);
|
||||
|
||||
nsCOMPtr<nsIWindowWatcher> wwatch(do_GetService("@mozilla.org/embedcomp/window-watcher;1"));
|
||||
nsCOMPtr<nsIWindowWatcher> wwatch(do_GetService(NS_WINDOWWATCHER_CONTRACTID));
|
||||
if (wwatch) {
|
||||
nsCOMPtr<nsIDOMWindow> newWindow;
|
||||
wwatch->OpenWindow(parentWindow, spec.get(), "", 0, 0,
|
||||
|
|
|
@ -66,7 +66,7 @@ NS_IMETHODIMP nsAlertsService::ShowAlertNotification(const char * aImageUrl, con
|
|||
const PRUnichar * aAlertCookie,
|
||||
nsIAlertListener * aAlertListener)
|
||||
{
|
||||
nsCOMPtr<nsIWindowWatcher> wwatch(do_GetService("@mozilla.org/embedcomp/window-watcher;1"));
|
||||
nsCOMPtr<nsIWindowWatcher> wwatch(do_GetService(NS_WINDOWWATCHER_CONTRACTID));
|
||||
nsCOMPtr<nsIDOMWindow> newWindow;
|
||||
nsresult rv;
|
||||
|
||||
|
|
|
@ -2438,7 +2438,7 @@ nsBookmarksService::OnStopRequest(nsIRequest* request, nsISupports *ctxt,
|
|||
interfaces->GetInterface(NS_GET_IID(nsIPrompt), getter_AddRefs(prompter));
|
||||
if (!prompter)
|
||||
{
|
||||
nsCOMPtr<nsIWindowWatcher> wwatch(do_GetService("@mozilla.org/embedcomp/window-watcher;1"));
|
||||
nsCOMPtr<nsIWindowWatcher> wwatch(do_GetService(NS_WINDOWWATCHER_CONTRACTID));
|
||||
if (wwatch)
|
||||
wwatch->GetNewPrompter(0, getter_AddRefs(prompter));
|
||||
}
|
||||
|
@ -2511,7 +2511,7 @@ nsBookmarksService::OnStopRequest(nsIRequest* request, nsISupports *ctxt,
|
|||
{
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
nsCOMPtr<nsIWindowWatcher> wwatch(do_GetService("@mozilla.org/embedcomp/window-watcher;1"));
|
||||
nsCOMPtr<nsIWindowWatcher> wwatch(do_GetService(NS_WINDOWWATCHER_CONTRACTID));
|
||||
if (wwatch)
|
||||
{
|
||||
nsCOMPtr<nsIDOMWindow> newWindow;
|
||||
|
|
|
@ -139,7 +139,7 @@ nsHTTPIndex::GetInterface(const nsIID &anIID, void **aResult )
|
|||
if (!aDOMWindow)
|
||||
return NS_ERROR_NO_INTERFACE;
|
||||
|
||||
nsCOMPtr<nsIWindowWatcher> wwatch(do_GetService("@mozilla.org/embedcomp/window-watcher;1"));
|
||||
nsCOMPtr<nsIWindowWatcher> wwatch(do_GetService(NS_WINDOWWATCHER_CONTRACTID));
|
||||
|
||||
return wwatch->GetNewPrompter(aDOMWindow, (nsIPrompt**)aResult);
|
||||
}
|
||||
|
@ -153,7 +153,7 @@ nsHTTPIndex::GetInterface(const nsIID &anIID, void **aResult )
|
|||
if (!aDOMWindow)
|
||||
return NS_ERROR_NO_INTERFACE;
|
||||
|
||||
nsCOMPtr<nsIWindowWatcher> wwatch(do_GetService("@mozilla.org/embedcomp/window-watcher;1"));
|
||||
nsCOMPtr<nsIWindowWatcher> wwatch(do_GetService(NS_WINDOWWATCHER_CONTRACTID));
|
||||
|
||||
return wwatch->GetNewAuthPrompter(aDOMWindow, (nsIAuthPrompt**)aResult);
|
||||
}
|
||||
|
|
|
@ -723,7 +723,7 @@ nsDownloadManager::Open(nsIDOMWindow* aParent, nsIDownload* aDownload)
|
|||
|
||||
// if we ever have the capability to display the UI of third party dl managers,
|
||||
// we'll open their UI here instead.
|
||||
nsCOMPtr<nsIWindowWatcher> ww = do_GetService("@mozilla.org/embedcomp/window-watcher;1", &rv);
|
||||
nsCOMPtr<nsIWindowWatcher> ww = do_GetService(NS_WINDOWWATCHER_CONTRACTID, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
// pass the datasource to the window
|
||||
|
|
|
@ -127,7 +127,7 @@ NS_IMETHODIMP nsFontPackageHandler::NeedFontPackage(const char *aFontPackID)
|
|||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
nsCOMPtr<nsIWindowWatcher> windowWatch(do_GetService("@mozilla.org/embedcomp/window-watcher;1"));
|
||||
nsCOMPtr<nsIWindowWatcher> windowWatch(do_GetService(NS_WINDOWWATCHER_CONTRACTID));
|
||||
NS_ENSURE_TRUE(windowWatch, NS_ERROR_FAILURE);
|
||||
|
||||
nsCOMPtr<nsIDOMWindow> dialog;
|
||||
|
|
|
@ -321,7 +321,7 @@ OSErr nsMacCommandLine::HandlePrintOneDoc(const FSSpec& inFileSpec, OSType fileT
|
|||
nsresult nsMacCommandLine::OpenWindow(const char *chrome, const PRUnichar *url)
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
nsCOMPtr<nsIWindowWatcher> wwatch(do_GetService("@mozilla.org/embedcomp/window-watcher;1"));
|
||||
nsCOMPtr<nsIWindowWatcher> wwatch(do_GetService(NS_WINDOWWATCHER_CONTRACTID));
|
||||
nsCOMPtr<nsISupportsString> urlWrapper(do_CreateInstance(NS_SUPPORTS_STRING_CONTRACTID));
|
||||
if (!wwatch || !urlWrapper)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
|
|
@ -538,7 +538,7 @@ XRemoteService::OpenChromeWindow(nsIDOMWindow *aParent,
|
|||
nsIDOMWindow **_retval)
|
||||
{
|
||||
nsCOMPtr<nsIWindowWatcher> watcher;
|
||||
watcher = do_GetService("@mozilla.org/embedcomp/window-watcher;1");
|
||||
watcher = do_GetService(NS_WINDOWWATCHER_CONTRACTID);
|
||||
|
||||
if (!watcher)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
|
|
@ -369,7 +369,7 @@ nsXPInstallManager::OpenProgressDialog(const PRUnichar **aPackageList, PRUint32
|
|||
params->AppendElement(callbackwrap);
|
||||
|
||||
// --- open the window
|
||||
nsCOMPtr<nsIWindowWatcher> wwatch(do_GetService("@mozilla.org/embedcomp/window-watcher;1", &rv));
|
||||
nsCOMPtr<nsIWindowWatcher> wwatch(do_GetService(NS_WINDOWWATCHER_CONTRACTID, &rv));
|
||||
if (wwatch) {
|
||||
nsCOMPtr<nsIDOMWindow> newWindow;
|
||||
rv = wwatch->OpenWindow(0,
|
||||
|
|
Загрузка…
Ссылка в новой задаче