зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1523249, r=valentin
Differential Revision: https://phabricator.services.mozilla.com/D17965 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
9e3969c99a
Коммит
ace4e930e1
|
@ -23,7 +23,6 @@
|
|||
27=Beginning FTP transaction…
|
||||
28=Finished FTP transaction
|
||||
|
||||
UnsupportedFTPServer=The FTP server %1$S is currently unsupported.
|
||||
RepostFormData=This web page is being redirected to a new location. Would you like to resend the form data you have typed to the new location?
|
||||
|
||||
# Directory listing strings
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
#include "mozilla/ipc/URIUtils.h"
|
||||
#include "SerializedLoadContext.h"
|
||||
#include "mozilla/ipc/BackgroundUtils.h"
|
||||
#include "nsIPrompt.h"
|
||||
#include "nsIURIMutator.h"
|
||||
|
||||
using mozilla::dom::ContentChild;
|
||||
|
@ -468,29 +467,6 @@ mozilla::ipc::IPCResult FTPChannelChild::RecvOnStopRequest(
|
|||
return IPC_OK();
|
||||
}
|
||||
|
||||
class nsFtpChildAsyncAlert : public Runnable {
|
||||
public:
|
||||
nsFtpChildAsyncAlert(nsIPrompt* aPrompter, nsString aResponseMsg)
|
||||
: Runnable("nsFtpChildAsyncAlert"),
|
||||
mPrompter(aPrompter),
|
||||
mResponseMsg(std::move(aResponseMsg)) {}
|
||||
|
||||
protected:
|
||||
virtual ~nsFtpChildAsyncAlert() = default;
|
||||
|
||||
public:
|
||||
NS_IMETHOD Run() override {
|
||||
if (mPrompter) {
|
||||
mPrompter->Alert(nullptr, mResponseMsg.get());
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
private:
|
||||
nsCOMPtr<nsIPrompt> mPrompter;
|
||||
nsString mResponseMsg;
|
||||
};
|
||||
|
||||
class MaybeDivertOnStopFTPEvent
|
||||
: public NeckoTargetChannelEvent<FTPChannelChild> {
|
||||
public:
|
||||
|
@ -539,23 +515,6 @@ void FTPChannelChild::DoOnStopRequest(const nsresult& aChannelStatus,
|
|||
AutoEventEnqueuer ensureSerialDispatch(mEventQ);
|
||||
(void)mListener->OnStopRequest(this, mListenerContext, aChannelStatus);
|
||||
|
||||
if (NS_FAILED(aChannelStatus) && !aErrorMsg.IsEmpty()) {
|
||||
nsCOMPtr<nsIPrompt> prompter;
|
||||
GetCallback(prompter);
|
||||
if (prompter) {
|
||||
nsCOMPtr<nsIRunnable> alertEvent;
|
||||
if (aUseUTF8) {
|
||||
alertEvent = new nsFtpChildAsyncAlert(
|
||||
prompter, NS_ConvertUTF8toUTF16(aErrorMsg));
|
||||
} else {
|
||||
alertEvent = new nsFtpChildAsyncAlert(
|
||||
prompter, NS_ConvertASCIItoUTF16(aErrorMsg));
|
||||
}
|
||||
|
||||
Dispatch(alertEvent.forget());
|
||||
}
|
||||
}
|
||||
|
||||
mListener = nullptr;
|
||||
mListenerContext = nullptr;
|
||||
|
||||
|
|
|
@ -31,7 +31,6 @@
|
|||
#include "nsIStreamListenerTee.h"
|
||||
#include "nsIPrefService.h"
|
||||
#include "nsIPrefBranch.h"
|
||||
#include "nsIStringBundle.h"
|
||||
#include "nsAuthInformationHolder.h"
|
||||
#include "nsIProtocolProxyService.h"
|
||||
#include "nsICancelable.h"
|
||||
|
@ -850,33 +849,8 @@ nsFtpState::R_syst() {
|
|||
mServerType = FTP_VMS_TYPE;
|
||||
} else {
|
||||
NS_ERROR("Server type list format unrecognized.");
|
||||
// Guessing causes crashes.
|
||||
// (Of course, the parsing code should be more robust...)
|
||||
nsCOMPtr<nsIStringBundleService> bundleService =
|
||||
do_GetService(NS_STRINGBUNDLE_CONTRACTID);
|
||||
if (!bundleService) return FTP_ERROR;
|
||||
|
||||
nsCOMPtr<nsIStringBundle> bundle;
|
||||
nsresult rv =
|
||||
bundleService->CreateBundle(NECKO_MSGS_URL, getter_AddRefs(bundle));
|
||||
if (NS_FAILED(rv)) return FTP_ERROR;
|
||||
|
||||
char16_t *ucs2Response = ToNewUnicode(mResponseMsg);
|
||||
const char16_t *formatStrings[1] = {ucs2Response};
|
||||
|
||||
nsAutoString formattedString;
|
||||
rv = bundle->FormatStringFromName("UnsupportedFTPServer", formatStrings,
|
||||
1, formattedString);
|
||||
free(ucs2Response);
|
||||
if (NS_FAILED(rv)) return FTP_ERROR;
|
||||
|
||||
// TODO(darin): this code should not be dictating UI like this!
|
||||
nsCOMPtr<nsIPrompt> prompter;
|
||||
mChannel->GetCallback(prompter);
|
||||
if (prompter) prompter->Alert(nullptr, formattedString.get());
|
||||
|
||||
// since we just alerted the user, clear mResponseMsg,
|
||||
// which is displayed to the user.
|
||||
// clear mResponseMsg, which is displayed to the user.
|
||||
mResponseMsg = "";
|
||||
return FTP_ERROR;
|
||||
}
|
||||
|
@ -1629,29 +1603,6 @@ void nsFtpState::KillControlConnection() {
|
|||
mControlConnection = nullptr;
|
||||
}
|
||||
|
||||
class nsFtpAsyncAlert : public Runnable {
|
||||
public:
|
||||
nsFtpAsyncAlert(nsIPrompt *aPrompter, nsString aResponseMsg)
|
||||
: mozilla::Runnable("nsFtpAsyncAlert"),
|
||||
mPrompter(aPrompter),
|
||||
mResponseMsg(std::move(aResponseMsg)) {}
|
||||
|
||||
protected:
|
||||
virtual ~nsFtpAsyncAlert() = default;
|
||||
|
||||
public:
|
||||
NS_IMETHOD Run() override {
|
||||
if (mPrompter) {
|
||||
mPrompter->Alert(nullptr, mResponseMsg.get());
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
private:
|
||||
nsCOMPtr<nsIPrompt> mPrompter;
|
||||
nsString mResponseMsg;
|
||||
};
|
||||
|
||||
nsresult nsFtpState::StopProcessing() {
|
||||
// Only do this function once.
|
||||
if (!mKeepRunning) return NS_OK;
|
||||
|
@ -1660,23 +1611,7 @@ nsresult nsFtpState::StopProcessing() {
|
|||
LOG_INFO(("FTP:(%p) nsFtpState stopping", this));
|
||||
|
||||
if (NS_FAILED(mInternalError) && !mResponseMsg.IsEmpty()) {
|
||||
// check to see if the control status is bad.
|
||||
// web shell wont throw an alert. we better:
|
||||
|
||||
// XXX(darin): this code should not be dictating UI like this!
|
||||
nsCOMPtr<nsIPrompt> prompter;
|
||||
mChannel->GetCallback(prompter);
|
||||
if (prompter) {
|
||||
nsCOMPtr<nsIRunnable> alertEvent;
|
||||
if (mUseUTF8) {
|
||||
alertEvent =
|
||||
new nsFtpAsyncAlert(prompter, NS_ConvertUTF8toUTF16(mResponseMsg));
|
||||
} else {
|
||||
alertEvent =
|
||||
new nsFtpAsyncAlert(prompter, NS_ConvertASCIItoUTF16(mResponseMsg));
|
||||
}
|
||||
NS_DispatchToMainThread(alertEvent);
|
||||
}
|
||||
// check to see if the control status is bad, forward the error message.
|
||||
nsCOMPtr<nsIFTPChannelParentInternal> ftpChanP;
|
||||
mChannel->GetCallback(ftpChanP);
|
||||
if (ftpChanP) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче