зеркало из https://github.com/mozilla/gecko-dev.git
Bug 425078: Not showing authentication dialog box when request is made throught XMLHttpRequest in chrome window. r/sr=jst
This commit is contained in:
Родитель
5175617691
Коммит
3706916cab
|
@ -82,6 +82,7 @@ REQUIRES = xpcom \
|
||||||
appshell \
|
appshell \
|
||||||
shistory \
|
shistory \
|
||||||
editor \
|
editor \
|
||||||
|
windowwatcher \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
ifdef ACCESSIBILITY
|
ifdef ACCESSIBILITY
|
||||||
|
|
|
@ -88,6 +88,8 @@
|
||||||
#include "nsIMultiPartChannel.h"
|
#include "nsIMultiPartChannel.h"
|
||||||
#include "nsIScriptObjectPrincipal.h"
|
#include "nsIScriptObjectPrincipal.h"
|
||||||
#include "nsIStorageStream.h"
|
#include "nsIStorageStream.h"
|
||||||
|
#include "nsIPromptFactory.h"
|
||||||
|
#include "nsIWindowWatcher.h"
|
||||||
|
|
||||||
#define LOAD_STR "load"
|
#define LOAD_STR "load"
|
||||||
#define ERROR_STR "error"
|
#define ERROR_STR "error"
|
||||||
|
@ -2335,6 +2337,8 @@ nsXMLHttpRequest::OnStatus(nsIRequest *aRequest, nsISupports *aContext, nsresult
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsXMLHttpRequest::GetInterface(const nsIID & aIID, void **aResult)
|
nsXMLHttpRequest::GetInterface(const nsIID & aIID, void **aResult)
|
||||||
{
|
{
|
||||||
|
nsresult rv;
|
||||||
|
|
||||||
// Make sure to return ourselves for the channel event sink interface and
|
// Make sure to return ourselves for the channel event sink interface and
|
||||||
// progress event sink interface, no matter what. We can forward these to
|
// progress event sink interface, no matter what. We can forward these to
|
||||||
// mNotificationCallbacks if it wants to get notifications for them. But we
|
// mNotificationCallbacks if it wants to get notifications for them. But we
|
||||||
|
@ -2354,7 +2358,7 @@ nsXMLHttpRequest::GetInterface(const nsIID & aIID, void **aResult)
|
||||||
// Now give mNotificationCallbacks (if non-null) a chance to return the
|
// Now give mNotificationCallbacks (if non-null) a chance to return the
|
||||||
// desired interface.
|
// desired interface.
|
||||||
if (mNotificationCallbacks) {
|
if (mNotificationCallbacks) {
|
||||||
nsresult rv = mNotificationCallbacks->GetInterface(aIID, aResult);
|
rv = mNotificationCallbacks->GetInterface(aIID, aResult);
|
||||||
if (NS_SUCCEEDED(rv)) {
|
if (NS_SUCCEEDED(rv)) {
|
||||||
NS_ASSERTION(*aResult, "Lying nsIInterfaceRequestor implementation!");
|
NS_ASSERTION(*aResult, "Lying nsIInterfaceRequestor implementation!");
|
||||||
return rv;
|
return rv;
|
||||||
|
@ -2362,7 +2366,6 @@ nsXMLHttpRequest::GetInterface(const nsIID & aIID, void **aResult)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mState & XML_HTTP_REQUEST_BACKGROUND) {
|
if (mState & XML_HTTP_REQUEST_BACKGROUND) {
|
||||||
nsresult rv;
|
|
||||||
nsCOMPtr<nsIInterfaceRequestor> badCertHandler(do_CreateInstance(NS_BADCERTHANDLER_CONTRACTID, &rv));
|
nsCOMPtr<nsIInterfaceRequestor> badCertHandler(do_CreateInstance(NS_BADCERTHANDLER_CONTRACTID, &rv));
|
||||||
|
|
||||||
// Ignore failure to get component, we may not have all its dependencies
|
// Ignore failure to get component, we may not have all its dependencies
|
||||||
|
@ -2373,6 +2376,24 @@ nsXMLHttpRequest::GetInterface(const nsIID & aIID, void **aResult)
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (aIID.Equals(NS_GET_IID(nsIAuthPrompt)) ||
|
||||||
|
aIID.Equals(NS_GET_IID(nsIAuthPrompt2))) {
|
||||||
|
nsCOMPtr<nsIPromptFactory> wwatch =
|
||||||
|
do_GetService(NS_WINDOWWATCHER_CONTRACTID, &rv);
|
||||||
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
|
// Get the an auth prompter for our window so that the parenting
|
||||||
|
// of the dialogs works as it should when using tabs.
|
||||||
|
|
||||||
|
nsCOMPtr<nsIDOMWindow> window;
|
||||||
|
if (mOwner) {
|
||||||
|
window = mOwner->GetOuterWindow();
|
||||||
|
}
|
||||||
|
|
||||||
|
return wwatch->GetPrompt(window, aIID,
|
||||||
|
reinterpret_cast<void**>(aResult));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
return QueryInterface(aIID, aResult);
|
return QueryInterface(aIID, aResult);
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче