зеркало из https://github.com/mozilla/gecko-dev.git
Bug 808402 - Make call to nsIPrompt::Alert from nsFtpState::StopProcessing async r=jduell
This commit is contained in:
Родитель
7cdb0c1b8c
Коммит
1e0da4f45e
|
@ -1848,6 +1848,32 @@ nsFtpState::KillControlConnection()
|
||||||
mControlConnection = nullptr;
|
mControlConnection = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class nsFtpAsyncAlert : public nsRunnable
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
nsFtpAsyncAlert(nsIPrompt *aPrompter, nsACString& aResponseMsg)
|
||||||
|
: mPrompter(aPrompter)
|
||||||
|
, mResponseMsg(aResponseMsg)
|
||||||
|
{
|
||||||
|
MOZ_COUNT_CTOR(nsFtpAsyncAlert);
|
||||||
|
}
|
||||||
|
virtual ~nsFtpAsyncAlert()
|
||||||
|
{
|
||||||
|
MOZ_COUNT_DTOR(nsFtpAsyncAlert);
|
||||||
|
}
|
||||||
|
NS_IMETHOD Run()
|
||||||
|
{
|
||||||
|
if (mPrompter) {
|
||||||
|
mPrompter->Alert(nullptr, NS_ConvertASCIItoUTF16(mResponseMsg).get());
|
||||||
|
}
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
private:
|
||||||
|
nsCOMPtr<nsIPrompt> mPrompter;
|
||||||
|
nsCString mResponseMsg;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
nsFtpState::StopProcessing()
|
nsFtpState::StopProcessing()
|
||||||
{
|
{
|
||||||
|
@ -1869,8 +1895,11 @@ nsFtpState::StopProcessing()
|
||||||
// XXX(darin): this code should not be dictating UI like this!
|
// XXX(darin): this code should not be dictating UI like this!
|
||||||
nsCOMPtr<nsIPrompt> prompter;
|
nsCOMPtr<nsIPrompt> prompter;
|
||||||
mChannel->GetCallback(prompter);
|
mChannel->GetCallback(prompter);
|
||||||
if (prompter)
|
if (prompter) {
|
||||||
prompter->Alert(nullptr, NS_ConvertASCIItoUTF16(mResponseMsg).get());
|
nsCOMPtr<nsIRunnable> alertEvent =
|
||||||
|
new nsFtpAsyncAlert(prompter, mResponseMsg);
|
||||||
|
NS_DispatchToMainThread(alertEvent, NS_DISPATCH_NORMAL);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult broadcastErrorCode = mControlStatus;
|
nsresult broadcastErrorCode = mControlStatus;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче