Bug 312473: extension update does not try authentication if needed.
r+sr=dveditz
--- 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)
{