Bug 312473: extension update does not try authentication if needed.
authordtownsend@oxymoronical.com
Fri, 15 Jun 2007 10:21:16 -0700
changeset 2441 eae491fbdbbb6b98daed63c0bbf93e4016ed3267
parent 2440 a8fc604263b63bdba43fe18f83d45296be063160
child 2442 04a55431795e7869f164863f1c11e88fba74bae7
push idunknown
push userunknown
push dateunknown
bugs312473
milestone1.9a6pre
Bug 312473: extension update does not try authentication if needed. r+sr=dveditz
xpinstall/src/nsXPInstallManager.cpp
--- a/xpinstall/src/nsXPInstallManager.cpp
+++ b/xpinstall/src/nsXPInstallManager.cpp
@@ -60,16 +60,17 @@
 #include "nsSoftwareUpdateIIDs.h"
 
 #include "nsXPITriggerInfo.h"
 #include "nsXPInstallManager.h"
 #include "nsInstallTrigger.h"
 #include "nsInstallResources.h"
 #include "nsIProxyObjectManager.h"
 #include "nsIWindowWatcher.h"
+#include "nsIAuthPrompt.h"
 #include "nsIWindowMediator.h"
 #include "nsIDOMWindowInternal.h"
 #include "nsDirectoryService.h"
 #include "nsDirectoryServiceDefs.h"
 #include "nsAppDirectoryServiceDefs.h"
 
 #include "nsReadableUtils.h"
 #include "nsProxiedService.h"
@@ -1146,16 +1147,32 @@ nsXPInstallManager::OnStatus(nsIRequest*
     // don't need to do anything
     return NS_OK;
 }
 
 // nsIInterfaceRequestor method
 NS_IMETHODIMP
 nsXPInstallManager::GetInterface(const nsIID & eventSinkIID, void* *_retval)
 {
+    if (eventSinkIID.Equals(NS_GET_IID(nsIAuthPrompt))) {    
+        *_retval = nsnull;
+ 
+        nsresult rv;
+        nsCOMPtr<nsIWindowWatcher> ww(do_GetService(NS_WINDOWWATCHER_CONTRACTID, &rv));
+        NS_ENSURE_SUCCESS(rv, rv);
+ 
+        nsCOMPtr<nsIAuthPrompt> prompt;
+        rv = ww->GetNewAuthPrompter(nsnull, getter_AddRefs(prompt));
+        NS_ENSURE_SUCCESS(rv, rv);
+ 
+        nsIAuthPrompt *p = prompt.get();
+        NS_ADDREF(p);
+        *_retval = p;
+        return NS_OK;
+    }
     return QueryInterface(eventSinkIID, (void**)_retval);
 }
 
 // IXPIListener methods
 
 PRInt32 
 nsXPInstallManager::GetIndexFromURL(const PRUnichar* aUrl)
 {